@ Override public void eventOccurred ( AbstractTaskEvent event ) { if ( event instanceof TerminationEvent ) { terminationSignaled = true ; } else if ( event instanceof AllWorkersDoneEvent ) { AllWorkersDoneEvent wde = ( AllWorkersDoneEvent ) event ; aggregatorNames = wde . getAggregatorNames ( ) ; aggregates = wde . getAggregates ( userCodeClassLoader ) ; } else { throw new IllegalArgumentException ( "Unknown event type." ) ; } latch . countDown ( ) ; }
barrier will release the waiting thread if an event occurs