Mercurial > hg > Members > tatsuki > Alice
changeset 350:388e7d4b0624
heart beat may finish.
author | sugi |
---|---|
date | Tue, 22 Apr 2014 04:21:22 +0900 |
parents | 335e5846e154 |
children | f025283c1e2a |
files | src/main/java/alice/codesegment/OutputDataSegment.java src/main/java/alice/datasegment/DataSegmentManager.java src/main/java/alice/datasegment/LocalDataSegmentManager.java src/main/java/alice/datasegment/RemoteDataSegmentManager.java src/main/java/alice/topology/manager/keeparive/RespondPing.java src/main/java/alice/topology/manager/keeparive/TaskExecuter.java |
diffstat | 6 files changed, 20 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/codesegment/OutputDataSegment.java Mon Apr 21 20:01:24 2014 +0900 +++ b/src/main/java/alice/codesegment/OutputDataSegment.java Tue Apr 22 04:21:22 2014 +0900 @@ -95,5 +95,14 @@ public void ping(String managerKey, String returnKey) { DataSegment.get(managerKey).ping(returnKey); } + + /** + * this method is to forcibly close socket + * + * @param managerKey + */ + public void shutdown(String managerKey){ + DataSegment.get(managerKey).shutdown(); + } }
--- a/src/main/java/alice/datasegment/DataSegmentManager.java Mon Apr 21 20:01:24 2014 +0900 +++ b/src/main/java/alice/datasegment/DataSegmentManager.java Tue Apr 22 04:21:22 2014 +0900 @@ -61,7 +61,7 @@ public abstract void quickTake(Receiver receiver, CodeSegment cs); public abstract void remove(String key); - public abstract void shutdown(String key); + public abstract void shutdown(); public abstract void close(); public abstract void finish();
--- a/src/main/java/alice/datasegment/LocalDataSegmentManager.java Mon Apr 21 20:01:24 2014 +0900 +++ b/src/main/java/alice/datasegment/LocalDataSegmentManager.java Tue Apr 22 04:21:22 2014 +0900 @@ -165,7 +165,7 @@ } @Override - public void shutdown(String key) { + public void shutdown() { }
--- a/src/main/java/alice/datasegment/RemoteDataSegmentManager.java Mon Apr 21 20:01:24 2014 +0900 +++ b/src/main/java/alice/datasegment/RemoteDataSegmentManager.java Tue Apr 22 04:21:22 2014 +0900 @@ -140,12 +140,6 @@ } @Override - public void close() { - Command cmd = new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null); - connection.sendCommand(cmd); - } - - @Override public void ping(String returnKey) { Command cmd = new Command(CommandType.PING, null, returnKey, null, 0, 0, null, null, null); connection.write(cmd); @@ -158,7 +152,13 @@ } @Override - public void shutdown(String key) { + public void close() { + Command cmd = new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null); + connection.sendCommand(cmd); + } + + @Override + public void shutdown() { connection.close(); }
--- a/src/main/java/alice/topology/manager/keeparive/RespondPing.java Mon Apr 21 20:01:24 2014 +0900 +++ b/src/main/java/alice/topology/manager/keeparive/RespondPing.java Tue Apr 22 04:21:22 2014 +0900 @@ -20,7 +20,7 @@ System.out.println(" Recieved time "+(d.time - pingedTime)); if (d.time - pingedTime > 60 * 1000){ // need check, this connection is alive. may be close - DataSegment.get(d.from).close(); + DataSegment.get(d.from).shutdown(); } else { // if nowTask close d.from's socket cancel. // if not remove close task in the Queue.
--- a/src/main/java/alice/topology/manager/keeparive/TaskExecuter.java Mon Apr 21 20:01:24 2014 +0900 +++ b/src/main/java/alice/topology/manager/keeparive/TaskExecuter.java Tue Apr 22 04:21:22 2014 +0900 @@ -63,7 +63,7 @@ } else if (nowTask.getType() == TaskType.CLOSE) { // no response from the Remote DataSegment. So close this connection. System.out.println("SHOTDOWN"); - DataSegment.get(nowTask.getManagerKey()).close(); + DataSegment.get(nowTask.getManagerKey()).shutdown(); } } nowTask = null;