private OperationResponseHandler newOperationResponseHandler() { OperationResponseHandler delegate = offloadedOperation.getOperationResponseHandler(); // we need to peel of the OperationResponseHandlerImpl if (delegate instanceof OffloadedOperationResponseHandler) { delegate = ((OffloadedOperationResponseHandler) delegate).delegate; } return new OffloadedOperationResponseHandler(delegate); }
private OperationResponseHandler newOperationResponseHandler() { OperationResponseHandler delegate = offloadedOperation.getOperationResponseHandler(); // we need to peel of the OperationResponseHandlerImpl if (delegate instanceof OffloadedOperationResponseHandler) { delegate = ((OffloadedOperationResponseHandler) delegate).delegate; } return new OffloadedOperationResponseHandler(delegate); }
public void onCancel() { OperationResponseHandler responseHandler = op.getOperationResponseHandler(); responseHandler.sendResponse(op, cancelResponse); }
public void onCancel() { OperationResponseHandler responseHandler = op.getOperationResponseHandler(); responseHandler.sendResponse(op, cancelResponse); }
/** * Constructs a local execution with retry logic. The operation must not * have an {@link OperationResponseHandler}, it must return a response * and it must not validate the target. * * @return the local execution * @throws IllegalArgumentException if the operation has a response handler * set, if it does not return a response * or if it validates the operation target * @see Operation#returnsResponse() * @see Operation#getOperationResponseHandler() * @see Operation#validatesTarget() */ public static LocalRetryableExecution executeLocallyWithRetry(NodeEngine nodeEngine, Operation operation) { if (operation.getOperationResponseHandler() != null) { throw new IllegalArgumentException("Operation must not have a response handler set"); } if (!operation.returnsResponse()) { throw new IllegalArgumentException("Operation must return a response"); } if (operation.validatesTarget()) { throw new IllegalArgumentException("Operation must not validate the target"); } final LocalRetryableExecution execution = new LocalRetryableExecution(nodeEngine, operation); execution.run(); return execution; }
/** * Constructs a local execution with retry logic. The operation must not * have an {@link OperationResponseHandler}, it must return a response * and it must not validate the target. * * @return the local execution * @throws IllegalArgumentException if the operation has a response handler * set, if it does not return a response * or if it validates the operation target * @see Operation#returnsResponse() * @see Operation#getOperationResponseHandler() * @see Operation#validatesTarget() */ public static LocalRetryableExecution executeLocallyWithRetry(NodeEngine nodeEngine, Operation operation) { if (operation.getOperationResponseHandler() != null) { throw new IllegalArgumentException("Operation must not have a response handler set"); } if (!operation.returnsResponse()) { throw new IllegalArgumentException("Operation must return a response"); } if (operation.validatesTarget()) { throw new IllegalArgumentException("Operation must not validate the target"); } final LocalRetryableExecution execution = new LocalRetryableExecution(nodeEngine, operation); execution.run(); return execution; }
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(); } }
public final void sendResponse(Object value) { OperationResponseHandler responseHandler = getOperationResponseHandler(); if (responseHandler == null) { if (value instanceof Throwable) { // in case of a throwable, we want the stacktrace. getLogger().warning("Missing responseHandler for " + toString(), (Throwable) value); } else { getLogger().warning("Missing responseHandler for " + toString() + " value[" + value + "]"); } } else { responseHandler.sendResponse(this, value); } }
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(); } }
public final void sendResponse(Object value) { OperationResponseHandler responseHandler = getOperationResponseHandler(); if (responseHandler == null) { if (value instanceof Throwable) { // in case of a throwable, we want the stacktrace. getLogger().warning("Missing responseHandler for " + toString(), (Throwable) value); } else { getLogger().warning("Missing responseHandler for " + toString() + " value[" + value + "]"); } } else { responseHandler.sendResponse(this, value); } }