Search in sources :

Example 1 with CommandCheckWorker

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

the class WorkerStarter method checkWorker.

private void checkWorker(NIONode n, String name) {
    long delay = WAIT_TIME_UNIT;
    long totalWait = 0;
    CommandCheckWorker cmd = new CommandCheckWorker(DEPLOYMENT_ID, name);
    do {
        if (DEBUG) {
            LOGGER.debug("[WorkerStarter] Sending check command to worker " + name);
        }
        // Send command check
        Connection c = NIOAdaptor.getTransferManager().startConnection(n);
        c.sendCommand(cmd);
        c.receive();
        c.finishConnection();
        // Sleep before next iteration
        try {
            LOGGER.debug("[WorkerStarter] Waiting to send next check worker command with delay " + delay);
            Thread.sleep(delay);
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
        }
        totalWait += delay;
        delay = (delay < 3_900) ? delay * 2 : 4_000;
    } while (!this.workerIsReady && totalWait < MAX_WAIT_FOR_INIT && !this.toStop);
}
Also used : CommandCheckWorker(es.bsc.compss.nio.commands.CommandCheckWorker) Connection(es.bsc.comm.Connection)

Aggregations

Connection (es.bsc.comm.Connection)1 CommandCheckWorker (es.bsc.compss.nio.commands.CommandCheckWorker)1