/** * Configure {@link InputReader}. */ protected void configureInputBuffer(InputReader inputStream, Context context, HttpWorkerThread workerThread) { inputStream.recycle(); inputStream.setSelectionKey(context.getSelectionKey()); inputStream.setByteBuffer(workerThread.getByteBuffer()); inputStream.setSecure(isSecure()); }
/** * Configure {@link InputReader}. */ @Override protected void configureInputBuffer(InputReader inputStream, Context context, HttpWorkerThread workerThread) { // Save the buffer before recycle final ByteBuffer associatedBuffer = inputStream.getByteBuffer(); inputStream.recycle(); // Restore the buffer inputStream.setByteBuffer(associatedBuffer); inputStream.setSelectionKey(context.getSelectionKey()); inputStream.setSecure(isSecure()); }
public boolean postProcess(ProcessorTask processorTask) { final boolean keepAlive = processorTask.isKeepAlive(); final SelectorHandler selectorHandler = processorTask.getSelectorHandler(); final SelectionKey selectionKey = processorTask.getSelectionKey(); final SelectorThread selectorThread = processorTask.getSelectorThread(); if (keepAlive) { selectorHandler.register(selectionKey, SelectionKey.OP_READ); } else { if (selectorThread.isAsyncHttpWriteEnabled()) { flushAsyncWriteQueueAndClose(selectorHandler, selectionKey); } else { selectorHandler.addPendingKeyCancel(selectionKey); } } ((InputReader) processorTask.getInputStream()).recycle(); processorTask.recycle(); selectorThread.returnTask(processorTask); return true; }
inputStream.recycle();