add log in ZkclientZookeeperClient.java (#3109)
This commit is contained in:
parent
04aae2a66e
commit
d4d6dbfa36
|
|
@ -18,6 +18,8 @@ package org.apache.dubbo.remoting.zookeeper.zkclient;
|
|||
|
||||
import org.apache.dubbo.common.Constants;
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.remoting.zookeeper.ChildListener;
|
||||
import org.apache.dubbo.remoting.zookeeper.StateListener;
|
||||
import org.apache.dubbo.remoting.zookeeper.support.AbstractZookeeperClient;
|
||||
|
|
@ -32,6 +34,8 @@ import java.util.List;
|
|||
|
||||
public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildListener> {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ZkclientZookeeperClient.class);
|
||||
|
||||
private final ZkClientWrapper client;
|
||||
|
||||
private volatile KeeperState state = KeeperState.SyncConnected;
|
||||
|
|
@ -65,6 +69,7 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
client.createPersistent(path);
|
||||
} catch (ZkNodeExistsException e) {
|
||||
logger.error("zookeeper failed to create persistent node with " + path + ": ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +78,7 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
client.createEphemeral(path);
|
||||
} catch (ZkNodeExistsException e) {
|
||||
logger.error("zookeeper failed to create ephemeral node with " + path + ": ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +87,8 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
client.createPersistent(path, data);
|
||||
} catch (ZkNodeExistsException e) {
|
||||
logger.error("zookeeper failed to create persistent node with " +
|
||||
path + " and " + data + " : ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,6 +97,8 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
client.createEphemeral(path, data);
|
||||
} catch (ZkNodeExistsException e) {
|
||||
logger.error("zookeeper failed to create ephemeral node with " +
|
||||
path + " and " + data + " : ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +107,7 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
client.delete(path);
|
||||
} catch (ZkNoNodeException e) {
|
||||
logger.error("zookeeper failed to delete node with " + path + ": ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,6 +116,7 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
return client.getChildren(path);
|
||||
} catch (ZkNoNodeException e) {
|
||||
logger.error("zookeeper failed to get children node with " + path + ": ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -114,6 +126,7 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
return client.exists(path);
|
||||
} catch (Throwable t) {
|
||||
logger.error("zookeeper failed to check node existing with " + path + ": ", t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -128,6 +141,7 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
|
|||
try {
|
||||
return client.getData(path);
|
||||
} catch (ZkNoNodeException e) {
|
||||
logger.error("zookeeper failed to get data with " + path + ": ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue