Package java.util.concurrent

Examples of java.util.concurrent.ArrayBlockingQueue$Itrs


    }
}

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


    * 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

    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

    private final BlockingQueue<Message> queue;

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

    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

@Beta
public final class Queues
{
  public static ArrayBlockingQueue newArrayBlockingQueue(int paramInt)
  {
    return new ArrayBlockingQueue(paramInt);
  }
View Full Code Here

  private boolean isStartd = false;
  OutputStream output;
  BlockingQueue queue;
 
  public AsyncOutputStream(OutputStream output) {
    this(output,new ArrayBlockingQueue(50000));
  }
View Full Code Here

    * 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.tracef("Skipping address: %s", address);
         }
      }
View Full Code Here

public class ExtasysThreadPool extends ThreadPoolExecutor
{

    public ExtasysThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit)
    {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, new ArrayBlockingQueue(500000, true));
        this.prestartAllCoreThreads();
    }
View Full Code Here

                } else {
                    return (Collection) converter.instanceOfType();
                }
            } else if (Queue.class.isAssignableFrom(parameterType)) {
                if (ArrayBlockingQueue.class.isAssignableFrom(parameterType)) {
                    return new ArrayBlockingQueue(100);
                }
                return (Collection) (parameterType.isInterface()
                    || Modifier.isAbstract(parameterType.getModifiers()) ? new LinkedBlockingQueue()
                    : parameterType.newInstance());
            } else if (Collection.class.isAssignableFrom(parameterType)) {
View Full Code Here

TOP

Related Classes of java.util.concurrent.ArrayBlockingQueue$Itrs

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.