com.caucho.jms.jdbc
Class JdbcQueue

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

public class JdbcQueue
extends PollingQueue

A jdbc queue.

See Also:
Serialized Form

Field Summary
protected  JdbcManager _jdbcManager
           
 
Fields inherited from class com.caucho.jms.queue.AbstractDestination
_messageFactory
 
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.
 MessageImpl receive(boolean isAutoAck)
          Receives a message from the queue.
 void send(JmsSession session, MessageImpl message, int priority, long expireTime)
          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
addListenerException, addMessageAvailableListener, close, getBrowserList, getConsumerCount, getListenerFailCountTotal, getListenerFailLastTime, getQueueSize, notifyMessageAvailable, postConstruct, removeMessageAvailableListener
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
acknowledge, drainTo, drainTo, generateMessageID, generateMessageID, getJMSDestination, getReadConsumer, getTopicName, getUrl, getWriteSession, hasMessage, iterator, offer, offer, peek, poll, poll, put, remainingCapacity, rollback, setSerializationHandle, size, take
 
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

getName

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

Overrides:
getName in class AbstractDestination

getQueueName

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

Overrides:
getQueueName in class AbstractDestination

setQueueName

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

Overrides:
setQueueName in class AbstractQueue

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
Throws:
ConfigException

send

public void send(JmsSession session,
                 MessageImpl message,
                 int priority,
                 long expireTime)
          throws JMSException
Sends the message to the queue.

Specified by:
send in class AbstractDestination
Throws:
JMSException

receive

public MessageImpl receive(boolean isAutoAck)
                    throws JMSException
Receives a message from the queue.

Overrides:
receive in class AbstractDestination
Parameters:
isAutoAck - if true, automatically acknowledge the message
Throws:
JMSException

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

toString

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

Overrides:
toString in class AbstractDestination