diff src/main/java/alice/topology/node/IncomingConnectionInfo.java @ 345:8f71c3e6f11d

Change directory structure Maven standard
author sugi
date Wed, 16 Apr 2014 18:26:07 +0900
parents
children 3a0056e03040
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Wed Apr 16 18:26:07 2014 +0900
@@ -0,0 +1,49 @@
+package alice.topology.node;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.DataSegment;
+import alice.datasegment.Receiver;
+import alice.topology.HostMessage;
+
+public class IncomingConnectionInfo extends CodeSegment {
+
+	public Receiver hostInfo = ids.create(CommandType.TAKE);
+	private List<String> connectionList;
+	private String absName;
+	private int count;
+	
+	public IncomingConnectionInfo(String absName, int count) {
+		this.absName = absName;
+		this.count = count;
+		this.connectionList = new ArrayList<String>();
+	}
+	
+	public IncomingConnectionInfo(String absName, int count, List<String> connectionList) {
+		this.absName = absName;
+		this.count = count;
+		this.connectionList = connectionList;
+	}
+
+	@Override
+	public void run() {
+		if (this.hostInfo.getVal() == null) {
+			ods.put("local", "configNodeNum", count);
+			return;
+		}
+		
+		HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
+		//System.out.println(hostInfo.reconnectFlag);
+		DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port, hostInfo.reconnectFlag);
+		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);
+		
+	}
+
+}