You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2019/11/07 13:18:13 UTC
[tomee] branch master updated (4cc11cc -> 5e904ca)
This is an automated email from the ASF dual-hosted git repository.
jgallimore pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git.
from 4cc11cc TOMEE-2727 update commons-daemon to 1.2.2
new 3c9f227 TOMEE-2728 update Tomcat to 9.0.27
new 5e904ca Do not unconditionally call AsyncContext.dispatch()
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/superbiz/asyncservlet/CalcServlet.java | 35 ++++++++++++++++++++--
pom.xml | 2 +-
2 files changed, 33 insertions(+), 4 deletions(-)
[tomee] 02/02: Do not unconditionally call AsyncContext.dispatch()
Posted by jg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jgallimore pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 5e904cac7cc0c425d8b841d386f5951e3ea63a20
Author: Jonathan Gallimore <jo...@jrg.me.uk>
AuthorDate: Thu Nov 7 13:17:38 2019 +0000
Do not unconditionally call AsyncContext.dispatch()
---
.../org/superbiz/asyncservlet/CalcServlet.java | 35 ++++++++++++++++++++--
pom.xml | 2 +-
2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/examples/async-servlet/src/main/java/org/superbiz/asyncservlet/CalcServlet.java b/examples/async-servlet/src/main/java/org/superbiz/asyncservlet/CalcServlet.java
index de4d1b2..1dc7453 100644
--- a/examples/async-servlet/src/main/java/org/superbiz/asyncservlet/CalcServlet.java
+++ b/examples/async-servlet/src/main/java/org/superbiz/asyncservlet/CalcServlet.java
@@ -18,6 +18,8 @@ package org.superbiz.asyncservlet;
import javax.ejb.EJB;
import javax.servlet.AsyncContext;
+import javax.servlet.AsyncEvent;
+import javax.servlet.AsyncListener;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -25,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
@WebServlet(urlPatterns = "/*", asyncSupported = true)
public class CalcServlet extends HttpServlet {
@@ -111,6 +114,30 @@ public class CalcServlet extends HttpServlet {
final int threadDelay = delay;
final AsyncContext asyncContext = req.startAsync();
+
+ final AtomicBoolean interrupted = new AtomicBoolean(false);
+
+ asyncContext.addListener(new AsyncListener() {
+ @Override
+ public void onComplete(AsyncEvent asyncEvent) throws IOException {
+
+ }
+
+ @Override
+ public void onTimeout(AsyncEvent asyncEvent) throws IOException {
+ interrupted.set(true);
+ }
+
+ @Override
+ public void onError(AsyncEvent asyncEvent) throws IOException {
+ interrupted.set(true);
+ }
+
+ @Override
+ public void onStartAsync(AsyncEvent asyncEvent) throws IOException {
+
+ }
+ });
asyncContext.setTimeout(timeout);
asyncContext.start(() -> {
@@ -122,10 +149,12 @@ public class CalcServlet extends HttpServlet {
try {
process(operation, x, y, result);
- } catch (final Exception e) {
-
} finally {
- asyncContext.dispatch();
+ if (! interrupted.get()) {
+
+ // do not call dispatch if this request has timed-out or errored
+ asyncContext.dispatch();
+ }
}
});
diff --git a/pom.xml b/pom.xml
index 6cd7a33..e2e4cc1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -214,7 +214,7 @@
<microprofile.version>2.0</microprofile.version>
<microprofile.config.version>1.3</microprofile.config.version>
<microprofile.config.impl.version>1.2.1</microprofile.config.impl.version>
- <microprofile.jwt.version>1.2-SNAPSHOT</microprofile.jwt.version>
+ <microprofile.jwt.version>1.1.1</microprofile.jwt.version>
<microprofile.jwt.impl.version>${project.version}</microprofile.jwt.impl.version>
<!-- 1.1 Implementation not started yet -->
<microprofile.fault-tolerance.version>1.1.4</microprofile.fault-tolerance.version>
[tomee] 01/02: TOMEE-2728 update Tomcat to 9.0.27
Posted by jg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jgallimore pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 3c9f2271609db9f31f3a4626c42801670da8c933
Author: Jonathan Gallimore <jo...@jrg.me.uk>
AuthorDate: Thu Nov 7 11:06:39 2019 +0000
TOMEE-2728 update Tomcat to 9.0.27
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 30d5f61..6cd7a33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,7 +145,7 @@
<version.shrinkwrap.descriptor>2.0.0</version.shrinkwrap.descriptor>
<version.shrinkwrap.shrinkwrap>1.2.6</version.shrinkwrap.shrinkwrap>
- <tomcat.version>9.0.22</tomcat.version>
+ <tomcat.version>9.0.27</tomcat.version>
<cxf.version>3.3.2</cxf.version>
<ehcache.version>2.10.3</ehcache.version>
@@ -214,7 +214,7 @@
<microprofile.version>2.0</microprofile.version>
<microprofile.config.version>1.3</microprofile.config.version>
<microprofile.config.impl.version>1.2.1</microprofile.config.impl.version>
- <microprofile.jwt.version>1.1.1</microprofile.jwt.version>
+ <microprofile.jwt.version>1.2-SNAPSHOT</microprofile.jwt.version>
<microprofile.jwt.impl.version>${project.version}</microprofile.jwt.impl.version>
<!-- 1.1 Implementation not started yet -->
<microprofile.fault-tolerance.version>1.1.4</microprofile.fault-tolerance.version>