question: private boolean isZookeeperLeader ( String nodeIP , int port ) { try { Socket sock = new Socket ( ) ; sock . connect ( new InetSocketAddress ( nodeIP , port ) , 10000 ) ; sock . close ( ) ; return true ; } catch ( IOException ex ) { _log . warn ( "Unexpected IO errors when checking local coordinator state. {}" , ex . toString ( ) ) ; } return false ; }
target:  Zookeeper leader nodes listens on 2888(see coordinator-var.xml) for follower/observers. We depends on this behaviour to check if leader election is started