When a bundle is started an instance of the bundle's activator is created and executed by the OSGi framework. The start up of a bundle's activator is therefore strictly synchronous. For the majority of bundles this is desirable, but for situations where a bundle's activator takes a long time to complete, executing on a separate thread is useful since it allows other bundles to continue to start.
isStartAsync() returns
false to indicate that the bundle's activator should be
started synchronously.
isStartAsync() method to return true will
cause the bundle's activator to start on a separate thread, for example:
protected boolean isStartAsync() {
return true;
}
getAsyncStartPriority() returns the priority
at which the thread used to asynchronously start the bundle will be run.
By default this method returns Thread.NORM_PRIORITY, but
may be overridden, for example:
protected int getAsyncStartPriority() {
return Thread.NORM_PRIORITY + 1;
}
Copyright © 2001, 2007 IBM Corporation and others. All Rights Reserved.