private Runnable shutdownAfterHandoff ( final String workUnit ) { final Cluster cluster = this . cluster ; final Logger log = LOG ; return new Runnable ( ) { @ Override public void run ( ) { String str = cluster . getHandoffResult ( workUnit ) ; log . info ( "Shutting down {} following handoff to {}." , workUnit , ( str == null ) ? "(None)" : str ) ; cluster . shutdownWork ( workUnit , /*doLog =*/ false ) ; if ( cluster . hasState ( NodeState . Draining ) && cluster . myWorkUnits . isEmpty ( ) ) { cluster . shutdown ( ) ; } } } ; }
Builds a runnable to shut down a work unit after a configurable delay once handoff has completed . If the cluster has been instructed to shut down and the last work unit has been handed off this task also directs this Ordasity instance to shut down .