Search in sources :

Example 1 with PlatformStarter

use of org.eclipse.scout.rt.platform.internal.PlatformStarter in project scout.rt by eclipse.

the class PlatformAwaitStartedTest method testAwaitPlatformStarted.

@Test
public void testAwaitPlatformStarted() {
    final FixturePlatformWithStartListener platform = new FixturePlatformWithStartListener();
    new PlatformStarter(platform).start();
    try {
        platform.m_asyncFinished.await(1, TimeUnit.MINUTES);
    } catch (InterruptedException e) {
        throw new PlatformException("interrupted waiting for asyncFinished", e);
    }
    Assert.assertArrayEquals(new Object[] { "asyncStart", "listenerFinished", "asyncFinished" }, platform.m_events.toArray());
}
Also used : PlatformStarter(org.eclipse.scout.rt.platform.internal.PlatformStarter) PlatformException(org.eclipse.scout.rt.platform.exception.PlatformException) Test(org.junit.Test)

Example 2 with PlatformStarter

use of org.eclipse.scout.rt.platform.internal.PlatformStarter in project scout.rt by eclipse.

the class Platform method initialize.

private static synchronized void initialize() {
    if (platform != null) {
        return;
    }
    IPlatform tmpPlatform = null;
    ServiceLoader<IPlatform> loader = ServiceLoader.load(IPlatform.class);
    for (IPlatform p : loader) {
        tmpPlatform = p;
        break;
    }
    if (tmpPlatform == null) {
        tmpPlatform = new DefaultPlatform();
    }
    // Start platform initialization in separate thread to let class initialization complete
    new PlatformStarter(tmpPlatform).start();
    tmpPlatform.awaitPlatformStarting();
    platform = tmpPlatform;
}
Also used : PlatformStarter(org.eclipse.scout.rt.platform.internal.PlatformStarter)

Aggregations

PlatformStarter (org.eclipse.scout.rt.platform.internal.PlatformStarter)2 PlatformException (org.eclipse.scout.rt.platform.exception.PlatformException)1 Test (org.junit.Test)1