view src/main/java/alice/topology/node/IncomingConnectionInfo.java @ 416:6508ed6ea6a6 dispose

create Connection List in CreateConnection CodeSegment
author sugi
date Wed, 09 Jul 2014 03:45:14 +0900
parents fee3efd9257d
children aefbe41fcf12
line wrap: on
line source

package alice.topology.node;

import java.util.ArrayList;

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 String absName;
	private int count;

	public IncomingConnectionInfo(String absName, int count) {
		this.absName = absName;
		this.count = count;
	}


	@Override
	public void run() {
		if (this.hostInfo.getVal() == null) {
			ods.put("local", "configNodeNum", count);
		} else {
			if (count == 0)
				ods.put("_CLIST", new ArrayList<String>());
			
			HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
			DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
			ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
			ods.put("cMember", hostInfo.connectionName);
			count++;
			
			new CreateConnectionList();
		}
		IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, count);
		cs.hostInfo.setKey("manager", absName);
	}

}