summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
blob: c9af2c000d5f74e25cd3d86196b19ca1eb2e1664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.vaadin.tests.applicationcontext;

import com.vaadin.ui.UI;

public abstract class UIRunSafelyThread extends Thread {
    private UI ui;

    public UIRunSafelyThread(UI ui) {
        this.ui = ui;
    }

    @Override
    public void run() {
        ui.accessSynchronously(new Runnable() {

            @Override
            public void run() {
                runSafely();
            }
        });
    }

    protected abstract void runSafely();
}