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