com.caucho.jms.cluster
Class ServerQueue

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.cluster.ServerQueue
All Implemented Interfaces:
ServerDestination, HandleAware, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.concurrent.BlockingQueue, java.util.Queue, Destination

public class ServerQueue
extends AbstractQueue
implements ServerDestination

Implements a cluster receive queue.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.caucho.jms.queue.AbstractDestination
_messageFactory
 
Constructor Summary
ServerQueue()
           
ServerQueue(java.lang.String name)
           
 
Method Summary
 void acknowledge(java.lang.String msgId)
          Acknowledge receipt of the message.
 void close()
           
 MessageImpl createMessage(int msg)
           
 int getQueueSize()
          Returns the queue size
 java.lang.String getUrl()
          Returns the JMS configuration url.
 boolean hasMessage()
          Returns true if the queue has at least one message available
 boolean hasMessage(java.lang.String subscription)
           
 void init()
           
 boolean isBackup()
          Set true if messages should be backed up.
 MessageImpl receive(boolean isAutoAck)
          Polls the next message from the store.
 MessageImpl receiveCluster(java.lang.String subscription, boolean isAutoAck)
          Polls the next message from the store.
 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 setBackup(boolean isBackup)
          Set true if messages should be backed up.
 void setPath(Path path)
           
 
Methods inherited from class com.caucho.jms.queue.AbstractQueue
addListenerException, addMessageAvailableListener, getBrowserList, getConsumerCount, getListenerFailCountTotal, getListenerFailLastTime, notifyMessageAvailable, postConstruct, removeMessageAvailableListener, setQueueName, startPoll, stopPoll
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
drainTo, drainTo, generateMessageID, generateMessageID, getJMSDestination, getName, getQueueName, getReadConsumer, getTopicName, getWriteSession, iterator, offer, offer, peek, poll, poll, put, remainingCapacity, 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, wait, wait, wait
 
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

ServerQueue

public ServerQueue()

ServerQueue

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

setPath

public void setPath(Path path)

setBackup

public void setBackup(boolean isBackup)
Set true if messages should be backed up.


isBackup

public boolean isBackup()
Set true if messages should be backed up.


getUrl

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

Overrides:
getUrl in class AbstractDestination

getQueueSize

public int getQueueSize()
Description copied from class: AbstractQueue
Returns the queue size

Overrides:
getQueueSize in class AbstractQueue

init

public void init()
Overrides:
init in class AbstractQueue

createMessage

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

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)
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

hasMessage

public boolean hasMessage()
Description copied from class: AbstractDestination
Returns true if the queue has at least one message available

Overrides:
hasMessage in class AbstractDestination

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 subscription,
                                  boolean isAutoAck)
Polls the next message from the store. If no message is available, wait for the timeout.

Specified by:
receiveCluster 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

hasMessage

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

close

public void close()
Overrides:
close in class AbstractQueue