|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.util.CacheFactory
public class CacheFactory
Creates Cache objects. The returned caches will either be local or clustered depending on the clustering enabled setting and a user's license.
When clustered caching is turned on, cache usage statistics for all caches that have been created are periodically published to the clustered cache named "opt-$cacheStats".
Nested Class Summary | |
---|---|
static interface |
CacheFactory.ClusteringListener
Listener interface for any object which needs to be notified when clustering starts or stops |
Field Summary | |
---|---|
static java.lang.String |
CLUSTER_PROPERTY_NAME
|
static com.tangosol.util.ConcurrentMap |
lockingMap
A special map that can be used for doing cluster-wide locking. |
Method Summary | |
---|---|
static void |
addClusteringListener(CacheFactory.ClusteringListener listener)
|
static void |
clearCaches()
|
static Cache |
createCache(java.lang.String name)
Returns the named cache, creating it as necessary. |
static Cache |
createCache(java.lang.String name,
int maxCacheSize,
long maxLifetime)
Returns the named cache, creating it as necessary, using the supplied name, size, and lifetime. |
static void |
doClusterTask(com.tangosol.net.Invocable task)
Invokes a task on other cluster members in an asynchronous fashion. |
static void |
doClusterTask(com.tangosol.net.Invocable task,
com.tangosol.net.InvocationObserver observer)
Invokes a task on other cluster members in an asynchronous fashion. |
static void |
doClusterTask(com.tangosol.net.Invocable task,
com.tangosol.net.InvocationObserver observer,
boolean sendAsynchronously)
Invokes a task on other cluster members in an asynchronous fashion. |
static void |
doRandomMemberClusterTask(com.tangosol.net.Invocable task,
com.tangosol.net.InvocationObserver observer,
boolean sendAsynchronously)
Invokes a task on a random member of the cluster in an asynchronous fashion. |
static java.util.Map |
doSynchronousClusterTask(com.tangosol.net.Invocable task,
boolean includeLocalMember)
Invokes a task on other cluster members synchronously and returns the result as a Map (method will not return until the task has been executed on each cluster member). |
static Cache[] |
getAllCaches()
Returns an array of all caches in the system. |
static long |
getMaxLifetimeFromProperty(java.lang.String cacheName,
long defaultLifetime)
If a local property is found for the supplied name which specifies a value for cache entry lifetime, it is returned. |
static int |
getMaxSizeFromProperty(java.lang.String cacheName,
int defaultSize)
If a local property is found for the supplied name which specifies a value for cache size, it is returned. |
static void |
initialize()
Starts the cluster service if clustering is enabled, and begins tracking cache statistics. |
static boolean |
isClusteringEnabled()
Returns true if cache clustering is enabled. |
static boolean |
isSeniorClusterMember()
Returns true if this member is the senior member in the cluster. |
static void |
removeClusteringListener(CacheFactory.ClusteringListener listener)
|
static void |
saveCacheSettings()
Saves current cache settings to local properties. |
static void |
setClusteringEnabled(boolean enabled)
Sets whether cache clustering should be enabled. |
static void |
setMaxLifetimeProperty(java.lang.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(java.lang.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. |
static void |
shutdownClusteringService()
Shuts down the clustering service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLUSTER_PROPERTY_NAME
public static com.tangosol.util.ConcurrentMap lockingMap
Method Detail |
---|
public static Cache[] getAllCaches()
public static Cache createCache(java.lang.String name, int maxCacheSize, long maxLifetime)
name
- the name of the cache to create.maxCacheSize
- the max size the cache can grow to, in bytes.maxLifetime
- the max number of milliseconds that objects can remain in cache.
public static Cache createCache(java.lang.String name)
name
- the name of the cache to create.public static boolean isClusteringEnabled()
public static void setClusteringEnabled(boolean enabled)
enabled
- true if cache clustering should be enabled.public static void clearCaches()
public static boolean isSeniorClusterMember()
public static void doClusterTask(com.tangosol.net.Invocable task)
task
- the task to be invoked on all other cluster members.public static void doClusterTask(com.tangosol.net.Invocable task, com.tangosol.net.InvocationObserver observer)
task
- the Invocable object to be invoked on all other cluster members.observer
- the InvocationObserver object that will receive notifications
related to the task. This may be null if there is no wish to receive notifications
related to the task.public static void doClusterTask(com.tangosol.net.Invocable task, com.tangosol.net.InvocationObserver observer, boolean sendAsynchronously)
task
- the Invocable object to be invoked on all other cluster members.observer
- the InvocationObserver object that will receive notifications
related to the task. This may be null if there is no wish to receive notifications
related to the task.sendAsynchronously
- true if the invocable should be added to a queue and sent
to other cluster members on a queue. When false, the invocable will be sent
to other cluster members immediately (network operation).public static void doRandomMemberClusterTask(com.tangosol.net.Invocable task, com.tangosol.net.InvocationObserver observer, boolean sendAsynchronously)
task
- the Invocable object to be invoked on a random cluster member.observer
- the InvocationObserver object that will receive notifications
related to the task. This may be null if there is no wish to receive notifications
related to the task.sendAsynchronously
- true if the invocable should be added to a queue and sent
to other cluster members on a queue. When false, the invocable will be sent
to other cluster members immediately (network operation).public static java.util.Map doSynchronousClusterTask(com.tangosol.net.Invocable task, boolean includeLocalMember)
task
- the Invocable object to be invoked on all other cluster members.includeLocalMember
- true to run the task on the local member, false otherwisepublic static void shutdownClusteringService()
public static void addClusteringListener(CacheFactory.ClusteringListener listener)
public static void removeClusteringListener(CacheFactory.ClusteringListener listener)
public static void saveCacheSettings()
public static void setMaxSizeProperty(java.lang.String cacheName, int size)
cacheName
- the name of the cache to store a value for.size
- the maximum cache size.public static void setMaxLifetimeProperty(java.lang.String cacheName, long lifetime)
cacheName
- the name of the cache to store a value for.lifetime
- the maximum cache entry lifetime.public static int getMaxSizeFromProperty(java.lang.String cacheName, int defaultSize)
cacheName
- the name of the cache to look up a corresponding property for.defaultSize
- the value to return if no property is set.
public static long getMaxLifetimeFromProperty(java.lang.String cacheName, long defaultLifetime)
cacheName
- the name of the cache to look up a corresponding property for.defaultLifetime
- the value to return if no property is set.
public static void initialize()
Cache
s returned by calls to createCache(java.lang.String, int, long)
will return local caches. The process of starting clustering
will recreate them as distributed caches. This is safer than the alternative - where clustering is started before
any caches are created. In that scenario, cluster tasks can fire off in this process before it is safe for them to do so,
and cluster wide deadlocks can occur.
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |