Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package it.feargames.mythicmobsfixes;
- import java.util.concurrent.ExecutorService;
- import java.util.concurrent.TimeUnit;
- public class Executors {
- private static Executors instance;
- private final ExecutorService fileSaveExecutor;
- private Executors() {
- fileSaveExecutor = java.util.concurrent.Executors.newFixedThreadPool(10);
- }
- public ExecutorService getFileSaveExecutor() {
- return fileSaveExecutor;
- }
- public static void shutdown() {
- if (instance == null) {
- return;
- }
- instance.fileSaveExecutor.shutdown();
- try {
- instance.fileSaveExecutor.awaitTermination(15, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- instance = null;
- }
- public static Executors getInstance() {
- if (instance == null) {
- instance = new Executors();
- }
- return instance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement