diff options
Diffstat (limited to 'server/src/test/java/com/vaadin/ui/UITest.java')
-rw-r--r-- | server/src/test/java/com/vaadin/ui/UITest.java | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/server/src/test/java/com/vaadin/ui/UITest.java b/server/src/test/java/com/vaadin/ui/UITest.java index 886dd38087..ff9062ea0a 100644 --- a/server/src/test/java/com/vaadin/ui/UITest.java +++ b/server/src/test/java/com/vaadin/ui/UITest.java @@ -87,41 +87,35 @@ public class UITest { final ConcurrentLinkedQueue<Exception> exceptions = new ConcurrentLinkedQueue<Exception>(); // Simulates the websocket close thread - Runnable websocketClose = new Runnable() { - @Override - public void run() { - externalLock.lock(); - // Wait for disconnect thread to lock VaadinSession - websocketReachedCheckpoint.countDown(); - try { - uiDisconnectReachedCheckpoint.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - exceptions.add(e); - return; - } - uiSession.lock(); - externalLock.unlock(); + Runnable websocketClose = () -> { + externalLock.lock(); + // Wait for disconnect thread to lock VaadinSession + websocketReachedCheckpoint.countDown(); + try { + uiDisconnectReachedCheckpoint.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + exceptions.add(e); + return; } + uiSession.lock(); + externalLock.unlock(); }; - Runnable disconnectPushFromUI = new Runnable() { - @Override - public void run() { - uiSession.lock(); - // Wait for websocket thread to lock external lock - uiDisconnectReachedCheckpoint.countDown(); - try { - websocketReachedCheckpoint.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - exceptions.add(e); - return; - } - - ui.setSession(null); - uiSession.unlock(); + Runnable disconnectPushFromUI = () -> { + uiSession.lock(); + // Wait for websocket thread to lock external lock + uiDisconnectReachedCheckpoint.countDown(); + try { + websocketReachedCheckpoint.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + exceptions.add(e); + return; } + + ui.setSession(null); + uiSession.unlock(); }; Thread websocketThread = new Thread(websocketClose); |