@@ -104,10 +104,12 @@ public ZooKeeperLeaderRetrievalDriver(
104104
105105 client .getConnectionStateListenable ().addListener (connectionStateListener );
106106
107- LOG .debug (
108- "Monitoring data change in {}" ,
109- ZooKeeperUtils .generateZookeeperPath (
110- client .getNamespace (), connectionInformationPath ));
107+ if (LOG .isDebugEnabled ()) {
108+ LOG .debug (
109+ "Monitoring data change in {}" ,
110+ ZooKeeperUtils .generateZookeeperPath (
111+ client .getNamespace (), connectionInformationPath ));
112+ }
111113
112114 running = true ;
113115 }
@@ -142,7 +144,9 @@ public void close() throws Exception {
142144
143145 private void retrieveLeaderInformationFromZooKeeper () {
144146 try {
145- LOG .debug ("Leader node has changed." );
147+ if (LOG .isDebugEnabled ()) {
148+ LOG .debug ("Leader node has changed." );
149+ }
146150
147151 final ChildData childData = cache .getCurrentData (connectionInformationPath );
148152
@@ -170,7 +174,9 @@ private void retrieveLeaderInformationFromZooKeeper() {
170174 private void handleStateChange (ConnectionState newState ) {
171175 switch (newState ) {
172176 case CONNECTED :
173- LOG .debug ("Connected to ZooKeeper quorum. Leader retrieval can start." );
177+ if (LOG .isDebugEnabled ()) {
178+ LOG .debug ("Connected to ZooKeeper quorum. Leader retrieval can start." );
179+ }
174180 break ;
175181 case SUSPENDED :
176182 LOG .warn ("Connection to ZooKeeper suspended, waiting for reconnection." );
0 commit comments