@ SuppressWarnings ( "unchecked" ) private void startScheduler ( ) { scheduledExecutorService . scheduleAtFixedRate ( new Runnable ( ) { @ Override @ SuppressWarnings ( "rawtypes" ) public void run ( ) { Iterator < Entry < String , Long > > it = transactionCallbackTime . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry pair = ( Map . Entry ) it . next ( ) ; if ( ( System . currentTimeMillis ( ) - ( Long ) pair . getValue ( ) ) > 5000 ) { final String xferId = ( String ) pair . getKey ( ) ; it . remove ( ) ; status . put ( xferId , "ERROR" ) ; ascpCount -= numberOfSessionsInTransaction ( xferId ) ; removeAllTransactionSessions ( xferId ) ; removeTransactionProgressData ( xferId ) ; log . error ( "Status marked as [ERROR] for xferId [" + xferId + "] after not reporting for over 5 seconds" ) ; } } } } , 5 , 5 , TimeUnit . SECONDS ) ; }
Start the scheduler to monitor the transactions timestamps within transactionAuditTime