com.caucho.jms.queue
Class AbstractDestination<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by com.caucho.jms.queue.AbstractDestination<E>
All Implemented Interfaces:
HandleAware, java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.Queue<E>, Destination
Direct Known Subclasses:
AbstractQueue, AbstractTopic, JdbcDestination

public abstract class AbstractDestination<E>
extends java.util.AbstractQueue<E>
implements Destination, java.util.concurrent.BlockingQueue<E>, java.io.Serializable, HandleAware

Implements an abstract queue.

See Also:
Serialized Form

Constructor Summary
protected AbstractDestination()
           
 
Method Summary
 void acknowledge(java.lang.String msgId)
          Acknowledge receipt of the message.
 void close()
           
 java.lang.String generateMessageID()
          Creates a new random message identifier.
protected  void generateMessageID(java.lang.StringBuilder cb)
          Customization of the message id for different queue/topics
 Destination getJMSDestination()
           
 java.lang.String getName()
           
 java.lang.String getQueueName()
           
 java.lang.String getTopicName()
           
 java.lang.String getUrl()
          Returns a descriptive URL for the queue.
 boolean hasMessage()
          Returns true if the queue has at least one message available
 void rollback(java.lang.String msgId)
          Rollback the message read.
 void send(java.lang.String msgId, E msg, int priority, long expires, java.lang.String publisherId)
          Sends a message to the queue
 void setName(java.lang.String name)
          Sets the name of the destination
 void setSerializationHandle(java.lang.Object handle)
          Serialization callback from Resin-IoC to set the handle
 java.lang.String toString()
           
 
Methods inherited from class java.util.AbstractQueue
add, addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, 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, drainTo, drainTo, offer, offer, poll, put, remainingCapacity, remove, take
 
Methods inherited from interface java.util.Queue
element, peek, poll, remove
 
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

AbstractDestination

protected AbstractDestination()
Method Detail

setName

@Configurable
public void setName(java.lang.String name)
Sets the name of the destination


getName

public java.lang.String getName()

getQueueName

public java.lang.String getQueueName()

getTopicName

public java.lang.String getTopicName()

setSerializationHandle

public void setSerializationHandle(java.lang.Object handle)
Serialization callback from Resin-IoC to set the handle

Specified by:
setSerializationHandle in interface HandleAware

getUrl

public java.lang.String getUrl()
Returns a descriptive URL for the queue.


generateMessageID

public final java.lang.String generateMessageID()
Creates a new random message identifier.


generateMessageID

protected void generateMessageID(java.lang.StringBuilder cb)
Customization of the message id for different queue/topics


send

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

Throws:
MessageException

hasMessage

public boolean hasMessage()
Returns true if the queue has at least one message available


acknowledge

public void acknowledge(java.lang.String msgId)
Acknowledge receipt of the message.

Parameters:
msgId - message to acknowledge

rollback

public void rollback(java.lang.String msgId)
Rollback the message read.


getJMSDestination

public Destination getJMSDestination()

close

public void close()

toString

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