Refine search
public int flushBuffer() throws IOException { if (!_lock.tryLock()) return 0; try { if (!_endp.isOpen()) throw new EofException(); if (_buffer != null) { int flushed = _buffer.hasContent() ? _endp.flush(_buffer) : 0; if (_closed && _buffer.length() == 0) _endp.shutdownOutput(); return flushed; } return 0; } finally { _lock.unlock(); } }
public EofException(Throwable th) { if (th!=null) initCause(th); } }
LOG.warn("HttpParser Full for {} ",_endp); _buffer.clear(); throw new HttpException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413, "Request Entity Too Large: "+(_buffer==_body?"body":"head")); int filled = _endp.fill(_buffer); return filled; LOG.debug(e); throw (e instanceof EofException) ? e:new EofException(e);
if (LOG.isDebugEnabled()) LOG.debug("flushed {} {}", flushed, this); throw new EofException(e); if (!BufferUtil.isEmpty(b)) return false;
LOG.debug("{} flush enter {}", SslConnection.this, Arrays.toString(appOuts)); int consumed=0; try throw new EofException(new ClosedChannelException()); return false; BufferUtil.compact(_encryptedOutput); int pos = BufferUtil.flipToFill(_encryptedOutput); SSLEngineResult wrapResult = _sslEngine.wrap(appOuts, _encryptedOutput); if (DEBUG) LOG.debug("{} wrap {}", SslConnection.this, wrapResult); BufferUtil.flipToFlush(_encryptedOutput, pos); if (wrapResult.bytesConsumed()>0) consumed+=wrapResult.bytesConsumed(); getEndPoint().flush(_encryptedOutput); LOG.debug("{} {} {}", this, wrapResult.getStatus(), BufferUtil.toDetailString(_encryptedOutput)); if (BufferUtil.hasContent(_encryptedOutput)) getEndPoint().flush(_encryptedOutput); getEndPoint().close(); throw e;
int len = _endp.flush(_header); if (len<0 || !_endp.isOpen()) throw new EofException(); if (len==0) Thread.sleep(100); LOG.debug(e); throw new InterruptedIOException(e.toString());
if (LOG.isDebugEnabled()) LOG.debug("{} generate: {} ({},{},{})@{}", this, result, BufferUtil.toSummaryString(_header), BufferUtil.toSummaryString(_content), _lastContent, _generator.getState()); throw new EofException("request lifecycle violation"); BufferUtil.clear(chunk); BufferUtil.clear(_content); if (BufferUtil.hasContent(chunk)) getEndPoint().write(this, _header, chunk, _content); else getEndPoint().write(this, _header, _content); getEndPoint().write(this, _header); else if (BufferUtil.hasContent(chunk))
@Override public void send(HttpGenerator.ResponseInfo info, ByteBuffer content, boolean lastContent, final Callback callback) if (LOG.isDebugEnabled()) LOG.debug("Sending {} {} {} {} last={}", this, stream, info, BufferUtil.toDetailString(content), lastContent); EofException exception = new EofException("stream closed"); callback.failed(exception); return; boolean hasContent = BufferUtil.hasContent(content) && !isHeadRequest; boolean close = !hasContent && lastContent; "Stream already committed!"); callback.failed(exception); if (LOG.isDebugEnabled()) LOG.debug("Committed response twice.", exception); return; if (LOG.isDebugEnabled()) LOG.debug("Send content: {} on stream: {} lastContent={}", BufferUtil.toDetailString(content), stream, lastContent); stream.data(new ByteBufferDataInfo(endPoint.getIdleTimeout(), TimeUnit.MILLISECONDS, content, lastContent ), callback); if (LOG.isDebugEnabled()) LOG.debug("No content and lastContent=true. Sending empty ByteBuffer to close stream: {}", stream); stream.data(new ByteBufferDataInfo(endPoint.getIdleTimeout(), TimeUnit.MILLISECONDS, BufferUtil.EMPTY_BUFFER, lastContent), callback);
while (event && BufferUtil.hasContent(_requestBuffer) && _parser.inContentState()) _parser.parseNext(_requestBuffer); if (BufferUtil.isEmpty(_requestBuffer)) if (getEndPoint().isInputShutdown()) getEndPoint().fillInterested(_readBlocker); LOG.debug("{} block readable on {}",this,_readBlocker); _readBlocker.block(); int filled=getEndPoint().fill(_requestBuffer); LOG.debug("{} block filled {}",this,filled); if (filled<0) throw new EofException(e);
LOG.warn("Ignoring extra content {}",content); content.clear(); return; if (_endp.isOutputShutdown()) throw new EofException(); flushBuffer(); if (_content != null && _content.length()>0)
throw new EofException(); LOG.warn(e); if (_interruptable) throw new InterruptedIOException(){{this.initCause(e);}};
_writeListener.onError(_onError==null?new EofException("Async closed"):_onError); continue; LOG.debug(e); _channel.abort();
LOG.debug("flushed {} {}", flushed, this); throw new EofException(e); if (BufferUtil.isEmpty(b)) BufferUtil.clear(b); else all_flushed=false;
int len = _endp.flush(_header); if (len<0) throw new EofException(); if (len==0) Thread.sleep(100); LOG.debug(e); throw new InterruptedIOException(e.toString());
filled = _endp.fill(_buffer); LOG.debug(e); reset(); throw (e instanceof EofException) ? e : new EofException(e); throw new EofException();
_writeListener.onError(_onError==null?new EofException("Async close"):_onError); continue; write(BufferUtil.hasContent(_aggregate)?_aggregate:BufferUtil.EMPTY_BUFFER,!_channel.getResponse().isIncluding()); LOG.debug(e); _channel.abort();
throw new IllegalStateException(); // should never happen! case 6: len = _endp.flush(_header, _buffer, null); break; case 5: len = _endp.flush(_header, _content, null); break; case 4: len = _endp.flush(_header); break; case 3: LOG.ignore(e); throw (e instanceof EofException) ? e:new EofException(e);
private synchronized int flushBuffer() throws IOException { if (!_endp.isOpen()) throw new EofException(); if (_buffer!=null) return _endp.flush(_buffer); return 0; }
public void blockForOutput(long maxIdleTime) throws IOException { if (_endp.isBlocking()) { try { flushBuffer(); } catch(IOException e) { _endp.close(); throw e; } } else { if (!_endp.blockWritable(maxIdleTime)) { _endp.close(); throw new EofException("timeout"); } flushBuffer(); } }
public void flush(long maxIdleTime) throws IOException { // block until everything is flushed long now=System.currentTimeMillis(); long end=now+maxIdleTime; Buffer content = _content; Buffer buffer = _buffer; if (content!=null && content.length()>0 || buffer!=null && buffer.length()>0 || isBufferFull()) { flushBuffer(); while (now<end && (content!=null && content.length()>0 ||buffer!=null && buffer.length()>0)) { if (!_endp.isOpen() || _endp.isOutputShutdown()) throw new EofException(); blockForOutput(end-now); now=System.currentTimeMillis(); } } }