org.jboss.cache.config
Class Option

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

public class Option
extends java.lang.Object
implements java.lang.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(java.lang.Object o)
           
 DataVersion getDataVersion()
           
 boolean getForceDataGravitation()
           
 int hashCode()
           
 boolean isCacheModeLocal()
          only applies to put() and remove() methods on the cache.
 boolean isFailSilently()
           
 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 setForceDataGravitation(boolean enableDataGravitation)
          Enables data gravitation calls if a cache miss is detected when using Buddy Replication.
 void setForceWriteLock(boolean forceWriteLock)
          Forces a write lock to be acquired on the call, regardless of whether it is a read or write.
 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.
 java.lang.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:
2.0.0

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:
2.0.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

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

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.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