1 Reply Latest reply on Nov 7, 2008 7:48 PM by Alexander Smirnov

    a4j:push does not work in linux

    Asha AmbikaVijayakumaran Newbie

      I see some issues with a4j:push tag while my application deployed and running in linux. I use the exact code available in the demo application (given below). It seems to work fine in windows; however in linux I see that the push does not seem to be happening for the first 5 minutes at least. If I wait for a while (i.e.,after the initial 5 minutes) I could see the screen refresh as the result of the push activity. Is there any known issue of push in combination with linux? Any solution to this issue? My application is deployed and running on jetty6.1.5 and JDK1.5.17.

      The code snippet is given below.

      public class PushBean implements Runnable {

      private String uuid = "";
      private boolean enabled = false;
      private Date startDate;
      PushEventListener listener;
      private Thread thread;

      // private int eventsFired counter;
      public void addListener(EventListener listener) {
      synchronized (listener) {
      if (this.listener != listener) {
      this.listener = (PushEventListener) listener;

      public void run() {
      while (thread != null) {
      try {
      if (((new Date()).getTime() - startDate.getTime()) >= 60000) {
      uuid = UUID.randomUUID().toString();
      listener.onEvent(new EventObject(this));
      } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();

      public String getUuid() {
      return uuid;

      public void start() {
      if (thread == null) {
      thread = new Thread(this);
      setStartDate(new Date());

      public void stop() {
      if (thread != null) {
      thread = null;

      public Thread getThread() {
      return thread;

      public boolean isEnabled() {
      return enabled;

      public void setEnabled(boolean enabled) {
      this.enabled = enabled;

      public Date getStartDate() {
      return startDate;

      public void setStartDate(Date startDate) {
      this.startDate = startDate;

      Page code:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

      <a4j:push interval="1000" eventProducer="#{push.addListener}"
      reRender="push,out" enabled="#{push.enabled}" id="push"/>
      <f:facet name="header">
      <h:outputText value="Push Example"/>
      <h:panelGrid columns="1" id="out">
      <h:outputText rendered="#{!push.enabled}" value="Press Start to run push example"/>
      <h:panelGroup rendered="#{push.enabled}">
      <h:outputText value="Generated UUID:"/>
      <h:outputText value="#{push.uuid}"/>
      <a4j:commandButton value="Start" action="#{push.start}"
      ajaxSingle="true" rendered="#{!push.enabled}" reRender="push, out"/>
      <a4j:commandButton value="Stop" action="#{push.stop}"
      ajaxSingle="true" rendered="#{push.enabled}" reRender="push, out"/>