Mercurial > hg > Database > Alice
changeset 496:f82f259ea93b dispose
putConnectionInfo only called from keepAlive deamon
author | sugi |
---|---|
date | Fri, 12 Dec 2014 05:29:31 +0900 |
parents | b789b8459996 |
children | 5adb0f530e3d |
files | src/main/java/alice/daemon/Connection.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/fix/FixTopology.java src/main/java/alice/topology/manager/ParentManager.java |
diffstat | 6 files changed, 19 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/daemon/Connection.java Thu Dec 11 18:28:18 2014 +0900 +++ b/src/main/java/alice/daemon/Connection.java Fri Dec 12 05:29:31 2014 +0900 @@ -1,9 +1,7 @@ package alice.daemon; -import java.io.IOException; import java.net.Socket; import java.nio.ByteBuffer; -import java.nio.channels.ClosedChannelException; import java.util.concurrent.LinkedBlockingQueue; import alice.datasegment.Command; @@ -43,13 +41,7 @@ while (buffer.hasRemaining()) { socket.getChannel().write(buffer); } - } catch (ClosedChannelException e) { - // when put dataSegment to remote if connection close this dataSemgent put. - putConnectionInfo(); - - } catch (IOException e) { - putConnectionInfo(); - } + } catch (Exception e) { } } public void close(){ @@ -57,12 +49,8 @@ socket.shutdownOutput(); socket.shutdownInput(); socket.close(); - putConnectionInfo(); - } catch (ClosedChannelException e) { - return; - } catch (IOException e) { - return; - } + } catch (Exception e) { } + putConnectionInfo(); }
--- a/src/main/java/alice/datasegment/DataSegmentManager.java Thu Dec 11 18:28:18 2014 +0900 +++ b/src/main/java/alice/datasegment/DataSegmentManager.java Fri Dec 12 05:29:31 2014 +0900 @@ -62,6 +62,8 @@ public abstract void ping(String returnKey); public abstract void response(String returnKey); + public abstract void setSendError(boolean b); + public abstract void putSocketInfo(); }
--- a/src/main/java/alice/datasegment/LocalDataSegmentManager.java Thu Dec 11 18:28:18 2014 +0900 +++ b/src/main/java/alice/datasegment/LocalDataSegmentManager.java Fri Dec 12 05:29:31 2014 +0900 @@ -159,4 +159,9 @@ } + @Override + public void putSocketInfo() { + + } + }
--- a/src/main/java/alice/datasegment/RemoteDataSegmentManager.java Thu Dec 11 18:28:18 2014 +0900 +++ b/src/main/java/alice/datasegment/RemoteDataSegmentManager.java Fri Dec 12 05:29:31 2014 +0900 @@ -158,7 +158,11 @@ @Override public void setSendError(boolean b) { connection.sendManager = b; + } + @Override + public void putSocketInfo() { + connection.putConnectionInfo(); } }
--- a/src/main/java/alice/topology/fix/FixTopology.java Thu Dec 11 18:28:18 2014 +0900 +++ b/src/main/java/alice/topology/fix/FixTopology.java Fri Dec 12 05:29:31 2014 +0900 @@ -15,14 +15,12 @@ private Receiver info = ids.create(CommandType.TAKE); // disconnection nodeInfo private Receiver info1 = ids.create(CommandType.TAKE); // all connection Info - private Receiver info2 = ids.create(CommandType.TAKE); // node count private Receiver info3 = ids.create(CommandType.TAKE); // IP Table private Receiver info4 = ids.create(CommandType.TAKE); // parentManager public FixTopology() { info.setKey("_DISCONNECTNODE"); info1.setKey("topology"); - info2.setKey("hostCount"); info3.setKey("nameTable"); info4.setKey("parentManager"); } @@ -51,8 +49,7 @@ // change state not Alive lostNode.alive = false; // get lastJoinedNode - int last = info2.asInteger()-1; - String lastJoinNodeName = "node"+last; + String lastJoinNodeName = manager.getLastNode().getName(); LinkedList<HostMessage> connectionList = topology.get(lastJoinNodeName); // lastJoinedNode has one connection HostMessage parentNode = connectionList.poll(); @@ -132,7 +129,6 @@ } ods.put(info1.key, topology); - ods.put(info2.key, info2.getReceiveData()); ods.put(info3.key, nameTable); ods.put(info4.key, manager); }
--- a/src/main/java/alice/topology/manager/ParentManager.java Thu Dec 11 18:28:18 2014 +0900 +++ b/src/main/java/alice/topology/manager/ParentManager.java Fri Dec 12 05:29:31 2014 +0900 @@ -70,6 +70,10 @@ } } + public Parent getLastNode(){ + return list.getLast(); + } + public void show() { int counter = 0; System.out.print("| ");