Search in sources :

Example 1 with AsyncServicesCheckTask

use of com.alibaba.nacos.naming.core.v2.upgrade.doublewrite.execute.AsyncServicesCheckTask in project nacos by alibaba.

the class UpgradeJudgement method checkForUpgrade.

private boolean checkForUpgrade() {
    if (!useGrpcFeatures.get()) {
        boolean selfCheckResult = selfUpgradeChecker.isReadyToUpgrade(serviceManager, doubleWriteDelayTaskEngine);
        Member self = memberManager.getSelf();
        self.setExtendVal(MemberMetaDataConstants.READY_TO_UPGRADE, selfCheckResult);
        memberManager.updateMember(self);
        if (!selfCheckResult) {
            NamingExecuteTaskDispatcher.getInstance().dispatchAndExecuteTask(AsyncServicesCheckTask.class, new AsyncServicesCheckTask(doubleWriteDelayTaskEngine, this));
        }
    }
    boolean result = true;
    for (Member each : memberManager.allMembers()) {
        Object isReadyToUpgrade = each.getExtendVal(MemberMetaDataConstants.READY_TO_UPGRADE);
        result &= null != isReadyToUpgrade && (boolean) isReadyToUpgrade;
    }
    return result;
}
Also used : AsyncServicesCheckTask(com.alibaba.nacos.naming.core.v2.upgrade.doublewrite.execute.AsyncServicesCheckTask) Member(com.alibaba.nacos.core.cluster.Member)

Aggregations

Member (com.alibaba.nacos.core.cluster.Member)1 AsyncServicesCheckTask (com.alibaba.nacos.naming.core.v2.upgrade.doublewrite.execute.AsyncServicesCheckTask)1