Skip to content

Conversation

@markt-asf
Copy link
Contributor

This is intended only to align the Javadoc description of when an ISE is thrown with the text in the spec doc.

I'll leave this for at least a week in case others read the spec document differently.

@markt-asf
Copy link
Contributor Author

The alternative reading is that if calling complete is valid, multiple calls to complete() are allowed. The first completes the async processing and any others are NO-OPs.

@markt-asf
Copy link
Contributor Author

It has been several weeks with no feedback so I intend to merge this commit.

Before I merge I intend to make the following additional changes:

  • update the specification document to add text that states complete() may be called no more than once per asynchronous cycle with any additional calls triggering an IllegalStateException
  • add one or more TCK tests to check for this behaviour

I have read the specification multiple times and the text is currently ambiguous as to whether multiple calls to complete() per asynchronous cycle are allowed.

My reading of the specification document is that the intent was that multiple calls to complete are not allowed. This is based on the following:

  • All of the start and dispatch methods have strict requirements around number and sequence of calls that are permitted. It would be consistent for complete() to be similarly specified.
  • The description of complete() includes the text "An IllegalStateException MUST be thrown if startAsync was not called.". Given that complete() is a method on the AsyncContext and the only way to obtain an AsyncContext is to call startAsync() this sentence has no purpose unless the intention was to disallow multiple calls to complete().
  • Request (and response) objects associated with a asynchronous cycle are only valid up to the point complete() is called. Asynchronous applications using multiple threads therefore need to keep track of when complete() is called to avoid indeterminate behaviour (see 3.14 & 5.8). "Keeping track" of when complete() is called is equivalent to making sure complete() is only called once.

@markt-asf markt-asf changed the base branch from master to main October 15, 2025 13:05
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