Mercurial > hg > Members > tatsuki > Alice
changeset 270:23e53aaa8720
reconnect manager worked.
author | sugi |
---|---|
date | Wed, 21 Aug 2013 15:33:49 +0900 |
parents | 9982e1c4f099 |
children | 3667ab045530 |
files | src/alice/daemon/Connection.java src/alice/daemon/IncomingTcpConnection.java src/alice/test/topology/aquarium/CheckMyName.java src/alice/topology/manager/ConfigWaiter.java src/alice/topology/manager/TopologyFinish.java src/alice/topology/manager/reconnection/CheckABSName.java src/alice/topology/manager/reconnection/CheckConnectionList.java src/alice/topology/manager/reconnection/ReceiveError.java src/alice/topology/manager/reconnection/ReceiveReconnectData.java src/alice/topology/node/IncomingConnectionInfo.java src/alice/topology/node/IncomingReverseKey.java |
diffstat | 11 files changed, 37 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/daemon/Connection.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/daemon/Connection.java Wed Aug 21 15:33:49 2013 +0900 @@ -7,8 +7,6 @@ import alice.codesegment.SingletonMessage; import alice.datasegment.Command; -import alice.topology.HostMessage; -import alice.topology.manager.reconnection.SendError; public class Connection { @@ -43,7 +41,7 @@ socket.getChannel().write(buffer); } } catch (IOException e) { - new SendError(new HostMessage(socket.getInetAddress().getHostName(), socket.getPort())).execute(); + } }
--- a/src/alice/daemon/IncomingTcpConnection.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/daemon/IncomingTcpConnection.java Wed Aug 21 15:33:49 2013 +0900 @@ -13,6 +13,8 @@ import alice.datasegment.DataSegmentKey; import alice.datasegment.DataSegmentManager; import alice.datasegment.LocalDataSegmentManager; +import alice.topology.HostMessage; +import alice.topology.manager.reconnection.SendError; public class IncomingTcpConnection extends Thread { @@ -69,6 +71,7 @@ connection.sendCommand(new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null)); return; } catch (EOFException e) { + new SendError(new HostMessage(connection.socket.getInetAddress().getHostName(), connection.socket.getPort())).execute(); connection.sendCommand(new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null)); return; } catch (IOException e) {
--- a/src/alice/test/topology/aquarium/CheckMyName.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/test/topology/aquarium/CheckMyName.java Wed Aug 21 15:33:49 2013 +0900 @@ -54,7 +54,7 @@ new SetLocation(new MakeObject(frame), key, 0); new CheckLocalIndex(key,1); } - + /* for (int i = 3; i < 6 ; i++){ key = "fish"+i; if (num == 1) new AutoIncrement(key,0); @@ -91,7 +91,7 @@ -(float)Math.random(), (float)Math.random())); new SetLocation(new MakeObject(frame), key, 0); new CheckLocalIndex(key,1); - } + }*/ } }
--- a/src/alice/topology/manager/ConfigWaiter.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/manager/ConfigWaiter.java Wed Aug 21 15:33:49 2013 +0900 @@ -5,6 +5,7 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; +import alice.topology.manager.reconnection.ReceiveError; public class ConfigWaiter extends CodeSegment { @@ -20,6 +21,7 @@ count--; if (count == 0) { ods.put("local", "start", ValueFactory.createNilValue()); + new ReceiveError(); return; } ConfigWaiter cs3 = new ConfigWaiter(count);
--- a/src/alice/topology/manager/TopologyFinish.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/manager/TopologyFinish.java Wed Aug 21 15:33:49 2013 +0900 @@ -3,14 +3,13 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; -import alice.topology.manager.reconnection.ReceiveError; public class TopologyFinish extends CodeSegment { public Receiver finish = ids.create(CommandType.TAKE); @Override public void run() { //System.exit(0); - new ReceiveError(); + System.out.println("finish"); } }
--- a/src/alice/topology/manager/reconnection/CheckABSName.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/manager/reconnection/CheckABSName.java Wed Aug 21 15:33:49 2013 +0900 @@ -24,22 +24,27 @@ System.out.println("CheckABSName"); @SuppressWarnings("unchecked") List<HostMessage> ABSIPList = abs.asClass(List.class); + HostMessage hostInfo = host.asClass(HostMessage.class); for (HostMessage mes : ABSIPList){ if (mes.name.equals(message.name)&&mes.port == message.port){ - HostMessage hostInfo = host.asClass(HostMessage.class); DataSegment.remove(mes.getABSName()); + System.out.println(mes.getABSName()+" "+hostInfo.name+" "+hostInfo.port ); DataSegment.connect(mes.getABSName(), "", hostInfo.name, hostInfo.port); ods.put(mes.getABSName(), "host", mes.getABSName()); ods.put("_RECABSNAME", mes.getABSName()); - ods.put("HMCLONE", new HostMessage(mes.name, mes.port)); + ods.put("_HMCLONE", new HostMessage(mes.name, mes.port)); mes.port = hostInfo.port; mes.name = hostInfo.name; ods.update("_ABSIPTABLE", ABSIPList); - break; + new CheckConnectionList(); + return; } } + ods.put("host", hostInfo); + new ReceiveError(); - new CheckConnectionList(); + + // check node side }
--- a/src/alice/topology/manager/reconnection/CheckConnectionList.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/manager/reconnection/CheckConnectionList.java Wed Aug 21 15:33:49 2013 +0900 @@ -4,6 +4,8 @@ import java.util.HashMap; import java.util.List; +import org.msgpack.type.ValueFactory; + import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; @@ -20,7 +22,7 @@ name.setKey("_RECABSNAME"); connection.setKey("connection"); abs.setKey("_ABSIPTABLE"); - clone.setKey("HMCLONE"); + clone.setKey("_HMCLONE"); } @Override @@ -51,14 +53,21 @@ if (mes3.name.equals(oldInfo.name)&&mes3.port == oldInfo.port){ mes3.name = newInfo.name; mes3.port = newInfo.port; + System.out.println(mes3.port); + System.out.println(mes3.name); + System.out.println(absName2+" "+newInfo.port); + ods.put(absName2, "_RECODATA", mes3); break; } - ods.put(absName, "_RECODATA", mes3); + + } break; } } } + ods.put(absName, ValueFactory.createNilValue()); + ods.update("connection", connectionList); new ReceiveError();
--- a/src/alice/topology/manager/reconnection/ReceiveError.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/manager/reconnection/ReceiveError.java Wed Aug 21 15:33:49 2013 +0900 @@ -22,7 +22,9 @@ Socket socket = new Socket(message.name, message.port); socket.close(); } catch (IOException e) { - System.out.println("Error"); + System.out.println("Erorr"); + System.out.println(message.name); + System.out.println(message.port); new CheckABSName(message); return; }
--- a/src/alice/topology/manager/reconnection/ReceiveReconnectData.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/manager/reconnection/ReceiveReconnectData.java Wed Aug 21 15:33:49 2013 +0900 @@ -19,7 +19,7 @@ HostMessage host = hostData.asClass(HostMessage.class); DataSegment.remove(host.connectionName); DataSegment.connect(host.connectionName, host.reverseName, host.name, host.port); - + ods.put(host.connectionName, "reverseKey", host.reverseName); new ReceiveReconnectData(); }
--- a/src/alice/topology/node/IncomingConnectionInfo.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/node/IncomingConnectionInfo.java Wed Aug 21 15:33:49 2013 +0900 @@ -32,16 +32,19 @@ public void run() { if (this.hostInfo.getVal() == null) { ods.put("local", "configNodeNum", count); + System.out.println("bbb"); return; } HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class); + System.out.println(hostInfo.connectionName+" "+hostInfo.name+" "+hostInfo.port ); DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port); ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName); connectionList.add(hostInfo.connectionName); ods.update("_CLIST", connectionList); IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count, connectionList); cs.hostInfo.setKey("manager", absName); + System.out.println("aaa"); } }
--- a/src/alice/topology/node/IncomingReverseKey.java Tue Aug 20 17:35:03 2013 +0900 +++ b/src/alice/topology/node/IncomingReverseKey.java Wed Aug 21 15:33:49 2013 +0900 @@ -13,6 +13,7 @@ @Override public void run() { + System.out.println("incomingReversekey"); String reverseKey = ((Value)this.reverseKey.getVal()).asRawValue().getString(); String from = this.reverseKey.from; DataSegment.getAccept(from).reverseKey = reverseKey;