test_class.file: bundles/org.openhab.core/src/test/java/org/openhab/core/common/ThreadPoolManagerTest.java
test_class.identifier: ThreadPoolManagerTest
test_case.body: @Test
      public void testGetCachedPool() {
          ExecutorService result = ThreadPoolManager.getPool("test2");
  
          assertThat(result, instanceOf(ExecutorService.class));
  
          ThreadPoolExecutor tpe = (ThreadPoolExecutor) result;
  
          assertTrue(tpe.allowsCoreThreadTimeOut());
          assertEquals(ThreadPoolManager.THREAD_TIMEOUT, tpe.getKeepAliveTime(TimeUnit.SECONDS));
          assertEquals(ThreadPoolManager.DEFAULT_THREAD_POOL_SIZE, tpe.getMaximumPoolSize());
      }
test_case.class_method_signature: ThreadPoolManagerTest.testGetCachedPool()
test_case.full_signature: @Test public void testGetCachedPool()
test_case.identifier: testGetCachedPool
test_case.invocations: getPool assertThat instanceOf assertTrue allowsCoreThreadTimeOut assertEquals getKeepAliveTime assertEquals getMaximumPoolSize
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetCachedPool()
focal_class.declarator: CONFIGURATION_PID = "org.openhab.threadpool"
focal_class.modifier: public static final
focal_class.original_string: public static final String CONFIGURATION_PID = "org.openhab.threadpool";
focal_class.type: String
focal_class.var_name: CONFIGURATION_PID
focal_class.declarator: THREAD_POOL_NAME_COMMON = "common"
focal_class.modifier: public static final
focal_class.original_string: public static final String THREAD_POOL_NAME_COMMON = "common";
focal_class.type: String
focal_class.var_name: THREAD_POOL_NAME_COMMON
focal_class.declarator: LOGGER = LoggerFactory.getLogger(ThreadPoolManager.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(ThreadPoolManager.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: DEFAULT_THREAD_POOL_SIZE = 5
focal_class.modifier: protected static final
focal_class.original_string: protected static final int DEFAULT_THREAD_POOL_SIZE = 5;
focal_class.type: int
focal_class.var_name: DEFAULT_THREAD_POOL_SIZE
focal_class.declarator: THREAD_TIMEOUT = 65L
focal_class.modifier: protected static final
focal_class.original_string: protected static final long THREAD_TIMEOUT = 65L;
focal_class.type: long
focal_class.var_name: THREAD_TIMEOUT
focal_class.declarator: THREAD_MONITOR_SLEEP = 60000
focal_class.modifier: protected static final
focal_class.original_string: protected static final long THREAD_MONITOR_SLEEP = 60000;
focal_class.type: long
focal_class.var_name: THREAD_MONITOR_SLEEP
focal_class.declarator: pools = new WeakHashMap<>()
focal_class.modifier: protected static
focal_class.original_string: protected static Map<String, ExecutorService> pools = new WeakHashMap<>();
focal_class.type: Map<String, ExecutorService>
focal_class.var_name: pools
focal_class.declarator: configs = new ConcurrentHashMap<>()
focal_class.modifier: private static
focal_class.original_string: private static Map<String, Integer> configs = new ConcurrentHashMap<>();
focal_class.type: Map<String, Integer>
focal_class.var_name: configs
focal_class.file: bundles/org.openhab.core/src/main/java/org/openhab/core/common/ThreadPoolManager.java
focal_class.identifier: ThreadPoolManager
focal_class.class_method_signature: ThreadPoolManager.activate(Map<String, Object> properties)
focal_class.full_signature: protected void activate(Map<String, Object> properties)
focal_class.identifier: activate
focal_class.modifiers: protected
focal_class.parameters: (Map<String, Object> properties)
focal_class.return: void
focal_class.signature: void activate(Map<String, Object> properties)
focal_class.class_method_signature: ThreadPoolManager.modified(Map<String, Object> properties)
focal_class.full_signature: protected void modified(Map<String, Object> properties)
focal_class.identifier: modified
focal_class.modifiers: protected
focal_class.parameters: (Map<String, Object> properties)
focal_class.return: void
focal_class.signature: void modified(Map<String, Object> properties)
focal_class.class_method_signature: ThreadPoolManager.getScheduledPool(String poolName)
focal_class.full_signature: public static ScheduledExecutorService getScheduledPool(String poolName)
focal_class.identifier: getScheduledPool
focal_class.modifiers: public static
focal_class.parameters: (String poolName)
focal_class.return: ScheduledExecutorService
focal_class.signature: ScheduledExecutorService getScheduledPool(String poolName)
focal_class.class_method_signature: ThreadPoolManager.getPool(String poolName)
focal_class.full_signature: public static ExecutorService getPool(String poolName)
focal_class.identifier: getPool
focal_class.modifiers: public static
focal_class.parameters: (String poolName)
focal_class.return: ExecutorService
focal_class.signature: ExecutorService getPool(String poolName)
focal_class.class_method_signature: ThreadPoolManager.getConfig(String poolName)
focal_class.full_signature: protected static int getConfig(String poolName)
focal_class.identifier: getConfig
focal_class.modifiers: protected static
focal_class.parameters: (String poolName)
focal_class.return: int
focal_class.signature: int getConfig(String poolName)
focal_method.body: public static ExecutorService getPool(String poolName) {
          ExecutorService pool = pools.get(poolName);
          if (pool == null) {
              synchronized (pools) {
                  // do a double check if it is still null or if another thread might have created it meanwhile
                  pool = pools.get(poolName);
                  if (pool == null) {
                      int cfg = getConfig(poolName);
                      pool = QueueingThreadPoolExecutor.createInstance(poolName, cfg);
                      ((ThreadPoolExecutor) pool).setKeepAliveTime(THREAD_TIMEOUT, TimeUnit.SECONDS);
                      ((ThreadPoolExecutor) pool).allowCoreThreadTimeOut(true);
                      pools.put(poolName, pool);
                      LOGGER.debug("Created thread pool '{}' with size {}", poolName, cfg);
                  }
              }
          }
          return pool;
      }
focal_method.class_method_signature: ThreadPoolManager.getPool(String poolName)
focal_method.full_signature: public static ExecutorService getPool(String poolName)
focal_method.identifier: getPool
focal_method.invocations: get get getConfig createInstance setKeepAliveTime allowCoreThreadTimeOut put debug
focal_method.modifiers: public static
focal_method.parameters: (String poolName)
focal_method.return: ExecutorService
focal_method.signature: ExecutorService getPool(String poolName)