com.caucho.jms.queue
Class JmsBlockingQueue

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue
          extended by com.caucho.jms.queue.JmsBlockingQueue
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.concurrent.BlockingQueue, java.util.Queue

public class JmsBlockingQueue
extends java.util.AbstractQueue
implements java.util.concurrent.BlockingQueue

Wrapper around a JMS destination


Constructor Summary
JmsBlockingQueue()
           
JmsBlockingQueue(ConnectionFactory factory, Destination destination)
           
 
Method Summary
 void close()
           
 boolean contains(java.lang.Object obj)
           
 int drainTo(java.util.Collection c)
           
 int drainTo(java.util.Collection c, int max)
           
protected  MessageConsumer getReadConsumer()
           
protected  MessageProducer getWriteProducer()
           
 void init()
           
 java.util.Iterator iterator()
           
 boolean offer(java.lang.Object value)
           
 boolean offer(java.lang.Object value, long timeout, java.util.concurrent.TimeUnit unit)
          Adds the item to the queue, waiting if necessary
 java.lang.Object peek()
           
 java.lang.Object poll()
           
 java.lang.Object poll(long timeout, java.util.concurrent.TimeUnit unit)
           
 void put(java.lang.Object value)
           
 int remainingCapacity()
           
 boolean remove(java.lang.Object obj)
           
 void setDestination(Destination destination)
           
 void setFactory(ConnectionFactory factory)
           
 int size()
           
 java.lang.Object take()
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.AbstractQueue
add, addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.BlockingQueue
add
 
Methods inherited from interface java.util.Queue
element, remove
 
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

JmsBlockingQueue

public JmsBlockingQueue()

JmsBlockingQueue

public JmsBlockingQueue(ConnectionFactory factory,
                        Destination destination)
Method Detail

setFactory

public void setFactory(ConnectionFactory factory)

setDestination

public void setDestination(Destination destination)

init

@PostConstruct
public void init()

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in class java.util.AbstractCollection

contains

public boolean contains(java.lang.Object obj)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.concurrent.BlockingQueue
Overrides:
contains in class java.util.AbstractCollection

remove

public boolean remove(java.lang.Object obj)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.concurrent.BlockingQueue
Overrides:
remove in class java.util.AbstractCollection

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

offer

public boolean offer(java.lang.Object value,
                     long timeout,
                     java.util.concurrent.TimeUnit unit)
Adds the item to the queue, waiting if necessary

Specified by:
offer in interface java.util.concurrent.BlockingQueue

poll

public java.lang.Object poll(long timeout,
                             java.util.concurrent.TimeUnit unit)
Specified by:
poll in interface java.util.concurrent.BlockingQueue

offer

public boolean offer(java.lang.Object value)
Specified by:
offer in interface java.util.concurrent.BlockingQueue
Specified by:
offer in interface java.util.Queue

put

public void put(java.lang.Object value)
Specified by:
put in interface java.util.concurrent.BlockingQueue

remainingCapacity

public int remainingCapacity()
Specified by:
remainingCapacity in interface java.util.concurrent.BlockingQueue

peek

public java.lang.Object peek()
Specified by:
peek in interface java.util.Queue

poll

public java.lang.Object poll()
Specified by:
poll in interface java.util.Queue

take

public java.lang.Object take()
Specified by:
take in interface java.util.concurrent.BlockingQueue

drainTo

public int drainTo(java.util.Collection c)
Specified by:
drainTo in interface java.util.concurrent.BlockingQueue

drainTo

public int drainTo(java.util.Collection c,
                   int max)
Specified by:
drainTo in interface java.util.concurrent.BlockingQueue

getWriteProducer

protected MessageProducer getWriteProducer()
                                    throws JMSException
Throws:
JMSException

getReadConsumer

protected MessageConsumer getReadConsumer()
                                   throws JMSException
Throws:
JMSException

close

public void close()

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection