[fix][worker][bug] master/worker crash when registry recover from SUSPENDED to RECONNECTED (#13328)
This commit is contained in:
parent
664b17ae96
commit
d27d27f7d7
|
|
@ -92,18 +92,22 @@ public class MasterWaitingStrategy implements MasterConnectStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reconnect() {
|
public void reconnect() {
|
||||||
try {
|
if (ServerLifeCycleManager.isRunning()) {
|
||||||
ServerLifeCycleManager.recoverFromWaiting();
|
logger.info("no need to reconnect, as the current server status is running");
|
||||||
reStartMasterResource();
|
} else {
|
||||||
// reopen the resource
|
try {
|
||||||
logger.info("Recover from waiting success, the current server status is {}",
|
ServerLifeCycleManager.recoverFromWaiting();
|
||||||
ServerLifeCycleManager.getServerStatus());
|
reStartMasterResource();
|
||||||
} catch (Exception e) {
|
logger.info("Recover from waiting success, the current server status is {}",
|
||||||
String errorMessage =
|
ServerLifeCycleManager.getServerStatus());
|
||||||
String.format("Recover from waiting failed, the current server status is %s, will stop the server",
|
} catch (Exception e) {
|
||||||
ServerLifeCycleManager.getServerStatus());
|
String errorMessage =
|
||||||
logger.error(errorMessage, e);
|
String.format(
|
||||||
registryClient.getStoppable().stop(errorMessage);
|
"Recover from waiting failed, the current server status is %s, will stop the server",
|
||||||
|
ServerLifeCycleManager.getServerStatus());
|
||||||
|
logger.error(errorMessage, e);
|
||||||
|
registryClient.getStoppable().stop(errorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,19 +92,23 @@ public class WorkerWaitingStrategy implements WorkerConnectStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reconnect() {
|
public void reconnect() {
|
||||||
try {
|
if (ServerLifeCycleManager.isRunning()) {
|
||||||
ServerLifeCycleManager.recoverFromWaiting();
|
logger.info("no need to reconnect, as the current server status is running");
|
||||||
reStartWorkerResource();
|
} else {
|
||||||
logger.info("Recover from waiting success, the current server status is {}",
|
try {
|
||||||
ServerLifeCycleManager.getServerStatus());
|
ServerLifeCycleManager.recoverFromWaiting();
|
||||||
} catch (Exception e) {
|
reStartWorkerResource();
|
||||||
String errorMessage =
|
logger.info("Recover from waiting success, the current server status is {}",
|
||||||
String.format("Recover from waiting failed, the current server status is %s, will stop the server",
|
ServerLifeCycleManager.getServerStatus());
|
||||||
ServerLifeCycleManager.getServerStatus());
|
} catch (Exception e) {
|
||||||
logger.error(errorMessage, e);
|
String errorMessage =
|
||||||
registryClient.getStoppable().stop(errorMessage);
|
String.format(
|
||||||
|
"Recover from waiting failed, the current server status is %s, will stop the server",
|
||||||
|
ServerLifeCycleManager.getServerStatus());
|
||||||
|
logger.error(errorMessage, e);
|
||||||
|
registryClient.getStoppable().stop(errorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue