Package java.util

Examples of java.util.Queue


    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void testTransformedQueue_decorateTransform() {
        final Queue originalQueue = new LinkedList();
        final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
        for (final Object el : els) {
            originalQueue.add(el);
        }
        final Queue<?> queue = TransformedQueue.transformedQueue(originalQueue,
                TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
        assertEquals(els.length, queue.size());
        for (final Object el : els) {
View Full Code Here


    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void testTransformedQueue_decorateTransform() {
        final Queue originalQueue = new LinkedList();
        final Object[] elements = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
        Collections.addAll(originalQueue, elements);
        final Queue<?> queue = TransformedQueue.transformedQueue(originalQueue,
                TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
        assertEquals(elements.length, queue.size());
View Full Code Here

            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);
            Exception e = (Exception)exceptions.remove();
View Full Code Here

     * @throws Exception
     */
    protected Object doExecute() throws Exception {
        JaasRealm realm = (JaasRealm) session.get(JAAS_REALM);
        AppConfigurationEntry entry = (AppConfigurationEntry) session.get(JAAS_ENTRY);
        Queue commandQueue = (Queue) session.get(JAAS_CMDS);

        if (realm != null && entry != null) {
            if (commandQueue != null) {
                commandQueue.add(this);
            }
        } else {
            System.err.println("No JAAS Realm / Module has been selected.");
        }
        return null;
View Full Code Here

     * @throws Exception
     */
    protected Object doExecute() throws Exception {
        JaasRealm realm = (JaasRealm) session.get(JAAS_REALM);
        AppConfigurationEntry entry = (AppConfigurationEntry) session.get(JAAS_ENTRY);
        Queue commandQueue = (Queue) session.get(JAAS_CMDS);

        if (realm != null && entry != null) {
            if (commandQueue != null) {
                commandQueue.add(this);
            }
        } else {
            System.err.println("No JAAS Realm / Module has been selected.");
        }
        return null;
View Full Code Here

    }

    public static void readActionQueue(MarshallerReaderContext context) throws IOException, ClassNotFoundException {
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;
        Queue actionQueue = wm.getActionQueue();
        while ( context.readShort() == PersisterEnums.WORKING_MEMORY_ACTION ) {
            actionQueue.offer( PersisterHelper.readWorkingMemoryAction( context ) );
        }
    }
View Full Code Here

     *
     * @return the queue of messages, or if none existed, a new queue
     * @throws AsynchronousCommandException
     */
    synchronized Queue getQueue() throws AsynchronousCommandException {
        Queue queue;
        Ehcache cache = getMessageCache();
        Element element;
        try {
            element = cache.get(QUEUE_KEY);
        } catch (CacheException e) {
View Full Code Here

        notifyAll();
        return uid;
    }

    private void enqueue(String uid) throws AsynchronousCommandException {
        Queue queue;
        queue = getQueue();
        queue.add(uid);
    }
View Full Code Here

     */
    private synchronized void executeCommands() {
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("executeCommands invoked. " + countCachedPublishCommands() + " messages to be sent.");
        }
        Queue queue = null;
        InstrumentedCommand instrumentedCommand = null;
        try {
            queue = getQueue();
        } catch (AsynchronousCommandException e) {
            LOG.log(Level.SEVERE, "Unable to access the cache to retrieve commands. ", e);
        }
        Object object = null;
        while (true) {
            object = queue.peek();
            if (object == null) {
                break;
            }
            String uid = (String) object;
            try {
View Full Code Here

    /**
     * offer(null) throws NullPointerException
     */
    public void testOfferNull() {
        final Queue q = emptyCollection();
        try {
            q.offer(null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

TOP

Related Classes of 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.