public void start ( ) throws Exception { Preconditions . checkState ( state . compareAndSet ( State . LATENT , State . STARTED ) , "Cannot be started more than once" ) ; client . createContainers ( queuePath ) ; getInitialQueues ( ) ; leaderLatch . start ( ) ; service . submit ( new Callable < Void > ( ) { @ Override public Void call ( ) throws Exception { while ( state . get ( ) == State . STARTED ) { try { Thread . sleep ( policies . getThresholdCheckMs ( ) ) ; checkThreshold ( ) ; } catch ( InterruptedException e ) { // swallow the interrupt as it's only possible from either a background // operation and, thus, doesn't apply to this loop or the instance // is being closed in which case the while test will get it } } return null ; } } ) ; }
The sharder must be started