Examples of ArrayBlockingQueue


Examples of java.util.concurrent.ArrayBlockingQueue

    public void afterPropertiesSet() throws Exception {
        executor = new ThreadPoolExecutor(poolSize,
            poolSize,
            0L,
            TimeUnit.MILLISECONDS,
            new ArrayBlockingQueue(poolSize * 4),
            new NamedThreadFactory(WORKER_NAME),
            new ThreadPoolExecutor.CallerRunsPolicy());
    }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    public void afterPropertiesSet() throws Exception {
        executor = new ThreadPoolExecutor(poolSize,
            poolSize,
            0L,
            TimeUnit.MILLISECONDS,
            new ArrayBlockingQueue(poolSize * 4),
            new NamedThreadFactory(WORKER_NAME),
            new ThreadPoolExecutor.CallerRunsPolicy());
    }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    this( DEFAULT_BUFF_LENGHT, producersToWaitFor );
  }
 
  @SuppressWarnings("unchecked")
  public ProducerConsumerQueue( int queueLenght, int producersToWaitFor ) {
    queue = new ArrayBlockingQueue( queueLenght );
    this.producersToWaitFor = new AtomicInteger( producersToWaitFor );
  }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    this( DEFAULT_BUFF_LENGHT, producersToWaitFor );
  }

  @SuppressWarnings("unchecked")
  public ProducerConsumerQueue( int queueLenght, int producersToWaitFor ) {
    queue = new ArrayBlockingQueue( queueLenght );
    this.producersToWaitFor = new AtomicInteger( producersToWaitFor );
  }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    }

    public void afterPropertiesSet() throws Exception {
        if (executor == null) {// 初始化一个默认值
            executor = new ThreadPoolExecutor(poolSize, poolSize, 60, TimeUnit.SECONDS,
                                              new ArrayBlockingQueue(acceptCount), new NamedThreadFactory(name),
                                              new ThreadPoolExecutor.CallerRunsPolicy());
        }
    }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    }
}

public class ArrayBlockingQueueUsing {
    public static void main(String[] args) {
        BlockingQueue q = new ArrayBlockingQueue(100);
        Producer p = new Producer(q);
        Consumer c1 = new Consumer(q);
        Consumer c2 = new Consumer(q);
        new Thread(p).start();
        new Thread(c1).start();
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    * Important: this *MUST* be called with WL on {@link #address2key}.
    */
   private void addQueuesForAddresses(Collection<Address> addresses) {
      for (Address address : addresses) {
         if (interestedInAddress(address)) {
            address2key.put(address, new ArrayBlockingQueue(bufferSize));
         } else {
            if (log.isTraceEnabled())
               log.trace("Skipping address: " + address);
         }
      }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    this( DEFAULT_BUFF_LENGHT, producersToWaitFor );
  }
 
  @SuppressWarnings("unchecked")
  public ProducerConsumerQueue( int queueLenght, int producersToWaitFor ) {
    queue = new ArrayBlockingQueue( queueLenght );
    this.producersToWaitFor = new AtomicInteger( producersToWaitFor );
  }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    private final BlockingQueue<Message> queue;

    @JsonCreator
    public MemoryQueue4Sink(@JsonProperty("capacity") int capacity) {
        this.queue = new ArrayBlockingQueue(capacity);
    }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    private SAXParserFactory factory;
    private int capacity;

    public ParserPool(int capacity) {
        this.capacity = capacity;
        queue = new ArrayBlockingQueue(capacity);
        //factory = SAXParserFactory.newInstance();
        factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl();
        factory.setNamespaceAware(true);
        for (int i=0; i < capacity; i++) {
           try {
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.