public synchronized void handleResponse(Response<Object> res) { r = res; done = true; if (continuation != null) { continuation.resume(); } notifyAll(); } public boolean hasContinuation() {
public synchronized void handleResponse(Response<Object> res) { r = res; done = true; if (continuation != null) { continuation.resume(); } notifyAll(); } public boolean hasContinuation() {
synchronized void wakeupNext(long i) { try { Continuation c = continuations.remove(i + 1); if (c != null) { //next was found, don't resume everything, just the next one c.resume(); return; } //next wasn't found, nothing to resume, assume it will come in later... } finally { notifyAll(); } }
public void done(boolean doneSync) { // make sure the continuation resume will not be called before the suspend method in other thread synchronized (continuation) { LOG.trace("Resuming continuation of exchangeId: {}", camelExchange.getExchangeId()); // resume processing after both, sync and async callbacks continuation.resume(); } } });
public void done(boolean doneSync) { // make sure the continuation resume will not be called before the suspend method in other thread synchronized (continuation) { LOG.trace("Resuming continuation of exchangeId: {}", camelExchange.getExchangeId()); // resume processing after both, sync and async callbacks continuation.resume(); } } });
public void run() { try { continuation.resume(); } catch (Exception e) { e.printStackTrace(); } } }).start();
private void resumeRequest(final String name) { Continuation suspendedCont = null; synchronized (suspended) { suspendedCont = suspended.get(name); } if (suspendedCont != null) { synchronized (suspendedCont) { suspendedCont.resume(); } } }
public void resumeRequest(final String name) { Continuation suspendedCont = null; synchronized (suspended) { suspendedCont = suspended.get(name); } if (suspendedCont != null) { synchronized (suspendedCont) { suspendedCont.resume(); } } }
public void resumeRequest(final String name) { Continuation suspendedCont = null; synchronized (suspended) { suspendedCont = suspended.get(name); } if (suspendedCont != null) { synchronized (suspendedCont) { suspendedCont.resume(); } } }
public void resumeRequest(final String name) { Continuation suspendedCont = null; synchronized (suspended) { suspendedCont = suspended.get(name); } if (suspendedCont != null) { synchronized (suspendedCont) { suspendedCont.resume(); } } }
public void resumeRequest(final String name) { Continuation suspendedCont = null; synchronized (suspended) { suspendedCont = suspended.get(name); } if (suspendedCont != null) { synchronized (suspendedCont) { suspendedCont.resume(); } } }
private synchronized boolean doResumeFinal(Object response) { inMessage.getExchange().put(AsyncResponse.class, this); cont.setObject(response); resumedByApplication = true; if (!initialSuspend) { cont.resume(); } else { initialSuspend = false; } return true; }
@Override public void onError(Throwable t) { try { if (entity.getError() != null) { entity.getError().error(t); } else { throw t; } } catch (final Throwable ex) { LOG.warning("NIO WriteListener error: " + ExceptionUtils.getStackTrace(ex)); } finally { cont.resume(); } } }
@Override public synchronized boolean setTimeout(long time, TimeUnit unit) throws IllegalStateException { if (isCancelledOrNotSuspended()) { return false; } setAsyncResponseOnExchange(); long timeout = TimeUnit.MILLISECONDS.convert(time, unit); initialSuspend = false; if (!cont.isPending()) { cont.suspend(timeout); } else { pendingTimeout = timeout; cont.resume(); } return true; }
private synchronized void doResume(Object response) throws IllegalStateException { checkCancelled(); checkSuspended(); inMessage.getExchange().put(AsyncResponse.class, this); cont.setObject(response); resumedByApplication = true; if (!initialSuspend) { cont.resume(); } else { initialSuspend = false; } }
/** * Handles the {@code IncomingDataTransferResultEvent} and wraps the result in a {@code IncomingDataTransferResult} which is * written to the 'result' member. Returns true if the event is of type {@code IncomingDataTransferResultEvent}, otherwise * false. Does a countDown on the countDownLatch to indicate the 'wait' is over. * * @param event event message * @return true if the event is of type {@code IncomingDataTransferResultEvent}, otherwise false. */ @Override public boolean onEvent(EventMessage<?> event) { IncomingDataTransferResultEvent resultEvent; if (event.getPayload() instanceof IncomingDataTransferResultEvent) { resultEvent = (IncomingDataTransferResultEvent) event.getPayload(); this.setResult(new IncomingDataTransferResult(resultEvent.getData(), resultEvent.getStatus())); this.countDownLatch(); if (continuation != null) { // no need to wait for the continuation timeout, resume it now continuation.resume(); } return true; } else { // not the right type of event... not 'handled' return false; } }
/** * Handles the {@code AuthorizationResultEvent} and wraps the result in a {@code AuthorizationResult} which is * written to the 'result' member. Returns true if the event is of type {@code AuthorizationResultEvent}, otherwise * false. Does a countDown on the countDownLatch to indicate the 'wait' is over. * * @param event event message * @return true if the event is of type {@code AuthorizationResultEvent}, otherwise false. */ @Override public boolean onEvent(EventMessage<?> event) { AuthorizationResultEvent resultEvent; if (event.getPayload() instanceof AuthorizationResultEvent) { resultEvent = (AuthorizationResultEvent) event.getPayload(); this.setResult(new AuthorizationResult(resultEvent.getIdentifyingToken().getToken(), resultEvent.getAuthenticationStatus())); this.countDownLatch(); if (continuation != null) { // no need to wait for the continuation timeout, resume it now continuation.resume(); } return true; } else { // not the right type of event... not 'handled' return false; } }
synchronized(continuation) { if (continuation.isPending()) { continuation.resume();
continuation.resume();