49
|
1 package christie.topology.manager.keepalive;
|
|
2
|
|
3
|
|
4 import christie.annotation.Take;
|
|
5 import christie.codegear.CodeGear;
|
|
6 import christie.codegear.CodeGearManager;
|
|
7
|
|
8 public class RespondPing extends CodeGear{
|
|
9 @Take
|
|
10 RespondData respondData;
|
|
11 // private long pingedTime = System.currentTimeMillis();
|
|
12
|
|
13
|
|
14 @Override
|
|
15 public void run(CodeGearManager cgm) {
|
|
16 TaskExecuter exec = TaskExecuter.getInstance();
|
|
17 synchronized (exec){
|
|
18 //System.out.print("ping from "+d.from);
|
|
19 //System.out.println(" Recieved time "+(d.time - pingedTime));
|
|
20
|
|
21 TaskInfo task = new TaskInfo(TaskType.CLOSE);
|
|
22 task.setInfo(respondData.from, null, 0);
|
|
23 if (!exec.compareAndSkip(task)){
|
|
24 // case: remove task is still in the waiting queue.
|
|
25 getLocalDGM().put("_REMOVETASK",task);
|
|
26 new RemoveTask();
|
|
27 }
|
|
28 }
|
|
29 }
|
|
30 }
|