Mercurial > hg > Database > Alice
view src/main/java/alice/topology/manager/keeparive/RemoveTask.java @ 498:e5d2141af6c2 dispose
keep alive Scheduler has bug
author | sugi |
---|---|
date | Mon, 15 Dec 2014 19:16:20 +0900 |
parents | aefbe41fcf12 |
children | c5072a63b257 |
line wrap: on
line source
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() { ListManager list = info1.asClass(ListManager.class); // explicit cast TaskInfo task = info2.asClass(TaskInfo.class); TaskExecuter exec = TaskExecuter.getInstance(); if (!exec.compareAndSkip(task)){ // case: remove task is still in the waiting queue. boolean removeFlag = list.deleteTask(task); if (!removeFlag){ System.out.println("falied RemoveTask "+task.getManagerKey()); ods.put("_REMOVETASK", task); } else { System.out.println("success RemoveTask "+task.getManagerKey()); //list.show(); } } else { System.out.println("success RemoveTask "+task.getManagerKey()); //list.show(); } ods.update("_WAITINGLIST", list); } }