All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.phantomthief.stats.n.util.SharedStatsScheduledExecutorHolder Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
/**
 * 
 */
package com.github.phantomthief.stats.n.util;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

/**
 * @author w.vela
 */
public class SharedStatsScheduledExecutorHolder {

    private static final int THREAD_COUNT = 10;

    private static class LazyHolder {

        private static final ScheduledExecutorService INSTANCE = Executors.newScheduledThreadPool(
                THREAD_COUNT,
                new ThreadFactoryBuilder() //
                        .setNameFormat("scheduled-stats-helper-%d") //
                        .setPriority(Thread.MIN_PRIORITY) //
                        .setDaemon(true) //
                        .build());
    }

    private SharedStatsScheduledExecutorHolder() {
    }

    public static ScheduledExecutorService getInstance() {
        return LazyHolder.INSTANCE;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy