private void handleInvocationException(Exception e) { if (e instanceof RetryableException) { notifyError(e); } else { throw rethrow(e); } }
private void handleInvocationException(Exception e) { if (e instanceof RetryableException) { notifyError(e); } else { throw rethrow(e); } }
private void onTargetLoss(Invocation invocation) { // Notify only if invocation's target is left member and invocation's member-list-version // is lower than member-list-version at time of member removal. // // Comparison of invocation's target and left member is done using member UUID. // Normally Hazelcast does not support crash-recover, a left member cannot rejoin // with the same UUID. Hence UUID comparison is enough. // // But Hot-Restart breaks this limitation and when Hot-Restart is enabled a member // can restore its UUID and it's allowed to rejoin when cluster state is FROZEN or PASSIVE. // // That's why another ordering property is needed. Invocation keeps member-list-version before // operation is submitted to the target. If a member restarts with the same identity (UUID), // by comparing member-list-version during member removal with the invocation's member-list-version // we can determine whether invocation is submitted before member left or after restart. if (invocation.memberListVersion < memberListVersion) { invocation.notifyError(new MemberLeftException(leftMember)); } }
private boolean engineActive() { NodeState state = context.node.getState(); if (state == NodeState.ACTIVE) { return true; } boolean allowed = state == NodeState.PASSIVE && (op instanceof AllowedDuringPassiveState); if (!allowed) { notifyError(new HazelcastInstanceNotActiveException("State: " + state + " Operation: " + op.getClass())); remote = false; } return allowed; }
public void shutdown() { alive = false; for (Invocation invocation : this) { try { invocation.notifyError(new HazelcastInstanceNotActiveException()); } catch (Throwable e) { logger.warning(invocation + " could not be notified with shutdown message -> " + e.getMessage(), e); } } } }
public void reset(Throwable cause) { for (Invocation invocation : this) { try { invocation.notifyError(new MemberLeftException(cause)); } catch (Throwable e) { logger.warning(invocation + " could not be notified with reset message -> " + e.getMessage()); } } }
private boolean engineActive() { NodeState state = context.node.getState(); if (state == NodeState.ACTIVE) { return true; } boolean allowed = state == NodeState.PASSIVE && (op instanceof AllowedDuringPassiveState); if (!allowed) { notifyError(new HazelcastInstanceNotActiveException("State: " + state + " Operation: " + op.getClass())); remote = false; } return allowed; }
public void reset(Throwable cause) { for (Invocation invocation : this) { try { invocation.notifyError(new MemberLeftException(cause)); } catch (Throwable e) { logger.warning(invocation + " could not be notified with reset message -> " + e.getMessage()); } } }
public void shutdown() { alive = false; for (Invocation invocation : this) { try { invocation.notifyError(new HazelcastInstanceNotActiveException()); } catch (Throwable e) { logger.warning(invocation + " could not be notified with shutdown message -> " + e.getMessage(), e); } } } }
private void onTargetLoss(Invocation invocation) { // Notify only if invocation's target is left member and invocation's member-list-version // is lower than member-list-version at time of member removal. // // Comparison of invocation's target and left member is done using member UUID. // Normally Hazelcast does not support crash-recover, a left member cannot rejoin // with the same UUID. Hence UUID comparison is enough. // // But Hot-Restart breaks this limitation and when Hot-Restart is enabled a member // can restore its UUID and it's allowed to rejoin when cluster state is FROZEN or PASSIVE. // // That's why another ordering property is needed. Invocation keeps member-list-version before // operation is submitted to the target. If a member restarts with the same identity (UUID), // by comparing member-list-version during member removal with the invocation's member-list-version // we can determine whether invocation is submitted before member left or after restart. if (invocation.getMemberListVersion() < memberListVersion) { invocation.notifyError(new MemberLeftException(leftMember)); } }
private void doInvokeRemote() { Connection connection = context.connectionManager.getOrConnect(invTarget); this.connection = connection; if (!context.outboundOperationHandler.send(op, connection)) { notifyError(new RetryableIOException("Packet not sent to -> " + invTarget + " over " + connection)); } }
private void doInvokeRemote() { Connection connection = context.connectionManager.getOrConnect(targetAddress); this.connection = connection; if (!context.outboundOperationHandler.send(op, connection)) { notifyError(new RetryableIOException("Packet not sent to -> " + targetAddress + " over " + connection)); } }
void notifyErrorResponse(long callId, Object cause, Address sender) { responsesError.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning() && callId != 0) { logger.warning("No Invocation found for error response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyError(cause); }
void notifyErrorResponse(long callId, Object cause, Address sender) { responsesError.inc(); Invocation invocation = invocationRegistry.get(callId); if (invocation == null) { responsesMissing.inc(); if (nodeEngine.isRunning() && callId != 0) { logger.warning("No Invocation found for error response with callId=" + callId + " sent from " + sender); } return; } invocation.notifyError(cause); }
@Override public void sendResponse(Operation op, Object response) { if (!RESPONSE_RECEIVED.compareAndSet(this, FALSE, TRUE)) { throw new ResponseAlreadySentException("NormalResponse already responseReceived for callback: " + this + ", current-response: " + response); } if (response instanceof CallTimeoutResponse) { notifyCallTimeout(); } else if (response instanceof ErrorResponse || response instanceof Throwable) { notifyError(response); } else if (response instanceof NormalResponse) { NormalResponse normalResponse = (NormalResponse) response; notifyNormalResponse(normalResponse.getValue(), normalResponse.getBackupAcks()); } else { // there are no backups or the number of expected backups has returned; so signal the future that the result is ready complete(response); } }
@Override public void sendResponse(Operation op, Object response) { if (!RESPONSE_RECEIVED.compareAndSet(this, FALSE, TRUE)) { throw new ResponseAlreadySentException("NormalResponse already responseReceived for callback: " + this + ", current-response: " + response); } if (response instanceof CallTimeoutResponse) { notifyCallTimeout(); } else if (response instanceof ErrorResponse || response instanceof Throwable) { notifyError(response); } else if (response instanceof NormalResponse) { NormalResponse normalResponse = (NormalResponse) response; notifyNormalResponse(normalResponse.getValue(), normalResponse.getBackupAcks()); } else { // there are no backups or the number of expected backups has returned; so signal the future that the result is ready complete(response); } }
notifyError(initializationFailure); return;
notifyError(initializationFailure); return;
/** * Registers an invocation. * * @param invocation The invocation to register. * @return {@code false} when InvocationRegistry is not alive and registration is not successful, {@code true} otherwise */ public boolean register(Invocation invocation) { final long callId; boolean force = invocation.op.isUrgent() || invocation.isRetryCandidate(); try { callId = force ? callIdSequence.forceNext() : callIdSequence.next(); } catch (HazelcastOverloadException e) { throw new HazelcastOverloadException("Failed to start invocation due to overload: " + invocation, e); } try { // fails with IllegalStateException if the operation is already active setCallId(invocation.op, callId); } catch (IllegalStateException e) { callIdSequence.complete(); throw e; } invocations.put(callId, invocation); if (!alive) { invocation.notifyError(new HazelcastInstanceNotActiveException()); return false; } return true; }
/** * Registers an invocation. * * @param invocation The invocation to register. * @return {@code false} when InvocationRegistry is not alive and registration is not successful, {@code true} otherwise */ public boolean register(Invocation invocation) { final long callId; boolean force = invocation.op.isUrgent() || invocation.isRetryCandidate(); try { callId = force ? callIdSequence.forceNext() : callIdSequence.next(); } catch (HazelcastOverloadException e) { throw new HazelcastOverloadException("Failed to start invocation due to overload: " + invocation, e); } try { // fails with IllegalStateException if the operation is already active setCallId(invocation.op, callId); } catch (IllegalStateException e) { callIdSequence.complete(); throw e; } invocations.put(callId, invocation); if (!alive) { invocation.notifyError(new HazelcastInstanceNotActiveException()); return false; } return true; }