This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch feature/WW-3576-session-map-staleness in repository https://gitbox.apache.org/repos/asf/struts.git
commit 7160db170852ab9be8cd694786fea56823ff63cf Author: Lukasz Lenart <[email protected]> AuthorDate: Sun Oct 18 10:34:27 2026 +0200 WW-3576 docs: drop the stale execAndWait ActionContext warning The removed paragraph contradicted the sandbox paragraph. The invisibility test now fails when the background action failed or wrote nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .../org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java | 5 ----- .../apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java index 3885d52fa..44f5212a8 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java @@ -81,11 +81,6 @@ import java.util.Map; * millis we ensure the user is presented fast search results immediately and for the slow results a wait page is used. * </p> * - * <p><b>Important</b>: Because the action will be running in a separate thread, you can't use ActionContext because it - * is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware - * rather than calling ActionContext.getSession(). - * </p> - * * <p>The background process works on a session sandbox, a snapshot of the session taken when the process starts. Use * <code>ActionContext.getContext().getSession()</code> or {@link SessionAware} to reach it. Its writes are applied to * the real session by the polling request that sees the process finish, only if the session id is unchanged. diff --git a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java index 5216a6564..3e429b8e9 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java @@ -295,8 +295,10 @@ public class ExecuteAndWaitInterceptorTest extends StrutsInternalTestCase { useLiveSession(); assertEquals("wait", buildProxy("sessionAction").execute()); - awaitDone("sessionAction"); + BackgroundProcess process = awaitDone("sessionAction"); + assertNull(process.getException()); + assertEquals("done", process.getSessionSandbox().get("result")); assertNull(httpSession.getAttribute("result")); assertNull(httpSession.getAttribute("aware")); }
