Package edu.emory.mathcs.backport.java.util

Examples of edu.emory.mathcs.backport.java.util.Queue


            info.setCommandId(commandId);

            transport.onCommand(info);
        }
       
        Queue exceptions = listener.getExceptions();
        Queue commands = listener.getCommands();
        if (expected) {
            if (!exceptions.isEmpty()) {
                Exception e = (Exception) exceptions.remove();
                e.printStackTrace();
                fail("Caught exception: " + e);
            }
            assertEquals("number of messages received", expectedCount, commands.size());
           
            assertEquals("Should have no buffered commands", 0, transport.getBufferedCommandCount());
                   }
        else {
            assertTrue("Should have received an exception!", exceptions.size() > 0);
View Full Code Here


                .getThreadGroup()))// can't block kernel thread
            throw new IllegalStateException("can't block kernel thread");
    }

    private Queue getQueue() {
        Queue queue = (Queue) local.get();
        if (queue == null) {
            queue = new LinkedList();
            local.set(queue);
        }
        return queue;
View Full Code Here

        }
        return queue;
    }

    public void dispatch(Session session, Runnable event) {
        Queue queue = getQueue();
        queue.add(event); // enqueue

        if (queue.size() == 1) {
            event.run();
            queue.poll(); // dequeue current runnable
            for (Runnable task = null; (task = (Runnable) queue.peek()) != null; queue
                    .poll())
                task.run();
        }
    }
View Full Code Here

TOP

Related Classes of edu.emory.mathcs.backport.java.util.Queue

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.