|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.ha.framework.server.DistributedStateImpl
This class manages distributed state across the cluster.
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 |
protected static final String SERVICE_NAME
protected static final Class[] set_types
protected static final Class[] remove_types
protected HashMap categories
protected HashMap keyListeners
protected HAPartition partition
protected org.jboss.logging.Logger log
protected javax.management.MBeanServer mbeanServer
protected String name
Constructor Detail |
public DistributedStateImpl()
public DistributedStateImpl(HAPartition partition, javax.management.MBeanServer server)
Method Detail |
public void init() throws Exception
Exception
public void start() throws Exception
Exception
public void stop() throws Exception
Exception
public String listContent() throws Exception
listContent
in interface DistributedStateImplMBean
Exception
public String listXmlContent() throws Exception
listXmlContent
in interface DistributedStateImplMBean
Exception
public void set(String category, Serializable key, Serializable value) throws Exception
DistributedState
set
in interface DistributedState
category
- Name of the private naming-spacekey
- Name of the data to setvalue
- Value of the data to set
Exception
- If a network communication occurspublic void set(String category, Serializable key, Serializable value, boolean asynchronousCall) throws Exception
DistributedState
set
in interface DistributedState
Exception
public Serializable remove(String category, Serializable key) throws Exception
DistributedState
remove
in interface DistributedState
category
- Name of the categorykey
- Key to be removed
Exception
- if a network exception occurs while removing the entry.public Serializable remove(String category, Serializable key, boolean asynchronousCall) throws Exception
DistributedState
remove
in interface DistributedState
Exception
public Serializable get(String category, Serializable key)
DistributedState
get
in interface DistributedState
category
- Name of the private naming-spacekey
- The key of the value to read
public Collection getAllCategories()
DistributedState
getAllCategories
in interface DistributedState
public Collection getAllKeys(String category)
DistributedState
getAllKeys
in interface DistributedState
category
- The category under which to look for keys
public Collection getAllValues(String category)
DistributedState
getAllValues
in interface DistributedState
category
- The category name under which to look for values
public void registerDSListenerEx(String category, DistributedState.DSListenerEx subscriber)
DistributedState
DistributedState.DSListenerEx
events
registerDSListenerEx
in interface DistributedState
category
- Name of the private-space to watch forsubscriber
- Object that will receive callbacks. Thispublic void unregisterDSListenerEx(String category, DistributedState.DSListenerEx subscriber)
DistributedState
DistributedState.DSListenerEx
events
unregisterDSListenerEx
in interface DistributedState
category
- Name of the private-space dictionary currently observedsubscriber
- object currently observing this categorypublic void registerDSListener(String category, DistributedState.DSListener subscriber)
DistributedState
DistributedState.DSListener
events
registerDSListener
in interface DistributedState
category
- Name of the private-space to watch forsubscriber
- Object that will receive callbacks. Thispublic void unregisterDSListener(String category, DistributedState.DSListener subscriber)
DistributedState
DistributedState.DSListener
events
unregisterDSListener
in interface DistributedState
category
- Name of the private-space dictionary currently observedsubscriber
- object currently observing this categorypublic void _set(String category, String key, Serializable value) throws Exception
Exception
public void _set(String category, Serializable key, Serializable value) throws Exception
Exception
public void _setInternal(String category, Serializable key, Serializable value) throws Exception
Exception
public void _remove(String category, String key) throws Exception
Exception
public void _remove(String category, Serializable key) throws Exception
Exception
public Serializable _removeInternal(String category, Serializable key) throws Exception
Exception
public Serializable getCurrentState()
HAPartition.HAPartitionStateTransfer
getCurrentState
in interface HAPartition.HAPartitionStateTransfer
public void setCurrentState(Serializable newState)
HAPartition.HAPartitionStateTransfer
setCurrentState
in interface HAPartition.HAPartitionStateTransfer
newState
- The serialized representation of the state of the new service.protected void registerListener(String category, Object subscriber)
protected void unregisterListener(String category, Object subscriber)
protected void notifyKeyListeners(String category, Serializable key, Serializable value, boolean locallyModified)
protected void notifyKeyListenersOfRemove(String category, Serializable key, Serializable oldContent, boolean locallyModified)
protected void cleanupKeyListeners()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |