4 ms·
I am looking into classloader isolation solution and it seems OSGi, especially the Classloader specification is wonderful. The whole OSGi spec is a 400+page boo
by mrbonner 7y ago
I am looking into classloader isolation solution and it seems OSGi, especially the Classloader specification is wonderful. The whole OSGi spec is a 400+page book if you are into services, security, etc... but the Classloading isolation spec is small and very useful.
I am in need of a way to allow plugins/integration with other teams. If we use standard Java package sharing mechanism, sooner or later teams will run into dependency conflict hell. More often, microservices (IPC) is suggested, too. But, the nature of our application is sensitive to latency and require high throughput. That throws IPC out of the picture.
Then, I remember the servlet API and how the servlet spec dictates classloading isolation at the container level. I rolled my own classloader to isolate the plugins/integrations but it is not as nice as OSGi implementation.
At this point, I am very inclined into using OSGi just for the sole classloading purpose.
One question that bother me is: since we are not that hardcore OSGi users, would it make sense for us to just bundle every plugins' into a fat jar and use bundle-classpath to resolve the plugin's owned dependencies? I know that by doing so, we are not strictly adhere to OSGi classes' sharing but it would lower the friction for independent teams to integrate with us.
- bullen 7y agoYou can take a look at my tiny web-server for the simplest hot-deployment implementation I have made/found so far: https://github.com/tinspin/rupy/blob/master/src/se/rupy/http/Deploy.java#L225 https://github.com/tinspin/rupy/blob/master/src/se/rupy/http...
- mkleczek 7y agoIn my opinion the main issue with OSGi class loading is that the spec couples three separate concerns: peer class loading (as opposed to hierarchical) dependency resolution dependency specification and module (bundle) packaging This makes OSGi an all or nothing solution: to use OSGi class loading you are forced to package your code in a specific way - which in turn makes it difficult to reuse existing libraries. Lack of peer class loading has been a long standing pain point in Java - and in my opinion one of the main obstacles for really interesting use cases - especially related to mobile code ( see Jini ).