view src/main/java/christie/topology/node/TopologyNode.java @ 94:87a203c99177

update HostMessage refactor
author akahori
date Sat, 15 Sep 2018 18:59:12 +0900
parents 33afa0fa8bc5
children 53e31b403815
line wrap: on
line source

package christie.topology.node;

import christie.annotation.Peek;
import christie.codegear.CodeGear;
import christie.codegear.CodeGearManager;
import christie.topology.HostMessage;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

public class TopologyNode extends CodeGear{

    @Peek
    TopologyNodeConfig topologyNodeConfig;

    public TopologyNode() {
    }

    @Override
    protected void run(CodeGearManager cgm) {

        cgm.createRemoteDGM(topologyNodeConfig.getManagerKey(),
                            topologyNodeConfig.getManagerHostName(),
                            topologyNodeConfig.getManagerPort());

        HostMessage hostMessage = new HostMessage();
        hostMessage.setLocalHostAndPort(cgm.localPort);
        hostMessage.setCookie(topologyNodeConfig.cookie);

        getDGM(topologyNodeConfig.getManagerKey()).put("hostMessage", hostMessage);

        getLocalDGM().put("_CLIST", new ArrayList<String>());
        getLocalDGM().put("reverseCount", 0);

        cgm.setup(new IncomingConnectionInfo());
        cgm.setup(new IncomingReverseKey());
        cgm.setup(new ConfigurationFinish());

    }
}