|
@@ -102,20 +102,23 @@ public class TaskCallbackService {
|
|
|
while (Stopper.isRunning()) {
|
|
|
masterNodes = zookeeperRegistryCenter.getMasterNodesDirectly();
|
|
|
if (CollectionUtils.isEmpty(masterNodes)) {
|
|
|
+ masterNodes = null;
|
|
|
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
|
|
|
- }else {
|
|
|
- logger.error("find {} masters for task : {}.",
|
|
|
- masterNodes.size(),
|
|
|
- taskInstanceId);
|
|
|
- break;
|
|
|
+ continue;
|
|
|
}
|
|
|
- }
|
|
|
- for(String masterNode : masterNodes){
|
|
|
- newChannel = nettyRemotingClient.getChannel(Host.of(masterNode));
|
|
|
- if(newChannel != null){
|
|
|
- return getRemoteChannel(newChannel, nettyRemoteChannel.getOpaque(), taskInstanceId);
|
|
|
+ logger.info("find {} masters for task : {}.",
|
|
|
+ masterNodes.size(),
|
|
|
+ taskInstanceId);
|
|
|
+ for (String masterNode : masterNodes) {
|
|
|
+ newChannel = nettyRemotingClient.getChannel(Host.of(masterNode));
|
|
|
+ if (newChannel != null) {
|
|
|
+ return getRemoteChannel(newChannel, nettyRemoteChannel.getOpaque(), taskInstanceId);
|
|
|
+ }
|
|
|
}
|
|
|
+ masterNodes = null;
|
|
|
+ ThreadUtils.sleep(SLEEP_TIME_MILLIS);
|
|
|
}
|
|
|
+
|
|
|
throw new IllegalStateException(String.format("all available master nodes : %s are not reachable for task: {}", masterNodes, taskInstanceId));
|
|
|
}
|
|
|
|