use of com.alibaba.nacos.naming.core.v2.upgrade.doublewrite.delay.DoubleWriteDelayTaskEngine 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;
}
use of com.alibaba.nacos.naming.core.v2.upgrade.doublewrite.delay.DoubleWriteDelayTaskEngine in project nacos by alibaba.
the class DoubleWriteEventListenerTest method testOnEvent.
@Test
public void testOnEvent() {
Mockito.when(upgradeJudgement.isUseGrpcFeatures()).thenReturn(true);
Service service = Service.newService("A", "B", "C");
ServiceEvent.ServiceChangedEvent serviceChangedEvent = new ServiceEvent.ServiceChangedEvent(service);
doubleWriteEventListener.onEvent(serviceChangedEvent);
Mockito.verify(doubleWriteDelayTaskEngine).addTask(Mockito.any(), Mockito.any());
}
use of com.alibaba.nacos.naming.core.v2.upgrade.doublewrite.delay.DoubleWriteDelayTaskEngine in project nacos by alibaba.
the class DoubleWriteEventListenerTest method testDoubleWriteMetadataToV1.
@Test
public void testDoubleWriteMetadataToV1() {
Mockito.when(upgradeJudgement.isUseGrpcFeatures()).thenReturn(true);
Service service = Service.newService("A", "B", "C");
doubleWriteEventListener.doubleWriteMetadataToV1(service, false);
Mockito.verify(doubleWriteDelayTaskEngine).addTask(Mockito.any(), Mockito.any());
}
Aggregations