title: PrimeFaces Push and Multithreading
body: <p>I have correctly set up a Push server using PrimeFaces p:push component (using a Jetty web server to handle Websockets).
  However, the Push mechanism does not work when trying to display an alert upon reception of another thread.</p>
  
  <p>Here some of the code I use:</p>
  
  <p><strong>JSF</strong> page firing the asynchronous Web Service call:</p>
  
  <pre><code>&lt;f:view ...&gt;
  &lt;pm:page title="TEST"&gt;
     &lt;p:push onmessage="handleMessage" channel="counter" widgetVar="pushEssaisCounter" autoConnect="true" /&gt; 
      &lt;pm:view id="essais-run"&gt;
          &lt;h:form prependId="false"&gt;
              &lt;pm:header title="TEST"&gt;
                  &lt;f:facet name="right"&gt;
                        &lt;pm:commandButton value="Async Call" actionListener="#{AsyncHandler.onRun}" update="erunMessages erunResult" swatch="a" inline="true" icon="check" /&gt;
                  &lt;/f:facet&gt;
              &lt;/pm:header&gt;
              &lt;pm:content&gt; ...
  </code></pre>
  
  <p>Backing bean handling the actionListener and forking on a new thread (<strong>AsyncHandler.java</strong>):</p>
  
  <pre><code>public void onRun(ActionEvent event) {
    Executors.newSingleThreadExecutor().submit(new EssaiCallable());
  }
  </code></pre>
  
  <p>Code executed asynchronously by the new thread (upon reception of <strong>the Web Service response</strong>):</p>
  
  <pre><code>private class EssaiCallable implements Callable&lt;CreerEssaiS1F2Response&gt; {
  
    @Override
    public synchronized CreerEssaiS1F2Response call() throws Exception {
      log.info("ASYNC TEST RESPONSE received!");
      RequestContext.getCurrentInstance().push("counter", 666);
    }
  }
  </code></pre>
  
  <p>I have no exception or error when running this code, but the content is just never pushed :-(
  Am I missing something? Any help would be appreciated, thanks in advance.</p>