private void executeReactor ( final InitStrategy is , TaskBuilder ... builders ) throws IOException , InterruptedException , ReactorException { Reactor reactor = new Reactor ( builders ) { /** * Sets the thread name to the task for better diagnostics. */ @ Override protected void runTask ( Task task ) throws Exception { if ( is != null && is . skipInitTask ( task ) ) return ; ACL . impersonate ( ACL . SYSTEM ) ; // full access in the initialization thread String taskName = InitReactorRunner . getDisplayName ( task ) ; Thread t = Thread . currentThread ( ) ; String name = t . getName ( ) ; if ( taskName != null ) t . setName ( taskName ) ; try { long start = System . currentTimeMillis ( ) ; super . runTask ( task ) ; if ( LOG_STARTUP_PERFORMANCE ) LOGGER . info ( String . format ( "Took %dms for %s by %s" , System . currentTimeMillis ( ) - start , taskName , name ) ) ; } catch ( Exception | Error x ) { if ( containsLinkageError ( x ) ) { LOGGER . log ( Level . WARNING , taskName + " failed perhaps due to plugin dependency issues" , x ) ; } else { throw x ; } } finally { t . setName ( name ) ; SecurityContextHolder . clearContext ( ) ; } } private boolean containsLinkageError ( Throwable x ) { if ( x instanceof LinkageError ) { return true ; } Throwable x2 = x . getCause ( ) ; return x2 != null && containsLinkageError ( x2 ) ; } } ; new InitReactorRunner ( ) { @ Override protected void onInitMilestoneAttained ( InitMilestone milestone ) { initLevel = milestone ; if ( milestone == PLUGINS_PREPARED ) { // set up Guice to enable injection as early as possible // before this milestone, ExtensionList.ensureLoaded() won't actually try to locate instances ExtensionList . lookup ( ExtensionFinder . class ) . getComponents ( ) ; } } } . run ( reactor ) ; }
Executes a reactor .