|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.activecluster.impl.DefaultCluster
A default implementation of ActiveCluster which uses standard JMS operations
Constructor Summary | |
DefaultCluster(LocalNode localNode,
Topic dataTopic,
Topic destination,
Connection connection,
Session session,
MessageProducer producer,
Timer timer,
long inactiveTime)
|
Method Summary | |
void |
addClusterListener(ClusterListener listener)
Adds a new listener to cluster events |
BytesMessage |
createBytesMessage()
Creates a new bytes message |
MessageConsumer |
createConsumer(Destination destination)
Creates a consumer of all the messags sent to the given destination, including messages sent via the send() messages |
MessageConsumer |
createConsumer(Destination destination,
String selector)
Creates a consumer of all message sent to the given destination, including messages sent via the send() message with an optional SQL 92 based selector to filter messages |
MessageConsumer |
createConsumer(Destination destination,
String selector,
boolean noLocal)
Creates a consumer of all message sent to the given destination, including messages sent via the send() message with an optional SQL 92 based selector to filter messages along with optionally ignoring local traffic - messages sent via the send() method on this object. |
MapMessage |
createMapMessage()
Creates a new MapMessage |
Message |
createMessage()
Creates a new message without a body |
ObjectMessage |
createObjectMessage()
Creates a new ObjectMessage |
ObjectMessage |
createObjectMessage(Serializable object)
Creates a new ObjectMessage |
StreamMessage |
createStreamMessage()
Creates a new StreamMessage |
TextMessage |
createTextMessage()
Creates a new TextMessage |
TextMessage |
createTextMessage(String text)
Creates a new TextMessage |
Topic |
getDestination()
Returns the destination used to send a message to all members of the cluster |
LocalNode |
getLocalNode()
The local Node which allows you to mutate the state or subscribe to the nodes temporary queue for inbound messages direct to the Node |
Map |
getNodes()
A snapshot of the nodes in the cluster indexed by the Destination |
protected Session |
getSession()
|
void |
removeClusterListener(ClusterListener listener)
Removes a listener to cluster events |
void |
send(Destination destination,
Message message)
Sends a message to a destination, which could be to the entire group or could be a single Node's destination |
void |
start()
Called to start the service |
void |
stop()
Called to shutdown the service |
boolean |
waitForClusterToComplete(int expectedCount,
long timeout)
wait until a the cardimality of the cluster is reaches the expected count. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultCluster(LocalNode localNode, Topic dataTopic, Topic destination, Connection connection, Session session, MessageProducer producer, Timer timer, long inactiveTime) throws JMSException
Method Detail |
public void addClusterListener(ClusterListener listener)
Cluster
addClusterListener
in interface Cluster
listener
- public void removeClusterListener(ClusterListener listener)
Cluster
removeClusterListener
in interface Cluster
listener
- public Topic getDestination()
Cluster
getDestination
in interface Cluster
public LocalNode getLocalNode()
Cluster
getLocalNode
in interface Cluster
public Map getNodes()
Cluster
getNodes
in interface Cluster
public void send(Destination destination, Message message) throws JMSException
Cluster
send
in interface Cluster
destination
- is either the group topic or a node's destinationmessage
- the message to be sent
JMSException
public MessageConsumer createConsumer(Destination destination) throws JMSException
Cluster
createConsumer
in interface Cluster
destination
-
JMSException
public MessageConsumer createConsumer(Destination destination, String selector) throws JMSException
Cluster
createConsumer
in interface Cluster
destination
- selector
-
JMSException
public MessageConsumer createConsumer(Destination destination, String selector, boolean noLocal) throws JMSException
Cluster
createConsumer
in interface Cluster
destination
- the destination to consume fromselector
- an optional SQL 92 filter of messages which could be nullnoLocal
- which if true messages sent via send() on this object will not be delivered to the consumer
JMSException
public Message createMessage() throws JMSException
Cluster
createMessage
in interface Cluster
JMSException
public BytesMessage createBytesMessage() throws JMSException
Cluster
createBytesMessage
in interface Cluster
JMSException
public MapMessage createMapMessage() throws JMSException
Cluster
MapMessage
createMapMessage
in interface Cluster
JMSException
public ObjectMessage createObjectMessage() throws JMSException
Cluster
ObjectMessage
createObjectMessage
in interface Cluster
JMSException
public ObjectMessage createObjectMessage(Serializable object) throws JMSException
Cluster
ObjectMessage
createObjectMessage
in interface Cluster
object
-
JMSException
public StreamMessage createStreamMessage() throws JMSException
Cluster
StreamMessage
createStreamMessage
in interface Cluster
JMSException
public TextMessage createTextMessage() throws JMSException
Cluster
TextMessage
createTextMessage
in interface Cluster
JMSException
public TextMessage createTextMessage(String text) throws JMSException
Cluster
TextMessage
createTextMessage
in interface Cluster
text
-
JMSException
public void start() throws JMSException
Service
start
in interface Service
JMSException
public void stop() throws JMSException
Service
stop
in interface Service
JMSException
public boolean waitForClusterToComplete(int expectedCount, long timeout) throws InterruptedException
Cluster
waitForClusterToComplete
in interface Cluster
expectedCount
- the number of expected members of a clustertimeout
- timeout in milliseconds
InterruptedException
protected Session getSession() throws JMSException
JMSException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |