private void runDestructionStage ( Event event ) { // Immediate synchronous dispatching of Destroy event try { setOwnerState ( OwnerState . DYING ) ; try { this . eventDispatcher . immediateDispatch ( event ) ; } finally { setOwnerState ( OwnerState . DEAD ) ; } } catch ( Exception e ) { // Log the exception final Logging loggingCapacity = getLoggingSkill ( ) ; if ( loggingCapacity != null ) { loggingCapacity . error ( Messages . InternalEventBusSkill_4 , e ) ; } else { final LogRecord record = new LogRecord ( Level . SEVERE , Messages . InternalEventBusSkill_4 ) ; this . logger . getKernelLogger ( ) . log ( this . logger . prepareLogRecord ( record , this . logger . getKernelLogger ( ) . getName ( ) , Throwables . getRootCause ( e ) ) ) ; } } }
This function runs the destruction of the agent .