public final void start ( long loaderInterval , JsMessagingEngine jsme ) throws MessageStoreRuntimeException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "start" , Long . valueOf ( loaderInterval ) ) ; messagingEngine = jsme ; if ( loaderInterval >= 0 ) // Use the given interval { interval = loaderInterval * 1000 ; } else { // Get property for cache loader interval String value = messageStore . getProperty ( MessageStoreConstants . PROP_CACHELOADER_INTERVAL , MessageStoreConstants . PROP_CACHELOADER_INTERVAL_DEFAULT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( this , tc , "start" , "Interval from system prop=<" + value + ">" ) ; } try { this . interval = Long . parseLong ( value . trim ( ) ) * 1000 ; } catch ( NumberFormatException e ) { //No FFDC Code Needed. lastException = e ; lastExceptionTime = timeNow ( ) ; SibTr . debug ( this , tc , "start" , "Unable to parse cacheLoaderInterval property: " + e ) ; this . interval = 60000 ; // Use hard coded default as last resort } } // Get value of maxStreamsPerCycle from property String value = messageStore . getProperty ( MessageStoreConstants . PROP_MAX_STREAMS_PER_CYCLE , MessageStoreConstants . PROP_MAX_STREAMS_PER_CYCLE_DEFAULT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( this , tc , "start" , "maxStreamsPerCycle from system prop=<" + value + ">" ) ; } try { maxStreamsPerCycle = Integer . parseInt ( value . trim ( ) ) ; } catch ( NumberFormatException e ) { //No FFDC Code Needed. lastException = e ; lastExceptionTime = timeNow ( ) ; SibTr . debug ( this , tc , "start" , "Unable to parse maxStreamsPerCycle property: " + e ) ; maxStreamsPerCycle = 10 ; // Use hard coded default as last resort } PersistentMessageStore pm = messageStore . getPersistentMessageStore ( ) ; // Get a set of IDs which represent streams containing expirable items. try { results = pm . identifyStreamsWithExpirableItems ( ) ; totalStreams = results . size ( ) ; iter = results . iterator ( ) ; // Now, schedule the first alarm if ( interval < 1 ) { enabled = false ; } else { if ( loaderAlarm == null ) { enabled = true ; shutdown = false ; loaderStartTime = timeNow ( ) ; loaderAlarm = scheduleAlarm ( interval ) ; } } } catch ( PersistenceException pe ) { com . ibm . ws . ffdc . FFDCFilter . processException ( pe , "com.ibm.ws.sib.msgstore.expiry.CacheLoader.run" , "191" , this ) ; lastException = pe ; lastExceptionTime = timeNow ( ) ; enabled = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( this , tc , "run" , "CacheLoader stopping - interrupted: " + pe ) ; } throw new MessageStoreRuntimeException ( "CACHE_LOADER_TERMINATED_SIMS2003" , new Object [ ] { pe } , pe ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "start" , "enabled=" + enabled + " interval=" + interval ) ; }
Start the CacheLoader daemon .