Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 207   Methods: 17
NCLOC: 111   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Option.java 29.4% 62% 88.2% 55.4%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.config;
 8   
 9    import org.jboss.cache.optimistic.DataVersion;
 10   
 11    /**
 12    * Used to override characteristics of specific calls to the cache. The javadocs of each of the setters below detail functionality and behaviour.
 13    *
 14    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 15    * @since 1.3.0
 16    */
 17    public class Option implements Cloneable
 18    {
 19    private boolean failSilently;
 20    private boolean cacheModeLocal;
 21    private DataVersion dataVersion;
 22    private boolean suppressLocking;
 23    private boolean forceDataGravitation;
 24    private boolean bypassInterceptorChain;
 25    private boolean forceWriteLock;
 26   
 27    /**
 28    * @since 1.4.0
 29    */
 30  3136105 public boolean isSuppressLocking()
 31    {
 32  3136090 return suppressLocking;
 33    }
 34   
 35    /**
 36    * Suppresses acquiring locks for the given invocation. Used with pessimistic locking only. Use with extreme care, may lead to a breach in data integrity!
 37    *
 38    * @since 1.4.0
 39    */
 40  11 public void setSuppressLocking(boolean suppressLocking)
 41    {
 42  11 this.suppressLocking = suppressLocking;
 43    }
 44   
 45   
 46    /**
 47    * @since 1.3.0
 48    */
 49  2483353 public boolean isFailSilently()
 50    {
 51  2483353 return failSilently;
 52    }
 53   
 54    /**
 55    * 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 <b>not</b> participate in any ongoing transactions even if a transaction is running.
 56    *
 57    * @since 1.3.0
 58    */
 59  29 public void setFailSilently(boolean failSilently)
 60    {
 61  29 this.failSilently = failSilently;
 62    }
 63   
 64    /**
 65    * only applies to put() and remove() methods on the cache.
 66    *
 67    * @since 1.3.0
 68    */
 69  1884645 public boolean isCacheModeLocal()
 70    {
 71  1884645 return cacheModeLocal;
 72    }
 73   
 74    /**
 75    * overriding CacheMode from REPL_SYNC, REPL_ASYNC, INVALIDATION_SYNC, INVALIDATION_ASYNC to LOCAL. Only applies to put() and remove() methods on the cache.
 76    *
 77    * @param cacheModeLocal
 78    * @since 1.3.0
 79    */
 80  1402192 public void setCacheModeLocal(boolean cacheModeLocal)
 81    {
 82  1402192 this.cacheModeLocal = cacheModeLocal;
 83    }
 84   
 85    /**
 86    * @since 1.3.0
 87    */
 88  3889 public DataVersion getDataVersion()
 89    {
 90  3889 return dataVersion;
 91    }
 92   
 93    /**
 94    * Passing in an {@link org.jboss.cache.optimistic.DataVersion} instance when using optimistic locking will override the default behaviour of internally generated version info and allow the caller to handle data versioning.
 95    *
 96    * @since 1.3.0
 97    */
 98  224 public void setDataVersion(DataVersion dataVersion)
 99    {
 100  224 this.dataVersion = dataVersion;
 101    }
 102   
 103    /**
 104    * @since 1.4.0
 105    */
 106  374 public boolean getForceDataGravitation()
 107    {
 108  374 return forceDataGravitation;
 109    }
 110   
 111    /**
 112    * Enables data gravitation calls if a cache miss is detected when using <a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheBuddyReplicationDesign">Buddy Replication</a>.
 113    * Enabled only for a given invocation, and only useful if <code>autoDataGravitation</code> is set to <code>false</code>.
 114    * See <a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheBuddyReplicationDesign">Buddy Replication</a> documentation for more details.
 115    *
 116    * @since 1.4.0
 117    */
 118  211830 public void setForceDataGravitation(boolean enableDataGravitation)
 119    {
 120  211830 this.forceDataGravitation = enableDataGravitation;
 121    }
 122   
 123   
 124  0 public String toString()
 125    {
 126  0 return "Option{" +
 127    "failSilently=" + failSilently +
 128    ", cacheModeLocal=" + cacheModeLocal +
 129    ", dataVersion=" + dataVersion +
 130    ", suppressLocking=" + suppressLocking +
 131    ", forceDataGravitation=" + forceDataGravitation +
 132    ", bypassInterceptorChain=" + bypassInterceptorChain +
 133    '}';
 134    }
 135   
 136  12 public Option clone() throws CloneNotSupportedException
 137    {
 138  12 return (Option) super.clone();
 139    }
 140   
 141   
 142  12 public boolean equals(Object o)
 143    {
 144  0 if (this == o) return true;
 145  0 if (o == null || getClass() != o.getClass()) return false;
 146   
 147  12 final Option option = (Option) o;
 148   
 149  0 if (bypassInterceptorChain != option.bypassInterceptorChain) return false;
 150  0 if (cacheModeLocal != option.cacheModeLocal) return false;
 151  0 if (failSilently != option.failSilently) return false;
 152  0 if (forceDataGravitation != option.forceDataGravitation) return false;
 153  0 if (suppressLocking != option.suppressLocking) return false;
 154  0 if (dataVersion != null ? !dataVersion.equals(option.dataVersion) : option.dataVersion != null) return false;
 155  0 if (forceWriteLock != option.forceWriteLock) return false;
 156  12 return true;
 157    }
 158   
 159  0 public int hashCode()
 160    {
 161  0 int result;
 162  0 result = (failSilently ? 1 : 0);
 163  0 result = 29 * result + (cacheModeLocal ? 1 : 0);
 164  0 result = 29 * result + (dataVersion != null ? dataVersion.hashCode() : 0);
 165  0 result = 29 * result + (suppressLocking ? 1 : 0);
 166  0 result = 29 * result + (forceDataGravitation ? 1 : 0);
 167  0 result = 29 * result + (bypassInterceptorChain ? 1 : 0);
 168  0 result = 29 * result + (forceWriteLock ? 0 : 1);
 169  0 return result;
 170    }
 171   
 172    /**
 173    * Resets this option to defaults.
 174    */
 175  2483294 public void reset()
 176    {
 177  2483304 this.bypassInterceptorChain = false;
 178  2483304 this.cacheModeLocal = false;
 179  2483304 this.failSilently = false;
 180  2483304 this.forceDataGravitation = false;
 181  2483304 this.suppressLocking = false;
 182  2483304 this.dataVersion = null;
 183  2483304 this.forceWriteLock = false;
 184    }
 185   
 186    /**
 187    * Forces a write lock to be acquired on the call, regardless of whether it is a read or write. Only applies to the {@link org.jboss.cache.interceptors.PessimisticLockInterceptor}
 188    *
 189    * @param forceWriteLock
 190    * @since 2.0.0
 191    */
 192  3 public void setForceWriteLock(boolean forceWriteLock)
 193    {
 194  3 this.forceWriteLock = forceWriteLock;
 195    }
 196   
 197   
 198    /**
 199    * Tests whether a write lock has been forced on the call, regardless of whether it is a read or write. Only applies to the {@link org.jboss.cache.interceptors.PessimisticLockInterceptor}
 200    *
 201    * @since 2.0.0
 202    */
 203  8480135 public boolean isForceWriteLock()
 204    {
 205  8480132 return forceWriteLock;
 206    }
 207    }