Enhance log info and fix code checkstyle (#4529)
* 1.fix code checkstyle check 2.enhance disconnect log info * log enhance * revert line
This commit is contained in:
parent
04c5056f13
commit
c72cb016b4
@ -74,7 +74,6 @@ public class PayloadRegistry {
|
||||
inited = true;
|
||||
}
|
||||
|
||||
|
||||
static void register(String type, Class clazz) {
|
||||
if (Modifier.isAbstract(clazz.getModifiers())) {
|
||||
return;
|
||||
|
@ -595,7 +595,7 @@ public class ClientWorker implements Closeable {
|
||||
@Override
|
||||
public void onDisConnect() {
|
||||
String taskId = rpcClientInner.getLabels().get("taskId");
|
||||
LOGGER.info("[0]clear listen context...", rpcClientInner.getName());
|
||||
LOGGER.info("[{}] clear listen context...", rpcClientInner.getName());
|
||||
Collection<CacheData> values = cacheMap.get().values();
|
||||
|
||||
for (CacheData cacheData : values) {
|
||||
|
@ -119,14 +119,15 @@ public abstract class RpcClient implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify when client re connected.
|
||||
* Notify when client disconnected.
|
||||
*/
|
||||
protected void notifyDisConnected() {
|
||||
if (!connectionEventListeners.isEmpty()) {
|
||||
LoggerUtils.printIfInfoEnabled(LOGGER, "Notify connection event listeners.");
|
||||
for (ConnectionEventListener connectionEventListener : connectionEventListeners) {
|
||||
connectionEventListener.onDisConnect();
|
||||
}
|
||||
if (connectionEventListeners.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
LoggerUtils.printIfInfoEnabled(LOGGER, "Notify disconnected event to listeners");
|
||||
for (ConnectionEventListener connectionEventListener : connectionEventListeners) {
|
||||
connectionEventListener.onDisConnect();
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,10 +135,12 @@ public abstract class RpcClient implements Closeable {
|
||||
* Notify when client new connected.
|
||||
*/
|
||||
protected void notifyConnected() {
|
||||
if (!connectionEventListeners.isEmpty()) {
|
||||
for (ConnectionEventListener connectionEventListener : connectionEventListeners) {
|
||||
connectionEventListener.onConnected();
|
||||
}
|
||||
if (connectionEventListeners.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
LoggerUtils.printIfInfoEnabled(LOGGER, "Notify connected event to listeners.");
|
||||
for (ConnectionEventListener connectionEventListener : connectionEventListeners) {
|
||||
connectionEventListener.onConnected();
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +259,8 @@ public abstract class RpcClient implements Closeable {
|
||||
}
|
||||
|
||||
if (connectToServer != null) {
|
||||
LoggerUtils.printIfInfoEnabled(LOGGER, String.format("[%s] success to connect to server on start up", name));
|
||||
LoggerUtils
|
||||
.printIfInfoEnabled(LOGGER, String.format("[%s] success to connect to server on start up", name));
|
||||
this.currentConnection = connectToServer;
|
||||
rpcClientStatus.set(RpcClientStatus.RUNNING);
|
||||
eventLinkedBlockingQueue.offer(new ConnectionEvent(ConnectionEvent.CONNECTED));
|
||||
|
@ -21,7 +21,6 @@ import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.alibaba.nacos.api.naming.pojo.Cluster;
|
||||
import com.alibaba.nacos.api.naming.pojo.Instance;
|
||||
import com.alibaba.nacos.api.naming.pojo.ServiceInfo;
|
||||
import com.alibaba.nacos.api.naming.utils.NamingUtils;
|
||||
import com.alibaba.nacos.common.utils.JacksonUtils;
|
||||
import com.alibaba.nacos.naming.core.v2.ServiceManager;
|
||||
import com.alibaba.nacos.naming.core.v2.index.ServiceStorage;
|
||||
|
Loading…
Reference in New Issue
Block a user