private void runInitializationStage ( Event event ) { // Immediate synchronous dispatching of Initialize event try { setOwnerState ( OwnerState . INITIALIZING ) ; try { this . eventDispatcher . immediateDispatch ( event ) ; } finally { setOwnerState ( OwnerState . ALIVE ) ; } this . agentAsEventListener . fireEnqueuedEvents ( this ) ; if ( this . agentAsEventListener . isKilled . get ( ) ) { this . agentAsEventListener . killOwner ( InternalEventBusSkill . this ) ; } } catch ( Exception e ) { // Log the exception final Logging loggingCapacity = getLoggingSkill ( ) ; if ( loggingCapacity != null ) { loggingCapacity . error ( Messages . InternalEventBusSkill_3 , e ) ; } else { final LogRecord record = new LogRecord ( Level . SEVERE , Messages . InternalEventBusSkill_3 ) ; this . logger . getKernelLogger ( ) . log ( this . logger . prepareLogRecord ( record , this . logger . getKernelLogger ( ) . getName ( ) , Throwables . getRootCause ( e ) ) ) ; } // If we have an exception within the agent's initialization, we kill the agent. setOwnerState ( OwnerState . ALIVE ) ; // Asynchronous kill of the event. this . agentAsEventListener . killOrMarkAsKilled ( ) ; } }
This function runs the initialization of the agent .