Search in sources :

Example 1 with CallStatus

use of com.hazelcast.spi.impl.operationservice.CallStatus in project hazelcast by hazelcast.

the class OperationRunnerImpl method call.

private void call(Operation op) throws Exception {
    CallStatus callStatus = op.call();
    switch(callStatus.ordinal()) {
        case RESPONSE_ORDINAL:
            int backupAcks = backupHandler.sendBackups(op);
            Object response = op.getResponse();
            if (backupAcks > 0) {
                response = new NormalResponse(response, op.getCallId(), backupAcks, op.isUrgent());
            }
            try {
                op.sendResponse(response);
            } catch (ResponseAlreadySentException e) {
                logOperationError(op, e);
            }
            afterRun(op);
            break;
        case VOID_ORDINAL:
            backupHandler.sendBackups(op);
            afterRun(op);
            break;
        case OFFLOAD_ORDINAL:
            op.afterRun();
            Offload offload = (Offload) callStatus;
            offload.init(nodeEngine, operationService.asyncOperations);
            offload.start();
            break;
        case WAIT_ORDINAL:
            nodeEngine.getOperationParker().park((BlockingOperation) op);
            break;
        default:
            throw new IllegalStateException();
    }
}
Also used : CallStatus(com.hazelcast.spi.impl.operationservice.CallStatus) NormalResponse(com.hazelcast.spi.impl.operationservice.impl.responses.NormalResponse) ResponseAlreadySentException(com.hazelcast.spi.exception.ResponseAlreadySentException) Offload(com.hazelcast.spi.impl.operationservice.Offload)

Aggregations

ResponseAlreadySentException (com.hazelcast.spi.exception.ResponseAlreadySentException)1 CallStatus (com.hazelcast.spi.impl.operationservice.CallStatus)1 Offload (com.hazelcast.spi.impl.operationservice.Offload)1 NormalResponse (com.hazelcast.spi.impl.operationservice.impl.responses.NormalResponse)1