Search in sources :

Example 1 with DistroSyncChangeTask

use of com.alibaba.nacos.core.distributed.distro.task.execute.DistroSyncChangeTask in project nacos by alibaba.

the class DistroDelayTaskProcessor method process.

@Override
public boolean process(NacosTask task) {
    if (!(task instanceof DistroDelayTask)) {
        return true;
    }
    DistroDelayTask distroDelayTask = (DistroDelayTask) task;
    DistroKey distroKey = distroDelayTask.getDistroKey();
    switch(distroDelayTask.getAction()) {
        case DELETE:
            DistroSyncDeleteTask syncDeleteTask = new DistroSyncDeleteTask(distroKey, distroComponentHolder);
            distroTaskEngineHolder.getExecuteWorkersManager().addTask(distroKey, syncDeleteTask);
            return true;
        case CHANGE:
        case ADD:
            DistroSyncChangeTask syncChangeTask = new DistroSyncChangeTask(distroKey, distroComponentHolder);
            distroTaskEngineHolder.getExecuteWorkersManager().addTask(distroKey, syncChangeTask);
            return true;
        default:
            return false;
    }
}
Also used : DistroSyncChangeTask(com.alibaba.nacos.core.distributed.distro.task.execute.DistroSyncChangeTask) DistroKey(com.alibaba.nacos.core.distributed.distro.entity.DistroKey) DistroSyncDeleteTask(com.alibaba.nacos.core.distributed.distro.task.execute.DistroSyncDeleteTask)

Aggregations

DistroKey (com.alibaba.nacos.core.distributed.distro.entity.DistroKey)1 DistroSyncChangeTask (com.alibaba.nacos.core.distributed.distro.task.execute.DistroSyncChangeTask)1 DistroSyncDeleteTask (com.alibaba.nacos.core.distributed.distro.task.execute.DistroSyncDeleteTask)1