Code cleanup.

This commit is contained in:
Simone Bordet 2016-08-26 10:45:04 +02:00
parent 33ca8cf695
commit 2389b65578
1 changed files with 103 additions and 94 deletions

View File

@ -187,6 +187,7 @@ public class HttpInput extends ServletInputStream implements Runnable
* produce more Content and add it via {@link #addContent(Content)}.
* For protocols that are constantly producing (eg HTTP2) this can
* be left as a noop;
*
* @throws IOException if unable to produce content
*/
protected void produceContent() throws IOException
@ -211,9 +212,11 @@ public class HttpInput extends ServletInputStream implements Runnable
return content;
}
/** Poll the inputQ for Content.
/**
* Poll the inputQ for Content.
* Consumed buffers and {@link PoisonPillContent}s are removed and
* EOF state updated if need be.
*
* @return Content or null
*/
protected Content pollContent()
@ -289,9 +292,11 @@ public class HttpInput extends ServletInputStream implements Runnable
return content;
}
/** Poll the inputQ for Content or EOF.
/**
* Poll the inputQ for Content or EOF.
* Consumed buffers and non EOF {@link PoisonPillContent}s are removed.
* EOF state is not updated.
*
* @return Content, EOF or null
*/
protected Content pollReadable()
@ -397,6 +402,7 @@ public class HttpInput extends ServletInputStream implements Runnable
* <p>Typically used to push back content that has
* been read, perhaps mutated. The bytes prepended are
* deducted for the contentConsumed total</p>
*
* @param item the content to add
* @return true if content channel woken for read
*/
@ -476,6 +482,7 @@ public class HttpInput extends ServletInputStream implements Runnable
* <p>
* Typically this will result in an EOFException being thrown
* from a subsequent read rather than a -1 return.
*
* @return true if content channel woken for read
*/
public boolean earlyEOF()
@ -486,6 +493,7 @@ public class HttpInput extends ServletInputStream implements Runnable
/**
* This method should be called to signal that all the expected
* content arrived.
*
* @return true if content channel woken for read
*/
public boolean eof()
@ -620,7 +628,6 @@ public class HttpInput extends ServletInputStream implements Runnable
return woken;
}
/* ------------------------------------------------------------ */
/*
* <p>
* While this class is-a Runnable, it should never be dispatched in it's own thread. It is a
@ -713,6 +720,7 @@ public class HttpInput extends ServletInputStream implements Runnable
public static class PoisonPillContent extends Content
{
private final String _name;
public PoisonPillContent(String name)
{
super(BufferUtil.EMPTY_BUFFER);
@ -793,6 +801,7 @@ public class HttpInput extends ServletInputStream implements Runnable
protected class ErrorState extends EOFState
{
final Throwable _error;
ErrorState(Throwable error)
{
_error = error;