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.
This commit is contained in:
parent
33df7c9b85
commit
455f69ad9e
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue