private Object getOrCreateMutex(Continuation continuation) { Object result = null; // let's try to find the object that corresponds to the exchange first if (continuation != null) { result = continuation.getAttribute(MUTEX); } // no luck finding an existing object, let's create a new one if (result == null) { result = new Object(); } return result; }
private Object getOrCreateMutex(Continuation continuation) { Object result = null; // let's try to find the object that corresponds to the exchange first if (continuation != null) { result = continuation.getAttribute(MUTEX); } // no luck finding an existing object, let's create a new one if (result == null) { result = new Object(); } return result; }
private MessageExchange doClean(Object mutex, Continuation continuation, String exchangeId) { if (mutex != null) { synchronized (mutex) { if (exchangeId == null && continuation != null) { exchangeId = (String) continuation.getAttribute(EXCHANGEID); } if (exchangeId != null && continuation == null) { continuation = continuations.remove(exchangeId); } if (continuation != null) { continuation.removeAttribute(EXCHANGEID); continuation.removeAttribute(EXCHANGE); continuation.removeAttribute(MUTEX); } if (exchangeId != null) { mutexes.remove(exchangeId); continuations.remove(exchangeId); return sentExchanges.remove(exchangeId); } } } return null; }
private MessageExchange doClean(Object mutex, Continuation continuation, String exchangeId) { if (mutex != null) { synchronized (mutex) { if (exchangeId == null && continuation != null) { exchangeId = (String) continuation.getAttribute(EXCHANGEID); } if (exchangeId != null && continuation == null) { continuation = continuations.remove(exchangeId); } if (continuation != null) { continuation.removeAttribute(EXCHANGEID); continuation.removeAttribute(EXCHANGE); continuation.removeAttribute(MUTEX); } if (exchangeId != null) { mutexes.remove(exchangeId); continuations.remove(exchangeId); return sentExchanges.remove(exchangeId); } } } return null; }
/** * The method that should be called by a background thread when we are being awakened */ public void resumeWork() { while(true) { doWork(); if (continuation.getAttribute(ATTRIBUTE_SLEEPER) == null) { // If we have disconnected the Sleeper from the container then it is time to end the async cycle return; } synchronized (workLock) { if (queuedWork) { // New work has arrived so fall through to take another spin in the loop queuedWork = false; } else { // No work in the queue so exit loop and go to sleep again continuation.suspend(); workInProgress = false; return; } } } }
exchange = (MessageExchange) continuation.getAttribute(EXCHANGE); id = (String)continuation.getAttribute(EXCHANGEID);
exchange = (MessageExchange) continuation.getAttribute(EXCHANGE); id = (String)continuation.getAttribute(EXCHANGEID);
final Object mutex = continuation.getAttribute(MUTEX); if (mutex == null) { handleLateResponse(exchange);
final Object mutex = continuation.getAttribute(MUTEX); if (mutex == null) { handleLateResponse(exchange);
final JettyHttpMessageReceiver.ContinuationsResponseHandler responseHandler = (JettyHttpMessageReceiver.ContinuationsResponseHandler) continuation.getAttribute(RESPONSE_HANDLER_KEY); responseHandler.complete();