aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
blob: a7edd2c0d0c20050467b5275e57c1b7423152aaa (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();
}