提交 455f69ad 编写于 作者: Y YuXiaoFeng 提交者: wu-sheng

Enhance EtcdCoordinator if disconnected from etcd server for a long time (#3782)

* Update EtcdCoordinator.java

when EtcdCoordinator cannot connect to etcd cluster for a long time, 
the information registered in etcd will expire and refresh() function will not work.
上级 33df7c9b
......@@ -34,11 +34,14 @@ import org.apache.skywalking.oap.server.core.cluster.RemoteInstance;
import org.apache.skywalking.oap.server.core.cluster.ServiceRegisterException;
import org.apache.skywalking.oap.server.core.remote.client.Address;
import org.apache.skywalking.oap.server.telemetry.api.TelemetryRelatedContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Alan Lau
*/
public class EtcdCoordinator implements ClusterRegister, ClusterNodesQuery {
private static final Logger logger = LoggerFactory.getLogger(EtcdCoordinator.class);
private ClusterModuleEtcdConfig config;
......@@ -113,7 +116,11 @@ public class EtcdCoordinator implements ClusterRegister, ClusterNodesQuery {
try {
client.refresh(key, KEY_TTL).send().get();
} catch (Exception e) {
try {
client.put(key, json).ttl(KEY_TTL).send().get();
} catch (Exception ee) {
logger.error(ee.getMessage(), ee);
}
}
}, 5 * 1000, 30 * 1000, TimeUnit.MILLISECONDS);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册