view src/main/java/alice/topology/node/DeleteConnection.java @ 483:86c45738dd9e dispose

success fix topology ..... may be
author sugi
date Fri, 05 Dec 2014 21:24:37 +0900
parents cf345b10a21a
children c5072a63b257
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;
import alice.topology.manager.keeparive.ListManager;

public class DeleteConnection extends CloseEventCodeSegment {

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

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

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

        if (list.contains(name)) {
            list.remove(name);
            if (DataSegment.contains(name))
                DataSegment.get(name).shutdown();
        }
        ListManager manager = info1.asClass(ListManager.class);
        manager.deleteAll(name);
        ods.update(info.key, list);
        ods.update(info1.key, manager);
    }

}