12 Oct 2012 , tagged: Java, OSGI, Reading List
OSGI Classloading Reading List
I’ve been doing a lot of reading on how OSGI handles class loading. I’m starting to fully understand and leverage OSGI and I’m trying to keep my framework Object Mapper as compatible with OSGI as I can.
In OSGI classloading is very restricted, similar to what happens in enterprisy Java application servers, and completely unlike traditional Java applications where everything shares a single classloader. In OSGI each bundle has its own classloader and what is visible accross the bundle boundaries is subject to strict export rules. In order to use a class outside of a bundle you’ll have to explicitly declare its package as exported. There are many benefits to this strict architecture, clean architectures, reusable components and the ability to update bundles at runtime are probably the most important ones.
The downside of this strict model is that frameworks that rely on byte code generation will have a hard time making classes available. There are many techniques I was completely unaware of, and here are some excellent references I am reading: