portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [44/50] [abbrv] portals-pluto git commit: Completed contextual support for thread executed with AsyncContext#start()
Date Thu, 14 Apr 2016 12:29:24 GMT
Completed contextual support for thread executed with AsyncContext#start()


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/74d5f10b
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/74d5f10b
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/74d5f10b

Branch: refs/heads/master
Commit: 74d5f10be327e165686edc46f72da50b5a60feda
Parents: 27e17ae
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Mon Apr 4 22:07:08 2016 +0200
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Mon Apr 4 22:07:08 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/portals/samples/AsyncPortletFilter.java  | 2 +-
 .../services/container/PortletAsyncContextualRunner.java     | 5 ++++-
 .../container/PortletResourceRequestContextImpl.java         | 8 ++++++--
 3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/74d5f10b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletFilter.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletFilter.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletFilter.java
index be096c5..f7c430e 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletFilter.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/AsyncPortletFilter.java
@@ -65,7 +65,7 @@ public class AsyncPortletFilter implements ResourceFilter {
       txt.append(", request #: ").append(reqnum.getRandomNumber());
       LOGGER.fine(txt.toString());
       
-      if (type != DispatcherType.ASYNC && adb.isUseFilter()) {
+      if (adb.isUseFilter()) {
          txt.setLength(0);
          txt.append("<div class='msgbox'>");
          txt.append("Filter: Request number: ").append(reqnum.getRandomNumber());

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/74d5f10b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
index 6dcac04..8535a7e 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletAsyncContextualRunner.java
@@ -54,9 +54,12 @@ public class PortletAsyncContextualRunner implements Runnable {
          LOG.debug("Initializing contextual environment and launching runner in thread: "
+ Thread.currentThread().getId());
       }
 
-      pactx.registerContext();
       try {
+         pactx.registerContext();
          targetRunner.run();
+      } catch (Exception e) {
+         StringBuilder txt = new StringBuilder(128);
+         txt.append("Exception running thread: ").append(e.toString());
       } finally {
          if (isDebug) {
             LOG.debug("Shutting down contextual environment for thread: " + Thread.currentThread().getId());

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/74d5f10b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
index f607449..6906a57 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResourceRequestContextImpl.java
@@ -184,9 +184,13 @@ public class PortletResourceRequestContextImpl extends PortletRequestContextImpl
       HttpServletRequest wreq = new PortletAsyncRequestWrapper(hreq, request, this);
       HttpServletResponse wresp = new HttpServletPortletResponseWrapper(hresp, request, response,
false);
 
-      // Start async, add listener to release resources upon async complete only once.
+      // Start async, create portlet async context first time only.
 
-      actx = new PortletAsyncContextImpl(hreq.startAsync(wreq, wresp), wreq);
+      if (actx != null) {
+         actx.setWrapped(hreq.startAsync(wreq, wresp));
+      } else {
+         actx = new PortletAsyncContextImpl(hreq.startAsync(wreq, wresp), wreq);
+      }
 
       if (isTrace) {
          List<String> attrNames = Collections.list(hreq.getAttributeNames());


Mime
View raw message