Java tutorial
//package com.java2s; import java.util.Map; import java.util.concurrent.ExecutorService; import com.google.common.collect.Maps; public class Main { private static final Map<String, ExecutorService> POOLS = Maps.newHashMap(); private static void checkNamedPool(String poolName) { ExecutorService executorService = POOLS.get(poolName); if (executorService != null) { throw new RuntimeException( "Thread pool existes for: name=" + poolName + ", executorService=" + executorService); } } }