Buggy code:
class ConnectionManager implements Watcher { protected static final Logger log = LoggerFactory . getLogger ( ConnectionManager . class ) ; private final String name ; private CountDownLatch clientConnected ; private KeeperState state ; private boolean connected ; private final ZkClientConnectionStrategy connectionStrategy ; private Object connectionUpdateLock = new Object ( ) ; private String zkServerAddress ; private int zkClientTimeout ; private SolrZkClient client ; private OnReconnect onReconnect ; private volatile boolean isClosed = false ; public ConnectionManager ( String name , SolrZkClient client , String zkServerAddress , int zkClientTimeout , ZkClientConnectionStrategy strat , OnReconnect onConnect ) { } private synchronized void reset ( ) { } @ Override public synchronized void process ( WatchedEvent event ) { if ( ConnectionManager . log . isInfoEnabled ( ) ) { ConnectionManager . log . info ( ( ( ( ( ( ( ( ( ( "Watcher<seq2seq4repair_space>" + ( this ) ) + "<seq2seq4repair_space>name:" ) + ( name ) ) + "<seq2seq4repair_space>got<seq2seq4repair_space>event<seq2seq4repair_space>" ) + event ) + "<seq2seq4repair_space>path:" ) + ( event . getPath ( ) ) ) + "<seq2seq4repair_space>type:" ) + ( event . getType ( ) ) ) ) ; } if ( isClosed ) { ConnectionManager . log . info ( "Client->ZooKeeper<seq2seq4repair_space>status<seq2seq4repair_space>change<seq2seq4repair_space>trigger<seq2seq4repair_space>but<seq2seq4repair_space>we<seq2seq4repair_space>are<seq2seq4repair_space>already<seq2seq4repair_space>closed" ) ; return ; } state = event . getState ( ) ; if ( ( state ) == ( KeeperState . SyncConnected ) ) { connected = true ; clientConnected . countDown ( ) ; connectionStrategy . connected ( ) ; } else if ( ( state ) == ( KeeperState . Expired ) ) { connected = false ; ConnectionManager . log . info ( "Our<seq2seq4repair_space>previous<seq2seq4repair_space>ZooKeeper<seq2seq4repair_space>session<seq2seq4repair_space>was<seq2seq4repair_space>expired.<seq2seq4repair_space>Attempting<seq2seq4repair_space>to<seq2seq4repair_space>reconnect<seq2seq4repair_space>to<seq2seq4repair_space>recover<seq2seq4repair_space>relationship<seq2seq4repair_space>with<seq2seq4repair_space>ZooKeeper..." ) ; try { connectionStrategy . reconnect ( zkServerAddress , zkClientTimeout , this , new ZkClientConnectionStrategy . ZkUpdate ( ) { @ Override public void update ( SolrZooKeeper keeper ) { synchronized ( connectionUpdateLock ) { try { <START_BUG> waitForConnected ( DEFAULT_CLIENT_CONNECT_TIMEOUT ) ; <END_BUG> } catch ( Exception e1 ) { closeKeeper ( keeper ) ; throw new RuntimeException ( e1 ) ; } ConnectionManager . log . info ( "Connection<seq2seq4repair_space>with<seq2seq4repair_space>ZooKeeper<seq2seq4repair_space>reestablished." ) ; try { client . updateKeeper ( keeper ) ; } catch ( InterruptedException e ) { closeKeeper ( keeper ) ; Thread . currentThread ( ) . interrupt ( ) ; throw new RuntimeException ( e ) ; } catch ( Throwable t ) { closeKeeper ( keeper ) ; throw new RuntimeException ( t ) ; } if ( ( onReconnect ) != null ) { onReconnect . command ( ) ; } synchronized ( ConnectionManager . this ) { ConnectionManager . this . connected = true ; } } } } ) ; } catch ( Exception e ) { SolrException . log ( ConnectionManager . log , "" , e ) ; } ConnectionManager . log . info ( ( "Connected:" + ( connected ) ) ) ; } else if ( ( state ) == ( KeeperState . Disconnected ) ) { ConnectionManager . log . info ( "zkClient<seq2seq4repair_space>has<seq2seq4repair_space>disconnected" ) ; connected = false ; connectionStrategy . disconnected ( ) ; } else { connected = false ; } notifyAll ( ) ; } public synchronized boolean isConnected ( ) { } public void close ( ) { } public synchronized KeeperState state ( ) { } public synchronized void waitForConnected ( long waitForConnection ) throws TimeoutException { } public synchronized void waitForDisconnected ( long timeout ) throws InterruptedException , TimeoutException { } private void closeKeeper ( SolrZooKeeper keeper ) { } }

Fix:
waitForConnected ( Long . MAX_VALUE ) ;