getCallId(), isDone); if (!isDone) { return CallReturn.ASYNC_CALL_IN_PROGRESS; LOG.trace("#{} invoke: ASYNC_INVOKED", getCallId()); final boolean mode = Client.isAsynchronousMode(); try { Client.setAsynchronousMode(true); final Object r = invokeMethod(); if (getCounters().isZeros()) { LOG.trace("#{} invoke: initAsyncCall", getCallId()); asyncCallHandler.initAsyncCall(this, asyncCallReturn);
long checkCalls() { final long startTime = Time.monotonicNow(); long minWaitTime = Processor.MAX_WAIT_PERIOD; for (final Iterator<AsyncCall> i = queue.iterator(); i.hasNext();) { final AsyncCall c = i.next(); if (c.isDone()) { i.remove(); // the call is done, remove it from the queue. queue.checkEmpty(); } else { final Long waitTime = c.getWaitTime(startTime); if (waitTime != null && waitTime > 0 && waitTime < minWaitTime) { minWaitTime = waitTime; } } } return minWaitTime; }
/** @return true if the call is done; otherwise, return false. */ boolean isDone() { final CallReturn r = invokeOnce(); LOG.debug("#{}: {}", getCallId(), r.getState()); switch (r.getState()) { case RETURNED: case EXCEPTION: asyncCallReturn.set(r); // the async call is done return true; case RETRY: invokeOnce(); break; case WAIT_RETRY: case ASYNC_CALL_IN_PROGRESS: case ASYNC_INVOKED: // nothing to do break; default: Preconditions.checkState(false); } return false; }
getCallId(), isDone); if (!isDone) { return CallReturn.ASYNC_CALL_IN_PROGRESS; LOG.trace("#{} invoke: ASYNC_INVOKED", getCallId()); final boolean mode = Client.isAsynchronousMode(); try { Client.setAsynchronousMode(true); final Object r = invokeMethod(); if (getCounters().isZeros()) { LOG.trace("#{} invoke: initAsyncCall", getCallId()); asyncCallHandler.initAsyncCall(this, asyncCallReturn);
/** @return true if the call is done; otherwise, return false. */ boolean isDone() { final CallReturn r = invokeOnce(); LOG.debug("#{}: {}", getCallId(), r.getState()); switch (r.getState()) { case RETURNED: case EXCEPTION: asyncCallReturn.set(r); // the async call is done return true; case RETRY: invokeOnce(); break; case WAIT_RETRY: case ASYNC_CALL_IN_PROGRESS: case ASYNC_INVOKED: // nothing to do break; default: Preconditions.checkState(false); } return false; }
long checkCalls() { final long startTime = Time.monotonicNow(); long minWaitTime = Processor.MAX_WAIT_PERIOD; for (final Iterator<AsyncCall> i = queue.iterator(); i.hasNext();) { final AsyncCall c = i.next(); if (c.isDone()) { i.remove(); // the call is done, remove it from the queue. queue.checkEmpty(); } else { final Long waitTime = c.getWaitTime(startTime); if (waitTime != null && waitTime > 0 && waitTime < minWaitTime) { minWaitTime = waitTime; } } } return minWaitTime; }
AsyncCall newAsyncCall(Method method, Object[] args, boolean isRpc, int callId, RetryInvocationHandler<?> retryInvocationHandler) { return new AsyncCall(method, args, isRpc, callId, retryInvocationHandler, this); }
@Override CallReturn processWaitTimeAndRetryInfo() { final Long waitTime = getWaitTime(Time.monotonicNow()); LOG.trace("#{} processRetryInfo: waitTime={}", getCallId(), waitTime); if (waitTime != null && waitTime > 0) { return CallReturn.WAIT_RETRY; } processRetryInfo(); return CallReturn.RETRY; }
AsyncCall newAsyncCall(Method method, Object[] args, boolean isRpc, int callId, RetryInvocationHandler<?> retryInvocationHandler) { return new AsyncCall(method, args, isRpc, callId, retryInvocationHandler, this); }
@Override CallReturn processWaitTimeAndRetryInfo() { final Long waitTime = getWaitTime(Time.monotonicNow()); LOG.trace("#{} processRetryInfo: waitTime={}", getCallId(), waitTime); if (waitTime != null && waitTime > 0) { return CallReturn.WAIT_RETRY; } processRetryInfo(); return CallReturn.RETRY; }