org.logicblaze.lingo.jms
Class JmsQueue

java.lang.Object
  extended by java.util.AbstractCollection
      extended by org.logicblaze.lingo.jms.JmsQueue
All Implemented Interfaces:
edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue, edu.emory.mathcs.backport.java.util.Queue, Iterable, Collection

public class JmsQueue
extends AbstractCollection
implements edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue

An implementation of the Queue interface which maps to a JMS Destination. Note that when you have finished using this object you should call the close() method to free up any resources.

Version:
$Revision$

Nested Class Summary
protected  class JmsQueue.JmsQueueIterator
           
 
Constructor Summary
JmsQueue(JmsClient jmsClient)
           
 
Method Summary
 boolean add(Object element)
           
 void clear()
           
 void close()
           
 boolean contains(Object element)
          This method could be quite slow for huge queues as this method may have to iterate through the entire queue
 boolean containsAll(Collection coll)
          This method could be quite slow for huge queues as this results in iterating through all of the available objects to count them.
 int drainTo(Collection coll)
           
 int drainTo(Collection coll, int maximumElements)
           
 Object element()
           
protected  boolean equals(Object element, Object value)
          returns true if both values are null or identical or equal to each other
protected  JmsClient getJmsClient()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean offer(Object element)
           
 boolean offer(Object element, long timeout, edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
           
 Object peek()
           
 Object poll()
           
 Object poll(long timeout, edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
           
 void put(Object element)
           
 int remainingCapacity()
           
 Object remove()
           
 boolean removeAll(Collection coll)
           
 boolean retainAll(Collection c)
           
 int size()
          This method could be quite slow for huge queues as this results in iterating through all of the available objects to count them.
 Object take()
           
 
Methods inherited from class java.util.AbstractCollection
addAll, remove, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
remove
 
Methods inherited from interface java.util.Collection
addAll, equals, hashCode, toArray, toArray
 

Constructor Detail

JmsQueue

public JmsQueue(JmsClient jmsClient)
Method Detail

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in class AbstractCollection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Overrides:
isEmpty in class AbstractCollection

size

public int size()
This method could be quite slow for huge queues as this results in iterating through all of the available objects to count them.

Specified by:
size in interface Collection
Specified by:
size in class AbstractCollection

contains

public boolean contains(Object element)
This method could be quite slow for huge queues as this method may have to iterate through the entire queue

Specified by:
contains in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Specified by:
contains in interface Collection
Overrides:
contains in class AbstractCollection

containsAll

public boolean containsAll(Collection coll)
This method could be quite slow for huge queues as this results in iterating through all of the available objects to count them.

Specified by:
containsAll in interface Collection
Overrides:
containsAll in class AbstractCollection

add

public boolean add(Object element)
Specified by:
add in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Specified by:
add in interface edu.emory.mathcs.backport.java.util.Queue
Specified by:
add in interface Collection
Overrides:
add in class AbstractCollection

offer

public boolean offer(Object element)
Specified by:
offer in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Specified by:
offer in interface edu.emory.mathcs.backport.java.util.Queue

remove

public Object remove()
Specified by:
remove in interface edu.emory.mathcs.backport.java.util.Queue

poll

public Object poll()
Specified by:
poll in interface edu.emory.mathcs.backport.java.util.Queue

element

public Object element()
Specified by:
element in interface edu.emory.mathcs.backport.java.util.Queue

peek

public Object peek()
Specified by:
peek in interface edu.emory.mathcs.backport.java.util.Queue

put

public void put(Object element)
         throws InterruptedException
Specified by:
put in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Throws:
InterruptedException

offer

public boolean offer(Object element,
                     long timeout,
                     edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
              throws InterruptedException
Specified by:
offer in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Throws:
InterruptedException

take

public Object take()
            throws InterruptedException
Specified by:
take in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Throws:
InterruptedException

poll

public Object poll(long timeout,
                   edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
            throws InterruptedException
Specified by:
poll in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
Throws:
InterruptedException

remainingCapacity

public int remainingCapacity()
Specified by:
remainingCapacity in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue

drainTo

public int drainTo(Collection coll)
Specified by:
drainTo in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue

drainTo

public int drainTo(Collection coll,
                   int maximumElements)
Specified by:
drainTo in interface edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue

clear

public void clear()
Specified by:
clear in interface Collection
Overrides:
clear in class AbstractCollection

removeAll

public boolean removeAll(Collection coll)
Specified by:
removeAll in interface Collection
Overrides:
removeAll in class AbstractCollection

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection
Overrides:
retainAll in class AbstractCollection

close

public void close()

getJmsClient

protected JmsClient getJmsClient()

equals

protected boolean equals(Object element,
                         Object value)
returns true if both values are null or identical or equal to each other



Copyright © 2012 LogicBlaze, Inc.. All Rights Reserved.