org.eclipse.osgi.baseadaptor.loader
Interface ParallelClassLoader

All Superinterfaces:
BaseClassLoader, BundleClassLoader, BundleReference
All Known Implementing Classes:
DefaultClassLoader

public interface ParallelClassLoader
extends BaseClassLoader

A parallel class loader. Parallel class loaders are thread safe class loaders which can handle multiple threads loading classes and resources from them at the same time. This is important for OSGi class loaders because the class loader delegate in OSGi is not strictly hierarchical, instead the delegation is grid based and may have cycles.

The ClasspathManager handles parallel capable class loaders differently from other class loaders. For parallel capable class loaders when ClasspathManager.findLocalClass(String) is called a lock will be obtained for the class name being searched while calling BaseClassLoader.publicFindLoaded(String) and BaseClassLoader.defineClass(String, byte[], ClasspathEntry, org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry). This prevents other threads from trying to searching for the same class at the same time. For other class loaders the class loader lock is obtained instead. This prevents other threads from trying to search for any class while the lock is held.

Note: This interface is part of an interim API that is still under development. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will may be broken (repeatedly) as the API evolves.

Since:
3.5

Method Summary
 boolean isParallelCapable()
          Indicates if this class loader is parallel capable.
 
Methods inherited from interface org.eclipse.osgi.baseadaptor.loader.BaseClassLoader
createClassPathEntry, defineClass, getClasspathManager, getDomain, publicDefinePackage, publicFindLoaded, publicGetPackage
 
Methods inherited from interface org.eclipse.osgi.framework.adaptor.BundleClassLoader
attachFragment, close, findLocalClass, findLocalResource, findLocalResources, getDelegate, getParent, getResource, getResources, initialize, loadClass
 
Methods inherited from interface org.osgi.framework.BundleReference
getBundle
 

Method Detail

isParallelCapable

boolean isParallelCapable()
Indicates if this class loader is parallel capable. Even if a class loader is able to be parallel capable there are some restrictions imposed by the VM which may prevent a class loader from being parallel capable. For example, some VMs may lock the class loader natively before delegating to a class loader. This type of locking will prevent a class loader from being parallel capable.

Returns:
true if this class loader is parallel capable; false otherwise.


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.