|
|
|
@ -106,6 +106,11 @@ public class ServerNodeManager implements InitializingBean {
|
|
|
|
|
*/ |
|
|
|
|
private RegistryClient registryClient = RegistryClient.getInstance(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* eg : /node/worker/group/127.0.0.1:xxx |
|
|
|
|
*/ |
|
|
|
|
private static final int WORKER_LISTENER_CHECK_LENGTH = 5; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* worker group mapper |
|
|
|
|
*/ |
|
|
|
@ -155,7 +160,7 @@ public class ServerNodeManager implements InitializingBean {
|
|
|
|
|
/** |
|
|
|
|
* init WorkerNodeListener listener |
|
|
|
|
*/ |
|
|
|
|
registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_WORKERS, new MasterDataListener()); |
|
|
|
|
registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_WORKERS, new WorkerDataListener()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -210,7 +215,7 @@ public class ServerNodeManager implements InitializingBean {
|
|
|
|
|
/** |
|
|
|
|
* worker group node listener |
|
|
|
|
*/ |
|
|
|
|
class WorkerGroupNodeListener implements SubscribeListener { |
|
|
|
|
class WorkerDataListener implements SubscribeListener { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void notify(String path, DataChangeEvent dataChangeEvent) { |
|
|
|
@ -240,7 +245,7 @@ public class ServerNodeManager implements InitializingBean {
|
|
|
|
|
|
|
|
|
|
private String parseGroup(String path) { |
|
|
|
|
String[] parts = path.split("/"); |
|
|
|
|
if (parts.length < 6) { |
|
|
|
|
if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { |
|
|
|
|
throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); |
|
|
|
|
} |
|
|
|
|
return parts[parts.length - 2]; |
|
|
|
@ -307,7 +312,6 @@ public class ServerNodeManager implements InitializingBean {
|
|
|
|
|
* sync master nodes |
|
|
|
|
* |
|
|
|
|
* @param nodes master nodes |
|
|
|
|
* @param masterNodes |
|
|
|
|
*/ |
|
|
|
|
private void syncMasterNodes(Set<String> nodes, List<Server> masterNodes) { |
|
|
|
|
masterLock.lock(); |
|
|
|
|