public void shutdown ( ) { if ( m_done . compareAndSet ( false , true ) ) { m_es . shutdown ( ) ; m_buses . shutdown ( ) ; DeleteNode deleteHost = new DeleteNode ( joinZKPath ( HOST_DN , m_hostId ) ) ; DeleteNode deleteCandidate = new DeleteNode ( m_candidate ) ; try { m_es . awaitTermination ( 365 , TimeUnit . DAYS ) ; } catch ( InterruptedException e ) { throw loggedDistributerException ( e , "interrupted while waiting for executor termination" ) ; } try { m_buses . awaitTermination ( 365 , TimeUnit . DAYS ) ; } catch ( InterruptedException e ) { throw loggedDistributerException ( e , "interrupted while waiting for executor termination" ) ; } deleteHost . onComplete ( ) ; deleteCandidate . onComplete ( ) ; } }
Sets the done flag shuts down its executor thread and deletes its own host and candidate nodes