From jira-events at lists.jboss.org Tue Mar 27 06:23:47 2012 Content-Type: multipart/mixed; boundary="===============7319705326535106189==" MIME-Version: 1.0 From: =?utf-8?q?Luk=C3=A1=C5=A1_Fry=C4=8D_=28JIRA=29_=3Cjira-events_at_lists=2E?= =?utf-8?q?jboss=2Eorg=3E?= To: richfaces-issues at lists.jboss.org Subject: [richfaces-issues] [JBoss JIRA] (RF-12072) Push: add onsubscribed event (was: Lost event in push) Date: Tue, 27 Mar 2012 06:23:47 -0400 Message-ID: <612515439.33612.1332843827395.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 1823827590.22721.1332335688298.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com --===============7319705326535106189== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/RF-12072?page=3Dcom.atlassian.jira.p= lugin.system.issuetabpanels:all-tabpanel ] Luk=C3=A1=C5=A1 Fry=C4=8D updated RF-12072: ---------------------------- Summary: Push: add onsubscribed event (was: Lost event in push) (was: = Add onsubscribed event (was: Lost event in push)) = > Push: add onsubscribed event (was: Lost event in push) > ------------------------------------------------------ > > Key: RF-12072 > URL: https://issues.jboss.org/browse/RF-12072 > Project: RichFaces > Issue Type: Bug > Security Level: Public(Everyone can see) = > Components: component-push/poll > Reporter: Stian Thorgersen > Assignee: Luk=C3=A1=C5=A1 Fry=C4=8D > Fix For: 4.2.1.CR1 > > > Event can be lost if produced while a response is being prepared. I've at= tached an example where a push event is used to refresh a count whenever an= event is fired. It's using Thread.sleep to simulate an event being produce= d while the response is being prepared. Note, if the sleep just before retu= rning the count is removed it all works fine, and the page is refreshed eve= ry 5 seconds, but with the sleep in place the event is lost. > View: > {code} > > > xmlns:f=3D"http://java.sun.com/jsf/core" > xmlns:h=3D"http://java.sun.com/jsf/html" > xmlns:a4j=3D"http://richfaces.org/a4j" > xmlns:rich=3D"http://richfaces.org/rich"> > > > > > > > > > > > > > {code} > Bean: > {code} > package com.example; > import java.io.Serializable; > import java.util.concurrent.atomic.AtomicInteger; > import javax.enterprise.context.SessionScoped; > import javax.inject.Named; > import org.richfaces.application.push.TopicKey; > import org.richfaces.application.push.TopicsContext; > @Named > @SessionScoped > public class MyBean implements Serializable > { > private AtomicInteger count =3D new AtomicInteger(); > public int getCount() > { > int c =3D count.get(); > new Thread() > { > public void run() > { > try > { > Thread.sleep(5000); > count.incrementAndGet(); > TopicKey topicKey =3D new TopicKey("chat"); > TopicsContext topicsContext =3D TopicsContext.lookup(= ); > topicsContext.publish(topicKey, ""); > } > catch (Exception e) > { > e.printStackTrace(); > } > }; > }.start(); > = > try > { > Thread.sleep(10000); > } > catch (InterruptedException e) > { > } > return c; > } > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.jboss.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira = --===============7319705326535106189==--