Search in sources :

Example 1 with ShutdownException

use of es.bsc.compss.types.request.exceptions.ShutdownException in project compss by bsc-wdc.

the class AccessProcessor method run.

@Override
public void run() {
    while (keepGoing) {
        APRequest request = null;
        try {
            request = requestQueue.take();
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.getAPRequestEvent(request.getRequestType().name()).getId(), Tracer.getRuntimeEventsType());
            }
            request.process(this, taskAnalyser, dataInfoProvider, taskDispatcher);
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
        } catch (ShutdownException se) {
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
            se.getSemaphore().release();
            break;
        } catch (Exception e) {
            LOGGER.error("Exception", e);
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
        }
    }
    LOGGER.info("AccessProcessor shutdown");
}
Also used : APRequest(es.bsc.compss.types.request.ap.APRequest) ShutdownException(es.bsc.compss.types.request.exceptions.ShutdownException) ShutdownException(es.bsc.compss.types.request.exceptions.ShutdownException) CannotLoadException(es.bsc.compss.exceptions.CannotLoadException)

Example 2 with ShutdownException

use of es.bsc.compss.types.request.exceptions.ShutdownException in project compss by bsc-wdc.

the class TaskDispatcher method run.

// Dispatcher thread
@Override
public void run() {
    while (keepGoing) {
        String requestType = "Not defined";
        try {
            TDRequest request = requestQueue.take();
            requestType = request.getType().toString();
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.getTDRequestEvent(request.getType().name()).getId(), Tracer.getRuntimeEventsType());
            }
            request.process(scheduler);
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
        } catch (InterruptedException ie) {
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
            Thread.currentThread().interrupt();
            continue;
        } catch (ShutdownException se) {
            LOGGER.debug("Exiting dispatcher because of shutting down");
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
            se.getSemaphore().release();
            break;
        } catch (Exception e) {
            LOGGER.error("Error in request " + requestType, e);
            if (Tracer.isActivated()) {
                Tracer.emitEvent(Tracer.EVENT_END, Tracer.getRuntimeEventsType());
            }
            continue;
        }
    }
}
Also used : TDRequest(es.bsc.compss.types.request.td.TDRequest) ShutdownException(es.bsc.compss.types.request.exceptions.ShutdownException) ShutdownException(es.bsc.compss.types.request.exceptions.ShutdownException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

ShutdownException (es.bsc.compss.types.request.exceptions.ShutdownException)2 CannotLoadException (es.bsc.compss.exceptions.CannotLoadException)1 APRequest (es.bsc.compss.types.request.ap.APRequest)1 TDRequest (es.bsc.compss.types.request.td.TDRequest)1 FileNotFoundException (java.io.FileNotFoundException)1