view src/main/java/alice/topology/node/ConfigurationFinish.java @ 552:767d93626b88 dispose

add compressed to DSM name
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Mon, 16 Nov 2015 18:33:23 +0900
parents 145c425db88d
children
line wrap: on
line source

package alice.topology.node;

import org.msgpack.type.ValueFactory;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;
import alice.topology.manager.keeparive.StartKeepAlive;

public class ConfigurationFinish extends CodeSegment {

    public Receiver reverseCount = ids.create(CommandType.PEEK);
    public Receiver configNodeNum = ids.create(CommandType.PEEK);
    private CodeSegment startCS;

    public ConfigurationFinish(CodeSegment startCS) {
        this.startCS = startCS;
    }

    @Override
    public void run() {
        int rcount = reverseCount.asInteger();
        int ncount = configNodeNum.asInteger();
        if (rcount == ncount) {
            ods.put("compressedmanager", "done", ValueFactory.createNilValue());
            Start cs = new Start(startCS);
            cs.done.setKey("compressedmanager", "start");

            new StartKeepAlive().execute();
            new ReceiveCloseMessage(CommandType.PEEK);
            ClosedEventManager.getInstance().register(DeleteConnection.class);
            ClosedEventManager.getInstance().setKey();
            return;
        }

        ConfigurationFinish cs3 = new ConfigurationFinish(startCS);
        cs3.reverseCount.setKey("compressedlocal", "reverseCount", this.reverseCount.index);
        cs3.configNodeNum.setKey("compressedlocal", "configNodeNum");
    }

}