Examples of ThreadFactory


Examples of EDU.oswego.cs.dl.util.concurrent.ThreadFactory

        return clockDaemon;
    }

    public void doStart() throws Exception {
        clockDaemon = new ClockDaemon();
        clockDaemon.setThreadFactory(new ThreadFactory() {
            public Thread newThread(Runnable r) {
                Thread t = new Thread(r, poolName + " ");
                t.setDaemon(true);
                return t;
            }
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.ThreadFactory

   {
      PooledExecutor threadPool = new PooledExecutor(max_pool);
      threadPool.waitWhenBlocked();
      threadPool.setMinimumPoolSize(1);
      threadPool.setKeepAliveTime(pool_thread_keep_alive);
      threadPool.setThreadFactory(new ThreadFactory()
      {

         public Thread newThread(final Runnable command)
         {
            synchronized (poolLock)
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.ThreadFactory

        Properties      tmp=new Properties();

        if(output != null)
            this.output=new FileWriter(output, false);

        response_sender.setThreadFactory(new ThreadFactory() {
            public Thread newThread(Runnable runnable) {
                return new Thread(runnable, "Test.ResponseSender");
            }
        });
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.ThreadFactory

      long keepAlive = 30*1000;
        PooledExecutor executor = new PooledExecutor(5);
        executor.setMinimumPoolSize(1);
        executor.waitWhenBlocked();
        executor.setKeepAliveTime(keepAlive);
        executor.setThreadFactory(new ThreadFactory() {
            public Thread newThread(final Runnable command) {
              synchronized (poolLock) {
                    count++;
                }
                return new Thread("poolid=" +count) {
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory

        this.threadNamePrefix = threadNamePrefix;
       
        // Create the default filter
        defaultFilter = new ExecutorFilter();
        ThreadPoolExecutor tpe = ( ThreadPoolExecutor ) defaultFilter.getExecutor();
        final ThreadFactory originalThreadFactory = tpe.getThreadFactory();
        ThreadFactory newThreadFactory = new ThreadFactory()
        {
            private final AtomicInteger threadId = new AtomicInteger( 0 );

            public Thread newThread( Runnable runnable )
            {
View Full Code Here

Examples of io.fabric8.utils.ThreadFactory

        // only the download servlet has a thread pool
        if (threadMaximumPoolSize > 0) {
            // lets use a synchronous queue so it waits for the other threads to be available before handing over
            // we are waiting for the task to be done anyway in doGet so there is no point in having a worker queue
            executorService = new ThreadPoolExecutor(1, threadMaximumPoolSize, 60, TimeUnit.SECONDS,
                    new SynchronousQueue<Runnable>(), new ThreadFactory("MavenDownloadProxyServlet"));
            // lets allow core threads to timeout also, so if there is no download for a while then no threads is wasted
            executorService.allowCoreThreadTimeOut(true);
        }

        super.start();
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

    public ExecutionServiceDemo(String props, String name, int size) {
        this.props=props;
        this.name=name;
        queue=new ArrayDeque<Future<?>>();
        executor = Executors.newCachedThreadPool(new ThreadFactory() {
           
            @Override
            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r, "Consumer-" +
                    poolNumber.getAndIncrement());
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

   public TaskRunner(int numThreads)
   {
      final ThreadGroup tg = new ThreadGroup(Thread.currentThread().getThreadGroup(), "LoadGenerators");
      final AtomicInteger ai = new AtomicInteger(1);
      this.exec = Executors.newFixedThreadPool(numThreads, new ThreadFactory() {        
         public Thread newThread(Runnable r) {
            return new Thread(tg, r, "LoadGenerator-" + ai.getAndIncrement());
         }
      });
   }
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

            throw new IllegalArgumentException("rank < 0");
        if (rank >= size())
            throw new IllegalArgumentException("rank >= size");

        // Create daemon threads for running async communications
        executor = Executors.newCachedThreadPool(new ThreadFactory() {
            public Thread newThread(Runnable r) {
                Thread t = new Thread(r);
                t.setDaemon(true);
                return t;
            }
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

     * @param name     ${name} in the pattern name
     * @param daemon   whether the threads is daemon or not
     * @return the created pool
     */
    public static ScheduledExecutorService newScheduledThreadPool(final int poolSize, final String pattern, final String name, final boolean daemon) {
        return Executors.newScheduledThreadPool(poolSize, new ThreadFactory() {
            public Thread newThread(Runnable r) {
                Thread answer = new Thread(r, getThreadName(pattern, name));
                answer.setDaemon(daemon);
                return answer;
            }
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.