[
https://issues.jboss.org/browse/WFLY-3295?page=com.atlassian.jira.plugin....
]
Philippe Marschall updated WFLY-3295:
-------------------------------------
Attachment: AsyncServlet.java
Consider the following code in the attached class
{code}
CountDownLatch latch = new CountDownLatch(1);
AsyncContext context = req.startAsync();
LOG.info("sync work in" + Thread.currentThread().getName());
context.start(() -> {
LOG.info("async work in" + Thread.currentThread().getName());
try {
latch.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warning("interrupted");
}
});
LOG.info("count down");
latch.countDown();
{code}
If {{AsyncContext#start}} runs in a different thread (or the same thread just later) I
would expect the following output:
* sync work indefault task-x
* count down
* async work indefault task-y
Instead I get:
* sync work indefault task-1
* async work indefault task-1
* nothing anymore since the runnable is executed in the caller thread
AsyncContext#start runs in caller thread
----------------------------------------
Key: WFLY-3295
URL:
https://issues.jboss.org/browse/WFLY-3295
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Web (Undertow)
Affects Versions: 8.1.0.CR1
Reporter: Philippe Marschall
Assignee: Stuart Douglas
Attachments: AsyncServlet.java
{{javax.servlet.AsyncContext.start(Runnable)}} seems to run the runnable in the caller
thread. In order for this method to be useful it should be run in a different thread.
I'll attach a class to demonstrate the issue.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira