com.caucho.jms.cluster
Class ServerTopic

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.AbstractTopic
                  extended by com.caucho.jms.cluster.ServerTopic
All Implemented Interfaces:
ServerDestination, HandleAware, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.concurrent.BlockingQueue, java.util.Queue, Destination, Topic

public class ServerTopic
extends AbstractTopic
implements ServerDestination

Implements a cluster receive topic.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.caucho.jms.queue.AbstractDestination
_messageFactory
 
Constructor Summary
ServerTopic()
           
ServerTopic(java.lang.String name)
           
 
Method Summary
 void acknowledge(java.lang.String msgId)
          Acknowledge receipt of the message.
 void close()
           
 void closeSubscriber(AbstractQueue queue)
           
 MessageImpl createMessage(int msg)
           
 AbstractQueue createSubscriber(JmsSession session, java.lang.String name, boolean noLocal)
           
 java.lang.String getUrl()
          Returns the JMS configuration url.
 boolean hasMessage(java.lang.String subscriber)
           
 void init()
           
 void notifyMessageAvailable()
           
 MessageImpl receive(boolean isAutoAck)
          Polls the next message from the store.
 MessageImpl receiveCluster(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(JmsSession session, MessageImpl msg, int priority, long expires)
          Sends a message to the queue
 void sendCluster(MessageImpl msg, long timeout)
           
 void sendClusterBackup(MessageImpl msg, long timeout)
           
 void setPath(Path path)
           
 
Methods inherited from class com.caucho.jms.queue.AbstractTopic
postConstruct, receive, setTopicName
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
addMessageAvailableListener, drainTo, drainTo, generateMessageID, generateMessageID, getJMSDestination, getName, getQueueName, getReadConsumer, getTopicName, getWriteSession, hasMessage, iterator, offer, offer, peek, poll, poll, put, remainingCapacity, removeMessageAvailableListener, setName, setSerializationHandle, size, take, 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 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

ServerTopic

public ServerTopic()

ServerTopic

public ServerTopic(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

createMessage

public MessageImpl createMessage(int msg)
Specified by:
createMessage in interface ServerDestination

init

public void init()
Overrides:
init in class AbstractTopic

send

public void send(JmsSession session,
                 MessageImpl msg,
                 int priority,
                 long expires)
          throws JMSException
Description copied from class: AbstractDestination
Sends a message to the queue

Specified by:
send in class AbstractDestination
Throws:
JMSException

rollback

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

Specified by:
rollback in interface ServerDestination
Overrides:
rollback in class AbstractDestination

acknowledge

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

Specified by:
acknowledge in interface ServerDestination
Overrides:
acknowledge in class AbstractDestination
Parameters:
msgId - message to acknowledge

receive

public MessageImpl receive(boolean isAutoAck)
                    throws JMSException
Polls the next message from the store. If no message is available, wait for the timeout.

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

sendCluster

public void sendCluster(MessageImpl msg,
                        long timeout)
                 throws JMSException
Specified by:
sendCluster in interface ServerDestination
Throws:
JMSException

sendClusterBackup

public void sendClusterBackup(MessageImpl msg,
                              long timeout)
                       throws JMSException
Specified by:
sendClusterBackup in interface ServerDestination
Throws:
JMSException

receiveCluster

public MessageImpl receiveCluster(java.lang.String subscriber,
                                  boolean isAutoAck)
                           throws JMSException
Specified by:
receiveCluster in interface ServerDestination
Throws:
JMSException

hasMessage

public boolean hasMessage(java.lang.String subscriber)
Specified by:
hasMessage in interface ServerDestination

removeCluster

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

Specified by:
removeCluster in interface ServerDestination

notifyMessageAvailable

public void notifyMessageAvailable()

createSubscriber

public AbstractQueue createSubscriber(JmsSession session,
                                      java.lang.String name,
                                      boolean noLocal)
Specified by:
createSubscriber in class AbstractTopic

closeSubscriber

public void closeSubscriber(AbstractQueue queue)
Specified by:
closeSubscriber in class AbstractTopic

close

public void close()
Overrides:
close in class AbstractDestination