Vaadin 7.6.X push Tomcat 7 Liferay 6.2

Hello,

I’m new in vaadin and liferay. I would like to use the push tchnology.
In liferay 6.2, I change the version of vaadin from 6 to 7.6.1

I have added the jar for the push
I have added the @push annotation

Then i have one button, when I clicked on, a background thread is sleeping then watch a notification.
But Now, I always need to click on a button or anything else to watch the notification.

I think, it’s possible to refresh the UI with the push. But I don’t know where is the problem

public void buttonClick(ClickEvent event) {
if (event.getButton() == pushButton1) {
new Push1Thread().start();
}

class Push1Thread extends Thread
{
public void run() {
try {
Thread.sleep(5000);

            final UI localUi = UI.getCurrent();
            localUi.access(new Runnable() {
                public void run() {
                    // Here the UI is locked and can be update                 
                    Notification.show("Je suis réveillé push 1", Notification.Type.ERROR_MESSAGE);    
                }
            });            
        } catch ( InterruptedException e ) {
            e.printStackTrace();
        }
    }
}

Can anyone help me ?
Thanks a lot
Bertrand

23401.xml (1.36 KB)
23402.xml (668 Bytes)

use
localUI.push();

Ilia Motornyi

Thank you for your response.

My code is now:

class Push1Thread extends Thread
{
public void run() {
try {
Thread.sleep(5000);

            final UI localUi = UI.getCurrent();
            localUi.access(new Runnable() {
                public void run() {
                    Notification.show("Je suis réveillé push 1", Notification.Type.ERROR_MESSAGE);
                }
                
            });
            
            localUi.push();
        } catch ( InterruptedException e ) {
            e.printStackTrace();
        }
    }
}

But it doesn’t work. I believed thst we need localUI.push(); was needed if push is manual. But maybe i’m wrong.

i have tested Vaadin application with only Tomcat and it works. I think the problem is coming from the relation betwen Liferay and Vaadin.
I manually update vaadin in Liferay from Vaadin 6 to Vaadin 7 thanks to a wiki. But maybe I need to update more jars ?

thanks for your help