|
Openfire 3.4.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.util.cache.DefaultLocalCacheStrategy
public class DefaultLocalCacheStrategy
CacheFactoryStrategy for use in Openfire. It creates and manages local caches, and it's cluster related method implementations do nothing.
Cache
,
CacheFactory
Field Summary | |
---|---|
static long |
DEFAULT_MAX_CACHE_LIFETIME
|
static int |
DEFAULT_MAX_CACHE_SIZE
|
Constructor Summary | |
---|---|
DefaultLocalCacheStrategy()
|
Method Summary | |
---|---|
Cache |
createCache(String name)
Creates a new cache for the cache name specified. |
void |
doClusterTask(ClusterTask task)
Invokes a task on other cluster members in an asynchronous fashion. |
boolean |
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. |
Collection<ClusterNodeInfo> |
getClusterNodesInfo()
Returns basic information about the current members of the cluster or an empty collection if not running in a cluster. |
int |
getMaxClusterNodes()
Returns the maximum number of cluster members allowed. |
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. |
void |
lockKey(Object key,
long timeout)
Locks the specified key in the locking map. |
static void |
setMaxLifetimeProperty(String cacheName,
long lifetime)
Sets a local property which overrides the maximum cache entry lifetime as configured in coherence-cache-config.xml for the supplied cache name. |
static void |
setMaxSizeProperty(String cacheName,
int size)
Sets a local property which overrides the maximum cache size as configured in coherence-cache-config.xml for the supplied cache name. |
boolean |
startCluster()
Returns true if the cluster has been started. |
void |
stopCluster()
Stops the cluster. |
void |
unlockKey(Object key)
Unlocks the specified key in the locking map. |
void |
updateCacheStats(Map<String,Cache> caches)
Updates the statistics of the specified caches and publishes them into a cache for statistics. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_CACHE_SIZE
public static final long DEFAULT_MAX_CACHE_LIFETIME
Constructor Detail |
---|
public DefaultLocalCacheStrategy()
Method Detail |
---|
public boolean startCluster()
CacheFactoryStrategy
An error should be logged when the cluster fails to be started.
startCluster
in interface CacheFactoryStrategy
public void stopCluster()
CacheFactoryStrategy
stopCluster
in interface CacheFactoryStrategy
public Cache createCache(String name)
CacheFactoryStrategy
createCache
in interface CacheFactoryStrategy
name
- name of the cache to create.
public boolean isSeniorClusterMember()
CacheFactoryStrategy
isSeniorClusterMember
in interface CacheFactoryStrategy
public Collection<ClusterNodeInfo> getClusterNodesInfo()
CacheFactoryStrategy
getClusterNodesInfo
in interface CacheFactoryStrategy
public int getMaxClusterNodes()
CacheFactoryStrategy
getMaxClusterNodes
in interface CacheFactoryStrategy
public byte[] getSeniorClusterMemberID()
CacheFactoryStrategy
getSeniorClusterMemberID
in interface CacheFactoryStrategy
public byte[] getClusterMemberID()
CacheFactoryStrategy
getClusterMemberID
in interface CacheFactoryStrategy
public void doClusterTask(ClusterTask task)
CacheFactoryStrategy
doClusterTask
in interface CacheFactoryStrategy
task
- the task to be invoked on all other cluster members.public boolean doClusterTask(ClusterTask task, byte[] nodeID)
CacheFactoryStrategy
doClusterTask
in interface CacheFactoryStrategy
task
- 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)
CacheFactoryStrategy
doSynchronousClusterTask
in interface CacheFactoryStrategy
task
- the ClusterTask object to be invoked on all other cluster members.includeLocalMember
- true to run the task on the local member, false otherwise
public Object doSynchronousClusterTask(ClusterTask task, byte[] nodeID)
CacheFactoryStrategy
doSynchronousClusterTask
in interface CacheFactoryStrategy
task
- 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)
CacheFactoryStrategy
The statistics cache must contain a long array of 5 positions for each cache with the following content:
updateCacheStats
in interface CacheFactoryStrategy
caches
- caches to get their stats and publish them in a statistics cache.public void lockKey(Object key, long timeout)
CacheFactoryStrategy
lockKey
in interface CacheFactoryStrategy
key
- the key to lock.timeout
- number of milliseconds to wait to obtain the lock. -1 means wait forever.public void unlockKey(Object key)
CacheFactoryStrategy
unlockKey
in interface CacheFactoryStrategy
key
- the key to unlock.public static void setMaxSizeProperty(String cacheName, int size)
cacheName
- the name of the cache to store a value for.size
- the maximum cache size.public static void setMaxLifetimeProperty(String cacheName, long lifetime)
cacheName
- the name of the cache to store a value for.lifetime
- the maximum cache entry lifetime.
|
Openfire 3.4.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |