DefaultCluster (ActiveCluster 1.0 API)
Keywords: org.codehaus.activecluster.impl.DefaultCluster class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activecluster.impl
Class DefaultCluster

    java.lang.Object
      org.codehaus.activecluster.impl.DefaultCluster

All Implemented Interfaces:
  Cluster, Service

public class DefaultCluster
extends Object
implements Cluster

A default implementation of ActiveCluster which uses standard JMS operations

Version:
  $Revision: 1.12 $

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

### DefaultCluster

    public DefaultCluster(LocalNode localNode,
                          Topic dataTopic,
                          Topic destination,
                          Connection connection,
                          Session session,
                          MessageProducer producer,
                          Timer timer,
                          long inactiveTime)
                   throws JMSException

Method Detail

### addClusterListener

    public void addClusterListener(ClusterListener listener)

  Description copied from interface: `Cluster`
  Adds a new listener to cluster events

  Specified by:
    `addClusterListener` in interface `Cluster`
  Parameters:
    `listener` -

### removeClusterListener

    public void removeClusterListener(ClusterListener listener)

  Description copied from interface: `Cluster`
  Removes a listener to cluster events

  Specified by:
    `removeClusterListener` in interface `Cluster`
  Parameters:
    `listener` -

### getDestination

    public Topic getDestination()

  Description copied from interface: `Cluster`
  Returns the destination used to send a message to all members of the cluster

  Specified by:
    `getDestination` in interface `Cluster`
  Returns:
    the destination to send messages to all members of the cluster

### getLocalNode

    public LocalNode getLocalNode()

  Description copied from interface: `Cluster`
  The local Node which allows you to mutate the state or subscribe to the nodes temporary queue for inbound messages direct to the Node

  Specified by:
    `getLocalNode` in interface `Cluster`
  Returns:

### getNodes

    public Map getNodes()

  Description copied from interface: `Cluster`
  A snapshot of the nodes in the cluster indexed by the Destination

  Specified by:
    `getNodes` in interface `Cluster`
  Returns:

### send

    public void send(Destination destination,
                     Message message)
              throws JMSException

  Description copied from interface: `Cluster`
  Sends a message to a destination, which could be to the entire group or could be a single Node's destination

  Specified by:
    `send` in interface `Cluster`
  Parameters:
    `destination` - is either the group topic or a node's destination
    `message` - the message to be sent
  Throws:
    `JMSException`

### createConsumer

    public MessageConsumer createConsumer(Destination destination)
                                   throws JMSException

  Description copied from interface: `Cluster`
  Creates a consumer of all the messags sent to the given destination, including messages sent via the send() messages

  Specified by:
    `createConsumer` in interface `Cluster`
  Parameters:
    `destination` -
  Returns:
  Throws:
    `JMSException`

### createConsumer

    public MessageConsumer createConsumer(Destination destination,
                                          String selector)
                                   throws JMSException

  Description copied from interface: `Cluster`
  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

  Specified by:
    `createConsumer` in interface `Cluster`
  Parameters:
    `destination` -
    `selector` -
  Returns:
  Throws:
    `JMSException`

### createConsumer

    public MessageConsumer createConsumer(Destination destination,
                                          String selector,
                                          boolean noLocal)
                                   throws JMSException

  Description copied from interface: `Cluster`
  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.

  Specified by:
    `createConsumer` in interface `Cluster`
  Parameters:
    `destination` - the destination to consume from
    `selector` - an optional SQL 92 filter of messages which could be null
    `noLocal` - which if true messages sent via send() on this object will not be delivered to the consumer
  Returns:
  Throws:
    `JMSException`

### createMessage

    public Message createMessage()
                          throws JMSException

  Description copied from interface: `Cluster`
  Creates a new message without a body

  Specified by:
    `createMessage` in interface `Cluster`
  Returns:
  Throws:
    `JMSException`

### createBytesMessage

    public BytesMessage createBytesMessage()
                                    throws JMSException

  Description copied from interface: `Cluster`
  Creates a new bytes message

  Specified by:
    `createBytesMessage` in interface `Cluster`
  Returns:
  Throws:
    `JMSException`

### createMapMessage

    public MapMessage createMapMessage()
                                throws JMSException

  Description copied from interface: `Cluster`
  Creates a new `MapMessage`

  Specified by:
    `createMapMessage` in interface `Cluster`
  Returns:
  Throws:
    `JMSException`

### createObjectMessage

    public ObjectMessage createObjectMessage()
                                      throws JMSException

  Description copied from interface: `Cluster`
  Creates a new `ObjectMessage`

  Specified by:
    `createObjectMessage` in interface `Cluster`
  Returns:
  Throws:
    `JMSException`

### createObjectMessage

    public ObjectMessage createObjectMessage(Serializable object)
                                      throws JMSException

  Description copied from interface: `Cluster`
  Creates a new `ObjectMessage`

  Specified by:
    `createObjectMessage` in interface `Cluster`
  Parameters:
    `object` -
  Returns:
  Throws:
    `JMSException`

### createStreamMessage

    public StreamMessage createStreamMessage()
                                      throws JMSException

  Description copied from interface: `Cluster`
  Creates a new `StreamMessage`

  Specified by:
    `createStreamMessage` in interface `Cluster`
  Returns:
  Throws:
    `JMSException`

### createTextMessage

    public TextMessage createTextMessage()
                                  throws JMSException

  Description copied from interface: `Cluster`
  Creates a new `TextMessage`

  Specified by:
    `createTextMessage` in interface `Cluster`
  Returns:
  Throws:
    `JMSException`

### createTextMessage

    public TextMessage createTextMessage(String text)
                                  throws JMSException

  Description copied from interface: `Cluster`
  Creates a new `TextMessage`

  Specified by:
    `createTextMessage` in interface `Cluster`
  Parameters:
    `text` -
  Returns:
  Throws:
    `JMSException`

### start

    public void start()
               throws JMSException

  Description copied from interface: `Service`
  Called to start the service

  Specified by:
    `start` in interface `Service`
  Throws:
    `JMSException`

### stop

    public void stop()
              throws JMSException

  Description copied from interface: `Service`
  Called to shutdown the service

  Specified by:
    `stop` in interface `Service`
  Throws:
    `JMSException`

### waitForClusterToComplete

    public boolean waitForClusterToComplete(int expectedCount,
                                            long timeout)
                                     throws InterruptedException

  Description copied from interface: `Cluster`
  wait until a the cardimality of the cluster is reaches the expected count. This method will return false if the cluster isn't started or stopped while waiting

  Specified by:
    `waitForClusterToComplete` in interface `Cluster`
  Parameters:
    `expectedCount` - the number of expected members of a cluster
    `timeout` - timeout in milliseconds
  Returns:
    true if the cluster is fully connected
  Throws:
    `InterruptedException`

### getSession

    protected Session getSession()
                          throws JMSException

  Throws:
    `JMSException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2005 Protique, Ltd.. All Rights Reserved.