/** * @return <tt>true</tt> if the request execution has been suspended in the * current thread, or <tt>false</tt> otherwise. The suspend flag is getting * reset. */ private static boolean checkRequestSuspended() { return SuspendResponseUtils.removeSuspendedInCurrentThread(); }
/** * Prepare and post the response. */ public void postResponse() throws Exception{ if (isProcessingCompleted){ return; } // Do not commit the response; if (SuspendResponseUtils.isSuspendedInCurrentThread()) { return; } finishResponse(); }
SuspendResponseUtils.attach(selectionKey, ra); SuspendResponseUtils.setSuspendedInCurrentThread(); } finally { lock.unlock();
public void setIdleTimeoutDelay(long idleTimeoutDelay) { this.idleTimeoutDelay = validateIdleTimeoutDelay(idleTimeoutDelay); SuspendResponseUtils.updateIdleTimeOutDelay(response.selectionKey, response.getResponseAttachment()); }
public static void attach(SelectionKey selectionKey, Response.ResponseAttachment suspendedResponse) { Object attachment = selectionKey.attachment(); if (attachment == null || !(attachment instanceof ThreadAttachment)) { attachment = obtainThreadAttachment(); selectionKey.attach(attachment); } final ThreadAttachment threadAttachment = (ThreadAttachment) attachment; suspendedResponse.setThreadAttachment(threadAttachment); suspendedResponse.resetTimeout(); threadAttachment.setIdleTimeoutDelay(suspendedResponse.getIdleTimeoutDelay()); threadAttachment.setTimeoutListener(suspendedResponse); threadAttachment.setKeySelectionListener(suspendedResponse); threadAttachment.setAttribute(SUSPENDED_RESPONSE_ATTR, suspendedResponse); }
if (SuspendResponseUtils.removeSuspendedInCurrentThread()) {
public boolean hasNextRequest() { return !error && keepAlive && !SuspendResponseUtils.isSuspendedInCurrentThread() && (handleKeepAliveBlockingThread || inputBuffer.available() > 0); }
if (SuspendResponseUtils.removeSuspendedInCurrentThread()) {
public boolean postProcess(final ProcessorTask processorTask) { if (processorTask.hasNextRequest()) { try { processorTask.doProcess(); return !processorTask.response.isSuspended() && !SuspendResponseUtils.isSuspendedInCurrentThread(); } catch (Exception e) { if (logger.isLoggable(Level.FINEST)) { logger.log(Level.FINEST, "AsyncResponsePostProcessor", e); } processorTask.error = true; processorTask.response.setErrorException(e); } } return true; } }
keepAlive = processorTask.process(inputStream, null); final boolean isSuspended = SuspendResponseUtils.removeSuspendedInCurrentThread(); if (processorTask != null && !processorTask.isError() && isSuspended) { // Process suspended HTTP request
/** * Post process the http request, after the response has been * commited. */ public void postProcess() throws Exception { if (response.isSuspended() || SuspendResponseUtils.isSuspendedInCurrentThread()) { return; } if (error) { keepAlive = false; connectionHeaderValueSet = false; } inputBuffer.recycle(); outputBuffer.recycle(); response.setSelectionKey(null); outputBuffer.setSelectionKey(null); // Recycle ssl info sslSupport = null; }