Components that take a long time to initialize should use a background thread to perform this initialization. This is so that OSGi doesn't hang while waiting for your component to initialize.
The framework class ComponentImpl (the base class for all components and pipeline stages) implements several methods to make it easier to handle background initialization threads. These methods handle startup initialization with a specific set of protocols.
Implications of the protocol:
If you use the methods below, your component will automatically report its initialization status on the Admin interface with a message and a progress bar.
If an exception error occurs during initialization; this will also be reported.
Clicking more shows you the exception error traceback stack.
The following methods are all specified on the ComponentImpl class (the base class for most Aspire Components).
class MyStage extends StageImpl implements Runnable // NOTE: Implements Runnable { @Override public void process(Job j) throws AspireException { checkInitialized(); // Blocks the job if the stage is not yet initialized // Note: Use this method for any access which a requires a fully initialized component . . . } public void close() { . . . // Shuts down any background initialization thread closeBackgroundInitialization(); } public void initialize(Element config) { . . . // Initializing locking mechanism and starts up the background thread startBackgroundInitialization(this); } @Override public void run() { try { setMaxInitializationProgress(/*set to appropriate value*/100); // Initialize the component here // use: // setCurInitializationProgress() - to set the current progress bar setting // setInitializationMessage() - to specify a message letting the admin user know what's going on . . . } catch(Exception e) { setInitializationException(e); } finally { endBackgroundInitialization(); } }