@ Override public void run ( ) { long currentTimestamp = timeService . time ( ) ; for ( Map . Entry < CacheXid , TxState > entry : storage . entrySet ( ) ) { TxState state = entry . getValue ( ) ; CacheXid cacheXid = entry . getKey ( ) ; if ( ! state . hasTimedOut ( currentTimestamp ) || skipReaper ( state . getOriginator ( ) , cacheXid . getCacheName ( ) ) ) { continue ; } switch ( state . getStatus ( ) ) { case ACTIVE : case PREPARING : case PREPARED : onOngoingTransaction ( cacheXid , state ) ; break ; case MARK_ROLLBACK : onTransactionDecision ( cacheXid , state , false ) ; break ; case MARK_COMMIT : onTransactionDecision ( cacheXid , state , true ) ; break ; case COMMITTED : case ROLLED_BACK : onTransactionCompleted ( cacheXid ) ; break ; case ERROR : case NO_TRANSACTION : case OK : default : //not valid status } } }
periodically checks for idle transactions and rollbacks them .