Buggy code:
public class CacheManager extends SpyThread implements CacheMonitor . CacheMonitorListener , Watcher { private static final String ARCUS_BASE_CACHE_LIST_ZPATH = "//arcus//cache_list//" ; private static final String ARCUS_BASE_CLIENT_INFO_ZPATH = "//arcus//client_list//" ; private static final String CACHE_1_7_LIST_PATH = "//arcus_1_7//cache_list//" ; private static final String CLIENT_1_7_INFO_PATH = "//arcus_1_7//client_list//" ; private static final int ZK_SESSION_TIMEOUT = 15000 ; private static final long ZK_CONNECT_TIMEOUT = CacheManager . ZK_SESSION_TIMEOUT ; private final String hostPort ; private final String serviceCode ; private CacheMonitor cacheMonitor ; private ZooKeeper zk ; private ArcusClient [ ] client ; private final CountDownLatch clientInitLatch ; private final ConnectionFactoryBuilder cfb ; private final int waitTimeForConnect ; private final int poolSize ; private volatile boolean shutdownRequested = false ; private CountDownLatch zkInitLatch ; private List < String > prevChildren ; public static final String FAKE_SERVER_NODE = "0.0.0.0:23456" ; private boolean arcus17 = false ; public CacheManager ( String hostPort , String serviceCode , ConnectionFactoryBuilder cfb , CountDownLatch clientInitLatch , int poolSize , int waitTimeForConnect ) { } private void initZooKeeperClient ( ) { } private String getClientInfo ( ) { } public void process ( WatchedEvent event ) { } public void run ( ) { } public void closing ( ) { } public void commandNodeChange ( List < String > children ) { } public List < String > getPrevChildren ( ) { } private void createArcusClient ( String addrs ) { List < InetSocketAddress > socketList ; int addrCount ; if ( arcus17 ) { socketList = Arcus17NodeAddress . getAddresses ( addrs ) ; addrCount = 0 ; for ( InetSocketAddress a : socketList ) { <START_BUG> boolean isFake = ( "//" + ( CacheMonitor . FAKE_SERVER_NODE ) ) . equals ( a . toString ( ) ) ; <END_BUG> if ( ! isFake ) addrCount ++ ; } } else { socketList = AddrUtil . getAddresses ( addrs ) ; addrCount = socketList . size ( ) ; } final CountDownLatch latch = new CountDownLatch ( addrCount ) ; final ConnectionObserver observer = new ConnectionObserver ( ) { @ Override public void connectionLost ( SocketAddress sa ) { } @ Override public void connectionEstablished ( SocketAddress sa , int reconnectCount ) { latch . countDown ( ) ; } } ; cfb . setInitialObservers ( Collections . singleton ( observer ) ) ; int _awaitTime = 0 ; if ( ( waitTimeForConnect ) == 0 ) _awaitTime = 50 * addrCount ; else _awaitTime = waitTimeForConnect ; client = new ArcusClient [ poolSize ] ; for ( int i = 0 ; i < ( poolSize ) ; i ++ ) { try { client [ i ] = ArcusClient . getInstance ( cfb . build ( ) , socketList ) ; client [ i ] . setName ( ( "Memcached<seq2seq4repair_space>IO<seq2seq4repair_space>for<seq2seq4repair_space>" + ( serviceCode ) ) ) ; client [ i ] . setCacheManager ( this ) ; } catch ( IOException e ) { getLogger ( ) . fatal ( "Arcus<seq2seq4repair_space>Connection<seq2seq4repair_space>has<seq2seq4repair_space>critical<seq2seq4repair_space>problems.<seq2seq4repair_space>contact<seq2seq4repair_space>arcus<seq2seq4repair_space>manager." ) ; } } try { if ( latch . await ( _awaitTime , TimeUnit . MILLISECONDS ) ) { getLogger ( ) . warn ( "All<seq2seq4repair_space>arcus<seq2seq4repair_space>connections<seq2seq4repair_space>are<seq2seq4repair_space>established." ) ; } else { getLogger ( ) . error ( "Some<seq2seq4repair_space>arcus<seq2seq4repair_space>connections<seq2seq4repair_space>are<seq2seq4repair_space>not<seq2seq4repair_space>established." ) ; } } catch ( InterruptedException e ) { getLogger ( ) . fatal ( "Arcus<seq2seq4repair_space>Connection<seq2seq4repair_space>has<seq2seq4repair_space>critical<seq2seq4repair_space>problems.<seq2seq4repair_space>contact<seq2seq4repair_space>arcus<seq2seq4repair_space>manager." ) ; } this . clientInitLatch . countDown ( ) ; } public ArcusClient [ ] getAC ( ) { } private void shutdownZooKeeperClient ( ) { } public void shutdown ( ) { } }

Fix:
boolean isFake = ( "//" + ( CacheManager . FAKE_SERVER_NODE ) ) . equals ( a . toString ( ) ) ;