Package org.jgroups.util

Examples of org.jgroups.util.Queue.peek()


        final Queue queue=new Queue();
        queue.add("Q1");
        queue.add("Q2");
        queue.add("Q3");

        assert queue.peek().equals("Q1");
        assert queue.remove().equals("Q1");

        assert queue.peek().equals("Q2");
        assert queue.remove().equals("Q2");
        queue.add("Q5");
View Full Code Here


        queue.add("Q3");

        assert queue.peek().equals("Q1");
        assert queue.remove().equals("Q1");

        assert queue.peek().equals("Q2");
        assert queue.remove().equals("Q2");
        queue.add("Q5");

        queue.close(true);
View Full Code Here

        }

        int size=queue.size();
        queue.removeElement("Q5");
        assert queue.size() == size -1;
        assert queue.peek().equals("Q3");
        assert queue.remove().equals("Q3");
        assert queue.closed();
    }

View Full Code Here

        assert queue.getLast().equals(queue.getFirst());

        queue.add(s2);
        assert queue.getFirst() != queue.getLast();

        Object o1=queue.peek();
        Object o2=queue.getFirst();

        System.out.println("o1=" + o1 + ", o2=" + o2 + ", o1.equals(o2)=" + o1.equals(o2));

        assert queue.getFirst().equals(queue.peek());
View Full Code Here

        Object o1=queue.peek();
        Object o2=queue.getFirst();

        System.out.println("o1=" + o1 + ", o2=" + o2 + ", o1.equals(o2)=" + o1.equals(o2));

        assert queue.getFirst().equals(queue.peek());
        queue.remove();

        assert queue.size() == 1;
        assert queue.getLast().equals(queue.getFirst());
        queue.remove();
View Full Code Here

    public static void testWaitUntilClosed2() {
        final Queue queue=new Queue();
        queue.close(true);
        try {
            queue.peek();
            assert false : "peek() should throw a QueueClosedException";
        }
        catch(QueueClosedException e) {
            assert e != null;
        }
View Full Code Here

    public static void testWaitUntilClosed3() throws QueueClosedException {
        final Queue queue=new Queue();
        queue.add("one");
        queue.close(true);
        Object obj=queue.peek();
        assert obj.equals("one");
        assert queue.size() == 1;
        queue.remove();
        try {
            queue.peek();
View Full Code Here

        Object obj=queue.peek();
        assert obj.equals("one");
        assert queue.size() == 1;
        queue.remove();
        try {
            queue.peek();
            assert false : "peek() should throw a QueueClosedException";
        }
        catch(QueueClosedException e) {
            assert e != null;
        }
View Full Code Here

        final Queue queue=new Queue();
        queue.add("Q1");
        queue.add("Q2");
        queue.add("Q3");

        assert queue.peek().equals("Q1");
        assert queue.remove().equals("Q1");

        assert queue.peek().equals("Q2");
        assert queue.remove().equals("Q2");
        queue.add("Q5");
View Full Code Here

        queue.add("Q3");

        assert queue.peek().equals("Q1");
        assert queue.remove().equals("Q1");

        assert queue.peek().equals("Q2");
        assert queue.remove().equals("Q2");
        queue.add("Q5");

        queue.close(true);
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.