Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Main {
    private static ThreadPoolExecutor pool = ((ThreadPoolExecutor) Executors.newCachedThreadPool());

    public static void shutdown() {
        try {
            pool.awaitTermination(30, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            System.err.println("Shutdown was interrupted, forcing shutdown...");
            pool.shutdownNow();
            e.printStackTrace();
        }
    }
}