Package edu.emory.mathcs.backport.java.util.concurrent

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


            return new DedicatedTaskRunner(task, name, priority, daemon);
        }
    }
   
    protected ExecutorService createDefaultExecutor() {
        ThreadPoolExecutor rc = new ThreadPoolExecutor(1, Integer.MAX_VALUE, 10, TimeUnit.SECONDS, new SynchronousQueue(), new ThreadFactory() {
            public Thread newThread(Runnable runnable) {
                Thread thread = new Thread(runnable, name);
                thread.setDaemon(daemon);
                thread.setPriority(priority);
                return thread;
View Full Code Here


  protected BlockingQueue createQueue(int queueCapacity) {
    if (queueCapacity > 0) {
      return new LinkedBlockingQueue(queueCapacity);
    }
    else {
      return new SynchronousQueue();
    }
  }
View Full Code Here

  protected BlockingQueue createQueue(int queueCapacity) {
    if (queueCapacity > 0) {
      return new LinkedBlockingQueue(queueCapacity);
    }
    else {
      return new SynchronousQueue();
    }
  }
View Full Code Here

    protected ThreadPoolExecutor createDefaultExecutor(final String name,
                                                       final int priority,
                                                       final boolean daemon) {
        ThreadPoolExecutor rc = new ThreadPoolExecutor(5, Integer.MAX_VALUE, 10,
                TimeUnit.SECONDS, new SynchronousQueue(),
                new edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory() {
            public Thread newThread(Runnable runnable) {
                Thread thread = new Thread(runnable, name);
                thread.setDaemon(daemon);
                thread.setPriority(priority);
View Full Code Here

    public ThreadPool(int poolSize, String poolName, long keepAliveTime, ClassLoader classLoader, String objectName) {
        ThreadPoolExecutor p = new ThreadPoolExecutor(
            poolSize, // core size
            poolSize, // max size
            keepAliveTime, TimeUnit.MILLISECONDS,
            new SynchronousQueue());

        p.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
        p.setThreadFactory(new ThreadPoolThreadFactory(poolName, classLoader));
       
        try {
View Full Code Here

        executor.shutdown();
    }

    protected ThreadPoolExecutor createDefaultExecutor(final String name, final int priority, final boolean daemon) {
        ThreadPoolExecutor rc = new ThreadPoolExecutor(5, Integer.MAX_VALUE, 10, TimeUnit.SECONDS, new SynchronousQueue(), new edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory() {
            public Thread newThread(Runnable runnable) {
                Thread thread = new Thread(runnable, name);
                thread.setDaemon(daemon);
                thread.setPriority(priority);
                return thread;
View Full Code Here

                                                       final int priority,
                                                       final boolean daemon) {
        ThreadPoolExecutor rc;
        if (maxPoolSize == Integer.MAX_VALUE) {
            rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10,
                    TimeUnit.SECONDS, new SynchronousQueue(),
                    new DefaultThreadFactory(name, daemon, priority));
        } else {
            rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10,
                    TimeUnit.SECONDS, new LinkedBlockingQueue(),
                    new DefaultThreadFactory(name, daemon, priority));
View Full Code Here

    protected Object createInstance() throws Exception {
        BlockingQueue queue = null;
        if (queueCapacity > 0) {
            queue = new LinkedBlockingQueue(queueCapacity);
        } else {
            queue = new SynchronousQueue();
        }
        return new ThreadPoolExecutor(corePoolSize, maxPoolSize,
                keepAliveSeconds, TimeUnit.SECONDS, queue, threadFactory,
                rejectedExecutionHandler);
    }
View Full Code Here

        {
            queue = new LinkedBlockingQueue( queueCapacity );
        }
        else
        {
            queue = new SynchronousQueue();
        }
        return new ThreadPoolExecutor(
                corePoolSize, maxPoolSize, keepAliveSeconds, TimeUnit.SECONDS,
                queue, threadFactory, rejectedExecutionHandler );
    }
View Full Code Here

*/
public class ExecutorThreadModelFactoryBeanTest extends TestCase
{
    public void testSuccessfulCreationWithExecutor() throws Exception
    {
        Executor executor = new ThreadPoolExecutor( 1, 10, 3600, TimeUnit.SECONDS, new SynchronousQueue() );
        ExecutorThreadModelFactoryBean factory = new  ExecutorThreadModelFactoryBean();
        factory.setServiceName( "foo" );
        factory.setExecutor( executor );
        factory.afterPropertiesSet();
        ExecutorThreadModel threadModel = ( ExecutorThreadModel ) factory.getObject();
View Full Code Here

TOP

Related Classes of edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue

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.