@Override protected void onComplete() { callIdSequence.complete(); }
InternalDelegatingExecutionCallback(ExecutionCallback<ClientMessage> callback) { this.callback = callback; callIdSequence.forceNext(); }
@Probe(name = "invocations.usedPercentage") private double invocationsUsedPercentage() { int maxConcurrentInvocations = callIdSequence.getMaxConcurrentInvocations(); if (maxConcurrentInvocations == Integer.MAX_VALUE) { return 0; } return (HUNDRED_PERCENT * invocations.size()) / maxConcurrentInvocations; }
/** * 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; }
private void retry() { // retry modifies the client message and should not reuse the client message. // It could be the case that it is in write queue of the connection. clientMessage = clientMessage.copy(); // first we force a new invocation slot because we are going to return our old invocation slot immediately after // It is important that we first 'force' taking a new slot; otherwise it could be that a sneaky invocation gets // through that takes our slot! clientMessage.setCorrelationId(callIdSequence.forceNext()); //we release the old slot callIdSequence.complete(); try { invokeOnSelection(); } catch (Throwable e) { clientInvocationFuture.complete(e); } }
@Probe(level = MANDATORY) private long startedInvocations() { return callIdSequence.getLastCallId(); }
public ClientInvocationFuture invoke() { assert (clientMessage != null); clientMessage.setCorrelationId(callIdSequence.next()); invokeOnSelection(); return clientInvocationFuture; }
@Override public long concurrentInvocations() { return callIdSequence.concurrentInvocations(); }
/** * 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; }
private void retry() { // retry modifies the client message and should not reuse the client message. // It could be the case that it is in write queue of the connection. clientMessage = clientMessage.copy(); // first we force a new invocation slot because we are going to return our old invocation slot immediately after // It is important that we first 'force' taking a new slot; otherwise it could be that a sneaky invocation gets // through that takes our slot! clientMessage.setCorrelationId(callIdSequence.forceNext()); //we release the old slot callIdSequence.complete(); try { invokeOnSelection(); } catch (Throwable e) { clientInvocationFuture.complete(e); } }
@Probe(name = "invocations.lastCallId") long getLastCallId() { return callIdSequence.getLastCallId(); }
public ClientInvocationFuture invoke() { assert (clientMessage != null); clientMessage.setCorrelationId(callIdSequence.next()); invokeOnSelection(); return clientInvocationFuture; }
@Override protected void onComplete() { callIdSequence.complete(); }
@Probe(level = MANDATORY) private long maxCurrentInvocations() { return callIdSequence.getMaxConcurrentInvocations(); }
InternalDelegatingExecutionCallback(ExecutionCallback<ClientMessage> callback) { this.callback = callback; callIdSequence.forceNext(); }
@Probe(level = MANDATORY) private long startedInvocations() { return callIdSequence.getLastCallId(); }
@Override public void onFailure(Throwable t) { try { callback.onFailure(t); } finally { callIdSequence.complete(); } } }
@Probe(level = MANDATORY) private long maxCurrentInvocations() { return callIdSequence.getMaxConcurrentInvocations(); }
public ClientInvocationFuture invokeUrgent() { assert (clientMessage != null); clientMessage.setCorrelationId(callIdSequence.forceNext()); invokeOnSelection(); return clientInvocationFuture; }
@Probe(name = "invocations.lastCallId") long getLastCallId() { return callIdSequence.getLastCallId(); }