public class DefaultLocalCacheStrategy extends Object implements CacheFactoryStrategy
Cache,
CacheFactory| Constructor and Description |
|---|
DefaultLocalCacheStrategy() |
| Modifier and Type | Method and Description |
|---|---|
Cache |
createCache(String name)
Creates a new cache for the cache name specified.
|
void |
destroyCache(Cache cache)
Destroys the supplied cache.
|
void |
doClusterTask(ClusterTask task)
Invokes a task on other cluster members in an asynchronous fashion.
|
void |
doClusterTask(ClusterTask task,
byte[] nodeID)
Invokes a task on other the specified cluster member in an asynchronous fashion.
|
Collection<Object> |
doSynchronousClusterTask(ClusterTask task,
boolean includeLocalMember)
Invokes a task on other cluster members synchronously and returns the result as a Collection
(method will not return until the task has been executed on each cluster member).
|
Object |
doSynchronousClusterTask(ClusterTask task,
byte[] nodeID)
Invokes a task on a given cluster member synchronously and returns the result of
the remote operation.
|
byte[] |
getClusterMemberID()
Returns a byte[] that uniquely identifies this member within the cluster or null
when not in a cluster.
|
ClusterNodeInfo |
getClusterNodeInfo(byte[] nodeID)
Returns the node info for the given cluster node
|
Collection<ClusterNodeInfo> |
getClusterNodesInfo()
Returns basic information about the current members of the cluster or an empty
collection if not running in a cluster.
|
long |
getClusterTime()
Gets the pseudo-synchronized time from the cluster.
|
Lock |
getLock(Object key,
Cache cache)
Returns an existing lock on the specified key or creates a new one if none was found.
|
int |
getMaxClusterNodes()
Returns the maximum number of cluster members allowed.
|
String |
getPluginName()
Get the plugin name corresponding to this clustering implementation
|
byte[] |
getSeniorClusterMemberID()
Returns a byte[] that uniquely identifies this senior cluster member or null
when not in a cluster.
|
boolean |
isSeniorClusterMember()
Returns true if this node is the maste node of the cluster.
|
boolean |
startCluster()
Returns true if the cluster has been started.
|
void |
stopCluster()
Stops the cluster.
|
void |
updateCacheStats(Map<String,Cache> caches)
Updates the statistics of the specified caches and publishes them into
a cache for statistics.
|
public boolean startCluster()
CacheFactoryStrategyAn error should be logged when the cluster fails to be started.
startCluster in interface CacheFactoryStrategypublic void stopCluster()
CacheFactoryStrategystopCluster in interface CacheFactoryStrategypublic Cache createCache(String name)
CacheFactoryStrategycreateCache in interface CacheFactoryStrategyname - name of the cache to create.public void destroyCache(Cache cache)
CacheFactoryStrategydestroyCache in interface CacheFactoryStrategycache - the cache to destroy.public boolean isSeniorClusterMember()
CacheFactoryStrategyisSeniorClusterMember in interface CacheFactoryStrategypublic Collection<ClusterNodeInfo> getClusterNodesInfo()
CacheFactoryStrategygetClusterNodesInfo in interface CacheFactoryStrategypublic int getMaxClusterNodes()
CacheFactoryStrategygetMaxClusterNodes in interface CacheFactoryStrategypublic byte[] getSeniorClusterMemberID()
CacheFactoryStrategygetSeniorClusterMemberID in interface CacheFactoryStrategypublic byte[] getClusterMemberID()
CacheFactoryStrategygetClusterMemberID in interface CacheFactoryStrategypublic long getClusterTime()
CacheFactoryStrategygetClusterTime in interface CacheFactoryStrategypublic void doClusterTask(ClusterTask task)
CacheFactoryStrategydoClusterTask in interface CacheFactoryStrategytask - the task to be invoked on all other cluster members.public void doClusterTask(ClusterTask task, byte[] nodeID)
CacheFactoryStrategydoClusterTask in interface CacheFactoryStrategytask - the task to be invoked on the specified cluster member.nodeID - the byte array that identifies the target cluster member.public Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember)
CacheFactoryStrategydoSynchronousClusterTask in interface CacheFactoryStrategytask - the ClusterTask object to be invoked on all other cluster members.includeLocalMember - true to run the task on the local member, false otherwisepublic Object doSynchronousClusterTask(ClusterTask task, byte[] nodeID)
CacheFactoryStrategydoSynchronousClusterTask in interface CacheFactoryStrategytask - the ClusterTask object to be invoked on a given cluster member.nodeID - the byte array that identifies the target cluster member.public void updateCacheStats(Map<String,Cache> caches)
CacheFactoryStrategyThe statistics cache must contain a long array of 5 positions for each cache with the following content:
updateCacheStats in interface CacheFactoryStrategycaches - caches to get their stats and publish them in a statistics cache.public String getPluginName()
CacheFactoryStrategygetPluginName in interface CacheFactoryStrategypublic Lock getLock(Object key, Cache cache)
CacheFactoryStrategygetLock in interface CacheFactoryStrategykey - the object that defines the visibility or scope of the lock.cache - the cache used for holding the lock.public ClusterNodeInfo getClusterNodeInfo(byte[] nodeID)
CacheFactoryStrategygetClusterNodeInfo in interface CacheFactoryStrategynodeID - The target cluster nodeCopyright © 2003-2008 Jive Software.