view src/main/java/alice/topology/node/IncomingConnectionInfo.java @ 419:aefbe41fcf12 dispose

change tab to space
author sugi
date Tue, 15 Jul 2014 16:00:22 +0900
parents 6508ed6ea6a6
children 1b32ea1263f3
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);
    }

}