org.jboss.cache.config
Class Option

java.lang.Object
  extended by org.jboss.cache.config.Option
All Implemented Interfaces:
Cloneable

public class Option
extends Object
implements Cloneable

Used to override characteristics of specific calls to the cache. The javadocs of each of the setters below detail functionality and behaviour.

Since:
1.3.0
Author:
Manik Surtani (manik AT jboss DOT org), Galder Zamarreno

Constructor Summary
Option()
           
 
Method Summary
 Option clone()
          Deprecated. this method may disappear in future, please use copy() instead.
 Option copy()
           
 boolean equals(Object o)
           
 DataVersion getDataVersion()
          Deprecated. this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.
 boolean getForceDataGravitation()
           
 int getGroupRequestMode()
           
 int getLockAcquisitionTimeout()
          Gets any lock acquisition timeout configured for the call.
 long getSyncReplTimeout()
           
 int hashCode()
           
 boolean isCacheModeLocal()
          only applies to put() and remove() methods on the cache.
 boolean isFailSilently()
           
 boolean isForceAsynchronous()
          Gets whether replication or invalidation should be done asynchronously, even if the cache is configured in a synchronous mode.
 boolean isForceSynchronous()
          Gets whether replication or invalidation should be done synchronously, even if the cache is configured in an asynchronous mode.
 boolean isForceWriteLock()
          Tests whether a write lock has been forced on the call, regardless of whether it is a read or write.
 boolean isSkipCacheStatusCheck()
           
 boolean isSkipDataGravitation()
           
 boolean isSuppressEventNotification()
          Get whether event notifications for this invocation will be suppresed.
 boolean isSuppressLocking()
           
 boolean isSuppressPersistence()
          If set to true, any persistence to a cache loader will be suppressed for the current invocation only.
 void reset()
          Resets this option to defaults.
 void setCacheModeLocal(boolean cacheModeLocal)
          overriding CacheMode from REPL_SYNC, REPL_ASYNC, INVALIDATION_SYNC, INVALIDATION_ASYNC to LOCAL.
 void setDataVersion(DataVersion dataVersion)
          Deprecated. this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.
 void setFailSilently(boolean failSilently)
          suppress any failures in your cache operation, including version mismatches with optimistic locking, timeouts obtaining locks, transaction rollbacks.
 void setForceAsynchronous(boolean forceAsynchronous)
          Sets whether replication or invalidation should be done asynchronously, even if the cache is configured in a synchronous mode.
 void setForceDataGravitation(boolean enableDataGravitation)
          Enables data gravitation calls if a cache miss is detected when using Buddy Replication.
 void setForceSynchronous(boolean forceSynchronous)
          Sets whether replication or invalidation should be done synchronously, even if the cache is configured in an asynchronous mode.
 void setForceWriteLock(boolean forceWriteLock)
          Forces a write lock to be acquired on the call, regardless of whether it is a read or write.
 void setGroupRequestMode(int groupRequestMode)
          By default, the RPCManager has inbuilt logic when it comes to selecting a group request mode.
 void setLockAcquisitionTimeout(int lockAcquisitionTimeout)
          Sets any lock acquisition timeout configured for the call.
 void setSkipCacheStatusCheck(boolean skipCacheStatusCheck)
          If set to true, cache lifecycle checks will be skipped.
 void setSkipDataGravitation(boolean skipDataGravitation)
          Suppresses data gravitation when buddy replication is used.
 void setSuppressEventNotification(boolean suppressEventNotification)
          Set whether event notifications should be suppressed for this particular cache or transaction invocation.
 void setSuppressLocking(boolean suppressLocking)
          Suppresses acquiring locks for the given invocation.
 void setSuppressPersistence(boolean suppressPersistence)
          If set to true, any persistence to a cache loader will be suppressed for the current invocation only.
 void setSyncReplTimeout(long syncReplTimeout)
          Used to override the value in Configuration.getSyncReplTimeout() (used when cache mode is either Configuration.CacheMode.REPL_SYNC or Configuration.CacheMode.INVALIDATION_SYNC) for this specific invocation.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Option

public Option()
Method Detail

isSuppressLocking

public boolean isSuppressLocking()
Since:
1.4.0

setSuppressLocking

public void setSuppressLocking(boolean suppressLocking)
Suppresses acquiring locks for the given invocation. Used with pessimistic locking only. Use with extreme care, may lead to a breach in data integrity!

Since:
1.4.0

isFailSilently

public boolean isFailSilently()
Since:
1.3.0

setFailSilently

public void setFailSilently(boolean failSilently)
suppress any failures in your cache operation, including version mismatches with optimistic locking, timeouts obtaining locks, transaction rollbacks. If this is option is set, the method invocation will __never fail or throw an exception__, although it may not succeed. With this option enabled the call will not participate in any ongoing transactions even if a transaction is running.

Since:
1.3.0

isCacheModeLocal

public boolean isCacheModeLocal()
only applies to put() and remove() methods on the cache.

Since:
1.3.0

setCacheModeLocal

public void setCacheModeLocal(boolean cacheModeLocal)
overriding CacheMode from REPL_SYNC, REPL_ASYNC, INVALIDATION_SYNC, INVALIDATION_ASYNC to LOCAL. Only applies to put() and remove() methods on the cache.

Parameters:
cacheModeLocal -
Since:
1.3.0

getDataVersion

@Deprecated
public DataVersion getDataVersion()
Deprecated. this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.

Since:
1.3.0

setDataVersion

@Deprecated
public void setDataVersion(DataVersion dataVersion)
Deprecated. this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.

Passing in an DataVersion instance when using optimistic locking will override the default behaviour of internally generated version info and allow the caller to handle data versioning.

Since:
1.3.0

getForceDataGravitation

public boolean getForceDataGravitation()
Since:
1.4.0

setForceDataGravitation

public void setForceDataGravitation(boolean enableDataGravitation)
Enables data gravitation calls if a cache miss is detected when using Buddy Replication. Enabled only for a given invocation, and only useful if autoDataGravitation is set to false. See Buddy Replication documentation for more details.

Since:
1.4.0

isSkipDataGravitation

public boolean isSkipDataGravitation()
Returns:
true if skipDataGravitation is set to true.
Since:
1.4.1.SP6

setSkipDataGravitation

public void setSkipDataGravitation(boolean skipDataGravitation)
Suppresses data gravitation when buddy replication is used. If true, overrides setForceDataGravitation(boolean) being set to true. Typically used to suppress gravitation calls when BuddyReplicationConfig.setAutoDataGravitation(boolean) is set to true.

Parameters:
skipDataGravitation -
Since:
1.4.1.SP6

isForceAsynchronous

public boolean isForceAsynchronous()
Gets whether replication or invalidation should be done asynchronously, even if the cache is configured in a synchronous mode. Has no effect if the call is occuring within a transactional context.

Returns:
true if replication/invalidation should be done asynchronously; false if the default mode configured for the cache should be used.

setForceAsynchronous

public void setForceAsynchronous(boolean forceAsynchronous)
Sets whether replication or invalidation should be done asynchronously, even if the cache is configured in a synchronous mode. Has no effect if the call is occuring within a transactional context.

Parameters:
forceAsynchronous - true if replication/invalidation should be done asynchronously; false if the default mode configured for the cache should be used.

isForceSynchronous

public boolean isForceSynchronous()
Gets whether replication or invalidation should be done synchronously, even if the cache is configured in an asynchronous mode. Has no effect if the call is occuring within a transactional context.

Returns:
true if replication/invalidation should be done synchronously; false if the default mode configured for the cache should be used.

setForceSynchronous

public void setForceSynchronous(boolean forceSynchronous)
Sets whether replication or invalidation should be done synchronously, even if the cache is configured in an asynchronous mode. Has no effect if the call is occuring within a transactional context.

Parameters:
forceSynchronous - true if replication/invalidation should be done synchronously; false if the default mode configured for the cache should be used.

getLockAcquisitionTimeout

public int getLockAcquisitionTimeout()
Gets any lock acquisition timeout configured for the call.

Returns:
the time in ms that lock acquisition attempts should block before failing with a TimeoutException. A value < 0 indicates that the cache's default timeout should be used.

setLockAcquisitionTimeout

public void setLockAcquisitionTimeout(int lockAcquisitionTimeout)
Sets any lock acquisition timeout configured for the call.

Parameters:
lockAcquisitionTimeout - the time in ms that lock acquisition attempts should block before failing with a TimeoutException. A value < 0 indicates that the cache's default timeout should be used.

toString

public String toString()
Overrides:
toString in class Object

clone

@Deprecated
public Option clone()
             throws CloneNotSupportedException
Deprecated. this method may disappear in future, please use copy() instead.

Overrides:
clone in class Object
Throws:
CloneNotSupportedException
See Also:
copy()

copy

public Option copy()
Returns:
a new Option instance with all fields shallow-copied.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

reset

public void reset()
Resets this option to defaults.


setForceWriteLock

public void setForceWriteLock(boolean forceWriteLock)
Forces a write lock to be acquired on the call, regardless of whether it is a read or write.

Note that this only applies to Configuration.NodeLockingScheme.MVCC and Configuration.NodeLockingScheme.PESSIMISTIC node locking schemes, and is ignored if Configuration.NodeLockingScheme.OPTIMISTIC is used.

Parameters:
forceWriteLock -
Since:
2.0.0

isForceWriteLock

public boolean isForceWriteLock()
Tests whether a write lock has been forced on the call, regardless of whether it is a read or write.

Note that this only applies to Configuration.NodeLockingScheme.MVCC and Configuration.NodeLockingScheme.PESSIMISTIC node locking schemes, and is ignored if Configuration.NodeLockingScheme.OPTIMISTIC is used.

Since:
2.0.0

setSkipCacheStatusCheck

public void setSkipCacheStatusCheck(boolean skipCacheStatusCheck)
If set to true, cache lifecycle checks will be skipped. DO NOT USE unless you really know what you're doing.

Since:
2.0.0

isSkipCacheStatusCheck

public boolean isSkipCacheStatusCheck()
Returns:
true if skipCacheStatusCheck is true
Since:
2.0.0

getSyncReplTimeout

public long getSyncReplTimeout()
Returns:
the value of the sync replication timeout (used when cache mode is either Configuration.CacheMode.REPL_SYNC or Configuration.CacheMode.INVALIDATION_SYNC) to be used for this specific call, or -1 (default) if the default value in Configuration.getSyncReplTimeout() is to be used instead.
Since:
2.1.0

setSyncReplTimeout

public void setSyncReplTimeout(long syncReplTimeout)
Used to override the value in Configuration.getSyncReplTimeout() (used when cache mode is either Configuration.CacheMode.REPL_SYNC or Configuration.CacheMode.INVALIDATION_SYNC) for this specific invocation. Defaults to -1, which means use the default in the configuration.

Parameters:
syncReplTimeout - new timeout value for this invocation.
Since:
2.1.0

getGroupRequestMode

public int getGroupRequestMode()
Returns:
overridden JGroups GroupRequest mode to use, or -1 if the RPCManager's own logic is to be used to select a group request mode (this is the default).
Since:
2.1.0

setGroupRequestMode

public void setGroupRequestMode(int groupRequestMode)
By default, the RPCManager has inbuilt logic when it comes to selecting a group request mode. This can be overridden by setting the group request mode here, using this method, for a specific invocation.

Parameters:
groupRequestMode - a group request mode, found in the GroupRequest class.
Since:
2.1.0

isSuppressPersistence

public boolean isSuppressPersistence()
If set to true, any persistence to a cache loader will be suppressed for the current invocation only. Does not apply to transactional calls.

Returns:
true if persistence is suppressed.
Since:
3.0

setSuppressPersistence

public void setSuppressPersistence(boolean suppressPersistence)
If set to true, any persistence to a cache loader will be suppressed for the current invocation only. Does not apply to transactional calls.

Parameters:
suppressPersistence - if true, will suppress persistence.
Since:
3.0

isSuppressEventNotification

public boolean isSuppressEventNotification()
Get whether event notifications for this invocation will be suppresed. By default is false which means that corresponding events are sent depending on the type of invocation.

Returns:
true, if event notification will be suppressed for this invocation.

setSuppressEventNotification

public void setSuppressEventNotification(boolean suppressEventNotification)
Set whether event notifications should be suppressed for this particular cache or transaction invocation.

Parameters:
suppressEventNotification - true if event notification should be skipped; false if events should be notified if there're any listeners.


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