在线程中执行
@param runnable 要执行的runnable
334478
public void excute(Runnable runnable) {
        ExecutorService executorService = getExecutorService();
        if (executorService != null) {
            // 优先使用线程池，提高效率
            executorService.execute(runnable);
        } else {
            // 线程池获取失败，则直接使用线程
            new Thread(runnable).start();
        }
    }
686648
public static <R> R runAndReturn(Runnable runnable,
            Supplier<R> returnSupplier) {
        runnable.run();
        return returnSupplier.get();
    }
416740
@Deprecated
    public void sync(final Runnable runnable) {
        clientConnector.send(new EmptyCommand(), new OnFinishedHandler() {
            public void onFinished() {
                runnable.run();
            }

        });
    }
818670
public static CompletableFuture<Void> runAsync(Runnable runnable,
            Executor executor) {
        return runAsync(runnable,
                handleExceptionally("runAsync", runnable, executor), executor);
    }
767428
public static Optional<Long> timedRun(Runnable runnable) {
    long t0 = System.currentTimeMillis();
    runnable.run();
    return Optional.of(System.currentTimeMillis() - t0);
  }
1179490
public Thread createThread(Runnable runnable) {
        Thread thread = new Thread(getThreadGroup(), runnable, nextThreadName());
        thread.setPriority(getThreadPriority());
        thread.setDaemon(isDaemon());
        return thread;
    }
663779
public static void unfailable(final @Nonnull ThrowingRunnable runnable) {
    try {
      runnable.run();
    } catch (final Exception exc) {
      Optional
        .ofNullable(Thread.currentThread().getUncaughtExceptionHandler())
        .ifPresent(ueh -> ueh.uncaughtException(Thread.currentThread(), exc));
    }
  }
921145
public <T extends Runnable> T executeAsync(T runnable) {
		synchronized (this.tasks) {
			this.tasks.add(runnable);
			// Notify that a task has been added
			this.tasks.notifyAll();

			if (this.tasks.size() == 1) {
				this.onTaskBecameNotEmpty();
			}

			this.onTaskAdded();
		}
		return runnable;
	}
412370
public static ScheduledFuture scheduleAtFixedRate(Runnable runnable, long periodInMilli) {
        /** 我们默认设定一个runnable生命周期与一个msgId一一对应 */
        Runnable proxied = wrapRunnable(runnable, null);
        return newSingleThreadScheduler().scheduleAtFixedRate(proxied, 0, periodInMilli, TimeUnit.MILLISECONDS);
    }
591904
private static void doExecute(Executor executor, Runnable runnable) {
    try {
      executor.execute(runnable);
    } catch (Throwable th) {
      log.log(Level.SEVERE, "Failed to execute PingCallback", th);
    }
  }
1219275
public void execute(final T runnable) {
        synchronized (queue) {
            if (runnable != null && !disabled) {
                queue.addLast(runnable);
                queue.notify();
                System.out.println("WorkQueue has added runable - WorkQueue size is " + queue.size());
            }
        }
    }
296247
public static void step(final ThrowableContextRunnableVoid<StepContext> runnable) {
        step(step -> {
            runnable.run(step);
            return null;
        });
    }
954735
public static void with(HttpRequest request, Runnable runnable) {
        HttpRequest existing = REQUEST.get();
        boolean isSet = false;
        try {
            if (request != existing) {
                isSet = true;
                REQUEST.set(request);
            }
            runnable.run();
        } finally {
            if (isSet) {
                REQUEST.remove();
            }
        }
    }
872887
public ServerListenerBuilder addStartedCallback(Runnable runnable) {
        requireNonNull(runnable, "runnable");
        serverStartedCallbacks.add(unused -> runnable.run());
        return this;
    }
31591
@Override
    public void run() {
        try {
            threadContext.activate();
            // run the original thread
            runnable.run();
        } finally {
            threadContext.invalidate();
            threadContext.deactivate();
        }

    }
962457
protected void executeOnGdx (final Runnable runnable) {
		final CountDownLatch latch = new CountDownLatch(1);

		final AtomicReference<Exception> exceptionAt = new AtomicReference<Exception>();

		Gdx.app.postRunnable(new Runnable() {
			@Override
			public void run () {
				try {
					runnable.run();
				} catch (Exception e) {
					exceptionAt.set(e);
				} finally {
					latch.countDown();
				}
			}
		});

		try {
			latch.await();

			final Exception e = exceptionAt.get();
			if (e != null) {
				failed(e);
			}
		} catch (InterruptedException e) {
			failed(e);
		}
	}
227710
public static void execute(Runnable runnable) {
		try {
			executor.execute(runnable);
		} catch (Exception e) {
			throw new UtilException(e, "Exception when running task!");
		}
	}