Package org.jgroups.util

Examples of org.jgroups.util.ThreadManagerThreadPoolExecutor


   
    protected ExecutorService createThreadPool(int min_threads,
      int max_threads, long keep_alive_time, String rejection_policy,
      BlockingQueue<Runnable> queue, final ThreadFactory factory) {

    ThreadPoolExecutor pool = new ThreadManagerThreadPoolExecutor(
        min_threads, max_threads, keep_alive_time,
        TimeUnit.MILLISECONDS, queue);
    pool.setThreadFactory(factory);

    // default
    RejectedExecutionHandler handler = new ThreadPoolExecutor.CallerRunsPolicy();
    if (rejection_policy != null) {
      if (rejection_policy.equals("abort"))
        handler = new ThreadPoolExecutor.AbortPolicy();
      else if (rejection_policy.equals("discard"))
        handler = new ThreadPoolExecutor.DiscardPolicy();
      else if (rejection_policy.equals("discardoldest"))
        handler = new ThreadPoolExecutor.DiscardOldestPolicy();
    }
    pool.setRejectedExecutionHandler(new ShutdownRejectedExecutionHandler(
        handler));

    return pool;
  }
View Full Code Here


    protected ExecutorService createThreadPool(int min_threads,
      int max_threads, long keep_alive_time, String rejection_policy,
      BlockingQueue<Runnable> queue, final ThreadFactory factory) {

    ThreadPoolExecutor pool = new ThreadManagerThreadPoolExecutor(
        min_threads, max_threads, keep_alive_time,
        TimeUnit.MILLISECONDS, queue);
    pool.setThreadFactory(factory);

    // default
    RejectedExecutionHandler handler = new ThreadPoolExecutor.CallerRunsPolicy();
    if (rejection_policy != null) {
      if (rejection_policy.equals("abort"))
        handler = new ThreadPoolExecutor.AbortPolicy();
      else if (rejection_policy.equals("discard"))
        handler = new ThreadPoolExecutor.DiscardPolicy();
      else if (rejection_policy.equals("discardoldest"))
        handler = new ThreadPoolExecutor.DiscardOldestPolicy();
    }
    pool.setRejectedExecutionHandler(new ShutdownRejectedExecutionHandler(
        handler));

    return pool;
  }
View Full Code Here

    protected ExecutorService createThreadPool(int min_threads,
      int max_threads, long keep_alive_time, String rejection_policy,
      BlockingQueue<Runnable> queue, final ThreadFactory factory) {

    ThreadPoolExecutor pool = new ThreadManagerThreadPoolExecutor(
        min_threads, max_threads, keep_alive_time,
        TimeUnit.MILLISECONDS, queue);
    pool.setThreadFactory(factory);

    // default
    RejectedExecutionHandler handler = new ThreadPoolExecutor.CallerRunsPolicy();
    if (rejection_policy != null) {
      if (rejection_policy.equals("abort"))
        handler = new ThreadPoolExecutor.AbortPolicy();
      else if (rejection_policy.equals("discard"))
        handler = new ThreadPoolExecutor.DiscardPolicy();
      else if (rejection_policy.equals("discardoldest"))
        handler = new ThreadPoolExecutor.DiscardOldestPolicy();
    }
    pool.setRejectedExecutionHandler(new ShutdownRejectedExecutionHandler(
        handler));

    return pool;
  }
View Full Code Here

TOP

Related Classes of org.jgroups.util.ThreadManagerThreadPoolExecutor

Copyright © 2018 www.massapicom. 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.