Here you can find the source of executeInThread(Runnable r)
Parameter | Description |
---|---|
r | : Runnable to be posted (get it from RunnableCreatorUtil ) |
public static Future<?> executeInThread(Runnable r)
//package com.java2s; //License from project: Creative Commons License import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; public class Main { private static ExecutorService exService = Executors.newFixedThreadPool(5); /**// w w w . j a v a 2s .co m * Posts a {@link Runnable} in a new {@link Thread} * @param r : {@link Runnable} to be posted (get it from {@link RunnableCreatorUtil}) * @return A {@link Future} to be able to manage failures & cancels. */ public static Future<?> executeInThread(Runnable r) { return exService.submit(r); } }