com.caucho.jms.jdbc
Class JdbcQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by com.caucho.jms.queue.AbstractDestination<E>
              extended by com.caucho.jms.queue.AbstractQueue<E>
                  extended by com.caucho.jms.queue.PollingQueue<E>
                      extended by com.caucho.jms.jdbc.JdbcQueue<E>
All Implemented Interfaces:
HandleAware, MessageQueue<E>, AlarmListener, java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.EventListener, java.util.Queue<E>, Destination

public class JdbcQueue<E>
extends PollingQueue<E>

A jdbc queue.

See Also:
Serialized Form

Field Summary
protected  JdbcManager _jdbcManager
           
 
Constructor Summary
JdbcQueue()
           
 
Method Summary
 void commit(int session)
          Removes the first message matching the selector.
protected  int createDestination(java.lang.String name, boolean isTopic)
          Creates a queue.
 int getId()
          Returns the JDBC id for the queue.
 JdbcManager getJdbcManager()
          Gets the JDBC manager.
 java.lang.String getName()
          Gets the name.
 java.lang.String getQueueName()
          Returns the queue's name.
 void init()
          Initializes the JdbcQueue
protected  void pollImpl()
           
protected  void purgeExpiredMessages()
          Purges expired messages.
 void send(java.lang.String msgId, E payload, int priority, long expireTime, java.lang.String publisherId)
          Sends the message to the queue.
 void setDataSource(javax.sql.DataSource dataSource)
          Sets the data source.
 void setJdbcManager(JdbcManager jdbcManager)
          Sets the jdbc manager
 void setName(java.lang.String name)
          Sets the name.
 void setQueueName(java.lang.String name)
          Sets the queue's name.
 void setTablespace(java.lang.String tablespace)
          Sets the tablespace for Oracle.
 java.lang.String toString()
          Returns a printable view of the queue.
 
Methods inherited from class com.caucho.jms.queue.PollingQueue
handleAlarm, setPollPeriod, startPoll, stopPoll
 
Methods inherited from class com.caucho.jms.queue.AbstractQueue
acknowledge, addListenerException, addMessageCallback, close, drainTo, drainTo, getBrowserList, getConsumerCount, getListenerFailCountTotal, getListenerFailLastTime, getQueueSize, getReceiverCount, iterator, offer, offer, peek, poll, poll, postConstruct, put, receive, receive, receive, receiveEntry, receiveEntry, remainingCapacity, removeMessageCallback, rollback, size, take
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
generateMessageID, generateMessageID, getJMSDestination, getTopicName, getUrl, hasMessage, setSerializationHandle
 
Methods inherited from class java.util.AbstractQueue
add, addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, 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, contains, remove
 
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
 

Field Detail

_jdbcManager

protected JdbcManager _jdbcManager
Constructor Detail

JdbcQueue

public JdbcQueue()
Method Detail

setName

public void setName(java.lang.String name)
Sets the name.

Overrides:
setName in class AbstractDestination<E>

getName

public java.lang.String getName()
Gets the name.

Overrides:
getName in class AbstractDestination<E>

getQueueName

public java.lang.String getQueueName()
Returns the queue's name.

Overrides:
getQueueName in class AbstractDestination<E>

setQueueName

public void setQueueName(java.lang.String name)
Sets the queue's name.

Overrides:
setQueueName in class AbstractQueue<E>

getId

public int getId()
Returns the JDBC id for the queue.


setJdbcManager

public void setJdbcManager(JdbcManager jdbcManager)
Sets the jdbc manager


getJdbcManager

public JdbcManager getJdbcManager()
Gets the JDBC manager.


setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Sets the data source.


setTablespace

public void setTablespace(java.lang.String tablespace)
Sets the tablespace for Oracle.


init

public void init()
          throws ConfigException
Initializes the JdbcQueue

Overrides:
init in class AbstractQueue<E>
Throws:
ConfigException

send

public void send(java.lang.String msgId,
                 E payload,
                 int priority,
                 long expireTime,
                 java.lang.String publisherId)
          throws MessageException
Sends the message to the queue.

Specified by:
send in interface MessageQueue<E>
Overrides:
send in class AbstractDestination<E>
Throws:
MessageException

commit

public void commit(int session)
            throws JMSException
Removes the first message matching the selector.

Throws:
JMSException

createDestination

protected int createDestination(java.lang.String name,
                                boolean isTopic)
                         throws java.sql.SQLException
Creates a queue.

Throws:
java.sql.SQLException

purgeExpiredMessages

protected void purgeExpiredMessages()
Purges expired messages.


pollImpl

protected void pollImpl()
Overrides:
pollImpl in class PollingQueue<E>

toString

public java.lang.String toString()
Returns a printable view of the queue.

Overrides:
toString in class AbstractDestination<E>