Search in sources :

Example 1 with CommandShutdown

use of es.bsc.compss.nio.commands.CommandShutdown in project compss by bsc-wdc.

the class NIOWorkerNode method stop.

@Override
public void stop(ShutdownListener sl) {
    if (started) {
        LOGGER.debug("Shutting down " + this.getName());
        if (node == null) {
            sl.notifyFailure(new UnstartedNodeException());
            LOGGER.error("Shutdown has failed");
        }
        Connection c = NIOAgent.getTransferManager().startConnection(node);
        commManager.shuttingDown(this, c, sl);
        CommandShutdown cmd = new CommandShutdown(null, null);
        c.sendCommand(cmd);
        c.receive();
        c.finishConnection();
    } else {
        LOGGER.debug("Worker " + this.getName() + " has not started. Setting this to be stopped");
        workerStarter.setToStop();
        sl.notifyEnd();
    }
}
Also used : UnstartedNodeException(es.bsc.compss.exceptions.UnstartedNodeException) Connection(es.bsc.comm.Connection) CommandShutdown(es.bsc.compss.nio.commands.CommandShutdown)

Aggregations

Connection (es.bsc.comm.Connection)1 UnstartedNodeException (es.bsc.compss.exceptions.UnstartedNodeException)1 CommandShutdown (es.bsc.compss.nio.commands.CommandShutdown)1