Examples of allowCoreThreadTimeOut()


Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

            DEFAULT_MAXIMUM_THREADS_PER_VOLUME),
          THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
          new LinkedBlockingQueue<Runnable>(), threadFactory);

      // This can reduce the number of running threads
      executor.allowCoreThreadTimeOut(true);
      synchronized (this) {
        executors.put(vol, executor);
      }
    }
   
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

            final ThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup(getThreadGroupName()), Boolean.FALSE, null, "%G - %t", null, null, AccessController.getContext());
            final ThreadPoolExecutor executorService = new ThreadPoolExecutor(POOL_CORE_SIZE, POOL_MAX_SIZE,
                                                            60L, TimeUnit.SECONDS, workQueue,
                                                            threadFactory);
            // Allow the core threads to time out as well
            executorService.allowCoreThreadTimeOut(true);
            getExecutorInjector().inject(executorService);
        }
    }

    /** {@inheritDoc} */
 
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

          CORE_THREADS_PER_VOLUME, MAXIMUM_THREADS_PER_VOLUME,
          THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
          new LinkedBlockingQueue<Runnable>(), threadFactory);

      // This can reduce the number of running threads
      executor.allowCoreThreadTimeOut(true);
      executors.put(vol, executor);
    }
   
  }
 
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

  private static synchronized ExecutorService getThreadPool(Master master) {
    if (threadPool == null) {
      int threadPoolSize = master.getSystemConfiguration().getCount(Property.MASTER_BULK_THREADPOOL_SIZE);
      ThreadPoolExecutor pool = new SimpleThreadPool(threadPoolSize, "bulk import");
      pool.allowCoreThreadTimeOut(true);
      threadPool = new TraceExecutorService(pool);
    }
    return threadPool;
  }
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

        int keepAliveTime = HBaseUtils.getConfiguration().getInt(COMMAND_PARALLEL_KEEP_ALIVE_TIME,
                DEFAULT_COMMAND_PARALLEL_KEEP_ALIVE_TIME);

        ThreadPoolExecutor pool = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.SECONDS,
                new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory(CommandParallel.class.getSimpleName()));
        pool.allowCoreThreadTimeOut(true);

        return pool;
    }

    public static ThreadPoolExecutor getThreadPoolExecutor() {
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

                maxThreads,
                keepAliveTime,
                TimeUnit.SECONDS,
                workQueue,
                Threads.newDaemonThreadFactory(toString() + "-shared-"));
            tpe.allowCoreThreadTimeOut(true);
            this.batchPool = tpe;
          }
          this.cleanupPool = true;
        }
      }
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

            final ThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup(getThreadGroupName()), Boolean.FALSE, null, "%G - %t", null, null, AccessController.getContext());
            final ThreadPoolExecutor executorService = new ThreadPoolExecutor(POOL_CORE_SIZE, POOL_MAX_SIZE,
                                                            60L, TimeUnit.SECONDS, workQueue,
                                                            threadFactory);
            // Allow the core threads to time out as well
            executorService.allowCoreThreadTimeOut(true);
            getExecutorInjector().inject(executorService);
        }
    }

    /** {@inheritDoc} */
 
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

      ThreadFactory threadFactory) {
    ThreadPoolExecutor boundedCachedThreadPool =
      new ThreadPoolExecutor(maxCachedThread, maxCachedThread, timeout,
        TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory);
    // allow the core pool threads timeout and terminate
    boundedCachedThreadPool.allowCoreThreadTimeOut(true);
    return boundedCachedThreadPool;
  }


  /**
 
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

    // it also scales when new region servers are added.
    ThreadPoolExecutor pool = new ThreadPoolExecutor(1, maxThreads,
        keepAliveTime, TimeUnit.SECONDS,
        new SynchronousQueue<Runnable>(),
        Threads.newDaemonThreadFactory("hbase-table"));
    pool.allowCoreThreadTimeOut(true);
    return pool;
  }

  /**
   * Creates an object to access a HBase table.
View Full Code Here

Examples of java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut()

            private String createName() {
                return "oak-executor-" + counter.getAndIncrement();
            }
        });
        executor.setKeepAliveTime(1, TimeUnit.MINUTES);
        executor.allowCoreThreadTimeOut(true);
        return executor;
    }

    private MBeanServer mbeanServer;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.