protected void init() { this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY); this.cache = initCache(null); try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, getObjectName()); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Returns a ThreadPoolExecutor with a fixed maximum number of threads, but whose * threads are terminated when idle for too long. * When all threads are actively executing tasks, new tasks are queued. * @param threadPoolName the name of the threads created by this executor * @param size the maximum number of threads for this executor * @param keepAliveTime the time an idle thread is kept alive before being terminated * @param unit tht time unit for {@code keepAliveTime} * @return the new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createWithMaximumPoolSize(String threadPoolName, int size, int keepAliveTime, TimeUnit unit) { return new DebuggableThreadPoolExecutor(size, Integer.MAX_VALUE, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }
protected void init() { this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY); this.cache = initCache(null); try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, getObjectName()); } catch (Exception e) { throw new RuntimeException(e); } }
protected void init() { this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY); this.cache = initCache(null); try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, getObjectName()); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Creates a thread pool that creates new threads as needed, but * will reuse previously constructed threads when they are * available. * @param threadPoolName the name of the threads created by this executor * @return The new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createCachedThreadpoolWithMaxSize(String threadPoolName) { return new DebuggableThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }
/** * Returns a ThreadPoolExecutor with a fixed maximum number of threads, but whose * threads are terminated when idle for too long. * When all threads are actively executing tasks, new tasks are queued. * @param threadPoolName the name of the threads created by this executor * @param size the maximum number of threads for this executor * @param keepAliveTime the time an idle thread is kept alive before being terminated * @param unit tht time unit for {@code keepAliveTime} * @return the new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createWithMaximumPoolSize(String threadPoolName, int size, int keepAliveTime, TimeUnit unit) { return new DebuggableThreadPoolExecutor(size, Integer.MAX_VALUE, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }
/** * Creates a thread pool that creates new threads as needed, but * will reuse previously constructed threads when they are * available. * @param threadPoolName the name of the threads created by this executor * @return The new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createCachedThreadpoolWithMaxSize(String threadPoolName) { return new DebuggableThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }
/** * Returns a ThreadPoolExecutor with a fixed maximum number of threads, but whose * threads are terminated when idle for too long. * When all threads are actively executing tasks, new tasks are queued. * @param threadPoolName the name of the threads created by this executor * @param size the maximum number of threads for this executor * @param keepAliveTime the time an idle thread is kept alive before being terminated * @param unit tht time unit for {@code keepAliveTime} * @return the new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createWithMaximumPoolSize(String threadPoolName, int size, int keepAliveTime, TimeUnit unit) { return new DebuggableThreadPoolExecutor(size, Integer.MAX_VALUE, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }
/** * Creates a thread pool that creates new threads as needed, but * will reuse previously constructed threads when they are * available. * @param threadPoolName the name of the threads created by this executor * @return The new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createCachedThreadpoolWithMaxSize(String threadPoolName) { return new DebuggableThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }
/** * Returns a ThreadPoolExecutor with a fixed maximum number of threads, but whose * threads are terminated when idle for too long. * When all threads are actively executing tasks, new tasks are queued. * @param threadPoolName the name of the threads created by this executor * @param size the maximum number of threads for this executor * @param keepAliveTime the time an idle thread is kept alive before being terminated * @param unit tht time unit for {@code keepAliveTime} * @return the new DebuggableThreadPoolExecutor */ public static DebuggableThreadPoolExecutor createWithMaximumPoolSize(String threadPoolName, int size, int keepAliveTime, TimeUnit unit) { return new DebuggableThreadPoolExecutor(size, Integer.MAX_VALUE, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(threadPoolName)); }