This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 0e324d1 Add end method for possible cleanups
0e324d1 is described below
commit 0e324d169ed239c30d39b662154eedd833a4ab90
Author: remm <[email protected]>
AuthorDate: Thu May 16 11:56:47 2019 +0200
Add end method for possible cleanups
Pull up start for NIO and APR.
---
java/org/apache/tomcat/util/net/AprEndpoint.java | 5 -----
java/org/apache/tomcat/util/net/NioEndpoint.java | 5 -----
java/org/apache/tomcat/util/net/SocketWrapperBase.java | 17 +++++++++++++----
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 984452e..a8437cb 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2775,11 +2775,6 @@ public class AprEndpoint extends
AbstractEndpoint<Long,Long> implements SNICallB
}
@Override
- protected void start() {
- run();
- }
-
- @Override
public void run() {
// Perform the IO operation
// Called from the poller to continue the IO operation
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 3677059..b3f1f2f 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1422,11 +1422,6 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
}
@Override
- protected void start() {
- run();
- }
-
- @Override
public void run() {
// Perform the IO operation
// Called from the poller to continue the IO operation
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index 01502cb..f23764f 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1047,23 +1047,30 @@ public abstract class SocketWrapperBase<E> {
protected boolean process() {
try {
getEndpoint().getExecutor().execute(this);
+ return true;
} catch (RejectedExecutionException ree) {
log.warn(sm.getString("endpoint.executor.fail",
SocketWrapperBase.this) , ree);
- return false;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
// This means we got an OOM or similar creating a thread, or
that
// the pool and its queue are full
log.error(sm.getString("endpoint.process.fail"), t);
- return false;
}
- return true;
+ return false;
}
/**
* Start the operation, this will typically call run.
*/
- protected abstract void start();
+ protected void start() {
+ run();
+ }
+
+ /**
+ * End the operation.
+ */
+ protected void end() {
+ }
}
@@ -1102,6 +1109,7 @@ public abstract class SocketWrapperBase<E> {
} else {
state.state = currentState;
}
+ state.end();
if (completion && state.handler != null) {
state.handler.completed(Long.valueOf(state.nBytes),
state.attachment);
}
@@ -1142,6 +1150,7 @@ public abstract class SocketWrapperBase<E> {
} else {
state.state = state.isInline() ? CompletionState.ERROR :
CompletionState.DONE;
}
+ state.end();
if (state.handler != null) {
state.handler.failed(exc, state.attachment);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]