private void createReaperAlarm ( ) { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( pmQuiesced ) { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( tc , " PM has been Quiesced, so cancel old reaper alarm." ) ; if ( am != null ) am . cancel ( false ) ; return ; } if ( nonDeferredReaperAlarm ) { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Creating non-deferrable alarm for reaper" ) ; if ( am != null ) { // If an alarm thread already exists, cancel it and create a // new one with the latest reapTime am . cancel ( false ) ; if ( am . isDone ( ) ) { alarmThreadCounter . decrementAndGet ( ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Previous alarm thread cancelled." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . nonDeferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } // end am.isDone() == true } // end am != null else { // am == null if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "No previous alarm thread exists. Creating a new one." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . nonDeferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } // am == null } // end nonDeferredReaperAlarm == true else { // nonDeferredReaperAlarm == false if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Creating deferrable alarm for reaper" ) ; if ( am != null ) { // If an alarm thread already exists, cancel it and create a // new one with the latest reapTime am . cancel ( false ) ; if ( am . isDone ( ) ) { alarmThreadCounter . decrementAndGet ( ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Previous alarm thread cancelled." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . deferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } // end am.isDone() == true } // end am != null else { // am == null if ( isTracingEnabled && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "No previous alarm thread exists. Creating a new one." ) ; alarmThreadCounter . incrementAndGet ( ) ; try { am = connectorSvc . deferrableSchedXSvcRef . getServiceWithException ( ) . schedule ( this , reapTime , TimeUnit . SECONDS ) ; } catch ( Exception e ) { alarmThreadCounter . decrementAndGet ( ) ; throw new RuntimeException ( e ) ; } } // am == null } // end nonDeferredReaperAlarm == false }
Creates a new alarm thread .