Just a couple lines to hopefully get some help about an hypotetical application using Comet with primefaces.
The whole idea is to try to get working a application using the <p:outputpanel> component and a long term background thread living a controller and pushing data into this component. I got something working but I loose the CometContext. How can i manage to keep the CometContext alive in another class?. Can anyone around here please shed more light in how to get working something like that?
Code: Select all
public void startMonitor(ActionEvent event) {
CometContext.publish("ack", "Wellcome to Foo monitor." ); // It works!
Runnable r = new Runnable(){
@Override
public void run() {
while (true) {
CometContext.publish("ack", new Date()); // It doesn't work, CometContext is null.
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}};
new Thread(r).start();
}