private void checkTimer ( ) { try { serviceThreadLock . lock ( ) ; if ( watchdogTimer == null ) { // if there is NOT an active timer if ( ! issuedWatchdogWrappers . allValues ( ) . isEmpty ( ) ) { // if there are active providers. LOGGER . debug ( "starting up " + THREAD_NAME + ", " + watchdogFrequency + "ms check frequency" ) ; // create a new timer startWatchdogThread ( ) ; } } } finally { serviceThreadLock . unlock ( ) ; } }
Regulate the timer . This is important because the timer task creates its own thread and if the task isn t cleaned up there could be a thread leak .