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

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


      passUp(new Event(Event.RESUME));
   }

   private PooledExecutor setupThreadPool()
   {
      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


                    if (closed.get()) {
                        socket.close();
                    }
                    else {
                        // have thread per channel for sending messages and a thread for receiving them
                        PooledExecutor executor = null;
                        if (useAsyncSend) {
                            executor = new PooledExecutor(new BoundedBuffer(maxOutstandingMessages), 1);
                        }
                        TcpTransportChannel channel = new TcpTransportChannel(wireFormat, socket, executor);
                        addClient(channel);
                    }
                }
View Full Code Here

        started = new SynchronizedBoolean(false);
        // there's not much point logging all exceptions, lets just keep a few around
        exceptionsList = new BoundedLinkedQueue(10);
        outboundLock = new Object();
        if (useAsyncSend) {
            executor = new PooledExecutor(new BoundedBuffer(1000), 1);
        }
    }
View Full Code Here

        closed = new SynchronizedBoolean(false);
        started = new SynchronizedBoolean(false);
        outboundLock = new Object();
        if (useAsyncSend) {
            executor = new PooledExecutor(new BoundedBuffer(1000), 1);
        }
    }
View Full Code Here

    public void testAsyncProxy() throws Exception {
        ExampleServer service = new ExampleServerImpl();
       
        // thread pool to execute tasks in
        PooledExecutor executor = new PooledExecutor(1);
       
        // async proxy
        ExampleServer proxy = (ExampleServer) AsyncProxy.createProxy(ExampleServer.class, service, executor);

        // lets make an async call
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

    private PooledExecutor executor;
    private ClassLoader classLoader;
    private ObjectName objectName;

    public ThreadPool(int poolSize, String poolName, long keepAliveTime, ClassLoader classLoader, String objectName) {
        PooledExecutor p = new PooledExecutor(poolSize);
        p.abortWhenBlocked();
        p.setKeepAliveTime(keepAliveTime);
        p.setMinimumPoolSize(poolSize);
        p.setThreadFactory(new ThreadPoolThreadFactory(poolName, classLoader));
        try {
            this.objectName = ObjectName.getInstance(objectName);
        } catch (MalformedObjectNameException e) {
            throw new IllegalStateException("Bad object name injected: "+e.getMessage());
        }
View Full Code Here

    public String getObjectName() {
        return objectName.getCanonicalName();
    }

    public void execute(Runnable command) throws InterruptedException {
        PooledExecutor p;
        synchronized(this) {
            p = executor;
        }
        if (p == null) {
            throw new IllegalStateException("ThreadPool has been stopped");
        }
        Runnable task = new ContextClassLoaderRunnable(command, classLoader);
        p.execute(task);
    }
View Full Code Here

    public void doStart() throws Exception {
    }

    public void doStop() throws Exception {
        PooledExecutor p;
        synchronized(this) {
            p = executor;
            executor = null;
            classLoader = null;
        }
        if (p != null) {
            p.shutdownNow();
        }
    }
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.