Author: remm
Date: Fri Sep 11 17:10:38 2015
New Revision: 1702518
URL: http://svn.apache.org/r1702518
Log:
Since I'm experimenting with it, improve a bit the API.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1702518&r1=1702517&r2=1702518&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Fri Sep 11
17:10:38 2015
@@ -1015,7 +1015,7 @@ public class Nio2Endpoint extends Abstra
if (complete) {
readPending.release();
state.state = currentState;
- if (completion) {
+ if (completion && state.handler != null) {
state.handler.completed(Long.valueOf(state.nBytes), state.attachment);
}
} else {
@@ -1038,8 +1038,10 @@ public class Nio2Endpoint extends Abstra
// If already closed, don't call onError and close again
return;
}
- state.state = Nio2Endpoint.isInline() ? CompletionState.INLINE
: CompletionState.DONE;
- state.handler.failed(ioe, state.attachment);
+ state.state = Nio2Endpoint.isInline() ? CompletionState.ERROR
: CompletionState.DONE;
+ if (state.handler != null) {
+ state.handler.failed(ioe, state.attachment);
+ }
}
}
@@ -1068,7 +1070,7 @@ public class Nio2Endpoint extends Abstra
if (complete) {
writePending.release();
state.state = currentState;
- if (completion) {
+ if (completion && state.handler != null) {
state.handler.completed(Long.valueOf(state.nBytes), state.attachment);
}
} else {
@@ -1087,8 +1089,10 @@ public class Nio2Endpoint extends Abstra
}
Nio2SocketWrapper.this.setError(ioe);
writePending.release();
- state.state = Nio2Endpoint.isInline() ? CompletionState.INLINE
: CompletionState.DONE;
- state.handler.failed(ioe, state.attachment);
+ state.state = Nio2Endpoint.isInline() ? CompletionState.ERROR
: CompletionState.DONE;
+ if (state.handler != null) {
+ state.handler.failed(ioe, state.attachment);
+ }
}
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1702518&r1=1702517&r2=1702518&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Fri Sep
11 17:10:38 2015
@@ -643,6 +643,10 @@ public abstract class SocketWrapperBase<
*/
INLINE,
/**
+ * The operation completed inline but failed.
+ */
+ ERROR,
+ /**
* The operation completed, but not inline.
*/
DONE
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]