Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq
Class ActiveMQQueueBrowser  view ActiveMQQueueBrowser download ActiveMQQueueBrowser.java

java.lang.Object
  extended byorg.activemq.ActiveMQQueueBrowser
All Implemented Interfaces:
java.util.Enumeration, javax.jms.QueueBrowser

public class ActiveMQQueueBrowser
extends java.lang.Object
implements javax.jms.QueueBrowser, java.util.Enumeration

A client uses a QueueBrowser object to look at messages on a queue without removing them.

The getEnumeration method returns a java.util.Enumeration that is used to scan the queue's messages. It may be an enumeration of the entire content of a queue, or it may contain only the messages matching a message selector.

Messages may be arriving and expiring while the scan is done. The JMS API does not require the content of an enumeration to be a static snapshot of queue content. Whether these changes are visible or not depends on the JMS provider.

A QueueBrowser can be created from either a Session or a QueueSession.


Field Summary
private  boolean closed
           
private  int cnum
           
private  ActiveMQMessageConsumer consumer
           
private  org.activemq.message.ActiveMQQueue destination
           
private  java.lang.String selector
           
private  ActiveMQSession session
           
 
Constructor Summary
protected ActiveMQQueueBrowser(ActiveMQSession session, org.activemq.message.ActiveMQQueue destination, java.lang.String selector, int cnum)
          Constructor for an ActiveMQQueueBrowser - used internally
 
Method Summary
private  void checkClosed()
           
 void close()
           
private  ActiveMQMessageConsumer createConsumer()
           
private  void destroyConsumer()
           
 java.util.Enumeration getEnumeration()
          Gets an enumeration for browsing the current queue messages in the order they would be received.
 java.lang.String getMessageSelector()
           
 javax.jms.Queue getQueue()
          Gets the queue associated with this queue browser.
 boolean hasMoreElements()
          Tests whether there are elements remaining in the enumeration.
 java.lang.Object nextElement()
          Obtain the next element in the enumeration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

private final ActiveMQSession session

destination

private final org.activemq.message.ActiveMQQueue destination

selector

private final java.lang.String selector

cnum

private final int cnum

consumer

private ActiveMQMessageConsumer consumer

closed

private boolean closed
Constructor Detail

ActiveMQQueueBrowser

protected ActiveMQQueueBrowser(ActiveMQSession session,
                               org.activemq.message.ActiveMQQueue destination,
                               java.lang.String selector,
                               int cnum)
                        throws javax.jms.JMSException
Constructor for an ActiveMQQueueBrowser - used internally

Method Detail

createConsumer

private ActiveMQMessageConsumer createConsumer()
                                        throws javax.jms.JMSException

destroyConsumer

private void destroyConsumer()

getEnumeration

public java.util.Enumeration getEnumeration()
                                     throws javax.jms.JMSException
Gets an enumeration for browsing the current queue messages in the order they would be received.

Specified by:
getEnumeration in interface javax.jms.QueueBrowser

checkClosed

private void checkClosed()
                  throws javax.jms.IllegalStateException

hasMoreElements

public boolean hasMoreElements()
Description copied from interface: java.util.Enumeration
Tests whether there are elements remaining in the enumeration.

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Description copied from interface: java.util.Enumeration
Obtain the next element in the enumeration.

Specified by:
nextElement in interface java.util.Enumeration

close

public void close()
           throws javax.jms.JMSException
Specified by:
close in interface javax.jms.QueueBrowser

getQueue

public javax.jms.Queue getQueue()
                         throws javax.jms.JMSException
Gets the queue associated with this queue browser.

Specified by:
getQueue in interface javax.jms.QueueBrowser

getMessageSelector

public java.lang.String getMessageSelector()
                                    throws javax.jms.JMSException
Specified by:
getMessageSelector in interface javax.jms.QueueBrowser