Examples of allowCoreThreadTimeOut()


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

        // aren't used when things are started lazily or from elsewhere.
        ThreadFactory threadFactory = new NamedThreadFactory(this.getName() + ".scheduler", muleContext.getExecutionClassLoader());
        ScheduledThreadPoolExecutor newExecutor = new ScheduledThreadPoolExecutor(4, threadFactory);
        newExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
        newExecutor.setKeepAliveTime(this.getReceiverThreadingProfile().getThreadTTL(), TimeUnit.MILLISECONDS);
        newExecutor.allowCoreThreadTimeOut(true);
        return newExecutor;
    }

    /**
     * Getter for property 'sessionHandler'.
View Full Code Here

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

    ThreadPoolExecutor executor;
    int nbcpu = Runtime.getRuntime().availableProcessors();
    executor = new ThreadPoolExecutor(nbcpu, 2 * nbcpu, 1,
        TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
    executor.prestartAllCoreThreads();
    executor.allowCoreThreadTimeOut(true);
    return executor;
  }

  /**
   * Stops the server.
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(volumes[v], executor);
    }
   
  }
 
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()

          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 String createName() {
                return "oak-executor-" + counter.getAndIncrement();
            }
        });
        executor.setKeepAliveTime(1, TimeUnit.MINUTES);
        executor.allowCoreThreadTimeOut(true);
        return executor;
    }

    private MBeanServer mbeanServer;
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

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()

      int maxThreads = 1;
      long keepAliveTime = 60;
      ThreadPoolExecutor pool = new ThreadPoolExecutor(1, maxThreads, keepAliveTime,
          TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
          Threads.newDaemonThreadFactory("hbase-table"));
      pool.allowCoreThreadTimeOut(true);
      return pool;
    }

    @Override
    public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit,
View Full Code Here

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

    public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
                minThreads, maxThreads,
                60L, TimeUnit.SECONDS,
                new ArrayBlockingQueue<Runnable>(queueSize));
        threadPoolExecutor.allowCoreThreadTimeOut(true);
        return threadPoolExecutor;
    }

}
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.