Package EDU.oswego.cs.dl.util.concurrent

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


        {
            throw new IllegalStateException( "ThreadManager is already initailized" );
        }

        final int maxPoolSize = Math.max(( m_processors * m_threadsPerProcessor ) + 1, m_processors + 1);
        m_threadPool = new PooledExecutor( m_processors + 1 );
        m_threadPool.setMinimumPoolSize( 2 ); // at least two threads
        m_threadPool.setMaximumPoolSize( maxPoolSize );
        m_threadPool.waitWhenBlocked();
        m_threadPool.setThreadFactory( new ThreadFactory() {
            public Thread newThread(Runnable run) {
View Full Code Here


        EventHandler handler = pipeline.getEventHandler();
        List sourceList = new ArrayList(sources.length);

        for (int i = 0; i < sources.length; i++)
        {
            PooledExecutor threadPool = new PooledExecutor();
            threadPool.setMinimumPoolSize(1);
            threadPool.setMaximumPoolSize(m_maxThreadsPerPool);
            SourceRunner initRunner = new SourceRunner(sources[i], handler);

            try
            {
                threadPool.execute(initRunner);
            }
            catch ( InterruptedException e )
            {
            }
View Full Code Here

        if( isInitialized() )
        {
            throw new IllegalStateException( "ThreadManager is already initailized" );
        }

        m_threadPool = new PooledExecutor(( m_processors * m_threadsPerProcessor ) + 1);
        m_threadPool.setMinimumPoolSize( 2 ); // at least two threads
        m_threadPool.setKeepAliveTime( getSleepTime() );
        m_threadPool.waitWhenBlocked();

        if( null == getLogger() )
View Full Code Here

    protected PooledExecutor threadPool;
   
   
    public NetworkConnector(BrokerContainer brokerContainer) {
        this.brokerContainer = brokerContainer;
        this.threadPool = new PooledExecutor();
    }
View Full Code Here

    public void setGBeanContext(GBeanContext context) {
    }

    public void doStart() throws WaitingException, Exception {
        PooledExecutor p = new PooledExecutor();
        p.setKeepAliveTime(keepAliveTime);
        p.setMinimumPoolSize(minimumPoolSize);
        p.setMaximumPoolSize(maximumPoolSize);
        p.setThreadFactory(new ThreadFactory() {
            public Thread newThread(Runnable arg0) {
                return new Thread(arg0, poolName + " " + getNextWorkerID());
            }
        });
View Full Code Here

     * one.
     *
     * @param maxSize Maximum size of the work executor pool.
     */
    public WorkExecutorPoolImpl(int maxSize) {
        pooledExecutor = new PooledExecutor(new LinkedQueue(), maxSize);
        pooledExecutor.setMinimumPoolSize(maxSize);
        pooledExecutor.waitWhenBlocked();
    }
View Full Code Here

     * @param maxSize Maximum size of the work executor pool.
     */
    public WorkExecutorPoolImpl(
            Channel channel,
            int maxSize) {
        pooledExecutor = new PooledExecutor(channel, maxSize);
        pooledExecutor.setMinimumPoolSize(maxSize);
        pooledExecutor.waitWhenBlocked();
    }
View Full Code Here

     */
    synchronized public Executor getWorkManager() {
        if (workManager != null)
            return workManager;

        PooledExecutor p = new PooledExecutor();
        p.setKeepAliveTime(1000 * 30);
        p.setMinimumPoolSize(5);
        p.setMaximumPoolSize(Integer.MAX_VALUE);
        p.setThreadFactory(new ThreadFactory() {
            public Thread newThread(Runnable arg0) {
                return new Thread(arg0, "Remoting 'async' protocol worker " + getNextWorkerID());
            }
        });

View Full Code Here

     */
    public Processors(String aName, int aMinSize, int aMaxSize) {
        if ( null == aName ) {
            throw new IllegalArgumentException("Name is required.");
        }
        executor = new PooledExecutor();
        name = aName;
        executor.setThreadFactory(
            new ThreadFactory() {
                public Thread newThread(Runnable arg0) {
                    Thread thread = new Thread(arg0, name);
View Full Code Here

        // 1. Create a Selector
        selector=Selector.open();

        // Create a thread pool (Executor)
        executor=new PooledExecutor(MAX_THREAD_POOL_SIZE);

        for (Iterator it=mappings.keySet().iterator(); it.hasNext();) {
            key=(MyInetSocketAddress) it.next();
            value=(MyInetSocketAddress) mappings.get(key);
View Full Code Here

TOP

Related Classes of EDU.oswego.cs.dl.util.concurrent.PooledExecutor

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.