Mercurial > hg > Database > Alice
diff src/alice/topology/manager/keeparive/RemoveTask.java @ 323:d746c4486287
work
author | one |
---|---|
date | Mon, 23 Dec 2013 17:13:16 +0900 |
parents | |
children | 806cc010a5bd |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/topology/manager/keeparive/RemoveTask.java Mon Dec 23 17:13:16 2013 +0900 @@ -0,0 +1,36 @@ +package alice.topology.manager.keeparive; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class RemoveTask extends CodeSegment { + private Receiver info1 = ids.create(CommandType.TAKE); // list + private Receiver info2 = ids.create(CommandType.TAKE); // remove task + + public RemoveTask(){ + info1.setKey("_WAITINGLIST"); + info2.setKey("_REMOVETASK"); + } + + @Override + public void run() { + System.out.println(); + ListManager list = info1.asClass(ListManager.class); // explicit cast + TaskInfo task = info2.asClass(TaskInfo.class); + TaskExecuter exec = TaskExecuter.getInstance(); + if (exec.compareNowTask(task)){ + // case: remove task is state countdown. + exec.skip(); + } else { + // case: remove task is still in the waiting queue. + for (TaskInfo t: list.getTaskList()){ + if (t.getType().equals(task.getType())){ + list.getTaskList().remove(t); + break; + } + } + } + ods.update("_WAITINGLIST", list); + } +}