comparison src/main/java/alice/topology/manager/keeparive/RemoveTask.java @ 345:8f71c3e6f11d

Change directory structure Maven standard
author sugi
date Wed, 16 Apr 2014 18:26:07 +0900
parents
children
comparison
equal deleted inserted replaced
344:9f97ec18f8c5 345:8f71c3e6f11d
1 package alice.topology.manager.keeparive;
2
3 import alice.codesegment.CodeSegment;
4 import alice.datasegment.CommandType;
5 import alice.datasegment.Receiver;
6
7 public class RemoveTask extends CodeSegment {
8 private Receiver info1 = ids.create(CommandType.TAKE); // list
9 private Receiver info2 = ids.create(CommandType.TAKE); // remove task
10
11 public RemoveTask(){
12 info1.setKey("_WAITINGLIST");
13 info2.setKey("_REMOVETASK");
14 }
15
16 @Override
17 public void run() {
18 ListManager list = info1.asClass(ListManager.class); // explicit cast
19 TaskInfo task = info2.asClass(TaskInfo.class);
20 TaskExecuter exec = TaskExecuter.getInstance();
21 if (exec.compareNowTask(task)){
22 // case: remove task is state countdown.
23 exec.skip();
24 } else {
25 // case: remove task is still in the waiting queue.
26 boolean removeFlag = list.deleteTask(task);
27 if (!removeFlag){
28 ods.put("_REMOVETASK", task);
29 }
30 }
31 ods.update("_WAITINGLIST", list);
32 }
33 }