Examples of ArrayBlockingQueue


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

    * 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

Examples of java.util.concurrent.ArrayBlockingQueue

        _arguments = arguments;
        _prefetchHigh = prefetchHigh;
        _prefetchLow = prefetchLow;
        _exclusive = exclusive;

        _synchronousQueue = new ArrayBlockingQueue(prefetchHigh, true);
        _autoClose = autoClose;
        _noConsume = noConsume;

        // Force queue browsers not to use acknowledge modes.
        if (_noConsume)
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

        _rawSelectorFieldTable = rawSelectorFieldTable;
        _prefetchHigh = prefetchHigh;
        _prefetchLow = prefetchLow;
        _exclusive = exclusive;
        _acknowledgeMode = acknowledgeMode;
        _synchronousQueue = new ArrayBlockingQueue(prefetchHigh, true);
        _autoClose = autoClose;
        _noConsume = noConsume;

        // Force queue browsers not to use acknowledge modes.
        if (_noConsume)
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

            return answer;
        }
    }

    protected BlockingQueueTransport createTransportChannel() {
        return new BlockingQueueTransport(new ArrayBlockingQueue(10));
    }
View Full Code Here

Examples of java.util.concurrent.ArrayBlockingQueue

    public RequestThreadPoolExecutor()
    {
        super(DatabaseDescriptor.getNativeTransportMinThreads(),
              DatabaseDescriptor.getNativeTransportMaxThreads(),
              CORE_THREAD_TIMEOUT_SEC, TimeUnit.SECONDS,
              new ArrayBlockingQueue(32), // Seems to help smooth latency compared to SynchronousQueue.
              new NamedThreadFactory("Native-Transport-Requests"));
    }
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 SAXParserFactoryImpl();
        factory.setNamespaceAware(true);
        for (int i=0; i < capacity; i++) {
           try {
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

        }
    }

    public void afterPropertiesSet() throws Exception {
        executor = new ThreadPoolExecutor(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS,
                                          new ArrayBlockingQueue(poolSize * 4), new NamedThreadFactory(name),
                                          new ThreadPoolExecutor.CallerRunsPolicy());
    }
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
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.