Closed mattisonchao closed 2 years ago
I think it's safe and more convenient. It is not safe because you are not sure that the contents of the NAR package are designed to work well this way. In fact you are going to share "static" variables.
There is not concept of "application" or "bundle" in Pulsar, like the concept of "Enterprise Application" or "Web Application" in a JakartaEE containers. If you want to go this way we have to formally "link" the two components using some descriptor or configuration option and tell Pulsar to use the same "Context".
Motivation
According to PIP-41 Pluggable Protocol Handler, we can use a pluggable protocol handler to process more than one protocol.
And then #11498 support we can use additional servelet to expose some REST API to help use expose metrics, monitors, etc. Some pluggable components like
ProtocolHanlder
,Interceptor
,AdditionalServelet
all useNarClassLoader
to load Nar package. For isolation reasons, different types of plugins use different loaders.Currently, when we want to use
AddtionalServelet
inProtocolHandler
. the awkward things happen.for this reason, I write this PIP want to use NarClassLoader Manager to manage all NarClassLoader. If the Nar Packet Path, additional jars, and parent loader are the same, we will use the same loader.
I think it's safe and more convenient.
Goal
Different Plugin Components have the same Nar package path( means at the same project ). Use the same
NarClassLoader
to load.API Changes
without API change.
Implementation
NarClassLoaderIdentifier
by nar package path, addtional jars, and parent loader.NarClassLoaderManager
to save allNarClassLoader
.Reject Alternatives
waiting for.