Package java.util.concurrent

Examples of java.util.concurrent.ArrayBlockingQueue


        _rawSelectorFieldTable = rawSelectorFieldTable;
        _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


    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

    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

    * 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

    * 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

      frame.setResizable(true);
   }

   public InfinispanDemo(String cfgFileName) {
      asyncExecutor = Executors.newFixedThreadPool(1);
      tableUpdateExecutor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new ArrayBlockingQueue(1),
            new ThreadPoolExecutor.DiscardPolicy());

      cacheConfigFile = cfgFileName;
      cacheStatusProgressBar.setVisible(false);
      cacheStatusProgressBar.setEnabled(false);
View Full Code Here

      frame.setResizable(true);
   }

   public InfinispanDemo(String cfgFileName) {
      asyncExecutor = Executors.newFixedThreadPool(1);
      tableUpdateExecutor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new ArrayBlockingQueue(1),
            new ThreadPoolExecutor.DiscardPolicy());

      cacheConfigFile = cfgFileName;
      cacheStatusProgressBar.setVisible(false);
      cacheStatusProgressBar.setEnabled(false);
View Full Code Here

        assertEquals(k * k, count.get());
    }

    @Test
    public void testIssue292() throws Exception {
        final BlockingQueue qResponse = new ArrayBlockingQueue(1);
        createSingleNodeExecutorService("testIssue292").submit(new MemberCheck(), new ExecutionCallback<Member>() {
            public void onResponse(Member response) {
                qResponse.offer(response);
            }

            public void onFailure(Throwable t) {
            }
        });
        Object response = qResponse.poll(10, TimeUnit.SECONDS);
        assertNotNull(response);
        assertTrue(response instanceof Member);
    }
View Full Code Here

  public AsyncWriter(Writer out,int queueCapacity) {
    this(out,queueCapacity,Thread.NORM_PRIORITY + 1);
  }
 
  public AsyncWriter(Writer out,int queueCapacity,int dataProcesserThreadPriority) {
    this(out,new ArrayBlockingQueue(queueCapacity),dataProcesserThreadPriority);
  }
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(thread);
        ExecutorService executor = new ThreadPoolExecutor(thread,
            thread,
            60,
            TimeUnit.SECONDS,
            new ArrayBlockingQueue(thread * 2),
            new NamedThreadFactory("load"),
            new ThreadPoolExecutor.CallerRunsPolicy());

        for (int sec = 0; sec < minute * 60; sec++) {
            // 执行秒循环
View Full Code Here

TOP

Related Classes of java.util.concurrent.ArrayBlockingQueue

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.