public final void start ( long deliveryDelayScanInterval , JsMessagingEngine jsme ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "start" , "interval=" + deliveryDelayScanInterval + " indexSize=" + deliveryDelayIndex . size ( ) ) ; messagingEngine = jsme ; if ( deliveryDelayScanInterval >= 0 ) // If an deliverydelayscan interval was given, use it { interval = deliveryDelayScanInterval ; } else // Otherwise, get it from the system property { // Get property for deliverydelayscan interval String value = messageStore . getProperty ( MessageStoreConstants . PROP_DELIVERY_DELAY_SCAN_INTERVAL , MessageStoreConstants . PROP_DELIVERY_DELAY_SCAN_INTERVAL_DEFAULT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "start" , "Value from property=<" + value + ">" ) ; try { this . interval = Long . parseLong ( value . trim ( ) ) ; } catch ( NumberFormatException e ) { // No FFDC Code Needed. lastException = e ; lastExceptionTime = timeNow ( ) ; SibTr . debug ( this , tc , "start" , "Unable to parse property: " + e ) ; this . interval = 1000 ; // Use hard coded default as last resort } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "start" , "deliveryDelayScanInterval=" + this . interval ) ; // about to tinker with various variables so take the lock now synchronized ( lockObject ) { if ( interval < 1 ) { runEnabled = false ; addEnabled = false ; } else { if ( deliveryDelayAlarm == null ) { scanForInvalidDeliveryDelay ( ) ; runEnabled = true ; addEnabled = true ; deliveryDelayManagerStartTime = timeNow ( ) ; // Now we look at the size of the index and only schedule the first // alarm if the index is not empty. Remember that deliveryDelayables can be // added BEFORE the delivery delay manager is started so it may not be empty. if ( deliveryDelayIndex . size ( ) > 0 ) // If the index is not empty, { scheduleAlarm ( interval ) ; // ... schedule the first alarm. } } else { // DeliveryDelayManager thread already running if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "DeliveryDelayManager already started" ) ; SevereMessageStoreException e = new SevereMessageStoreException ( "DELIVERYDELAYMANAGER_THREAD_ALREADY_RUNNING_SIMS2012" ) ; lastException = e ; lastExceptionTime = timeNow ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "start" ) ; throw e ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "start" , "runEnabled=" + runEnabled + " addEnabled=" + addEnabled + " interval=" + interval ) ; }
Start the DeliveryDelayManager daemon .