use of com.alibaba.nacos.core.distributed.distro.task.delay.DistroDelayTask in project nacos by alibaba.
the class DistroProtocol method syncToTarget.
/**
* Start to sync to target server.
*
* @param distroKey distro key of sync data
* @param action the action of data operation
* @param targetServer target server
* @param delay delay time for sync
*/
public void syncToTarget(DistroKey distroKey, DataOperation action, String targetServer, long delay) {
DistroKey distroKeyWithTarget = new DistroKey(distroKey.getResourceKey(), distroKey.getResourceType(), targetServer);
DistroDelayTask distroDelayTask = new DistroDelayTask(distroKeyWithTarget, action, delay);
distroTaskEngineHolder.getDelayTaskExecuteEngine().addTask(distroKeyWithTarget, distroDelayTask);
if (Loggers.DISTRO.isDebugEnabled()) {
Loggers.DISTRO.debug("[DISTRO-SCHEDULE] {} to {}", distroKey, targetServer);
}
}
use of com.alibaba.nacos.core.distributed.distro.task.delay.DistroDelayTask in project nacos by alibaba.
the class DistroClientTaskFailedHandler method retry.
@Override
public void retry(DistroKey distroKey, DataOperation action) {
DistroDelayTask retryTask = new DistroDelayTask(distroKey, action, DistroConfig.getInstance().getSyncRetryDelayMillis());
distroTaskEngineHolder.getDelayTaskExecuteEngine().addTask(distroKey, retryTask);
}
use of com.alibaba.nacos.core.distributed.distro.task.delay.DistroDelayTask in project nacos by alibaba.
the class DistroHttpCombinedKeyTaskFailedHandler method retry.
@Override
public void retry(DistroKey distroKey, DataOperation action) {
DistroHttpCombinedKey combinedKey = (DistroHttpCombinedKey) distroKey;
for (String each : combinedKey.getActualResourceTypes()) {
DistroKey newKey = new DistroKey(each, KeyBuilder.INSTANCE_LIST_KEY_PREFIX, distroKey.getTargetServer());
DistroDelayTask newTask = new DistroDelayTask(newKey, action, DistroConfig.getInstance().getSyncRetryDelayMillis());
distroTaskEngineHolder.getDelayTaskExecuteEngine().addTask(newKey, newTask);
}
}
use of com.alibaba.nacos.core.distributed.distro.task.delay.DistroDelayTask in project nacos by alibaba.
the class DistroHttpDelayTaskProcessor method process.
@Override
public boolean process(NacosTask task) {
DistroDelayTask distroDelayTask = (DistroDelayTask) task;
DistroKey distroKey = distroDelayTask.getDistroKey();
DistroHttpCombinedKeyExecuteTask executeTask = new DistroHttpCombinedKeyExecuteTask(globalConfig, distroTaskEngineHolder.getDelayTaskExecuteEngine(), distroKey, distroDelayTask.getAction());
distroTaskEngineHolder.getExecuteWorkersManager().addTask(distroKey, executeTask);
return true;
}
Aggregations