Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.util.concurrent.ThreadFactory;

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

public class Main {
    public static ExecutorService newFixedThreadPool(int concurrency, String poolName) {
        return Executors.newFixedThreadPool(concurrency, createFactory(poolName));
    }

    private static ThreadFactory createFactory(String poolName) {
        return new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build();
    }
}