Skip to content

WW-1742 docs(execAndWait): document token-scoped background process naming - #1861

Merged
lukaszlenart merged 1 commit into
mainfrom
WW-1742-document-token-scoped-exec-and-wait
Aug 23, 2026
Merged

WW-1742 docs(execAndWait): document token-scoped background process naming#1861
lukaszlenart merged 1 commit into
mainfrom
WW-1742-document-token-scoped-exec-and-wait

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Fixes WW-1742

Background

WW-1742 (filed 2007) asked Struts to ship a TokenizedExecuteAndWaitInterceptor so that several browser tabs of the same session could each run the same action in the background, instead of the second tab joining the process the first one started.

The dependency it was waiting on has long since landed: WW-1740 added the getBackgroundProcessName(ActionProxy) hook, and WW-1741 made the interceptor re-set the session token before returning wait. The capability is therefore already reachable in a handful of lines — the attached patch is just no longer applicable, because it overrides getName(ActionInvocation), a method that no longer exists.

What is missing is documentation, not a framework hook.

Why not ship the class

Two properties make a token-keyed default a bad trade:

  • The session entry is removed only when a request observes the background process as done. With the action-name key the number of stranded entries is bounded by the number of execAndWait actions; with a per-token key every abandoned run strands a BackgroundProcess — and the action instance it holds — in the session, unbounded.
  • The stock key fails safe: a wait page that loses its parameters still joins the running process. A token key fails open — every refresh that drops the token starts another background process.

What this PR does

  • Documents the override in the interceptor's extending javadoc snippet (the one rendered on the site), with the sample class and both caveats spelled out.
  • Adds ExecuteAndWaitInterceptorTokenScopeTest, covering both keyings: two tabs share one process under the action-name default, and get one process each under the documented override. The second test also guards the hook itself against being renamed again, which is what invalidated the original patch.

No behaviour change.

Testing

mvn test -DskipAssembly -pl core -Dtest=ExecuteAndWaitInterceptorTokenScopeTest,ExecuteAndWaitInterceptorTest

2 + 8 tests, 0 failures. mvn -pl core javadoc:javadoc is clean.

🤖 Generated with Claude Code

…aming

The request was for the framework to ship a TokenizedExecuteAndWaitInterceptor
so that several browser tabs of one session can run the same action in the
background. The hook that makes this possible already exists - WW-1740 added
getBackgroundProcessName(ActionProxy) - so the capability is reachable in a
few lines; what was missing is that nobody wrote it down.

Document the override in the interceptor's "extending" snippet, including the
two caveats that make shipping it as the default a bad trade: session entries
are only reclaimed when a request observes the process as done, so a per-token
key grows unboundedly with abandoned runs, and a wait page that does not
propagate the token starts a new background process on every refresh.

Add a test covering both keyings: the action-name default shares one process
across tabs, the documented override gives each tab its own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit 482b4d2 into main Aug 23, 2026
13 checks passed
@lukaszlenart
lukaszlenart deleted the WW-1742-document-token-scoped-exec-and-wait branch August 23, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant