invoke On Background Executors Thread - Java java.util.concurrent

Java examples for java.util.concurrent:Executors

Description

invoke On Background Executors Thread

Demo Code


//package com.java2s;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    public static void invokeOnBackgroundThread(Runnable runnable) {
        ExecutorService executor = Executors.newSingleThreadExecutor();
        executor.execute(runnable);//from   ww  w.j  a  v a2s.c  o m
        executor.shutdown();
    }
}

Related Tutorials