view src/main/java/alice/topology/node/IncomingConnectionInfo.java @ 467:6e304a7a60e7 dispose

remove white space
author sugi
date Sat, 22 Nov 2014 12:08:24 +0900
parents 9f6674e503df
children 45b3fe2375ef
line wrap: on
line source

package alice.topology.node;

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 {
            HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
            if (DataSegment.contains(hostInfo.connectionName)) {
                System.out.println("reconnection");
                DataSegment.remove(hostInfo.connectionName);
            } else {
                ods.put("cMember", hostInfo.connectionName);
                new CreateConnectionList();
                count++;
            }
            DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
            ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);

        }

        IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, count);
        cs.hostInfo.setKey("manager", absName);
    }

}