Java Utililty Methods Thread Executor Create

List of utility methods to do Thread Executor Create

Description

The list of methods to do Thread Executor Create are organized into topic(s).

Method

ScheduledExecutorServicegetExecutorServiceWithThreadName(final String threadNamePrefix, int threadCount)
get Executor Service With Thread Name
return Executors.newScheduledThreadPool(threadCount, new ThreadFactory() {
    private int i = 1;
    @Override
    public Thread newThread(Runnable r) {
        Thread thread = new Thread(r);
        thread.setName(threadNamePrefix + ":" + i++);
        return thread;
});
longgetExecutorThreadId(final ExecutorService executor)
Returns the thread ID of the background appender thread.
Future<Long> result = executor.submit(new Callable<Long>() {
    @Override
    public Long call() {
        return Thread.currentThread().getId();
});
try {
    return result.get();
...