List of usage examples for java.lang Runnable run
public abstract void run();
Runnable
is used to create a thread, starting the thread causes the object's run
method to be called in that separately executing thread. From source file:Main.java
static Runnable andThen(Runnable r1, Runnable r2) { return () -> { r1.run(); r2.run(); }; }
From source file:Main.java
/** * Construct a synchronous executor, which will run tasks directly on the calling thread when submitted. *///from w w w . j a v a 2 s .c o m public static Executor makeSynchronousExecutor() { return new Executor() { public void execute(Runnable command) { command.run(); } }; }
From source file:Main.java
public static void runGlRunnables() { // TODO//from w ww . ja va 2 s .co m for (Runnable runnable : glRunnables) { runnable.run(); } glRunnables.clear(); }
From source file:Main.java
public static Runnable andThen(Runnable r1, Runnable r2) { return () -> { r1.run(); r2.run(); }; }
From source file:Main.java
public static void runOnUiThread(Runnable run) { if (isUiThread()) { run.run(); } else {/* w w w .j a v a 2s . c o m*/ Platform.runLater(run); } }
From source file:Main.java
/** * Runs a Runnable if it is not null. Avoids those annoying null checks everywhere. * /*from www. ja v a2 s .c o m*/ * @param callback * The Runnable to run. */ public static void runCallback(final Runnable callback) { if (callback != null) { callback.run(); } }
From source file:Main.java
public static void post(Runnable run) { if (isMainThread()) { run.run(); } else {//from www .ja v a 2 s .c o m getHandler().post(run); } }
From source file:Main.java
public static void runOnEventQueue(Runnable r) { if (SwingUtilities.isEventDispatchThread()) { r.run(); } else {/*from w w w . java2s . c o m*/ SwingUtilities.invokeLater(r); } }
From source file:Main.java
public static void performLocked(Lock lock, Runnable action) { lock.lock();//w w w . ja v a2 s . c o m try { action.run(); } finally { lock.unlock(); } }
From source file:Main.java
public static void executeInFXThread(Runnable runnable) { if (Platform.isFxApplicationThread()) { runnable.run(); } else {/*from w w w.j av a2s . c o m*/ Platform.runLater(runnable); } }