Author: markt
Date: Wed Aug 28 10:20:21 2013
New Revision: 1518144
URL: http://svn.apache.org/r1518144
Log:
Refactoring.
Pull up code from NIO that also does a non-blocking read in the available()
call. This makes NIO and APR consistent. BIO is unaffected as it overrides
available() and always returns 1.
Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java?rev=1518144&r1=1518143&r2=1518144&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java Wed Aug
28 10:20:21 2013
@@ -343,6 +343,21 @@ public abstract class AbstractInputBuffe
available = activeFilters[i].available();
}
}
+ if (available > 0) {
+ return available;
+ }
+
+ try {
+ available = nbRead();
+ } catch (IOException ioe) {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(sm.getString("iib.available.readFail"), ioe);
+ }
+ // Not ideal. This will indicate that data is available which
should
+ // trigger a read which in turn will trigger another IOException
and
+ // that one can be thrown.
+ available = 1;
+ }
return available;
}
Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1518144&r1=1518143&r2=1518144&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Wed
Aug 28 10:20:21 2013
@@ -158,29 +158,6 @@ public class InternalNioInputBuffer exte
// --------------------------------------------------------- Public Methods
@Override
- public int available() {
-
- int available = super.available();
- if (available>0) {
- return available;
- }
-
- try {
- available = nbRead();
- }catch (IOException ioe) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("iib.available.readFail"), ioe);
- }
- // Not ideal. This will indicate that data is available which
should
- // trigger a read which in turn will trigger another IOException
and
- // that one can be thrown.
- available = 1;
- }
- return available;
- }
-
-
- @Override
public int nbRead() throws IOException {
return readSocket(true,false);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]