com.caucho.jms.file
Class FileQueueImpl<E extends java.io.Serializable>

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.AbstractMemoryQueue<E,FileQueueEntry<E>>
                      extended by com.caucho.jms.file.FileQueueImpl<E>
All Implemented Interfaces:
HandleAware, MessageQueue<E>, java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.Queue<E>, Destination, Topic
Direct Known Subclasses:
FileQueue, FileQueue

public class FileQueueImpl<E extends java.io.Serializable>
extends AbstractMemoryQueue<E,FileQueueEntry<E>>
implements Topic

A JMS queue backed by a file-based database. The URL looks like

 file:name=my-name;path=file:/var/www/webapps/test/WEB-INF/jms
 
It is configured as:
 <web-app xmlns="http://caucho.com/ns/resin"
             xmlns:resin="urn:java:com.caucho.resin">

   <resin:FileQueue>
     <resin:JndiName>jms/my-name</resin:JndiName>

     <resin:name>my-name</resin:name>
     <resin:path>WEB-INF/jms</resin:path>
   </resin:FileQueue>

 </web-app>
 

See Also:
Serialized Form

Constructor Summary
FileQueueImpl()
           
FileQueueImpl(byte[] queueHash)
           
FileQueueImpl(java.lang.String name)
           
 
Method Summary
protected  void acknowledge(FileQueueEntry<E> entry)
           
protected  void addEntry(long id, java.lang.String msgId, long leaseTimeout, int priority, long expireTime, E payload)
          Callback from startup
 int getFileStoreMessageCount()
          Statistics
 Path getPath()
           
 java.lang.String getUrl()
          Returns the JMS configuration url.
 void init()
          Initialize the queue
protected  void readPayload(FileQueueEntry<E> entry)
           
 void setPath(Path path)
          Deprecated. 
 void setTablePrefix(java.lang.String prefix)
          Deprecated. 
 FileQueueEntry<E> writeEntry(java.lang.String msgId, E payload, int priority, long expireTime)
          Adds the message to the persistent store.
 
Methods inherited from class com.caucho.jms.queue.AbstractMemoryQueue
acknowledge, addMessageCallback, addQueueEntry, dispatchMessage, getBrowserList, getConsumerCount, getMessageIds, getQueueSize, getQueueSizeMax, getReceiverCount, hasMessage, listen, readEntry, readEntry, receive, receiveEntry, receiveEntry, removeEntry, removeMessageCallback, rollback, send, setQueueSizeMax
 
Methods inherited from class com.caucho.jms.queue.AbstractQueue
addListenerException, close, drainTo, drainTo, getListenerFailCountTotal, getListenerFailLastTime, iterator, offer, offer, peek, poll, poll, postConstruct, put, receive, receive, remainingCapacity, setQueueName, size, take
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
generateMessageID, generateMessageID, getJMSDestination, getName, getQueueName, getTopicName, setName, setSerializationHandle, toString
 
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, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.Topic
getTopicName, toString
 
Methods inherited from interface javax.jms.Queue
getQueueName, toString
 
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
 

Constructor Detail

FileQueueImpl

public FileQueueImpl()

FileQueueImpl

public FileQueueImpl(byte[] queueHash)

FileQueueImpl

public FileQueueImpl(java.lang.String name)
Method Detail

setPath

@Deprecated
public void setPath(Path path)
Deprecated. 

Backward compatibility


getPath

public Path getPath()

setTablePrefix

@Deprecated
public void setTablePrefix(java.lang.String prefix)
Deprecated. 

Backward compatibility


getUrl

public java.lang.String getUrl()
Returns the JMS configuration url.

Overrides:
getUrl in class AbstractDestination<E extends java.io.Serializable>

init

public void init()
Initialize the queue

Overrides:
init in class AbstractQueue<E extends java.io.Serializable>

writeEntry

public FileQueueEntry<E> writeEntry(java.lang.String msgId,
                                    E payload,
                                    int priority,
                                    long expireTime)
Adds the message to the persistent store. Called if there are no active listeners.

Specified by:
writeEntry in class AbstractMemoryQueue<E extends java.io.Serializable,FileQueueEntry<E extends java.io.Serializable>>
Parameters:
msgId - the queue's unique identifier for the message
payload - the message payload to store
priority - the message priority
expireTime - the expires time

readPayload

protected void readPayload(FileQueueEntry<E> entry)
Overrides:
readPayload in class AbstractMemoryQueue<E extends java.io.Serializable,FileQueueEntry<E extends java.io.Serializable>>

acknowledge

protected void acknowledge(FileQueueEntry<E> entry)
Overrides:
acknowledge in class AbstractMemoryQueue<E extends java.io.Serializable,FileQueueEntry<E extends java.io.Serializable>>

addEntry

protected void addEntry(long id,
                        java.lang.String msgId,
                        long leaseTimeout,
                        int priority,
                        long expireTime,
                        E payload)
Callback from startup


getFileStoreMessageCount

public int getFileStoreMessageCount()
Statistics