Search in sources :

Example 1 with OperationResponseHandler

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

the class OnJoinOp method beforeRun.

@Override
public void beforeRun() throws Exception {
    if (!operations.isEmpty()) {
        NodeEngine nodeEngine = getNodeEngine();
        OperationResponseHandler responseHandler = createErrorLoggingResponseHandler(getLogger());
        for (Operation op : operations) {
            op.setNodeEngine(nodeEngine);
            op.setOperationResponseHandler(responseHandler);
            OperationAccessor.setCallerAddress(op, getCallerAddress());
            OperationAccessor.setConnection(op, getConnection());
        }
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) Operation(com.hazelcast.spi.impl.operationservice.Operation) UpdatePermissionConfigOperation(com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation) UrgentSystemOperation(com.hazelcast.spi.impl.operationservice.UrgentSystemOperation) OperationResponseHandler(com.hazelcast.spi.impl.operationservice.OperationResponseHandler)

Example 2 with OperationResponseHandler

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

the class OperationRunnerImpl method setOperationResponseHandler.

private void setOperationResponseHandler(Operation op) {
    OperationResponseHandler handler = outboundResponseHandler;
    if (op.getCallId() == 0) {
        if (op.returnsResponse()) {
            throw new HazelcastException("Operation " + op + " wants to return a response, but doesn't have a call ID");
        }
        handler = createEmptyResponseHandler();
    }
    op.setOperationResponseHandler(handler);
}
Also used : HazelcastException(com.hazelcast.core.HazelcastException) OperationResponseHandler(com.hazelcast.spi.impl.operationservice.OperationResponseHandler)

Example 3 with OperationResponseHandler

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

the class WaitSet method onShutdown.

public void onShutdown() {
    Object response = new HazelcastInstanceNotActiveException();
    Address thisAddress = nodeEngine.getThisAddress();
    for (WaitSetEntry entry : queue) {
        if (!entry.isValid()) {
            continue;
        }
        Operation op = entry.getOperation();
        // only for local invocations, remote ones will be expired via #onMemberLeft()
        if (thisAddress.equals(op.getCallerAddress())) {
            try {
                OperationResponseHandler responseHandler = op.getOperationResponseHandler();
                responseHandler.sendResponse(op, response);
            } catch (Exception e) {
                logger.finest("While sending HazelcastInstanceNotActiveException response...", e);
            }
        }
        queue.clear();
    }
}
Also used : HazelcastInstanceNotActiveException(com.hazelcast.core.HazelcastInstanceNotActiveException) Address(com.hazelcast.cluster.Address) BlockingOperation(com.hazelcast.spi.impl.operationservice.BlockingOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) OperationResponseHandler(com.hazelcast.spi.impl.operationservice.OperationResponseHandler) HazelcastInstanceNotActiveException(com.hazelcast.core.HazelcastInstanceNotActiveException) PartitionMigratingException(com.hazelcast.spi.exception.PartitionMigratingException)

Example 4 with OperationResponseHandler

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

the class WaitSetEntry method onCancel.

public void onCancel() {
    OperationResponseHandler responseHandler = op.getOperationResponseHandler();
    responseHandler.sendResponse(op, cancelResponse);
}
Also used : OperationResponseHandler(com.hazelcast.spi.impl.operationservice.OperationResponseHandler)

Example 5 with OperationResponseHandler

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

the class PartitionReplicaSyncResponse method prepareOperation.

private void prepareOperation(Operation op) {
    int partitionId = getPartitionId();
    int replicaIndex = getReplicaIndex();
    NodeEngine nodeEngine = getNodeEngine();
    ILogger opLogger = nodeEngine.getLogger(op.getClass());
    OperationResponseHandler responseHandler = createErrorLoggingResponseHandler(opLogger);
    op.setNodeEngine(nodeEngine).setPartitionId(partitionId).setReplicaIndex(replicaIndex).setOperationResponseHandler(responseHandler);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ILogger(com.hazelcast.logging.ILogger) OperationResponseHandler(com.hazelcast.spi.impl.operationservice.OperationResponseHandler)

Aggregations

OperationResponseHandler (com.hazelcast.spi.impl.operationservice.OperationResponseHandler)6 Operation (com.hazelcast.spi.impl.operationservice.Operation)3 NodeEngine (com.hazelcast.spi.impl.NodeEngine)2 Address (com.hazelcast.cluster.Address)1 HazelcastException (com.hazelcast.core.HazelcastException)1 HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)1 UpdatePermissionConfigOperation (com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation)1 ILogger (com.hazelcast.logging.ILogger)1 PartitionMigratingException (com.hazelcast.spi.exception.PartitionMigratingException)1 AbstractLocalOperation (com.hazelcast.spi.impl.operationservice.AbstractLocalOperation)1 BlockingOperation (com.hazelcast.spi.impl.operationservice.BlockingOperation)1 UrgentSystemOperation (com.hazelcast.spi.impl.operationservice.UrgentSystemOperation)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1