Mercurial > hg > Members > tatsuki > Alice
changeset 326:c382d6fe1ec4
need reamainingTime add next task
author | sugi |
---|---|
date | Fri, 24 Jan 2014 02:18:09 +0900 |
parents | 54d0b947079a |
children | 235f6d0994df |
files | src/alice/topology/manager/keeparive/RespondPing.java src/alice/topology/manager/keeparive/TaskExecuter.java src/alice/topology/manager/keeparive/TaskType.java |
diffstat | 3 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/topology/manager/keeparive/RespondPing.java Fri Jan 24 01:51:14 2014 +0900 +++ b/src/alice/topology/manager/keeparive/RespondPing.java Fri Jan 24 02:18:09 2014 +0900 @@ -22,7 +22,7 @@ // need check, this connection is alive. may be close DataSegment.get(d.from).close(); } else { - // if nowTask is close d.from's socket cancel. + // if nowTask close d.from's socket cancel. // if not remove close task in the Queue. TaskExecuter exec = TaskExecuter.getInstance(); TaskInfo task = new TaskInfo(TaskType.CLOSE);
--- a/src/alice/topology/manager/keeparive/TaskExecuter.java Fri Jan 24 01:51:14 2014 +0900 +++ b/src/alice/topology/manager/keeparive/TaskExecuter.java Fri Jan 24 02:18:09 2014 +0900 @@ -10,7 +10,6 @@ private TaskInfo nowTask; private boolean skipFlag = false; private long startTime = 0; - private long remainingTime = 0; private static TaskExecuter instance = new TaskExecuter(); private TaskExecuter(){} @@ -27,7 +26,6 @@ public synchronized void run(){ ListManager list = info.asClass(ListManager.class); if (list.getTaskList().size() == 0){ - remainingTime = 0; ods.update("_WAITINGLIST", list); setKey(); return; @@ -60,10 +58,12 @@ setKey(); } - public synchronized void skip(){ + public synchronized long skip(){ skipFlag = true; + long remainingTime = nowTask.getSleepTime() - (System.currentTimeMillis() - startTime); nowTask = null; notify(); + return remainingTime; } public TaskInfo getNowTask(){