Here you can find the source of runInNewThread(Runnable task)
Parameter | Description |
---|---|
task | task to run in a Thread different than the current one. |
public static void runInNewThread(Runnable task)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Main { private static final ExecutorService pool = Executors.newCachedThreadPool(); /**/*from www . jav a2s . c o m*/ * Runs a {@link Runnable} task in a {@link Thread} different than the * current one. * * @param task task to run in a {@link Thread} different than the current * one. */ public static void runInNewThread(Runnable task) { pool.submit(task); } }