org.jboss.ha.framework.server
Class DistributedStateImpl

java.lang.Object
  extended by org.jboss.ha.framework.server.DistributedStateImpl
All Implemented Interfaces:
org.jboss.ha.framework.interfaces.DistributedState, DistributedStateImplMBean, org.jboss.ha.framework.server.spi.ManagedDistributedState

public class DistributedStateImpl
extends Object
implements org.jboss.ha.framework.server.spi.ManagedDistributedState, DistributedStateImplMBean

This class manages distributed state across the cluster.

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.ha.framework.interfaces.DistributedState
org.jboss.ha.framework.interfaces.DistributedState.DSListener, org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx
 
Field Summary
protected  boolean acquiredCache
           
protected  org.jboss.cache.Cache<Serializable,Serializable> cache
           
protected  HAPartitionCacheHandlerImpl cacheHandler
           
protected  Map<String,List<Object>> keyListeners
           
protected  org.jboss.logging.Logger log
           
protected  String name
           
protected  boolean replAsync
           
static Serializable ROOT
           
static org.jboss.cache.Fqn<Serializable> ROOTFQN
           
static int ROOTFQNSIZE
           
protected static String SERVICE_NAME
           
 
Constructor Summary
DistributedStateImpl()
           
 
Method Summary
protected  org.jboss.cache.Fqn<Serializable> buildFqn(String category)
          ExtendedTreeCacheListener methods
protected  org.jboss.cache.Fqn<Serializable> buildFqn(String category, Serializable key)
           
protected  org.jboss.cache.Fqn<Serializable> buildFqn(String category, Serializable key, Serializable value)
           
protected  void cleanupKeyListeners()
           
 void createService()
           
 void destroyService()
           
 Serializable get(String category, Serializable key)
           
 Collection<String> getAllCategories()
           
 Collection<Serializable> getAllKeys(String category)
           
 Collection<Serializable> getAllValues(String category)
           
 HAPartitionCacheHandlerImpl getCacheHandler()
           
 org.jboss.cache.Cache<Serializable,Serializable> getClusteredCache()
           
protected  org.jboss.cache.Node<Serializable,Serializable> getNode(String category)
           
 String listContent()
           
 String listXmlContent()
           
 void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
           
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, org.jboss.ha.framework.interfaces.DistributedState.DSListener subscriber)
           
 void registerDSListenerEx(String category, org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx subscriber)
           
protected  void registerListener(String category, Object subscriber)
           
 Serializable remove(String category, Serializable key)
           
 Serializable remove(String category, Serializable key, boolean asynchronousCall)
           
 void set(String category, Serializable key, Serializable value)
           
 void set(String category, Serializable key, Serializable value, boolean asynchronousCall)
           
 void setCacheHandler(HAPartitionCacheHandlerImpl cacheHandler)
           
 void setClusteredCache(org.jboss.cache.Cache<Serializable,Serializable> cache)
          Sets the cache to use.
 void startService()
           
 void stopService()
           
 void unregisterDSListener(String category, org.jboss.ha.framework.interfaces.DistributedState.DSListener subscriber)
           
 void unregisterDSListenerEx(String category, org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx subscriber)
           
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

ROOT

public static final Serializable ROOT

ROOTFQN

public static final org.jboss.cache.Fqn<Serializable> ROOTFQN

ROOTFQNSIZE

public static final int ROOTFQNSIZE

SERVICE_NAME

protected static final String SERVICE_NAME
See Also:
Constant Field Values

keyListeners

protected Map<String,List<Object>> keyListeners

log

protected org.jboss.logging.Logger log

name

protected String name

cache

protected org.jboss.cache.Cache<Serializable,Serializable> cache

replAsync

protected boolean replAsync

cacheHandler

protected HAPartitionCacheHandlerImpl cacheHandler

acquiredCache

protected boolean acquiredCache
Constructor Detail

DistributedStateImpl

public DistributedStateImpl()
Method Detail

createService

public void createService()
                   throws Exception
Specified by:
createService in interface org.jboss.ha.framework.server.spi.ManagedDistributedState
Throws:
Exception

startService

public void startService()
                  throws Exception
Specified by:
startService in interface org.jboss.ha.framework.server.spi.ManagedDistributedState
Throws:
Exception

stopService

public void stopService()
                 throws Exception
Specified by:
stopService in interface org.jboss.ha.framework.server.spi.ManagedDistributedState
Throws:
Exception

destroyService

public void destroyService()
                    throws Exception
Specified by:
destroyService in interface org.jboss.ha.framework.server.spi.ManagedDistributedState
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

getClusteredCache

public org.jboss.cache.Cache<Serializable,Serializable> getClusteredCache()

setClusteredCache

public void setClusteredCache(org.jboss.cache.Cache<Serializable,Serializable> cache)
Sets the cache to use.

Parameters:
cache - the cache
Throws:
IllegalStateException - if the cache isn't configured for replication

getCacheHandler

public HAPartitionCacheHandlerImpl getCacheHandler()

setCacheHandler

public void setCacheHandler(HAPartitionCacheHandlerImpl cacheHandler)

set

public void set(String category,
                Serializable key,
                Serializable value)
         throws Exception
Specified by:
set in interface org.jboss.ha.framework.interfaces.DistributedState
Throws:
Exception

set

public void set(String category,
                Serializable key,
                Serializable value,
                boolean asynchronousCall)
         throws Exception
Specified by:
set in interface org.jboss.ha.framework.interfaces.DistributedState
Throws:
Exception

remove

public Serializable remove(String category,
                           Serializable key)
                    throws Exception
Specified by:
remove in interface org.jboss.ha.framework.interfaces.DistributedState
Throws:
Exception

remove

public Serializable remove(String category,
                           Serializable key,
                           boolean asynchronousCall)
                    throws Exception
Specified by:
remove in interface org.jboss.ha.framework.interfaces.DistributedState
Throws:
Exception

get

public Serializable get(String category,
                        Serializable key)
Specified by:
get in interface org.jboss.ha.framework.interfaces.DistributedState

getAllCategories

public Collection<String> getAllCategories()
Specified by:
getAllCategories in interface org.jboss.ha.framework.interfaces.DistributedState

getAllKeys

public Collection<Serializable> getAllKeys(String category)
Specified by:
getAllKeys in interface org.jboss.ha.framework.interfaces.DistributedState

getAllValues

public Collection<Serializable> getAllValues(String category)
Specified by:
getAllValues in interface org.jboss.ha.framework.interfaces.DistributedState

registerDSListenerEx

public void registerDSListenerEx(String category,
                                 org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx subscriber)
Specified by:
registerDSListenerEx in interface org.jboss.ha.framework.interfaces.DistributedState

unregisterDSListenerEx

public void unregisterDSListenerEx(String category,
                                   org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx subscriber)
Specified by:
unregisterDSListenerEx in interface org.jboss.ha.framework.interfaces.DistributedState

registerDSListener

public void registerDSListener(String category,
                               org.jboss.ha.framework.interfaces.DistributedState.DSListener subscriber)
Specified by:
registerDSListener in interface org.jboss.ha.framework.interfaces.DistributedState

unregisterDSListener

public void unregisterDSListener(String category,
                                 org.jboss.ha.framework.interfaces.DistributedState.DSListener subscriber)
Specified by:
unregisterDSListener in interface org.jboss.ha.framework.interfaces.DistributedState

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()

buildFqn

protected org.jboss.cache.Fqn<Serializable> buildFqn(String category)
ExtendedTreeCacheListener methods


buildFqn

protected org.jboss.cache.Fqn<Serializable> buildFqn(String category,
                                                     Serializable key)

buildFqn

protected org.jboss.cache.Fqn<Serializable> buildFqn(String category,
                                                     Serializable key,
                                                     Serializable value)

getNode

protected org.jboss.cache.Node<Serializable,Serializable> getNode(String category)
                                                           throws org.jboss.cache.CacheException
Throws:
org.jboss.cache.CacheException

nodeModified

public void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.