/** * Returns a {@link ExecutorThreadModel} instance for the specified <tt>serviceName</tt>. * Please note that all returned instances will be managed globally; the same instance * will be returned if you specified the same service name. Please try to specify * different names for different services. * * @param serviceName the name of the service that needs thread pooling */ public static ExecutorThreadModel getInstance(String serviceName) { if (serviceName == null) { throw new NullPointerException("serviceName"); } ExecutorThreadModel model; synchronized (service2model) { model = service2model.get(serviceName); if (model == null) { model = new ExecutorThreadModel(serviceName); service2model.put(serviceName, model); } } return model; }