< prev index next >

apps/toys/Hello/src/main/java/hello/HelloLaunchOnNewThread.java

Print this page
rev 9619 : [mq]: 9-jake.patch

*** 23,49 **** --- 23,56 ---- * questions. */ package hello; + import java.util.concurrent.atomic.AtomicBoolean; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class HelloLaunchOnNewThread extends Application { static long startTime; + static AtomicBoolean mainCalled = new AtomicBoolean(false); public HelloLaunchOnNewThread() { long endTime = System.nanoTime(); long elapsedMsec = (endTime - startTime + 500000) / 1000000; System.err.println("DONE: elapsed time = " + elapsedMsec + " msec"); System.err.println("Constructor: currentThread=" + Thread.currentThread().getName()); + if (!mainCalled.get()) { + System.err.println("***************************************"); + System.err.println("*** ERROR: main() method not called ***"); + System.err.println("***************************************"); + } } @Override public void init() { System.err.println("init: currentThread=" + Thread.currentThread().getName());
*** 79,88 **** --- 86,96 ---- /** * @param args the command line arguments */ public static void main(final String[] args) { + mainCalled.set(true); System.err.println("main: currentThread=" + Thread.currentThread().getName()); new Thread(() -> { // Sleep for a very short time to ensure main thread exits, // since that will provoke RT-9824
< prev index next >