zhuxt2015 commented on code in PR #11144:
URL: https://github.com/apache/dolphinscheduler/pull/11144#discussion_r956717444


##########
dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-raft/src/main/java/org/apache/dolphinscheduler/plugin/registry/raft/RaftConnectionStateListener.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.plugin.registry.raft;
+
+import org.apache.dolphinscheduler.registry.api.ConnectionListener;
+import org.apache.dolphinscheduler.registry.api.ConnectionState;
+
+import com.alipay.sofa.jraft.Status;
+import com.alipay.sofa.jraft.core.Replicator;
+import com.alipay.sofa.jraft.entity.PeerId;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class RaftConnectionStateListener implements 
Replicator.ReplicatorStateListener {
+    private final ConnectionListener connectionListener;
+    private ConnectionState connectionState;
+
+    public RaftConnectionStateListener(ConnectionListener connectionListener) {
+        this.connectionListener = connectionListener;
+    }
+
+    @Override
+    public void onCreated(PeerId peerId) {
+        log.info("{}:{} created...", peerId.getIp(), peerId.getPort());
+    }
+
+    @Override
+    public void onError(PeerId peerId, Status status) {
+        log.error("{}:{} an error occurred, {}", peerId.getIp(), 
peerId.getPort(), status.getErrorMsg());
+    }
+
+    @Override
+    public void onDestroyed(PeerId peerId) {
+        log.info("{}:{} destroyed...", peerId.getIp(), peerId.getPort());
+    }
+
+    @Override
+    public void stateChanged(PeerId peer, ReplicatorState newState) {
+        switch (newState) {

Review Comment:
   not get other peers state



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to