view src/main/java/alice/topology/node/DeleteConnection.java @ 470:780ae843cdac dispose

Delete disconnect managerKey from connection list
author sugi
date Mon, 24 Nov 2014 19:52:13 +0900
parents
children be0b61986ff7
line wrap: on
line source

package alice.topology.node;

import java.util.List;

import alice.codesegment.CloseEventCodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.DataSegment;
import alice.datasegment.Receiver;

public class DeleteConnection extends CloseEventCodeSegment {

    private Receiver info = ids.create(CommandType.TAKE);

    public DeleteConnection() {
        info.setKey("_CLIST");
    }

    @Override
    public void run() {
        String name = getConnectionInfo().name;
        @SuppressWarnings("unchecked")
        List<String> list = info.asClass(List.class);

        if (list.contains(name))
            list.remove(name);

        DataSegment.get(name).shutdown();
        ods.put(info.key, list);
    }

}