private void resume ( ) { // create runnable to resume the event context Runnable runnable = new Runnable ( ) { public void run ( ) { if ( scheduledFuture == null ) { // already resumed return ; } // cancel timer task scheduledFuture . cancel ( false ) ; scheduledFuture = null ; // send events frozen to event router again, will be processed only after this one ends (this one is already being executed) for ( EventContext ec : barriedEvents ) { ec . getLocalActivityContext ( ) . getExecutorService ( ) . routeEvent ( ec ) ; } barriedEvents = null ; // remove barrier on activity event queue event . getLocalActivityContext ( ) . getEventQueueManager ( ) . removeBarrier ( transaction ) ; // remove suspension suspended = false ; // continue routing the event related with this context event . getLocalActivityContext ( ) . getCurrentEventRoutingTask ( ) . run ( ) ; } } ; // run it using the activity executor service to avoid thread concurrency event . getLocalActivityContext ( ) . getExecutorService ( ) . execute ( runnable ) ; }
the real logic to resume the event context