Mercurial > hg > Members > tatsuki > Alice
changeset 315:f9ec5bead150
come back response. but has bug
author | sugi |
---|---|
date | Tue, 10 Dec 2013 12:32:43 +0900 |
parents | f1f0638861ab |
children | 9e84deb9b1e0 |
files | .classpath src/alice/topology/manager/keeparive/CreateTask.java src/alice/topology/manager/keeparive/RespondPing.java src/alice/topology/manager/keeparive/SendPing.java |
diffstat | 4 files changed, 25 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/.classpath Fri Dec 06 11:42:51 2013 +0900 +++ b/.classpath Tue Dec 10 12:32:43 2013 +0900 @@ -5,7 +5,6 @@ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.16.jar"/> <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.6.1.jar"/> <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.6.1.jar"/> - <classpathentry exported="true" kind="con" path="at.bestsolution.efxclipse.tooling.jdt.core.JAVAFX_CONTAINER"/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry exported="true" kind="lib" path="lib/msgpack-0.6.8-SNAPSHOT-sources.jar"/>
--- a/src/alice/topology/manager/keeparive/CreateTask.java Fri Dec 06 11:42:51 2013 +0900 +++ b/src/alice/topology/manager/keeparive/CreateTask.java Tue Dec 10 12:32:43 2013 +0900 @@ -20,7 +20,7 @@ List<String> list = info.asClass(List.class); new CheckExistTask(); - new GetTask(); + SendPing.getInstance().setKey(); for (String manager : list){ int i = 5; TaskInfo task = new TaskInfo(manager, "_RESPONCE", i * 1000);
--- a/src/alice/topology/manager/keeparive/RespondPing.java Fri Dec 06 11:42:51 2013 +0900 +++ b/src/alice/topology/manager/keeparive/RespondPing.java Tue Dec 10 12:32:43 2013 +0900 @@ -14,6 +14,8 @@ @Override public void run() { System.out.println(respond.getVal()); + TaskInfo task = new TaskInfo(respond.from, "_RESPONCE", 10 * 1000); + ods.put("_TASKINFO", task); } }
--- a/src/alice/topology/manager/keeparive/SendPing.java Fri Dec 06 11:42:51 2013 +0900 +++ b/src/alice/topology/manager/keeparive/SendPing.java Tue Dec 10 12:32:43 2013 +0900 @@ -13,14 +13,14 @@ private SendPing(){} public static SendPing getInstance() { - return instance; - } - + return instance; + } + public void setKey(){ ids.init(); info.setKey("_WAITINGLIST"); } - + @Override public synchronized void run() { ListManager list = info.asClass(ListManager.class); @@ -28,22 +28,23 @@ ods.update("_WAITINGLIST", list); new GetTask(); return; - } - try { - nowTask = list.getTaskList().pollFirst(); - ods.update("_WAITINGLIST", list); - System.out.print("managerkey is "+ nowTask.getManagerKey()); - System.out.println(" returnkey is "+ nowTask.getReturnKey()); - time = System.currentTimeMillis(); - if (nowTask.getSleepTime()!=0) - this.wait(nowTask.getSleepTime()); - if (interruptFlag){ - interruptFlag = false; - } else { - ods.ping(nowTask.getManagerKey(), nowTask.getReturnKey()); - new RespondPing(nowTask.getReturnKey()); + } else { + try { + nowTask = list.getTaskList().pollFirst(); + ods.update("_WAITINGLIST", list); + System.out.print("managerkey is "+ nowTask.getManagerKey()); + System.out.println(" returnkey is "+ nowTask.getReturnKey()); + time = System.currentTimeMillis(); + if (nowTask.getSleepTime()!=0) + this.wait(nowTask.getSleepTime()); + if (interruptFlag){ + interruptFlag = false; + } else { + ods.ping(nowTask.getManagerKey(), nowTask.getReturnKey()); + new RespondPing(nowTask.getReturnKey()); + } + } catch (InterruptedException e) { } - } catch (InterruptedException e) { } new GetTask(); } @@ -51,11 +52,11 @@ interruptFlag = true; notify(); } - + public TaskInfo getNowTask() { return nowTask; } - + public long getTime(){ return time; }