Package java.util.concurrent

Examples of java.util.concurrent.LinkedBlockingQueue.poll()


      int numberOfProducers = SeveralClientsStressTest.NUMBER_OF_PRODUCERS;
      int numberOfConsumers = SeveralClientsStressTest.NUMBER_OF_CONSUMERS;

      while (threads.size() > 0)
      {
         SeveralClientsStressTest.InternalMessage msg = (SeveralClientsStressTest.InternalMessage)testChannel.poll(2000,
                                                                                                                   TimeUnit.MILLISECONDS);

         log.info("Produced:" + SeveralClientsStressTest.producedMessages.get() +
                  " and Consumed:" +
                  SeveralClientsStressTest.readMessages.get() +
View Full Code Here


            return result;
        }
        LinkedBlockingQueue aQueue = entry.getQueue();
        //block and wait for result until timeout
        try {
            result = (ReplicationState)aQueue.poll(waitTime, TimeUnit.MILLISECONDS);
        } catch (InterruptedException ex) {
            // FIXME evaluate logging level
            if (_logger.isLoggable(Level.FINE)){
                _logger.log(Level.FINE, "ReplicationResponseRepository>>getEntry timed out", ex);
            }
View Full Code Here

      int numberOfProducers = SeveralClientsStressTest.NUMBER_OF_PRODUCERS;
      int numberOfConsumers = SeveralClientsStressTest.NUMBER_OF_CONSUMERS;

      while (threads.size() > 0)
      {
         SeveralClientsStressTest.InternalMessage msg = (SeveralClientsStressTest.InternalMessage)testChannel.poll(2000,
                                                                                                                   TimeUnit.MILLISECONDS);

         log.info("Produced:" + SeveralClientsStressTest.producedMessages.get() +
                  " and Consumed:" +
                  SeveralClientsStressTest.readMessages.get() +
View Full Code Here

        LinkedBlockingQueue q = new LinkedBlockingQueue();
    eventBus.enableCatchAllSubscriber(q);
    eventBus.publish(new Event("name", 1));
        assertEquals("No event enqueued to catch all subscriber.", 1, testAwareQueue.offeredCount.get());
        assertNotNull("No event enqueued to catch all subscriber sink under 1 second.", q.poll(1, TimeUnit.SECONDS));
        eventBus.disableCatchAllSubscriber();
        q.clear();
        testAwareQueue.offeredCount.set(0);

        eventBus.publish(new Event("name", 1));
View Full Code Here

        q.clear();
        testAwareQueue.offeredCount.set(0);

        eventBus.publish(new Event("name", 1));
        assertEquals("Event enqueued to catch all subscriber after disable.", 0, testAwareQueue.offeredCount.get());
        assertNull("Event enqueued to catch all subscriber sink under 1 second after disable.", q.poll(1, TimeUnit.SECONDS));
    }

  @Test
  public void testUnFilteredEventsWillBeDelivered() throws InvalidSubscriberException {
    EventBusImpl bus = eventBus;
View Full Code Here

                return offered;
            }

            @Override
            public Object nonBlockingTake() {
                Object retrievedItem = delegate.poll();
                if (null != retrievedItem) {
                    queueSizeCounter.decrementAndGet();
                }
                return retrievedItem;
            }
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.