org.codehaus.wadi.gridstate.activecluster
Class RestartableCluster

java.lang.Object
  extended byorg.codehaus.wadi.gridstate.activecluster.RestartableCluster
All Implemented Interfaces:
Cluster, ExtendedCluster, Service

public class RestartableCluster
extends Object
implements ExtendedCluster

An ActiveCluster Cluster that can be re-start()-ed after a stop().

Version:
$Revision: 1363 $
Author:
Jules Gosnell

Field Summary
protected  ExtendedCluster _cluster
           
protected  ClusterFactory _factory
           
protected  Topic _groupDestination
           
protected static Log _log
           
protected  String _topic
           
 
Constructor Summary
RestartableCluster(ClusterFactory factory, String topic)
           
RestartableCluster(ClusterFactory factory, Topic groupDestination)
           
 
Method Summary
 void addClusterListener(ClusterListener listener)
           
 BytesMessage createBytesMessage()
           
protected  void createCluster()
           
 MessageConsumer createConsumer(Destination destination)
           
 MessageConsumer createConsumer(Destination destination, String selector)
           
 MessageConsumer createConsumer(Destination destination, String selector, boolean noLocal)
           
 MapMessage createMapMessage()
           
 Message createMessage()
           
 ObjectMessage createObjectMessage()
           
 ObjectMessage createObjectMessage(Serializable object)
           
 StreamMessage createStreamMessage()
           
 TextMessage createTextMessage()
           
 TextMessage createTextMessage(String text)
           
protected  void ensureCluster()
           
 Connection getConnection()
           
 Topic getDestination()
           
 LocalNode getLocalNode()
           
 Map getNodes()
           
 void removeClusterListener(ClusterListener listener)
           
 void send(Destination destination, Message message)
           
 void setElectionStrategy(ElectionStrategy strategy)
           
 void start()
           
 void stop()
           
 boolean waitForClusterToComplete(int expectedCount, long timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static final Log _log

_factory

protected final ClusterFactory _factory

_groupDestination

protected final Topic _groupDestination

_topic

protected final String _topic

_cluster

protected ExtendedCluster _cluster
Constructor Detail

RestartableCluster

public RestartableCluster(ClusterFactory factory,
                          Topic groupDestination)

RestartableCluster

public RestartableCluster(ClusterFactory factory,
                          String topic)
Method Detail

getDestination

public Topic getDestination()
Specified by:
getDestination in interface Cluster

getNodes

public Map getNodes()
Specified by:
getNodes in interface Cluster

addClusterListener

public void addClusterListener(ClusterListener listener)
Specified by:
addClusterListener in interface Cluster

removeClusterListener

public void removeClusterListener(ClusterListener listener)
Specified by:
removeClusterListener in interface Cluster

getLocalNode

public LocalNode getLocalNode()
Specified by:
getLocalNode in interface Cluster

send

public void send(Destination destination,
                 Message message)
          throws JMSException
Specified by:
send in interface Cluster
Throws:
JMSException

createConsumer

public MessageConsumer createConsumer(Destination destination)
                               throws JMSException
Specified by:
createConsumer in interface Cluster
Throws:
JMSException

createConsumer

public MessageConsumer createConsumer(Destination destination,
                                      String selector)
                               throws JMSException
Specified by:
createConsumer in interface Cluster
Throws:
JMSException

createConsumer

public MessageConsumer createConsumer(Destination destination,
                                      String selector,
                                      boolean noLocal)
                               throws JMSException
Specified by:
createConsumer in interface Cluster
Throws:
JMSException

createMessage

public Message createMessage()
                      throws JMSException
Specified by:
createMessage in interface Cluster
Throws:
JMSException

createBytesMessage

public BytesMessage createBytesMessage()
                                throws JMSException
Specified by:
createBytesMessage in interface Cluster
Throws:
JMSException

createMapMessage

public MapMessage createMapMessage()
                            throws JMSException
Specified by:
createMapMessage in interface Cluster
Throws:
JMSException

createObjectMessage

public ObjectMessage createObjectMessage()
                                  throws JMSException
Specified by:
createObjectMessage in interface Cluster
Throws:
JMSException

createObjectMessage

public ObjectMessage createObjectMessage(Serializable object)
                                  throws JMSException
Specified by:
createObjectMessage in interface Cluster
Throws:
JMSException

createStreamMessage

public StreamMessage createStreamMessage()
                                  throws JMSException
Specified by:
createStreamMessage in interface Cluster
Throws:
JMSException

createTextMessage

public TextMessage createTextMessage()
                              throws JMSException
Specified by:
createTextMessage in interface Cluster
Throws:
JMSException

createTextMessage

public TextMessage createTextMessage(String text)
                              throws JMSException
Specified by:
createTextMessage in interface Cluster
Throws:
JMSException

waitForClusterToComplete

public boolean waitForClusterToComplete(int expectedCount,
                                        long timeout)
                                 throws InterruptedException
Specified by:
waitForClusterToComplete in interface Cluster
Throws:
InterruptedException

createCluster

protected void createCluster()

ensureCluster

protected void ensureCluster()

start

public void start()
           throws JMSException
Specified by:
start in interface Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
Specified by:
stop in interface Service
Throws:
JMSException

getConnection

public Connection getConnection()
Specified by:
getConnection in interface ExtendedCluster

setElectionStrategy

public void setElectionStrategy(ElectionStrategy strategy)


Copyright © 2004-2008 Core Developers Network Ltd.. All Rights Reserved.