VaadinSession.getCurrent().getUIs() doesn't return all the attached UIs for

Hi everyone,
I have some troubles in getting all the UIs attached to a Vaadin session: as shown in Chapter 4.7.8 of the book:

@Push public class MyPushyUI extends UI {
@Override
protected void init(VaadinRequest request) {
setContent(new Button(“Logout”, event → {// Java 8
for (UI ui: VaadinSession.getCurrent().getUIs())
ui.access(() → {
// Redirect from the page
ui.getPage().setLocation(“/logout.html”);
});
getSession().close();
}));
}
}

But it doesn’t work for me, I have 3 UIs opened but the
Collection
(Vaadin.getCurrent().getUIs()) which is iterated contains only one UI (the current) and thus only the current UI is redirected…

Why
VaadinSession.getCurrent().getUIs()
returns only the current UI and not all the UIs bounded to the session?

Are you sure that you have multiple UIs attached to the same SESSION?
Note that when you open the web application in another browser for example you create a new session. So when you have the web app open in 3 different browsers and each Browser has 1 UI open getUIs() will only return 1 UI.

No I use Chrome and when I start the Application I open the
MyPushyUI
and another
UI
I have created to test this behaviour, then I click the “Logout” button inside the MyPushyUI and MyPushyUI its redirected, but the other UI is not (I don’t even get the Session Expired System message for this UI…), instead if I reload the UI that is not redirected

sometimes

I get an exception in the console:

Dec 08, 2014 9:08:27 AM com.vaadin.server.communication.PushHandler onThrowable
SEVERE: Exception in push connection
java.io.IOException: AtmosphereResource Cancelled: 183854b4-fae9-419e-996d-0ba9f86bc1a9
    at org.atmosphere.cpr.AtmosphereResponse.validAsyncIOWriter(AtmosphereResponse.java:459)
    at org.atmosphere.cpr.AtmosphereResponse.access$1100(AtmosphereResponse.java:55)
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:499)
    at org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:141)
    at com.vaadin.server.communication.PushHandler$1.onStateChange(PushHandler.java:63)
    at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1018)
    at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1038)
    at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:879)
    at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:520)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)



Dec 08, 2014 9:08:28 AM com.vaadin.server.communication.PushHandler disconnect
SEVERE: Could not get UI. This should never happen, except when reloading in Firefox - see http://dev.vaadin.com/ticket/14251

However, I have logged the for cycle and the for is iterating only over a Collection with just a single item:

for (UI ui: uis) {

         ui.accessSynchronously(() -> { // Runnable implementation with a lambda expression

                  // Redirect from the page
                  System.out.println("UI class = " + ui.getClass().toString());
                  ui.getPage().setLocation("https://vaadin.com/forum");

                });
}


System.out.println
outputs:

UI class = class com.example.application_lifecycle.MyPushyUI

Could it be another problem?