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, java.lang.Iterable, java.util.Collection

public class JmsQueue
extends java.util.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(java.lang.Object element)
           
 void clear()
           
 void close()
           
 boolean contains(java.lang.Object element)
          This method could be quite slow for huge queues as this method may have to iterate through the entire queue
 boolean containsAll(java.util.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(java.util.Collection coll)
           
 int drainTo(java.util.Collection coll, int maximumElements)
           
 java.lang.Object element()
           
protected  boolean equals(java.lang.Object element, java.lang.Object value)
          returns true if both values are null or identical or equal to each other
protected  JmsClient getJmsClient()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean offer(java.lang.Object element)
           
 boolean offer(java.lang.Object element, long timeout, edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
           
 java.lang.Object peek()
           
 java.lang.Object poll()
           
 java.lang.Object poll(long timeout, edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
           
 void put(java.lang.Object element)
           
 int remainingCapacity()
           
 java.lang.Object remove()
           
 boolean removeAll(java.util.Collection coll)
           
 boolean retainAll(java.util.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.
 java.lang.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 java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in class java.util.AbstractCollection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Overrides:
isEmpty in class java.util.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 java.util.Collection
Specified by:
size in class java.util.AbstractCollection

contains

public boolean contains(java.lang.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 java.util.Collection
Overrides:
contains in class java.util.AbstractCollection

containsAll

public boolean containsAll(java.util.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 java.util.Collection
Overrides:
containsAll in class java.util.AbstractCollection

add

public boolean add(java.lang.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 java.util.Collection
Overrides:
add in class java.util.AbstractCollection

offer

public boolean offer(java.lang.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 java.lang.Object remove()
Specified by:
remove in interface edu.emory.mathcs.backport.java.util.Queue

poll

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

element

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

peek

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

put

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

offer

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

take

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

poll

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

remainingCapacity

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

drainTo

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

drainTo

public int drainTo(java.util.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 java.util.Collection
Overrides:
clear in class java.util.AbstractCollection

removeAll

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

retainAll

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

close

public void close()

getJmsClient

protected JmsClient getJmsClient()

equals

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



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