Examples of poll()


Examples of java.nio.file.WatchService.poll()

  public void testOpenWatchServicesClosed() throws IOException {
    WatchService ws1 = fs.newWatchService();
    WatchService ws2 = fs.newWatchService();

    assertNull(ws1.poll());
    assertNull(ws2.poll());

    fs.close();

    try {
      ws1.poll();
View Full Code Here

Examples of java.util.ArrayDeque.poll()

    @Test
    public void poll() throws Exception {
        ArrayDeque deque = create();
        assert deque.size() == 4;
        assert deque.poll().equals("1");
        assert deque.size() == 3;
        assert deque.pollFirst().equals("2");
        assert deque.size() == 2;
        assert deque.pollLast().equals("4");
        assert deque.size() == 1;
View Full Code Here

Examples of java.util.LinkedList.poll()

        Directory directory;

        // Try all of the directories in a breadth first order, hence the
        // reason for the queue to see if any of them can allocate a file.
        queue.add(root);
        while ((directory = (Directory) queue.poll()) != null) {
            File newFile = directory.allocateFile(queue);
            if (newFile != null) {
                return newFile;
            }
        }
View Full Code Here

Examples of java.util.PriorityQueue.poll()

    int n = methods.size();
    cachedMethods = new CachedMethod[n];
    for (int i = 0; i < n; i++) {
      CachedMethod cachedMethod = new CachedMethod();
      cachedMethod.method = methods.poll();

      // Store the serializer for each final parameter.
      Class[] parameterTypes = cachedMethod.method.getParameterTypes();
      cachedMethod.serializers = new Serializer[parameterTypes.length];
      for (int ii = 0, nn = parameterTypes.length; ii < nn; ii++)
View Full Code Here

Examples of java.util.Queue.poll()

        Directory directory;

        // Try all of the directories in a breadth first order, hence the
        // reason for the queue to see if any of them can allocate a file.
        queue.add(root);
        while ((directory = (Directory) queue.poll()) != null) {
            File newFile = directory.allocateFile(queue);
            if (newFile != null) {
                return newFile;
            }
        }
View Full Code Here

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

            }

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

    @Test
View Full Code Here

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

      try {
         maxNumberInvariant.readLock().lock();
         Object result;
         try {
            // first try to take an element without waiting
            result = queue.poll();
            if (result == null) {
               // there are no elements in the queue, make sure the producer is started
               keyProducerStartLatch.open();
               // our address might have been removed from the consistent hash
               if (!address.equals(getAddressForKey(address)))
View Full Code Here

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

        do {
            try {
                Runnable task;
                ConcurrentLinkedQueue tasks = m_tasks;

                while ((task = (Runnable) tasks.poll()) != null) {
                    runTask(task);
                }
            }
            finally {
                m_runningThread.set(null);
View Full Code Here

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

            }
        });

        // Wait at most half a second (TODO: Make this configurable)
        try {
            final Future<String> poll = ecs.poll(timeout, TimeUnit.MILLISECONDS);
            if (poll == null) return null;

            poll.get(timeout, TimeUnit.MILLISECONDS);

            return newClient;
View Full Code Here

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

    @Test
    public void testFIFO() {
        Queue q = new LinkedBlockingDeque();
        q.add("test");
        q.add("pest");
        assertEquals("test", q.poll());

        q = new LinkedBlockingQueue();
        q.add("test");
        q.add("pest");
        assertEquals("test", q.poll());
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.