For Ignite marshaling to support OSGI containers, we need to make sure that on the deserializing side we use proper bundle-aware class loaders.
The ClassLoaderResolver
should be called for every Object during serialization and deserialization and should be part of the IgniteConfiguraiton
:
public interface ClassLoaderResolver { public Object encodeClassLoader(ClassLoader clsLdr) throws IgniteException; public ClassLoader decodeClassLoader(Object obj) throws IgniteException; }
We should also provide OSGI class loader resolver out of the box:
public class OsgiClassLoaderResolver { // Manifest entry names to look up bundles during deserialization. private Collection<String> mfEntryNames; public OsgiClassLoaderResolver() {} public OsgiClassLoaderResolver(Collection<String> mfEntryNames) { ... } public Object encodeClassLoader(ClassLoader clsLdr) throws IgniteException { // TODO } public ClassLoader decodeClassLoader(Object obj) throws IgniteException { // TODO } }
We need a clear path to support Ignite optional dependencies in OSGI environments.
TODO: use OSGI fragments?
TODO