com.caucho.jms.cluster
Class ClusterTopicImpl<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.AbstractTopic<E>
                  extended by com.caucho.jms.cluster.ClusterTopicImpl<E>
All Implemented Interfaces:
HandleAware, ServerDestination<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:
ClusterTopic

public class ClusterTopicImpl<E extends java.io.Serializable>
extends AbstractTopic<E>
implements ServerDestination<E>

Workflow

See Also:
Serialized Form

Constructor Summary
ClusterTopicImpl()
           
ClusterTopicImpl(java.lang.String name)
           
 
Method Summary
 void acknowledge(java.lang.String msgId)
          Acknowledge receipt of the message.
 void close()
           
 void closeSubscriber(AbstractQueue<E> queue)
           
 AbstractQueue<E> createSubscriber(java.lang.String publisher, java.lang.String name, boolean noLocal)
           
protected  void destroy()
           
 java.lang.String getUrl()
          Returns the JMS configuration url.
 boolean hasMessage(java.lang.String subscriber)
           
protected  void init()
           
 void notifyMessageAvailable()
           
 E receiveLocal(java.lang.String subscriber, boolean isAutoAck)
           
 void removeCluster(java.lang.String id)
          Removes the message from the store, due to another server handling it
 void rollback(java.lang.String msgId)
          Rollback the message read.
 void send(java.lang.String msgId, E payload, int priority, long expireTime, java.lang.String publisherId)
          Sends a message to the queue
 void sendLocal(java.lang.String msgId, E payload, int priority, long timeout, java.lang.String publisherId)
          Polls the next message from the store.
 void sendLocalAsBackup(java.lang.String msgId, java.io.Serializable payload, long timeout)
           
 void setCluster(java.lang.String cluster)
           
 void setPath(Path path)
           
 void subscribeTopic()
          Subscribes the topic running on the current node to the Topic Cluster running on the Triad.
 
Methods inherited from class com.caucho.jms.queue.AbstractTopic
drainTo, drainTo, iterator, offer, offer, peek, poll, poll, postConstruct, put, receive, remainingCapacity, setTopicName, size, take
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
generateMessageID, generateMessageID, getJMSDestination, getName, getQueueName, getTopicName, hasMessage, 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, wait, wait, wait
 
Methods inherited from interface javax.jms.Topic
getTopicName, 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

ClusterTopicImpl

public ClusterTopicImpl()

ClusterTopicImpl

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

setPath

public void setPath(Path path)

getUrl

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

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

setCluster

public void setCluster(java.lang.String cluster)

init

@PostConstruct
protected void init()
Overrides:
init in class AbstractTopic<E extends java.io.Serializable>

destroy

@PreDestroy
protected void destroy()

subscribeTopic

public void subscribeTopic()
Subscribes the topic running on the current node to the Topic Cluster running on the Triad.

See Also:
ClusterTopicImpl#subscribeTopic(boolean)

send

public void send(java.lang.String msgId,
                 E payload,
                 int priority,
                 long expireTime,
                 java.lang.String publisherId)
Description copied from class: AbstractDestination
Sends a message to the queue

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

rollback

public void rollback(java.lang.String msgId)
Description copied from class: AbstractDestination
Rollback the message read.

Specified by:
rollback in interface ServerDestination<E extends java.io.Serializable>
Overrides:
rollback in class AbstractDestination<E extends java.io.Serializable>

acknowledge

public void acknowledge(java.lang.String msgId)
Description copied from class: AbstractDestination
Acknowledge receipt of the message.

Specified by:
acknowledge in interface ServerDestination<E extends java.io.Serializable>
Overrides:
acknowledge in class AbstractDestination<E extends java.io.Serializable>
Parameters:
msgId - message to acknowledge

sendLocal

public void sendLocal(java.lang.String msgId,
                      E payload,
                      int priority,
                      long timeout,
                      java.lang.String publisherId)
Polls the next message from the store. If no message is available, wait for the timeout.

Specified by:
sendLocal in interface ServerDestination<E extends java.io.Serializable>

sendLocalAsBackup

public void sendLocalAsBackup(java.lang.String msgId,
                              java.io.Serializable payload,
                              long timeout)
Specified by:
sendLocalAsBackup in interface ServerDestination<E extends java.io.Serializable>

receiveLocal

public E receiveLocal(java.lang.String subscriber,
                      boolean isAutoAck)
Specified by:
receiveLocal in interface ServerDestination<E extends java.io.Serializable>

hasMessage

public boolean hasMessage(java.lang.String subscriber)
Specified by:
hasMessage in interface ServerDestination<E extends java.io.Serializable>

removeCluster

public void removeCluster(java.lang.String id)
Removes the message from the store, due to another server handling it


notifyMessageAvailable

public void notifyMessageAvailable()

createSubscriber

public AbstractQueue<E> createSubscriber(java.lang.String publisher,
                                         java.lang.String name,
                                         boolean noLocal)
Specified by:
createSubscriber in class AbstractTopic<E extends java.io.Serializable>

closeSubscriber

public void closeSubscriber(AbstractQueue<E> queue)
Specified by:
closeSubscriber in class AbstractTopic<E extends java.io.Serializable>

close

@PreDestroy
public void close()
Overrides:
close in class AbstractDestination<E extends java.io.Serializable>