view src/main/java/christie/topology/manager/keepalive/RespondPing.java @ 111:671246274719

fix file dir
author akahori
date Tue, 20 Nov 2018 18:29:13 +0900
parents fd944876257b
children
line wrap: on
line source

package christie.topology.manager.keepalive;


import christie.annotation.Take;
import christie.codegear.CodeGear;
import christie.codegear.CodeGearManager;

public class RespondPing extends CodeGear{
    @Take
    RespondData respondData;
//    private long pingedTime = System.currentTimeMillis();


    @Override
    public void run(CodeGearManager cgm) {
        TaskExecuter exec = TaskExecuter.getInstance();
        synchronized (exec){
            //System.out.print("ping from "+d.from);
            //System.out.println(" Recieved time "+(d.time - pingedTime));

            TaskInfo task = new TaskInfo(TaskType.CLOSE);
            task.setInfo(respondData.from, null, 0);
            if (!exec.compareAndSkip(task)){
                // case: remove task is still in the waiting queue.
                getLocalDGM().put("_REMOVETASK",task);
                new RemoveTask();
            }
        }
    }
}