public boolean waitForReady ( ) throws InterruptedException { // wait for the framework to be set. if ( waitForFramework ( ) == null ) { return false ; } frameworkLaunched . await ( ) ; if ( ! frameworkLaunchSuccess ) { return false ; } // Now look for the FrameworkReady service in the service registry Collection < ServiceReference < FrameworkReady > > readyServiceRefs ; try { readyServiceRefs = systemBundleCtx . getServiceReferences ( FrameworkReady . class , null ) ; } catch ( InvalidSyntaxException e ) { throw new IllegalStateException ( e ) ; // unlikely. } catch ( IllegalStateException ex ) { // The framework might have been stopped before we finished starting if ( framework . getState ( ) != Bundle . ACTIVE ) { waitForFrameworkStop ( ) ; return false ; } else { throw ex ; } } // If we have any, we will wait for them... if ( readyServiceRefs != null ) { for ( ServiceReference < FrameworkReady > readyServiceRef : readyServiceRefs ) { FrameworkReady ready = systemBundleCtx . getService ( readyServiceRef ) ; if ( ready != null ) { ready . waitForFrameworkReady ( ) ; } } } // Check if some component declared a fatal start error by initiating // framework stop before we were fully started. If so, wait for the // framework to finish stopping, then report an error. if ( framework . getState ( ) != Bundle . ACTIVE ) { waitForFrameworkStop ( ) ; return false ; } return true ; }
Waits for the server to become ready .