[jbosscache-commits] JBoss Cache SVN: r7822 - in core/branches/flat/src: test/java/org/horizon/loader/bdbje and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Mar 2 13:47:13 EST 2009
Author: adriancole
Date: 2009-03-02 13:47:12 -0500 (Mon, 02 Mar 2009)
New Revision: 7822
Modified:
core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java
core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java
Log:
switched lock duration from micro to nanoseconds
Modified: core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java 2009-03-02 12:32:06 UTC (rev 7821)
+++ core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java 2009-03-02 18:47:12 UTC (rev 7822)
@@ -41,7 +41,7 @@
* <p/>
* <p/>
* All data access is transactional. Any attempted reads to locked records will block. The maximum duration of this is
- * set in microseconds via the parameter {@link org.horizon.loader.bdbje.BdbjeCacheStoreConfig#getLockAcquistionTimeoutMicros()}.
+ * set in nanoseconds via the parameter {@link org.horizon.loader.bdbje.BdbjeCacheStoreConfig#getLockAcquistionTimeout()}.
* Calls to {@link BdbjeCacheStore#prepare(java.util.List, javax.transaction.Transaction, boolean) prepare} will attempt
* to resolve deadlocks, retrying up to {@link org.horizon.loader.bdbje.BdbjeCacheStoreConfig#getMaxTxRetries()}
* attempts.
@@ -149,7 +149,8 @@
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
envConfig.setTransactional(true);
- envConfig.setLockTimeout(cfg.getLockAcquistionTimeoutMicros());
+ /* lock timeout is in microseconds */
+ envConfig.setLockTimeout(cfg.getLockAcquistionTimeout() * 1000);
if (log.isDebugEnabled()) {
envConfig.setConfigParam("je.txn.deadlockStackTrace", "true");
envConfig.setConfigParam("je.txn.dumpLocks", "true");
Modified: core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java 2009-03-02 12:32:06 UTC (rev 7821)
+++ core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java 2009-03-02 18:47:12 UTC (rev 7822)
@@ -9,8 +9,8 @@
* <ul> <li><tt>location</tt> - a location on disk where the store can write databases. This defaults to
* <tt>${java.io.tmpdir}</tt></li> <li><tt>purgeSynchronously</tt> - whether {@link
* org.horizon.loader.CacheStore#purgeExpired()} calls happen synchronously or not. By default, this is set to
- * <tt>false</tt>.</li> <li><tt>lockAcquistionTimeoutMicros</tt> - the length of time, in microseconds, to wait for
- * locks before timing out and throwing an exception. By default, this is set to <tt>60000000</tt>.</li>
+ * <tt>false</tt>.</li> <li><tt>lockAcquistionTimeout</tt> - the length of time, in milliseconds, to wait for locks
+ * before timing out and throwing an exception. By default, this is set to <tt>60000</tt>.</li>
* <li><tt>maxTxRetries</tt> - the number of times transaction prepares will attempt to resolve a deadlock before
* throwing an exception. By default, this is set to <tt>5</tt>.</li> </ul>
*
@@ -21,7 +21,7 @@
public class BdbjeCacheStoreConfig extends AbstractCacheLoaderConfig {
private String location = System.getProperty("java.io.tmpdir");
private boolean purgeSynchronously;
- private long lockAcquistionTimeoutMicros = 60 * 1000 * 1000;
+ private long lockAcquistionTimeout = 60 * 1000;
private int maxTxRetries = 5;
@@ -38,12 +38,12 @@
}
- public long getLockAcquistionTimeoutMicros() {
- return lockAcquistionTimeoutMicros;
+ public long getLockAcquistionTimeout() {
+ return lockAcquistionTimeout;
}
- public void setLockAcquistionTimeoutMicros(long lockAcquistionTimeoutMicros) {
- this.lockAcquistionTimeoutMicros = lockAcquistionTimeoutMicros;
+ public void setLockAcquistionTimeout(long lockAcquistionTimeout) {
+ this.lockAcquistionTimeout = lockAcquistionTimeout;
}
public String getLocation() {
Modified: core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java 2009-03-02 12:32:06 UTC (rev 7821)
+++ core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java 2009-03-02 18:47:12 UTC (rev 7822)
@@ -45,14 +45,14 @@
}
@Test
- public void testGetLockAcquistionTimeoutMicros() {
- assert config.getLockAcquistionTimeoutMicros() == 60 * 1000 * 1000;
+ public void testGetLockAcquistionTimeout() {
+ assert config.getLockAcquistionTimeout() == 60 * 1000;
}
@Test
public void testSetLockAcquistionTimeoutMicros() {
- config.setLockAcquistionTimeoutMicros(1);
- assert config.getLockAcquistionTimeoutMicros() == 1;
+ config.setLockAcquistionTimeout(1);
+ assert config.getLockAcquistionTimeout() == 1;
}
@Test
More information about the jbosscache-commits
mailing list