站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 cluster API Documentation 英文版文档

DistributedStateImpl (JBoss Cluster API) - JBoss 4.0.1 sp1 cluster API Documentation 英文版文档


org.jboss.ha.framework.server
Class DistributedStateImpl

java.lang.Object
  extended byorg.jboss.ha.framework.server.DistributedStateImpl
All Implemented Interfaces:
DistributedState, DistributedStateImplMBean, HAPartition.HAPartitionStateTransfer

public class DistributedStateImpl
extends Object
implements DistributedStateImplMBean, HAPartition.HAPartitionStateTransfer

This class manages distributed state across the cluster.

Version:
$Revision: 1.16 $
Author:
Sacha Labourey., Bill Burke., Scott.Stark@jboss.org

Nested Class Summary
 
Nested classes inherited from class org.jboss.ha.framework.interfaces.DistributedState
DistributedState.DSListener, DistributedState.DSListenerEx
 
Field Summary
protected  HashMap categories
          HashMap.
protected  HashMap keyListeners
           
protected  org.jboss.logging.Logger log
           
protected  javax.management.MBeanServer mbeanServer
           
protected  String name
           
protected  HAPartition partition
           
protected static Class[] remove_types
           
protected static String SERVICE_NAME
           
protected static Class[] set_types
           
 
Constructor Summary
DistributedStateImpl()
           
DistributedStateImpl(HAPartition partition, javax.management.MBeanServer server)
           
 
Method Summary
 void _remove(String category, Serializable key)
           
 void _remove(String category, String key)
           
 Serializable _removeInternal(String category, Serializable key)
           
 void _set(String category, Serializable key, Serializable value)
           
 void _set(String category, String key, Serializable value)
           
 void _setInternal(String category, Serializable key, Serializable value)
           
protected  void cleanupKeyListeners()
           
 Serializable get(String category, Serializable key)
          Read in a value associated to a key in the given category.
 Collection getAllCategories()
          Return a list of all categories.
 Collection getAllKeys(String category)
          Return a list of all keys in a category.
 Collection getAllValues(String category)
          Return a list of all values in a category.
 Serializable getCurrentState()
          Called when a new node need to be initialized.
 void init()
           
 String listContent()
           
 String listXmlContent()
           
protected  void notifyKeyListeners(String category, Serializable key, Serializable value, boolean locallyModified)
           
protected  void notifyKeyListenersOfRemove(String category, Serializable key, Serializable oldContent, boolean locallyModified)
           
 void registerDSListener(String category, DistributedState.DSListener subscriber)
          Subscribes to receive DistributedState.DSListener events
 void registerDSListenerEx(String category, DistributedState.DSListenerEx subscriber)
          Subscribes to receive DistributedState.DSListenerEx events
protected  void registerListener(String category, Object subscriber)
           
 Serializable remove(String category, Serializable key)
          Remove the key from the ReplicationService in the given category
 Serializable remove(String category, Serializable key, boolean asynchronousCall)
          Same as remove(String, String) but caller can choose if the call is made synchronously or asynchronously.
 void set(String category, Serializable key, Serializable value)
          Associates a value to a key in a specific category
 void set(String category, Serializable key, Serializable value, boolean asynchronousCall)
          Same as set(String, String) but caller can choose if the call is made synchronously or asynchronously.
 void setCurrentState(Serializable newState)
          This callback method is called when a new service starts on a new node: the state that it should hold is transfered to it through this callback
 void start()
           
 void stop()
           
 void unregisterDSListener(String category, DistributedState.DSListener subscriber)
          Subscribes from DistributedState.DSListener events
 void unregisterDSListenerEx(String category, DistributedState.DSListenerEx subscriber)
          Subscribes from DistributedState.DSListenerEx events
protected  void unregisterListener(String category, Object subscriber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

protected static final String SERVICE_NAME
See Also:
Constant Field Values

set_types

protected static final Class[] set_types

remove_types

protected static final Class[] remove_types

categories

protected HashMap categories
HashMap. Keys= category, value = HashMap


keyListeners

protected HashMap keyListeners

partition

protected HAPartition partition

log

protected org.jboss.logging.Logger log

mbeanServer

protected javax.management.MBeanServer mbeanServer

name

protected String name
Constructor Detail

DistributedStateImpl

public DistributedStateImpl()

DistributedStateImpl

public DistributedStateImpl(HAPartition partition,
                            javax.management.MBeanServer server)
Method Detail

init

public void init()
          throws Exception
Throws:
Exception

start

public void start()
           throws Exception
Throws:
Exception

stop

public void stop()
          throws Exception
Throws:
Exception

listContent

public String listContent()
                   throws Exception
Specified by:
listContent in interface DistributedStateImplMBean
Throws:
Exception

listXmlContent

public String listXmlContent()
                      throws Exception
Specified by:
listXmlContent in interface DistributedStateImplMBean
Throws:
Exception

set

public void set(String category,
                Serializable key,
                Serializable value)
         throws Exception
Description copied from interface: DistributedState
Associates a value to a key in a specific category

Specified by:
set in interface DistributedState
Parameters:
category - Name of the private naming-space
key - Name of the data to set
value - Value of the data to set
Throws:
Exception - If a network communication occurs

set

public void set(String category,
                Serializable key,
                Serializable value,
                boolean asynchronousCall)
         throws Exception
Description copied from interface: DistributedState
Same as set(String, String) but caller can choose if the call is made synchronously or asynchronously. By default, calls are asynchronous.

Specified by:
set in interface DistributedState
Throws:
Exception

remove

public Serializable remove(String category,
                           Serializable key)
                    throws Exception
Description copied from interface: DistributedState
Remove the key from the ReplicationService in the given category

Specified by:
remove in interface DistributedState
Parameters:
category - Name of the category
key - Key to be removed
Throws:
Exception - if a network exception occurs while removing the entry.

remove

public Serializable remove(String category,
                           Serializable key,
                           boolean asynchronousCall)
                    throws Exception
Description copied from interface: DistributedState
Same as remove(String, String) but caller can choose if the call is made synchronously or asynchronously. By default, calls are asynchronous.

Specified by:
remove in interface DistributedState
Throws:
Exception

get

public Serializable get(String category,
                        Serializable key)
Description copied from interface: DistributedState
Read in a value associated to a key in the given category. Read is performed locally.

Specified by:
get in interface DistributedState
Parameters:
category - Name of the private naming-space
key - The key of the value to read
Returns:
The value of the key in the given category

getAllCategories

public Collection getAllCategories()
Description copied from interface: DistributedState
Return a list of all categories. Call managed locally: no network access.

Specified by:
getAllCategories in interface DistributedState
Returns:
A collection of String representing the existing categories in the DS service.

getAllKeys

public Collection getAllKeys(String category)
Description copied from interface: DistributedState
Return a list of all keys in a category. Call managed locally: no network access.

Specified by:
getAllKeys in interface DistributedState
Parameters:
category - The category under which to look for keys
Returns:
A collection of all keys in the give category

getAllValues

public Collection getAllValues(String category)
Description copied from interface: DistributedState
Return a list of all values in a category. Call managed locally: no network access.

Specified by:
getAllValues in interface DistributedState
Parameters:
category - The category name under which to look for values
Returns:
A collection of all values in the give category

registerDSListenerEx

public void registerDSListenerEx(String category,
                                 DistributedState.DSListenerEx subscriber)
Description copied from interface: DistributedState
Subscribes to receive DistributedState.DSListenerEx events

Specified by:
registerDSListenerEx in interface DistributedState
Parameters:
category - Name of the private-space to watch for
subscriber - Object that will receive callbacks. This

unregisterDSListenerEx

public void unregisterDSListenerEx(String category,
                                   DistributedState.DSListenerEx subscriber)
Description copied from interface: DistributedState
Subscribes from DistributedState.DSListenerEx events

Specified by:
unregisterDSListenerEx in interface DistributedState
Parameters:
category - Name of the private-space dictionary currently observed
subscriber - object currently observing this category

registerDSListener

public void registerDSListener(String category,
                               DistributedState.DSListener subscriber)
Description copied from interface: DistributedState
Subscribes to receive DistributedState.DSListener events

Specified by:
registerDSListener in interface DistributedState
Parameters:
category - Name of the private-space to watch for
subscriber - Object that will receive callbacks. This

unregisterDSListener

public void unregisterDSListener(String category,
                                 DistributedState.DSListener subscriber)
Description copied from interface: DistributedState
Subscribes from DistributedState.DSListener events

Specified by:
unregisterDSListener in interface DistributedState
Parameters:
category - Name of the private-space dictionary currently observed
subscriber - object currently observing this category

_set

public void _set(String category,
                 String key,
                 Serializable value)
          throws Exception
Throws:
Exception

_set

public void _set(String category,
                 Serializable key,
                 Serializable value)
          throws Exception
Throws:
Exception

_setInternal

public void _setInternal(String category,
                         Serializable key,
                         Serializable value)
                  throws Exception
Throws:
Exception

_remove

public void _remove(String category,
                    String key)
             throws Exception
Throws:
Exception

_remove

public void _remove(String category,
                    Serializable key)
             throws Exception
Throws:
Exception

_removeInternal

public Serializable _removeInternal(String category,
                                    Serializable key)
                             throws Exception
Throws:
Exception

getCurrentState

public Serializable getCurrentState()
Description copied from interface: HAPartition.HAPartitionStateTransfer
Called when a new node need to be initialized. This is called on any existing node to determine a current state for this service.

Specified by:
getCurrentState in interface HAPartition.HAPartitionStateTransfer
Returns:
A serializable representation of the state

setCurrentState

public void setCurrentState(Serializable newState)
Description copied from interface: HAPartition.HAPartitionStateTransfer
This callback method is called when a new service starts on a new node: the state that it should hold is transfered to it through this callback

Specified by:
setCurrentState in interface HAPartition.HAPartitionStateTransfer
Parameters:
newState - The serialized representation of the state of the new service.

registerListener

protected void registerListener(String category,
                                Object subscriber)

unregisterListener

protected void unregisterListener(String category,
                                  Object subscriber)

notifyKeyListeners

protected void notifyKeyListeners(String category,
                                  Serializable key,
                                  Serializable value,
                                  boolean locallyModified)

notifyKeyListenersOfRemove

protected void notifyKeyListenersOfRemove(String category,
                                          Serializable key,
                                          Serializable oldContent,
                                          boolean locallyModified)

cleanupKeyListeners

protected void cleanupKeyListeners()


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.