[infinispan-commits] Infinispan SVN: r772 - in trunk: core/src/main/java/org/infinispan/config and 11 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Thu Sep 3 09:05:58 EDT 2009
Author: mircea.markus
Date: 2009-09-03 09:05:58 -0400 (Thu, 03 Sep 2009)
New Revision: 772
Modified:
trunk/README-Maven.txt
trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java
trunk/core/src/main/java/org/infinispan/config/Configuration.java
trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java
trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java
trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java
trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java
trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java
trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java
trunk/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java
trunk/core/src/main/java/org/infinispan/jmx/ResourceDMBean.java
trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStore.java
trunk/core/src/main/java/org/infinispan/remoting/responses/UnsuccessfulResponse.java
trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransactionManager.java
trunk/core/src/main/java/org/infinispan/util/ClassFinder.java
trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java
Log:
various findbugs improvements
Modified: trunk/README-Maven.txt
===================================================================
--- trunk/README-Maven.txt 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/README-Maven.txt 2009-09-03 13:05:58 UTC (rev 772)
@@ -168,7 +168,7 @@
2.5. Skipping the test run
--------------------------
-It is sometimes desirable to install the jboss cache package in your local repository without performing a full test run.
+It is sometimes desirable to install the Infinispan package in your local repository without performing a full test run.
To do this, simply use the maven.test.skip.exec property:
$ mvn -Dmaven.test.skip.exec=true install
Modified: trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -141,8 +141,8 @@
if (obj instanceof CacheLoaderManagerConfig) {
CacheLoaderManagerConfig other = (CacheLoaderManagerConfig) obj;
- return (this.passivation == other.passivation)
- && (this.shared == other.shared)
+ return (this.passivation.equals(other.passivation))
+ && (this.shared.equals(other.shared))
&& Util.safeEquals(this.preload, other.preload)
&& Util.safeEquals(this.cacheLoaderConfigs, other.cacheLoaderConfigs);
}
Modified: trunk/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -535,60 +535,33 @@
// OVERRIDDEN METHODS
// ------------------------------------------------------------------------------------------------------------
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof Configuration)) return false;
Configuration that = (Configuration) o;
- if (locking.concurrencyLevel != that.locking.concurrencyLevel) return false;
- if (eviction.maxEntries != that.eviction.maxEntries) return false;
- if (eviction.wakeUpInterval != that.eviction.wakeUpInterval) return false;
- if (expiration.lifespan != that.expiration.lifespan) return false;
- if (expiration.maxIdle != that.expiration.maxIdle) return false;
- if (jmxStatistics.enabled != that.jmxStatistics.enabled) return false;
- if (clustering.stateRetrieval.fetchInMemoryState != that.clustering.stateRetrieval.fetchInMemoryState) return false;
- if (invocationBatching.enabled != that.invocationBatching.enabled ) return false;
- if (clustering.l1.enabled != that.clustering.l1.enabled) return false;
- if (clustering.l1.lifespan != that.clustering.l1.lifespan) return false;
- if (clustering.hash.rehashWait != that.clustering.hash.rehashWait) return false;
- if (clustering.l1.onRehash != that.clustering.l1.onRehash) return false;
- if (locking.lockAcquisitionTimeout != that.locking.lockAcquisitionTimeout) return false;
- if (clustering.hash.numOwners != that.clustering.hash.numOwners) return false;
- if (clustering.async.replQueueInterval != that.clustering.async.replQueueInterval) return false;
- if (clustering.async.replQueueMaxElements != that.clustering.async.replQueueMaxElements) return false;
- if (clustering.stateRetrieval.timeout != that.clustering.stateRetrieval.timeout) return false;
- if (transaction.syncCommitPhase != that.transaction.syncCommitPhase) return false;
- if (clustering.sync.replTimeout != that.clustering.sync.replTimeout) return false;
- if (clustering.hash.rehashRpcTimeout != that.clustering.hash.rehashRpcTimeout) return false;
- if (transaction.syncRollbackPhase != that.transaction.syncRollbackPhase) return false;
- if (transaction.useEagerLocking != that.transaction.useEagerLocking) return false;
- if (lazyDeserialization.enabled != that.lazyDeserialization.enabled) return false;
- if (locking.useLockStriping != that.locking.useLockStriping) return false;
- if (clustering.async.useReplQueue != that.clustering.async.useReplQueue) return false;
- if (locking.writeSkewCheck != that.locking.writeSkewCheck) return false;
- if (loaders != null ? !loaders.equals(that.loaders) : that.loaders != null)
+ if (clustering != null ? !clustering.equals(that.clustering) : that.clustering != null) return false;
+ if (customInterceptors != null ? !customInterceptors.equals(that.customInterceptors) : that.customInterceptors != null)
return false;
- if (clustering.mode != that.clustering.mode) return false;
- if (clustering.hash.consistentHashClass != null ?
- !clustering.hash.consistentHashClass.equals(that.clustering.hash.consistentHashClass) :
- that.clustering.hash.consistentHashClass != null)
+ if (deadlockDetection != null ? !deadlockDetection.equals(that.deadlockDetection) : that.deadlockDetection != null)
return false;
- if (customInterceptors.customInterceptors != null ?
- !customInterceptors.customInterceptors.equals(that.customInterceptors.customInterceptors) :
- that.customInterceptors.customInterceptors != null)
+ if (eviction != null ? !eviction.equals(that.eviction) : that.eviction != null) return false;
+ if (expiration != null ? !expiration.equals(that.expiration) : that.expiration != null) return false;
+ if (globalConfiguration != null ? !globalConfiguration.equals(that.globalConfiguration) : that.globalConfiguration != null)
return false;
- if (eviction.strategy != that.eviction.strategy) return false;
- if (globalConfiguration != null ? !globalConfiguration.equals(that.globalConfiguration) :
- that.globalConfiguration != null)
+ if (invocationBatching != null ? !invocationBatching.equals(that.invocationBatching) : that.invocationBatching != null)
return false;
- if (locking.isolationLevel != that.locking.isolationLevel) return false;
- if (transaction.transactionManagerLookupClass != null ?
- !transaction.transactionManagerLookupClass.equals(that.transaction.transactionManagerLookupClass) :
- that.transaction.transactionManagerLookupClass != null)
+ if (jmxStatistics != null ? !jmxStatistics.equals(that.jmxStatistics) : that.jmxStatistics != null) return false;
+ if (lazyDeserialization != null ? !lazyDeserialization.equals(that.lazyDeserialization) : that.lazyDeserialization != null)
return false;
- if (clustering.async.asyncMarshalling != that.clustering.async.asyncMarshalling) return false;
+ if (loaders != null ? !loaders.equals(that.loaders) : that.loaders != null) return false;
+ if (locking != null ? !locking.equals(that.locking) : that.locking != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (transaction != null ? !transaction.equals(that.transaction) : that.transaction != null) return false;
+ if (unsafe != null ? !unsafe.equals(that.unsafe) : that.unsafe != null) return false;
return true;
}
@@ -596,42 +569,19 @@
@Override
public int hashCode() {
int result = globalConfiguration != null ? globalConfiguration.hashCode() : 0;
- result = 31 * result + (locking.useLockStriping ? 1 : 0);
- result = 31 * result + (clustering.async.useReplQueue ? 1 : 0);
- result = 31 * result + clustering.async.replQueueMaxElements;
- result = 31 * result + (int) (clustering.async.replQueueInterval ^ (clustering.async.replQueueInterval >>> 32));
- result = 31 * result + (jmxStatistics.enabled ? 1 : 0);
- result = 31 * result + (clustering.stateRetrieval.fetchInMemoryState ? 1 : 0);
- result = 31 * result + (int) (locking.lockAcquisitionTimeout ^ (locking.lockAcquisitionTimeout >>> 32));
- result = 31 * result + (int) (clustering.sync.replTimeout ^ (clustering.sync.replTimeout >>> 32));
- result = 31 * result + (clustering.mode != null ? clustering.mode.hashCode() : 0);
- result = 31 * result + (int) (clustering.stateRetrieval.timeout ^ (clustering.stateRetrieval.timeout >>> 32));
- result = 31 * result + (locking.isolationLevel != null ? locking.isolationLevel.hashCode() : 0);
- result = 31 * result + (transaction.transactionManagerLookupClass != null ?
- transaction.transactionManagerLookupClass.hashCode() : 0);
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (locking != null ? locking.hashCode() : 0);
result = 31 * result + (loaders != null ? loaders.hashCode() : 0);
- result = 31 * result + (transaction.syncCommitPhase ? 1 : 0);
- result = 31 * result + (transaction.syncRollbackPhase ? 1 : 0);
- result = 31 * result + (transaction.useEagerLocking ? 1 : 0);
- result = 31 * result + (lazyDeserialization.enabled ? 1 : 0);
- result = 31 * result + (customInterceptors.customInterceptors != null ?
- customInterceptors.customInterceptors.hashCode() : 0);
- result = 31 * result + (locking.writeSkewCheck ? 1 : 0);
- result = 31 * result + locking.concurrencyLevel;
- result = 31 * result + (invocationBatching.enabled ? 1 : 0);
- result = 31 * result + (int) (eviction.wakeUpInterval ^ (eviction.wakeUpInterval >>> 32));
- result = 31 * result + (eviction.strategy != null ? eviction.strategy.hashCode() : 0);
- result = 31 * result + eviction.maxEntries;
- result = 31 * result + (int) (expiration.lifespan ^ (expiration.lifespan >>> 32));
- result = 31 * result + (int) (expiration.maxIdle ^ (expiration.maxIdle >>> 32));
- result = 31 * result + (clustering.l1.enabled ? 1 : 0);
- result = 31 * result + (int) (clustering.l1.lifespan ^ (clustering.l1.lifespan >>> 32));
- result = 31 * result + (int) (clustering.hash.rehashWait ^ (clustering.hash.rehashWait >>> 32));
- result = 31 * result + (int) (clustering.hash.rehashRpcTimeout ^ (clustering.hash.rehashRpcTimeout >>> 32));
- result = 31 * result + (clustering.l1.onRehash ? 1 : 0);
- result = 31 * result + (clustering.hash.consistentHashClass != null ? clustering.hash.consistentHashClass.hashCode() : 0);
- result = 31 * result + clustering.hash.numOwners;
- result = 31 * result + (clustering.async.asyncMarshalling ? 1 : 0);
+ result = 31 * result + (transaction != null ? transaction.hashCode() : 0);
+ result = 31 * result + (customInterceptors != null ? customInterceptors.hashCode() : 0);
+ result = 31 * result + (eviction != null ? eviction.hashCode() : 0);
+ result = 31 * result + (expiration != null ? expiration.hashCode() : 0);
+ result = 31 * result + (unsafe != null ? unsafe.hashCode() : 0);
+ result = 31 * result + (clustering != null ? clustering.hashCode() : 0);
+ result = 31 * result + (jmxStatistics != null ? jmxStatistics.hashCode() : 0);
+ result = 31 * result + (lazyDeserialization != null ? lazyDeserialization.hashCode() : 0);
+ result = 31 * result + (invocationBatching != null ? invocationBatching.hashCode() : 0);
+ result = 31 * result + (deadlockDetection != null ? deadlockDetection.hashCode() : 0);
return result;
}
@@ -639,6 +589,7 @@
public Configuration clone() {
try {
Configuration dolly = (Configuration) super.clone();
+ if (clustering != null) dolly.clustering = clustering.clone();
if (globalConfiguration!= null) dolly.globalConfiguration = globalConfiguration.clone();
if (locking != null) dolly.locking = (LockingType) locking.clone();
if (loaders != null) dolly.loaders = loaders.clone();
@@ -758,6 +709,37 @@
testImmutability("useEagerLocking");
this.useEagerLocking = useEagerLocking;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof TransactionType)) return false;
+
+ TransactionType that = (TransactionType) o;
+
+ if (syncCommitPhase != null ? !syncCommitPhase.equals(that.syncCommitPhase) : that.syncCommitPhase != null)
+ return false;
+ if (syncRollbackPhase != null ? !syncRollbackPhase.equals(that.syncRollbackPhase) : that.syncRollbackPhase != null)
+ return false;
+ if (transactionManagerLookup != null ? !transactionManagerLookup.equals(that.transactionManagerLookup) : that.transactionManagerLookup != null)
+ return false;
+ if (transactionManagerLookupClass != null ? !transactionManagerLookupClass.equals(that.transactionManagerLookupClass) : that.transactionManagerLookupClass != null)
+ return false;
+ if (useEagerLocking != null ? !useEagerLocking.equals(that.useEagerLocking) : that.useEagerLocking != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = transactionManagerLookupClass != null ? transactionManagerLookupClass.hashCode() : 0;
+ result = 31 * result + (transactionManagerLookup != null ? transactionManagerLookup.hashCode() : 0);
+ result = 31 * result + (syncCommitPhase != null ? syncCommitPhase.hashCode() : 0);
+ result = 31 * result + (syncRollbackPhase != null ? syncRollbackPhase.hashCode() : 0);
+ result = 31 * result + (useEagerLocking != null ? useEagerLocking.hashCode() : 0);
+ return result;
+ }
}
/**
*
@@ -820,7 +802,37 @@
testImmutability("concurrencyLevel");
this.concurrencyLevel = concurrencyLevel;
}
- }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof LockingType)) return false;
+
+ LockingType that = (LockingType) o;
+
+ if (concurrencyLevel != null ? !concurrencyLevel.equals(that.concurrencyLevel) : that.concurrencyLevel != null)
+ return false;
+ if (isolationLevel != that.isolationLevel) return false;
+ if (lockAcquisitionTimeout != null ? !lockAcquisitionTimeout.equals(that.lockAcquisitionTimeout) : that.lockAcquisitionTimeout != null)
+ return false;
+ if (useLockStriping != null ? !useLockStriping.equals(that.useLockStriping) : that.useLockStriping != null)
+ return false;
+ if (writeSkewCheck != null ? !writeSkewCheck.equals(that.writeSkewCheck) : that.writeSkewCheck != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = lockAcquisitionTimeout != null ? lockAcquisitionTimeout.hashCode() : 0;
+ result = 31 * result + (isolationLevel != null ? isolationLevel.hashCode() : 0);
+ result = 31 * result + (writeSkewCheck != null ? writeSkewCheck.hashCode() : 0);
+ result = 31 * result + (useLockStriping != null ? useLockStriping.hashCode() : 0);
+ result = 31 * result + (concurrencyLevel != null ? concurrencyLevel.hashCode() : 0);
+ return result;
+ }
+ }
/**
*
@@ -878,6 +890,36 @@
dolly.hash = (HashType) hash.clone();
return dolly;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ClusteringType)) return false;
+
+ ClusteringType that = (ClusteringType) o;
+
+ if (async != null ? !async.equals(that.async) : that.async != null) return false;
+ if (hash != null ? !hash.equals(that.hash) : that.hash != null) return false;
+ if (l1 != null ? !l1.equals(that.l1) : that.l1 != null) return false;
+ if (mode != that.mode) return false;
+ if (stateRetrieval != null ? !stateRetrieval.equals(that.stateRetrieval) : that.stateRetrieval != null)
+ return false;
+ if (sync != null ? !sync.equals(that.sync) : that.sync != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = stringMode != null ? stringMode.hashCode() : 0;
+ result = 31 * result + (mode != null ? mode.hashCode() : 0);
+ result = 31 * result + (sync != null ? sync.hashCode() : 0);
+ result = 31 * result + (stateRetrieval != null ? stateRetrieval.hashCode() : 0);
+ result = 31 * result + (l1 != null ? l1.hashCode() : 0);
+ result = 31 * result + (async != null ? async.hashCode() : 0);
+ result = 31 * result + (hash != null ? hash.hashCode() : 0);
+ return result;
+ }
}
private static class ClusteringTypeAdapter extends XmlAdapter<ClusteringType, ClusteringType> {
@@ -946,7 +988,37 @@
super();
this.readFromXml = readFromXml;
}
-
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AsyncType)) return false;
+
+ AsyncType asyncType = (AsyncType) o;
+
+ if (readFromXml != asyncType.readFromXml) return false;
+ if (asyncMarshalling != null ? !asyncMarshalling.equals(asyncType.asyncMarshalling) : asyncType.asyncMarshalling != null)
+ return false;
+ if (replQueueInterval != null ? !replQueueInterval.equals(asyncType.replQueueInterval) : asyncType.replQueueInterval != null)
+ return false;
+ if (replQueueMaxElements != null ? !replQueueMaxElements.equals(asyncType.replQueueMaxElements) : asyncType.replQueueMaxElements != null)
+ return false;
+ if (useReplQueue != null ? !useReplQueue.equals(asyncType.useReplQueue) : asyncType.useReplQueue != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = (readFromXml ? 1 : 0);
+ result = 31 * result + (useReplQueue != null ? useReplQueue.hashCode() : 0);
+ result = 31 * result + (replQueueMaxElements != null ? replQueueMaxElements.hashCode() : 0);
+ result = 31 * result + (replQueueInterval != null ? replQueueInterval.hashCode() : 0);
+ result = 31 * result + (asyncMarshalling != null ? asyncMarshalling.hashCode() : 0);
+ return result;
+ }
+
private AsyncType(){
this(true);
}
@@ -1003,6 +1075,26 @@
testImmutability("maxIdle");
this.maxIdle = maxIdle;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ExpirationType)) return false;
+
+ ExpirationType that = (ExpirationType) o;
+
+ if (lifespan != null ? !lifespan.equals(that.lifespan) : that.lifespan != null) return false;
+ if (maxIdle != null ? !maxIdle.equals(that.maxIdle) : that.maxIdle != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = lifespan != null ? lifespan.hashCode() : 0;
+ result = 31 * result + (maxIdle != null ? maxIdle.hashCode() : 0);
+ return result;
+ }
}
/**
@@ -1041,6 +1133,29 @@
testImmutability("maxEntries");
this.maxEntries = maxEntries;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof EvictionType)) return false;
+
+ EvictionType that = (EvictionType) o;
+
+ if (maxEntries != null ? !maxEntries.equals(that.maxEntries) : that.maxEntries != null) return false;
+ if (strategy != that.strategy) return false;
+ if (wakeUpInterval != null ? !wakeUpInterval.equals(that.wakeUpInterval) : that.wakeUpInterval != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = wakeUpInterval != null ? wakeUpInterval.hashCode() : 0;
+ result = 31 * result + (strategy != null ? strategy.hashCode() : 0);
+ result = 31 * result + (maxEntries != null ? maxEntries.hashCode() : 0);
+ return result;
+ }
}
/**
@@ -1073,6 +1188,27 @@
testImmutability("timeout");
this.timeout = timeout;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof StateRetrievalType)) return false;
+
+ StateRetrievalType that = (StateRetrievalType) o;
+
+ if (fetchInMemoryState != null ? !fetchInMemoryState.equals(that.fetchInMemoryState) : that.fetchInMemoryState != null)
+ return false;
+ if (timeout != null ? !timeout.equals(that.timeout) : that.timeout != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = fetchInMemoryState != null ? fetchInMemoryState.hashCode() : 0;
+ result = 31 * result + (timeout != null ? timeout.hashCode() : 0);
+ return result;
+ }
}
/**
@@ -1095,6 +1231,24 @@
testImmutability("replTimeout");
this.replTimeout = replTimeout;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SyncType)) return false;
+
+ SyncType syncType = (SyncType) o;
+
+ if (replTimeout != null ? !replTimeout.equals(syncType.replTimeout) : syncType.replTimeout != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return replTimeout != null ? replTimeout.hashCode() : 0;
+ }
}
/**
@@ -1147,6 +1301,32 @@
testImmutability("rehashRpcTimeout");
this.rehashRpcTimeout = rehashRpcTimeout;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof HashType)) return false;
+
+ HashType hashType = (HashType) o;
+
+ if (consistentHashClass != null ? !consistentHashClass.equals(hashType.consistentHashClass) : hashType.consistentHashClass != null)
+ return false;
+ if (numOwners != null ? !numOwners.equals(hashType.numOwners) : hashType.numOwners != null) return false;
+ if (rehashRpcTimeout != null ? !rehashRpcTimeout.equals(hashType.rehashRpcTimeout) : hashType.rehashRpcTimeout != null)
+ return false;
+ if (rehashWait != null ? !rehashWait.equals(hashType.rehashWait) : hashType.rehashWait != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = consistentHashClass != null ? consistentHashClass.hashCode() : 0;
+ result = 31 * result + (numOwners != null ? numOwners.hashCode() : 0);
+ result = 31 * result + (rehashWait != null ? rehashWait.hashCode() : 0);
+ result = 31 * result + (rehashRpcTimeout != null ? rehashRpcTimeout.hashCode() : 0);
+ return result;
+ }
}
/**
@@ -1186,6 +1366,28 @@
testImmutability("onRehash");
this.onRehash = onRehash;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof L1Type)) return false;
+
+ L1Type l1Type = (L1Type) o;
+
+ if (enabled != null ? !enabled.equals(l1Type.enabled) : l1Type.enabled != null) return false;
+ if (lifespan != null ? !lifespan.equals(l1Type.lifespan) : l1Type.lifespan != null) return false;
+ if (onRehash != null ? !onRehash.equals(l1Type.onRehash) : l1Type.onRehash != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = enabled != null ? enabled.hashCode() : 0;
+ result = 31 * result + (lifespan != null ? lifespan.hashCode() : 0);
+ result = 31 * result + (onRehash != null ? onRehash.hashCode() : 0);
+ return result;
+ }
}
/**
*
@@ -1209,6 +1411,23 @@
testImmutability("enabled");
this.enabled = enabled;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof BooleanAttributeType)) return false;
+
+ BooleanAttributeType that = (BooleanAttributeType) o;
+
+ if (enabled != null ? !enabled.equals(that.enabled) : that.enabled != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return enabled != null ? enabled.hashCode() : 0;
+ }
}
/**
@@ -1240,6 +1459,26 @@
testImmutability("spinDuration");
this.spinDuration = spinDuration;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof DeadlockDetectionType)) return false;
+
+ DeadlockDetectionType that = (DeadlockDetectionType) o;
+
+ if (enabled != null ? !enabled.equals(that.enabled) : that.enabled != null) return false;
+ if (spinDuration != null ? !spinDuration.equals(that.spinDuration) : that.spinDuration != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = enabled != null ? enabled.hashCode() : 0;
+ result = 31 * result + (spinDuration != null ? spinDuration.hashCode() : 0);
+ return result;
+ }
}
/**
@@ -1263,6 +1502,24 @@
testImmutability("unreliableReturnValues");
this.unreliableReturnValues = unreliableReturnValues;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof UnsafeType)) return false;
+
+ UnsafeType that = (UnsafeType) o;
+
+ if (unreliableReturnValues != null ? !unreliableReturnValues.equals(that.unreliableReturnValues) : that.unreliableReturnValues != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return unreliableReturnValues != null ? unreliableReturnValues.hashCode() : 0;
+ }
}
/**
@@ -1290,6 +1547,24 @@
}
return dolly;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof CustomInterceptorsType)) return false;
+
+ CustomInterceptorsType that = (CustomInterceptorsType) o;
+
+ if (customInterceptors != null ? !customInterceptors.equals(that.customInterceptors) : that.customInterceptors != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return customInterceptors != null ? customInterceptors.hashCode() : 0;
+ }
}
/**
Modified: trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -21,7 +21,6 @@
*/
package org.infinispan.config;
-import net.jcip.annotations.Immutable;
import org.infinispan.interceptors.base.CommandInterceptor;
import org.infinispan.util.TypedProperties;
@@ -49,7 +48,6 @@
* @author Vladimir Blagojevic
* @since 4.0
*/
- at Immutable
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="interceptor")
public class CustomInterceptorConfig extends AbstractNamedCacheConfigurationBean {
@@ -303,7 +301,7 @@
CustomInterceptorConfig that = (CustomInterceptorConfig) o;
- if (index != that.index) return false;
+ if (index != null && !index.equals(that.index)) return false;
if (isFirst != that.isFirst) return false;
if (isLast != that.isLast) return false;
if (after != null ? !after.equals(that.after) : that.after != null) return false;
Modified: trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -364,9 +364,8 @@
return false;
if (transport.properties != null ? !transport.properties.equals(that.transport.properties) : that.transport.properties != null)
return false;
- if (transport.distributedSyncTimeout != that.transport.distributedSyncTimeout) return false;
+ return !(transport.distributedSyncTimeout != null && !transport.distributedSyncTimeout.equals(that.transport.distributedSyncTimeout));
- return true;
}
@Override
Modified: trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -22,6 +22,7 @@
package org.infinispan.config.parsing;
import org.infinispan.util.FileLookup;
+import org.infinispan.util.Util;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -53,10 +54,10 @@
*/
public class ConfigFilesConvertor {
- private static final String JBOSS_CACHE3X = "JBossCache3x";
- private static final String EHCACHE_CACHE16X = "Ehcache16x";
- private static final String EHCACHE_CACHE15X = "Ehcache15x";
- public static final String[] SUPPORTED_FORMATS = {JBOSS_CACHE3X, EHCACHE_CACHE15X, EHCACHE_CACHE16X};
+ static final String JBOSS_CACHE3X = "JBossCache3x";
+ static final String EHCACHE_CACHE16X = "Ehcache16x";
+ static final String EHCACHE_CACHE15X = "Ehcache15x";
+ static final String[] SUPPORTED_FORMATS = {JBOSS_CACHE3X, EHCACHE_CACHE15X, EHCACHE_CACHE16X};
public void parse(InputStream is, OutputStream os, String xsltFile) throws Exception {
InputStream xsltInStream = new FileLookup().lookupFile(xsltFile);
@@ -162,24 +163,39 @@
System.exit(1);
}
ConfigFilesConvertor convertor = new ConfigFilesConvertor();
- FileInputStream is = new FileInputStream(oldConfig);
- File destination = new File(destinationName);
- if (!destination.exists()) destination.createNewFile();
- FileOutputStream fos = new FileOutputStream(destinationName);
- convertor.parse(is, fos, "xslt/jbc3x2infinispan4x.xslt");
- fos.close();
- is.close();
-
+ FileInputStream is = null;
+ FileOutputStream fos = null;
File jgroupsConfigFile = new File("jgroupsConfig.xml");
- if (jgroupsConfigFile.exists()) jgroupsConfigFile.delete();
- jgroupsConfigFile.createNewFile();
- is = new FileInputStream(oldConfig);
- fos = new FileOutputStream(jgroupsConfigFile);
- convertor = new ConfigFilesConvertor();
- convertor.parse(is, fos, "xslt/jgroupsFileGen.xslt");
- is.close();
- fos.close();
+ try {
+ is = new FileInputStream(oldConfig);
+ File destination = new File(destinationName);
+ if (!destination.exists()) {
+ if (!destination.createNewFile()) {
+ System.err.println("Problems creating destination file: " + destination);
+ }
+ }
+ fos = new FileOutputStream(destinationName);
+ convertor.parse(is, fos, "xslt/jbc3x2infinispan4x.xslt");
+ fos.close();
+ is.close();
+
+ if (jgroupsConfigFile.exists())
+ if (!jgroupsConfigFile.delete()) {
+ System.err.println("Problems deleting existing jgroups file: " + jgroupsConfigFile);
+ }
+ if (!jgroupsConfigFile.createNewFile()) {
+ System.err.println("Could not create jgroupsConfigFile: " + jgroupsConfigFile);
+ }
+ is = new FileInputStream(oldConfig);
+ fos = new FileOutputStream(jgroupsConfigFile);
+ convertor = new ConfigFilesConvertor();
+ convertor.parse(is, fos, "xslt/jgroupsFileGen.xslt");
+ } finally {
+ Util.closeStream(is);
+ Util.flushAndCloseStream(fos);
+ }
+
//now this means that the generated file is basically empty, so delete ie
if (jgroupsConfigFile.length() < 5) {
jgroupsConfigFile.delete();
@@ -193,18 +209,24 @@
System.exit(1);
}
ConfigFilesConvertor convertor = new ConfigFilesConvertor();
- FileInputStream is = new FileInputStream(oldConfig);
- File destination = new File(destinationName);
- if (!destination.exists()) {
- destination.createNewFile();
- }
-
- FileOutputStream fos = new FileOutputStream(destinationName);
+ FileInputStream is = null;
+ FileOutputStream fos = null;
+
try {
+
+ is = new FileInputStream(oldConfig);
+ File destination = new File(destinationName);
+ if (!destination.exists()) {
+ if (!destination.createNewFile()) {
+ System.err.println("Warn! Could not create file " + destination);
+ }
+ }
+
+ fos = new FileOutputStream(destinationName);
convertor.parse(is, fos, "xslt/ehcache16x2infinispan4x.xslt");
} finally {
- fos.close();
- is.close();
+ Util.flushAndCloseStream(fos);
+ Util.closeStream(is);
}
}
Modified: trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -152,7 +152,7 @@
public void rehash(List<Address> newMembers, List<Address> oldMembers) {
- boolean join = oldMembers == null || oldMembers.size() < newMembers.size();
+ boolean join = oldMembers.size() < newMembers.size();
// on view change, we should update our view
log.info("Detected a veiw change. Member list changed from {0} to {1}", oldMembers, newMembers);
Modified: trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -141,6 +141,7 @@
log.info("Completed in {0}!", Util.prettyPrintTime(System.currentTimeMillis() - start));
} catch (Exception e) {
log.error("Caught exception!", e);
+ throw new CacheException("Unexpected exception", e);
} finally {
if (!unlocked) transactionLogger.unlockAndDisable();
dmi.joinComplete = true;
Modified: trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -857,6 +857,29 @@
return (priority < o.priority ? -1 : (priority == o.priority ? 0 : 1));
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof PrioritizedMethod)) return false;
+
+ PrioritizedMethod that = (PrioritizedMethod) o;
+
+ if (priority != that.priority) return false;
+ if (component != null ? !component.equals(that.component) : that.component != null) return false;
+ if (method != null ? !method.equals(that.method) : that.method != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = method != null ? method.hashCode() : 0;
+ result = 31 * result + (component != null ? component.hashCode() : 0);
+ result = 31 * result + priority;
+ return result;
+ }
+
void invoke() {
ReflectionUtil.invokeAccessibly(component.instance, method, null);
}
Modified: trunk/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -24,8 +24,6 @@
import org.infinispan.CacheException;
import org.infinispan.commands.VisitableCommand;
import org.infinispan.context.InvocationContext;
-import org.infinispan.context.InvocationContextContainer;
-import org.infinispan.factories.annotations.Inject;
import org.infinispan.factories.annotations.Start;
import org.infinispan.factories.scopes.Scope;
import org.infinispan.factories.scopes.Scopes;
@@ -47,29 +45,21 @@
*/
@Scope(Scopes.NAMED_CACHE)
public class InterceptorChain {
+
+ private static final Log log = LogFactory.getLog(InterceptorChain.class);
+
/**
* reference to the first interceptor in the chain
*/
- private CommandInterceptor firstInChain;
+ private volatile CommandInterceptor firstInChain;
/**
- * used for invoking commands on the chain
- */
- private InvocationContextContainer icc;
- private static final Log log = LogFactory.getLog(InterceptorChain.class);
-
- /**
* Constructs an interceptor chain having the supplied interceptor as first.
*/
public InterceptorChain(CommandInterceptor first) {
this.firstInChain = first;
}
- @Inject
- public void initialize(InvocationContextContainer icc) {
- this.icc = icc;
- }
-
@Start
private void printChainInfo() {
if (log.isDebugEnabled()) log.debug("Interceptor chain size: " + size());
@@ -108,7 +98,7 @@
* @throws IllegalArgumentException if the position is invalid (e.g. 5 and there are only 2 interceptors in the
* chain)
*/
- public synchronized void removeInterceptor(int position) {
+ public void removeInterceptor(int position) {
if (firstInChain == null) return;
if (position == 0) {
firstInChain = firstInChain.getNext();
@@ -162,7 +152,7 @@
/**
* Removes all the occurences of supplied interceptor type from the chain.
*/
- public synchronized void removeInterceptor(Class<? extends CommandInterceptor> clazz) {
+ public void removeInterceptor(Class<? extends CommandInterceptor> clazz) {
if (firstInChain.getClass() == clazz) {
firstInChain = firstInChain.getNext();
}
@@ -182,7 +172,7 @@
*
* @return true if the interceptor was added; i.e. the afterInterceptor exists
*/
- public synchronized boolean addInterceptorAfter(CommandInterceptor toAdd, Class<? extends CommandInterceptor> afterInterceptor) {
+ public boolean addInterceptorAfter(CommandInterceptor toAdd, Class<? extends CommandInterceptor> afterInterceptor) {
CommandInterceptor it = firstInChain;
while (it != null) {
if (it.getClass().equals(afterInterceptor)) {
@@ -200,7 +190,7 @@
*
* @return true if the interceptor was added; i.e. the afterInterceptor exists
*/
- public synchronized boolean addInterceptorBefore(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor) {
+ public boolean addInterceptorBefore(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor) {
if (firstInChain.getClass().equals(beforeInterceptor)) {
toAdd.setNext(firstInChain);
firstInChain = toAdd;
@@ -221,7 +211,7 @@
/**
* Appends at the end.
*/
- public void appendIntereceptor(CommandInterceptor ci) {
+ public synchronized void appendIntereceptor(CommandInterceptor ci) {
CommandInterceptor it = firstInChain;
while (it.hasNext()) it = it.getNext();
it.setNext(ci);
@@ -314,7 +304,7 @@
return false;
}
- public boolean containsInterceptorType(Class<? extends CommandInterceptor> interceptorType) {
+ public synchronized boolean containsInterceptorType(Class<? extends CommandInterceptor> interceptorType) {
CommandInterceptor it = firstInChain;
while (it != null) {
if (it.getClass().equals(interceptorType)) return true;
Modified: trunk/core/src/main/java/org/infinispan/jmx/ResourceDMBean.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/jmx/ResourceDMBean.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/jmx/ResourceDMBean.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -124,7 +124,7 @@
return obj;
}
- private void findDescription() {
+ private synchronized void findDescription() {
MBean mbean = getObject().getClass().getAnnotation(MBean.class);
if (mbean != null && mbean.description() != null && mbean.description().trim().length() > 0) {
description = mbean.description();
Modified: trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -1,15 +1,15 @@
package org.infinispan.loaders;
+import org.infinispan.loaders.decorators.AsyncStoreConfig;
+import org.infinispan.loaders.decorators.SingletonStoreConfig;
+import org.infinispan.util.Util;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.infinispan.loaders.decorators.AsyncStoreConfig;
-import org.infinispan.loaders.decorators.SingletonStoreConfig;
-import org.infinispan.util.Util;
-
/**
* Configures {@link AbstractCacheStore}. This allows you to tune a number of characteristics of the {@link
* AbstractCacheStore}.
@@ -134,8 +134,8 @@
AbstractCacheStoreConfig other = (AbstractCacheStoreConfig) obj;
return Util.safeEquals(this.cacheLoaderClassName, other.cacheLoaderClassName)
- && (this.ignoreModifications == other.ignoreModifications)
- && (this.fetchPersistentState == other.fetchPersistentState)
+ && (this.ignoreModifications.equals(other.ignoreModifications))
+ && (this.fetchPersistentState.equals(other.fetchPersistentState))
&& Util.safeEquals(this.singletonStore, other.singletonStore)
&& Util.safeEquals(this.async, other.async)
&& Util.safeEquals(this.purgeSynchronously, other.purgeSynchronously);
Modified: trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStore.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStore.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStore.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -8,6 +8,7 @@
import org.infinispan.loaders.bucket.Bucket;
import org.infinispan.loaders.bucket.BucketBasedCacheStore;
import org.infinispan.marshall.Marshaller;
+import org.infinispan.util.Util;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
@@ -109,20 +110,25 @@
byte[] buffer = new byte[streamBufferSize];
for (File file : files) {
int bytesRead, totalBytesRead = 0;
- FileInputStream fileInStream = new FileInputStream(file);
- int sz = fileInStream.available();
- BufferedInputStream bis = new BufferedInputStream(fileInStream);
- objectOutput.writeObject(file.getName());
- objectOutput.writeInt(sz);
+ BufferedInputStream bis = null;
+ FileInputStream fileInStream = null;
+ try {
+ fileInStream = new FileInputStream(file);
+ int sz = fileInStream.available();
+ bis = new BufferedInputStream(fileInStream);
+ objectOutput.writeObject(file.getName());
+ objectOutput.writeInt(sz);
- while (sz > totalBytesRead) {
- bytesRead = bis.read(buffer, 0, streamBufferSize);
- if (bytesRead == -1) break;
- totalBytesRead += bytesRead;
- objectOutput.write(buffer, 0, bytesRead);
+ while (sz > totalBytesRead) {
+ bytesRead = bis.read(buffer, 0, streamBufferSize);
+ if (bytesRead == -1) break;
+ totalBytesRead += bytesRead;
+ objectOutput.write(buffer, 0, bytesRead);
+ }
+ } finally {
+ Util.closeStream(bis);
+ Util.closeStream(fileInStream);
}
- bis.close();
- fileInStream.close();
}
} catch (IOException e) {
throw new CacheLoaderException("I/O expcetion while generating stream", e);
@@ -135,8 +141,9 @@
return;
}
for (File f : toDelete) {
- f.delete();
- if (f.exists()) log.warn("Had problems removing file {0}", f);
+ if (!f.delete()) {
+ log.warn("Had problems removing file {0}", f);
+ }
}
}
@@ -210,7 +217,9 @@
location = "Infinispan-FileCacheStore"; // use relative path!
location += File.separator + cache.getName();
root = new File(location);
- root.mkdirs();
+ if (!root.mkdirs()) {
+ log.warn("Problems creting the directory: " + root);
+ }
if (!root.exists()) {
throw new ConfigurationException("Directory " + root.getAbsolutePath() + " does not exist and cannot be created!");
}
Modified: trunk/core/src/main/java/org/infinispan/remoting/responses/UnsuccessfulResponse.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/responses/UnsuccessfulResponse.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/remoting/responses/UnsuccessfulResponse.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -1,12 +1,12 @@
package org.infinispan.remoting.responses;
+import org.infinispan.marshall.Ids;
+import org.infinispan.marshall.Marshallable;
+
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.infinispan.marshall.Ids;
-import org.infinispan.marshall.Marshallable;
-
/**
* An unsuccessful response
*
@@ -26,7 +26,8 @@
@Override
public boolean equals(Object o) {
- return o.getClass().equals(UnsuccessfulResponse.class);
+ if (o == null) return false;
+ return o.getClass().equals(this.getClass());
}
@Override
Modified: trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransactionManager.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransactionManager.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransactionManager.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -39,27 +39,31 @@
* @since 4.0
*/
public class DummyTransactionManager extends DummyBaseTransactionManager {
- protected static DummyTransactionManager instance = null;
- protected static DummyUserTransaction utx = null;
+ private static DummyTransactionManager instance = null;
+ private static DummyUserTransaction utx = null;
- protected static Log log = LogFactory.getLog(DummyTransactionManager.class);
+ protected static final Log log = LogFactory.getLog(DummyTransactionManager.class);
private static final long serialVersionUID = 4396695354693176535L;
public static DummyTransactionManager getInstance() {
if (instance == null) {
- instance = new DummyTransactionManager();
- utx = new DummyUserTransaction(instance);
- try {
- Properties p = new Properties();
- Context ctx = new InitialContext(p);
- ctx.bind("java:/TransactionManager", instance);
- ctx.bind("UserTransaction", utx);
- } catch (NoInitialContextException nie) {
- log.debug(nie.getMessage());
+ synchronized (DummyTransactionManager.class) {
+ if (instance == null) {
+ instance = new DummyTransactionManager();
+ utx = new DummyUserTransaction(instance);
+ try {
+ Properties p = new Properties();
+ Context ctx = new InitialContext(p);
+ ctx.bind("java:/TransactionManager", instance);
+ ctx.bind("UserTransaction", utx);
+ } catch (NoInitialContextException nie) {
+ log.debug(nie.getMessage());
- } catch (NamingException e) {
- log.debug("binding of DummyTransactionManager failed", e);
+ } catch (NamingException e) {
+ log.debug("binding of DummyTransactionManager failed", e);
+ }
+ }
}
}
return instance;
Modified: trunk/core/src/main/java/org/infinispan/util/ClassFinder.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/ClassFinder.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/main/java/org/infinispan/util/ClassFinder.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -21,6 +21,9 @@
*/
package org.infinispan.util;
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
+
import java.io.File;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
@@ -32,9 +35,6 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
-
/**
* Find infinispan classes utility
*/
@@ -42,7 +42,7 @@
private static final Log log = LogFactory.getLog(ClassFinder.class);
- public static String PATH = System.getProperty("java.class.path") + File.pathSeparator
+ public static final String PATH = System.getProperty("java.class.path") + File.pathSeparator
+ System.getProperty("surefire.test.class.path");
public static List<Class<?>> withAnnotationPresent(List<Class<?>> classes, Class<? extends Annotation> c) {
Modified: trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java 2009-09-03 09:43:08 UTC (rev 771)
+++ trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java 2009-09-03 13:05:58 UTC (rev 772)
@@ -98,11 +98,11 @@
public void testDefiningConfigurationWithTemplateName() {
CacheManager cm = TestCacheManagerFactory.createLocalCacheManager();
-
+
Configuration c = new Configuration();
c.setIsolationLevel(IsolationLevel.NONE);
Configuration oneCacheConfiguration = cm.defineConfiguration("oneCache", c);
- assert !oneCacheConfiguration.equals(c);
+ assert oneCacheConfiguration.equals(c);
assert oneCacheConfiguration.getIsolationLevel().equals(IsolationLevel.NONE);
c = new Configuration();
More information about the infinispan-commits
mailing list