Examples of ThreadPool


Examples of org.eclipse.jetty.util.thread.ThreadPool

    }
   
    protected void setupThreadPool() {
        AbstractConnector aconn = (AbstractConnector) connector;
        if (isSetThreadingParameters()) {
            ThreadPool pool = aconn.getThreadPool();
            if (pool == null) {
                pool = aconn.getServer().getThreadPool();
            }
            if (pool == null) {
                pool = new QueuedThreadPool();
                aconn.getServer().setThreadPool(pool);
                aconn.setThreadPool(pool);
            }
            //threads for the acceptors and selectors are taken from
            //the pool so we need to have room for those
            int acc = aconn.getAcceptors() * 2;
            if (getThreadingParameters().isSetMaxThreads()
                && getThreadingParameters().getMaxThreads() <= acc) {
                throw new Fault(new Message("NOT_ENOUGH_THREADS", LOG,
                                            port,
                                            acc + 1,
                                            getThreadingParameters().getMaxThreads(),
                                            acc));
            }
            if (pool instanceof QueuedThreadPool) {
                QueuedThreadPool pl = (QueuedThreadPool)pool;
                if (getThreadingParameters().isSetMinThreads()) {
                    pl.setMinThreads(getThreadingParameters().getMinThreads());
                }
                if (getThreadingParameters().isSetMaxThreads()) {
                    pl.setMaxThreads(getThreadingParameters().getMaxThreads());
                }
            } else {
                try {
                    if (getThreadingParameters().isSetMinThreads()) {
                        pool.getClass().getMethod("setMinThreads", Integer.TYPE)
                            .invoke(pool, getThreadingParameters().getMinThreads());
                    }
                    if (getThreadingParameters().isSetMaxThreads()) {
                        pool.getClass().getMethod("setMaxThreads", Integer.TYPE)
                            .invoke(pool, getThreadingParameters().getMaxThreads());
                    }
                } catch (Throwable t) {
                    //ignore - this won't happen for Jetty 7.1 - 7.2 and 7.3 and newer
                    //will be instanceof QueuedThreadPool above
View Full Code Here

Examples of org.eclipse.jetty.util.thread.ThreadPool

    }
   
    protected void setupThreadPool() {
        AbstractConnector aconn = (AbstractConnector) connector;
        if (isSetThreadingParameters()) {
            ThreadPool pool = aconn.getThreadPool();
            if (pool == null) {
                pool = new QueuedThreadPool();
                aconn.setThreadPool(pool);
            }
            if (pool instanceof QueuedThreadPool) {
                QueuedThreadPool pl = (QueuedThreadPool)pool;
                if (getThreadingParameters().isSetMinThreads()) {
                    pl.setMinThreads(getThreadingParameters().getMinThreads());
                }
                if (getThreadingParameters().isSetMaxThreads()) {
                    pl.setMaxThreads(getThreadingParameters().getMaxThreads());
                }
            } else {
                try {
                    if (getThreadingParameters().isSetMinThreads()) {
                        pool.getClass().getMethod("setMinThreads", Integer.TYPE)
                            .invoke(pool, getThreadingParameters().getMinThreads());
                    }
                    if (getThreadingParameters().isSetMinThreads()) {
                        pool.getClass().getMethod("setMaxThreads", Integer.TYPE)
                            .invoke(pool, getThreadingParameters().getMaxThreads());
                    }
                } catch (Throwable t) {
                    //ignore - this won't happen for Jetty 7.1 - 7.2 and 7.3 and newer
                    //will be instanceof QueuedThreadPool above
View Full Code Here

Examples of org.elasticsearch.threadpool.ThreadPool

        Store store = new ByteBufferStore(shardId, settings, null, new ByteBufferCache(settings));
//        Store store = new NioFsStore(shardId, settings);

        store.deleteContent();

        ThreadPool threadPool = new ThreadPool();
        SnapshotDeletionPolicy deletionPolicy = new SnapshotDeletionPolicy(new KeepOnlyLastDeletionPolicy(shardId, settings));
        Engine engine = new RobinEngine(shardId, settings, new ThreadPool(), new IndexSettingsService(shardId.index(), settings), store, deletionPolicy, new FsTranslog(shardId, EMPTY_SETTINGS, new File("work/fs-translog")), new LogByteSizeMergePolicyProvider(store, new IndexSettingsService(shardId.index(), EMPTY_SETTINGS)),
                new ConcurrentMergeSchedulerProvider(shardId, settings), new AnalysisService(shardId.index()), new SimilarityService(shardId.index()), new NoneBloomCache(shardId.index()));
        engine.start();

        SimpleEngineBenchmark benchmark = new SimpleEngineBenchmark(store, engine)
                .numberOfContentItems(1000)
                .searcherThreads(50).searcherIterations(10000)
                .writerThreads(10).writerIterations(10000)
                .refreshSchedule(new TimeValue(1, TimeUnit.SECONDS))
                .flushSchedule(new TimeValue(1, TimeUnit.MINUTES))
                .create(false)
                .build();

        benchmark.run();

        engine.close();
        store.close();
        threadPool.shutdown();
    }
View Full Code Here

Examples of org.fao.geonet.util.ThreadPool

        //------------------------------------------------------------------------
        //--- initialize thread pool

        logger.info("  - Thread Pool...");

        threadPool = new ThreadPool();

        //------------------------------------------------------------------------
        //--- initialize settings subsystem

        logger.info("  - Setting manager...");
View Full Code Here

Examples of org.glassfish.grizzly.config.dom.ThreadPool

        }
        if (!adminThreadPoolFound) {
            ConfigSupport.apply(new SingleConfigCode<ThreadPools>() {
                @Override
                public Object run(ThreadPools param) throws PropertyVetoException, TransactionFailure {
                    final ThreadPool pool = param.createChild(ThreadPool.class);
                    param.getThreadPool().add(pool);
                    pool.setName("admin-thread-pool");
                    pool.setMaxThreadPoolSize("50");
                    pool.setMaxQueueSize("256");
                    return null;
                }
            }, threadPools);
        }
    }
View Full Code Here

Examples of org.gudy.azureus2.core3.util.ThreadPool

   
    device = new NatPMPUPnPDevice();
   
    services = new UPnPService[]{ new NatPMPUPnPWANConnection() };
   
    thread_pool = new ThreadPool( "NatPMPUPnP", 1, true );
  }
View Full Code Here

Examples of org.jacorb.util.threadpool.ThreadPool

            logger.debug("Maximum connection threads: " + maxConnectionThreads);
            logger.debug("Maximum idle threads: " + maxIdleThreads);
        }

        pool =
            new ThreadPool( configuration,
                            threadNamePrefix,
                            new ConsumerFactory(){
                                public Consumer create()
                                {
                                    return new MessageReceptor(configuration);
View Full Code Here

Examples of org.jacorb.util.threadpool.ThreadPool

        catch (Exception e)
        {
            throw new ConfigurationException("Caught Exception", e);
        }

        stdout_pool = new ThreadPool( (org.jacorb.config.Configuration)myConfiguration, null,
                                      new OutputForwarderFactory( new InputStreamSelector(){
                                            public InputStream getInputStream( Process p )
                                            {
                                                return p.getInputStream();
                                            }
                                        }), //max threads
                                      100, 10 );//max idle threads

        stderr_pool = new ThreadPool( (org.jacorb.config.Configuration)myConfiguration, null,
                                      new OutputForwarderFactory( new InputStreamSelector(){
                                            public InputStream getInputStream( Process p )
                                            {
                                                return p.getErrorStream();
                                            }
View Full Code Here

Examples of org.jboss.util.threadpool.ThreadPool

      final Map internalSendPayload = sendPayload == null ? new HashMap() : sendPayload;
      internalSendPayload.put(ONEWAY_FLAG, "true");

      if (clientSide)
      {
         ThreadPool threadPool = getOnewayThreadPool();
         Runnable onewayRun = new Runnable()
         {
            public void run()
            {
               try
               {
                  invoke(param, internalSendPayload);
               }
               catch (Throwable e)
               {
                  // throw away exception since can't get it back to original caller
                  log.error("Error executing client oneway invocation request: " + param, e);
               }
            }
         };
         threadPool.run(onewayRun);
      }
      else
      {
         OnewayInvocation invocation = new OnewayInvocation(param);
         invoke(invocation, internalSendPayload);
View Full Code Here

Examples of org.jboss.util.threadpool.ThreadPool

        
         // BasicThreadPool timeout mechanism depends on the interrupted status of
         // the running thread.
         Thread.interrupted();
        
         ThreadPool pool = getTimeoutThreadPool();
         WaitingTaskWrapper wrapper = new WaitingTaskWrapper(r, simulatedTimeout);
         if (log.isTraceEnabled()) log.trace("starting task in thread pool");
         pool.runTaskWrapper(wrapper);
         if (log.isTraceEnabled()) log.trace("task finished in thread pool");
        
         Object result = resultHolder.value;
         if (result == null)
         {
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.