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@jboss.org)

Constructor Summary
Option()
           
 
Method Summary
 Option clone()
           
 boolean equals(Object o)
           
 DataVersion getDataVersion()
           
 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 isSuppressLocking()
           
 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)
          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.
 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
 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 setSuppressLocking(boolean suppressLocking)
          Suppresses acquiring locks for the given invocation.
 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

public DataVersion getDataVersion()
Since:
1.3.0

setDataVersion

public void setDataVersion(DataVersion dataVersion)
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

public Option clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

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. Only applies to the PessimisticLockInterceptor

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. Only applies to the PessimisticLockInterceptor

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


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