[jboss-jira] [JBoss JIRA] (WFLY-4599) AsyncListener.onComplete() not called if AsyncContext.dispatch() is called

Prashant Deva (JIRA) issues at jboss.org
Thu May 7 21:14:45 EDT 2015


    [ https://issues.jboss.org/browse/WFLY-4599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066399#comment-13066399 ] 

Prashant Deva commented on WFLY-4599:
-------------------------------------

it is fixed in 9.0 but the fix needs to be in 8.x branch for users who dont want to upgrade to major version number

> AsyncListener.onComplete() not called if AsyncContext.dispatch() is called
> --------------------------------------------------------------------------
>
>                 Key: WFLY-4599
>                 URL: https://issues.jboss.org/browse/WFLY-4599
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 8.2.0.Final
>            Reporter: Prashant Deva
>            Assignee: Stuart Douglas
>
> Consider this code:
> {code}
> protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
> {     
>         final AsyncContext asyncContext = req.startAsync();
>         asyncContext.addListener(new AsyncListener()
>         {
>             @Override
>             public void onComplete(AsyncEvent event) throws IOException
>             {
>                 System.out.println("complete");
>             }
>             @Override
>             public void onTimeout(AsyncEvent event) throws IOException
>             {
>                 System.out.println("timeout");
>             }
>             @Override
>             public void onError(AsyncEvent event) throws IOException
>             {
>                 System.out.println("err");
>             }
>             @Override
>             public void onStartAsync(AsyncEvent event) throws IOException
>             {
>                 System.out.println("start");
>             }
>         });
>         new Thread(new Runnable()
>         {
>             @Override
>             public void run()
>             {
>                 try
>                 {
>                     Thread.sleep(2000);
>                     asyncContext.dispatch("/path2");
>                 } catch (InterruptedException e)
>                 {
>                     e.printStackTrace();
>                 }
>             }
>         }).start();
>     }
> {code}
> When used in Wildfly 8.2.0.final {{complete}} will never be printed since {{onComplete()}} is not called by Wildfly when {{asyncContext.dispatch()}} is used even after {{path2}} has finished executing.
> On all other versions of wildfly, and other app servers like tomcat and jetty, {{complete}} will be printed.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list