[infinispan-commits] Infinispan SVN: r1951 - in trunk: cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary and 81 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Jul 1 11:00:56 EDT 2010


Author: mircea.markus
Date: 2010-07-01 11:00:41 -0400 (Thu, 01 Jul 2010)
New Revision: 1951

Added:
   trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractJdbcCacheStoreConfig.java
   trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractNonDelegatingJdbcCacheStoreConfig.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChangeTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HeavyLoadConnectionPoolingTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HitsAwareCacheManagersTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java
   trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java
   trunk/core/src/main/java/org/infinispan/manager/CacheManager.java
   trunk/core/src/test/java/org/infinispan/api/AsyncWithTxTest.java
Removed:
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChange.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java
   trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java
   trunk/core/src/main/java/org/infinispan/manager/CacheManager.java
Modified:
   trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java
   trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java
   trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
   trunk/cachestore/jdbc/src/test/java/org/infinispan/config/parsing/JdbcConfigurationTest.java
   trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/TableNameUniquenessTest.java
   trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/binary/BinaryStoreWithManagedConnectionTest.java
   trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/mixed/MixedStoreWithManagedConnectionTest.java
   trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/stringbased/StringStoreWithManagedConnectionTest.java
   trunk/cachestore/remote/src/main/java/org/infinispan/loaders/remote/RemoteCacheStoreConfig.java
   trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreConfigTest.java
   trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreFunctionalTest.java
   trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreTest.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCacheManager.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheSupport.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/SerializationMarshaller.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsHelper.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsImpl.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/AbstractTransport.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/TransportFactory.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/netty/NettyTransportFactory.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/PropsKeyedObjectPoolFactory.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/RoundRobinBalancingStrategy.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransportFactory.java
   trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TransportObjectFactory.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CSAIntegrationTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheContainerTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerNotStartedTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerStoppedTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodStatisticsTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RemoteAsyncAPITest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ReplTopologyChangeTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RoundRobinBalancingIntegrationTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ServerShutdownTest.java
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/WorkerThread.java
   trunk/client/hotrod-client/src/test/resources/hotrod-client.properties
   trunk/core/src/main/java/org/infinispan/AbstractDelegatingCache.java
   trunk/core/src/main/java/org/infinispan/Cache.java
   trunk/core/src/main/java/org/infinispan/CacheDelegate.java
   trunk/core/src/main/java/org/infinispan/config/Configuration.java
   trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.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/InternalCacheFactory.java
   trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStore.java
   trunk/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java
   trunk/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java
   trunk/core/src/main/java/org/infinispan/notifications/cachemanagerlistener/event/EventImpl.java
   trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java
   trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManager.java
   trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java
   trunk/core/src/main/java/org/infinispan/transaction/xa/TransactionTable.java
   trunk/core/src/test/java/org/infinispan/affinity/BaseKeyAffinityServiceTest.java
   trunk/core/src/test/java/org/infinispan/affinity/KeyAffinityServiceTest.java
   trunk/core/src/test/java/org/infinispan/api/AsyncAPITest.java
   trunk/core/src/test/java/org/infinispan/api/CacheAPITest.java
   trunk/core/src/test/java/org/infinispan/api/CacheClusterJoinTest.java
   trunk/core/src/test/java/org/infinispan/api/ForceWriteLockTest.java
   trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java
   trunk/core/src/test/java/org/infinispan/api/batch/BatchWithTMTest.java
   trunk/core/src/test/java/org/infinispan/api/batch/BatchWithoutTMTest.java
   trunk/core/src/test/java/org/infinispan/api/mvcc/LockTestBase.java
   trunk/core/src/test/java/org/infinispan/api/mvcc/repeatable_read/WriteSkewTest.java
   trunk/core/src/test/java/org/infinispan/atomic/APITest.java
   trunk/core/src/test/java/org/infinispan/atomic/AtomicHashMapConcurrencyTest.java
   trunk/core/src/test/java/org/infinispan/atomic/AtomicMapFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/config/CustomInterceptorConfigTest.java
   trunk/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java
   trunk/core/src/test/java/org/infinispan/config/SampleConfigFilesCorrectnessTest.java
   trunk/core/src/test/java/org/infinispan/config/parsing/Coherence2InfinispanTransformerTest.java
   trunk/core/src/test/java/org/infinispan/distribution/BaseDistCacheStoreTest.java
   trunk/core/src/test/java/org/infinispan/distribution/BaseDistFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java
   trunk/core/src/test/java/org/infinispan/distribution/SingleOwnerTest.java
   trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentJoinTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentNonOverlappingLeaveTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentOverlappingLeaveTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/L1OnRehashTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashAfterPartitionMergeTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleJoinTest.java
   trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleLeaveTest.java
   trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesEvictionTest.java
   trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesManualEvictionTest.java
   trunk/core/src/test/java/org/infinispan/expiry/ExpiryTest.java
   trunk/core/src/test/java/org/infinispan/interceptors/MarshalledValueInterceptorTest.java
   trunk/core/src/test/java/org/infinispan/jmx/CacheMBeanTest.java
   trunk/core/src/test/java/org/infinispan/jmx/CacheManagerMBeanTest.java
   trunk/core/src/test/java/org/infinispan/jmx/ComponentsJmxRegistrationTest.java
   trunk/core/src/test/java/org/infinispan/jmx/JmxStatsFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/jmx/RpcManagerMBeanTest.java
   trunk/core/src/test/java/org/infinispan/jmx/TxInterceptorMBeanTest.java
   trunk/core/src/test/java/org/infinispan/jndi/BindingTest.java
   trunk/core/src/test/java/org/infinispan/loaders/BaseCacheStoreFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/loaders/CacheLoaderFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/loaders/ClusterCacheLoaderTest.java
   trunk/core/src/test/java/org/infinispan/loaders/ConcurrentLoadAndEvictTxTest.java
   trunk/core/src/test/java/org/infinispan/loaders/PassivationFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/loaders/decorators/SingletonStoreTest.java
   trunk/core/src/test/java/org/infinispan/loaders/file/ClusterFileCacheStoreFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java
   trunk/core/src/test/java/org/infinispan/notifications/AsyncNotificationTest.java
   trunk/core/src/test/java/org/infinispan/notifications/CacheListenerCacheLoaderTest.java
   trunk/core/src/test/java/org/infinispan/notifications/CacheListenerRemovalTest.java
   trunk/core/src/test/java/org/infinispan/notifications/ConcurrentNotificationTest.java
   trunk/core/src/test/java/org/infinispan/notifications/cachelistener/CacheNotifierTest.java
   trunk/core/src/test/java/org/infinispan/notifications/cachemanagerlistener/CacheManagerNotifierTest.java
   trunk/core/src/test/java/org/infinispan/profiling/DeadlockDetectionPerformanceTest.java
   trunk/core/src/test/java/org/infinispan/remoting/jgroups/ChannelLookupTest.java
   trunk/core/src/test/java/org/infinispan/replication/ReplicationQueueTest.java
   trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferCacheLoaderFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java
   trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFileCacheLoaderFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java
   trunk/core/src/test/java/org/infinispan/stress/PutIfAbsentStressTest.java
   trunk/core/src/test/java/org/infinispan/test/AbstractCacheTest.java
   trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java
   trunk/core/src/test/java/org/infinispan/test/ReplListener.java
   trunk/core/src/test/java/org/infinispan/test/SingleCacheManagerTest.java
   trunk/core/src/test/java/org/infinispan/test/TestingUtil.java
   trunk/core/src/test/java/org/infinispan/test/ViewChangeListener.java
   trunk/core/src/test/java/org/infinispan/test/fwk/DebuggingUnitTestNGListener.java
   trunk/core/src/test/java/org/infinispan/tx/LargeTransactionTest.java
   trunk/core/src/test/java/org/infinispan/tx/MarkAsRollbackTest.java
   trunk/core/src/test/java/org/infinispan/tx/OnePhaseXATest.java
   trunk/core/src/test/java/org/infinispan/tx/ReplDeadlockDetectionTest.java
   trunk/core/src/test/java/org/infinispan/tx/StaleLockRecoveryTest.java
   trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningCaches.java
   trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningReplicatedCaches.java
   trunk/core/src/test/resources/log4j.xml
   trunk/demos/directory/src/main/java/org/infinispan/demos/directory/FilesystemDirectory.java
   trunk/demos/ec2/src/main/java/org/infinispan/ec2demo/CacheBuilder.java
   trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/CacheManagerHolder.java
   trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/GridStore.java
   trunk/demos/gui/src/main/java/org/infinispan/demo/InfinispanDemo.java
   trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DemoActions.java
   trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java
   trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml
   trunk/lucene-directory/src/test/java/org/infinispan/lucene/CacheTestSupport.java
   trunk/lucene-directory/src/test/java/org/infinispan/lucene/InfinispanDirectoryStressTest.java
   trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/IndexReadingStressTest.java
   trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/PerformanceCompareStressTest.java
   trunk/lucene-directory/src/test/java/org/infinispan/lucene/testutils/ClusteredCacheFactory.java
   trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java
   trunk/query/src/test/java/org/infinispan/query/blackbox/KeyTypeTest.java
   trunk/query/src/test/java/org/infinispan/query/blackbox/LocalCacheTest.java
   trunk/query/src/test/java/org/infinispan/query/config/QueryParsingTest.java
   trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala
   trunk/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodIdleTimeoutTest.scala
   trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedDecoder.scala
   trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala
   trunk/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedFunctionalTest.scala
   trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala
   trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala
   trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java
   trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServerHandler.java
   trunk/server/websocket/src/test/java/org/infinispan/server/websocket/handlers/MockClient.java
   trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java
   trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java
   trunk/tree/src/test/java/org/infinispan/profiling/TreeProfileTest.java
Log:
merge from 4.1.x (r1875 to r1949)

Copied: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractJdbcCacheStoreConfig.java (from rev 1949, branches/4.1.x/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractJdbcCacheStoreConfig.java)
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractJdbcCacheStoreConfig.java	                        (rev 0)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractJdbcCacheStoreConfig.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,70 @@
+package org.infinispan.loaders.jdbc;
+
+import org.infinispan.loaders.AbstractCacheStoreConfig;
+import org.infinispan.loaders.LockSupportCacheStoreConfig;
+import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
+
+/**
+ * This is an abstract configuration class containing common elements for all JDBC cache store types.
+ *
+ * @author Manik Surtani
+ * @version 4.1
+ */
+public abstract class AbstractJdbcCacheStoreConfig extends LockSupportCacheStoreConfig {
+
+   protected ConnectionFactoryConfig connectionFactoryConfig = new ConnectionFactoryConfig();
+
+   public void setConnectionFactoryClass(String connectionFactoryClass) {
+      testImmutability("connectionFactoryConfig");
+      this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
+   }
+
+   public ConnectionFactoryConfig getConnectionFactoryConfig() {
+      return connectionFactoryConfig;
+   }
+
+   /**
+    * Jdbc connection string for connecting to the database. Mandatory.
+    */
+   public void setConnectionUrl(String connectionUrl) {
+      testImmutability("connectionFactoryConfig");
+      this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
+   }
+
+   /**
+    * Database username.
+    */
+   public void setUserName(String userName) {
+      testImmutability("connectionFactoryConfig");
+      this.connectionFactoryConfig.setUserName(userName);
+   }
+
+   public void setDatasourceJndiLocation(String location) {
+      testImmutability("datasourceJndiLocation");
+      this.connectionFactoryConfig.setDatasourceJndiLocation(location);
+   }
+
+   /**
+    * Database username's password.
+    */
+   public void setPassword(String password) {
+      testImmutability("connectionFactoryConfig");
+      this.connectionFactoryConfig.setPassword(password);
+   }
+
+   /**
+    * The name of the driver used for connecting to the database. Mandatory, will be loaded before initiating the first
+    * connection.
+    */
+   public void setDriverClass(String driverClassName) {
+      testImmutability("connectionFactoryConfig");
+      this.connectionFactoryConfig.setDriverClass(driverClassName);
+   }
+
+   @Override
+   public AbstractJdbcCacheStoreConfig clone() {
+      AbstractJdbcCacheStoreConfig result = (AbstractJdbcCacheStoreConfig) super.clone();
+      result.connectionFactoryConfig = connectionFactoryConfig.clone();
+      return result;
+   }
+}

Copied: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractNonDelegatingJdbcCacheStoreConfig.java (from rev 1949, branches/4.1.x/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractNonDelegatingJdbcCacheStoreConfig.java)
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractNonDelegatingJdbcCacheStoreConfig.java	                        (rev 0)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/AbstractNonDelegatingJdbcCacheStoreConfig.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,164 @@
+package org.infinispan.loaders.jdbc;
+
+import org.infinispan.loaders.LockSupportCacheStoreConfig;
+
+/**
+ * An abstract configuration for JDBC cache stores which have support for locking.
+ *
+ * @author Manik Surtani
+ * @version 4.1
+ */
+public abstract class AbstractNonDelegatingJdbcCacheStoreConfig extends AbstractJdbcCacheStoreConfig {
+   private static final long serialVersionUID = 842757200078048889L;
+
+   public static final int DEFAULT_CONCURRENCY_LEVEL = 2048;
+   public static final int DEFAULT_LOCK_ACQUISITION_TIMEOUT = 60000;
+
+   private int lockConcurrencyLevel = DEFAULT_CONCURRENCY_LEVEL;
+   private long lockAcquistionTimeout = DEFAULT_LOCK_ACQUISITION_TIMEOUT;
+
+   protected TableManipulation tableManipulation = new TableManipulation();
+   protected boolean manageConnectionFactory = true;
+
+   /**
+    * Sets the name of the table where data will be stored.
+    */
+   public void setCacheName(String cacheName) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setCacheName(cacheName);
+   }
+
+   /**
+    * Sets the name of the column where the id will be stored. The id is obtained through:
+    * <pre>
+    *   key2StringMapper.getStringMapping(storedEntry.getKey());
+    * </pre>
+    * Mandatory.
+    */
+   public void setIdColumnName(String idColumnName) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setIdColumnName(idColumnName);
+   }
+
+   /**
+    * Sets the name of the column where the StoredEntry will be binary stored. Mandatory.
+    */
+   public void setDataColumnName(String dataColumnName) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setDataColumnName(dataColumnName);
+   }
+
+   /**
+    * Sets the name of the column where the timestamp (Long in java) will be stored. Mandatory.
+    */
+   public void setTimestampColumnName(String timestampColumnName) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setTimestampColumnName(timestampColumnName);
+   }
+
+   /**
+    * Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
+    * to this prefix in order to enforce unique table names for each cache.
+    */
+   public void setTimestampColumnType(String timestampColumnType) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setTimestampColumnType(timestampColumnType);
+   }
+
+   public TableManipulation getTableManipulation() {
+      return tableManipulation;
+   }
+
+   /**
+    * sql equivalent for java's String. Mandatory.
+    */
+   public void setIdColumnType(String idColumnType) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setIdColumnType(idColumnType);
+   }
+
+   /**
+    * Sets the type of the column where data will be binary stored. BLOB-like type, DBMS dependent. Mandatory.
+    */
+   public void setDataColumnType(String dataColumnType) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setDataColumnType(dataColumnType);
+   }
+
+   public void setDropTableOnExit(boolean dropTableOnExit) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setDropTableOnExit(dropTableOnExit);
+   }
+
+   public void setCreateTableOnStart(boolean createTableOnStart) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setCreateTableOnStart(createTableOnStart);
+   }
+
+   /**
+    * If this method returns false, then the connection factory should not be created by the {@link
+    * org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore}, but will be injected through {@link
+    * org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore#doConnectionFactoryInitialization(org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory)}
+    */
+   public boolean isManageConnectionFactory() {
+      return manageConnectionFactory;
+   }
+
+   public void setTableManipulation(TableManipulation tableManipulation) {
+      testImmutability("tableManipulation");
+      this.tableManipulation = tableManipulation;
+   }
+
+   /**
+    * @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
+    */
+   public void setFetchSize(int fetchSize) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setFetchSize(fetchSize);
+   }
+
+   /**
+    * @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
+    */
+   public void setBatchSize(int batchSize) {
+      testImmutability("tableManipulation");
+      this.tableManipulation.setBatchSize(batchSize);
+   }
+
+   /**
+    * @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
+    */
+   public int getFetchSize() {
+      return this.tableManipulation.getFetchSize();
+   }
+
+   /**
+    * @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
+    */
+   public int getBatchSize() {
+      return this.tableManipulation.getBatchSize();
+   }
+
+   public String getDatabaseType() {
+      return this.tableManipulation.databaseType == null ? "" : this.tableManipulation.databaseType.toString();
+   }
+
+   /**
+    * Sets the database dialect.  Valid types are reflected in the DatabaseType enum.  If unspecified, will attempt to
+    * "guess" appropriate dialect from the JDBC driver specified.
+    *
+    * @param dbType
+    */
+   public void setDatabaseType(String dbType) {
+      if (dbType != null)
+         this.tableManipulation.databaseType = DatabaseType.valueOf(dbType.toUpperCase().trim());
+   }
+
+
+   @Override
+   public AbstractNonDelegatingJdbcCacheStoreConfig clone() {
+      AbstractNonDelegatingJdbcCacheStoreConfig result = (AbstractNonDelegatingJdbcCacheStoreConfig) super.clone();
+      result.tableManipulation = tableManipulation.clone();
+      return result;
+   }
+}

Modified: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -21,8 +21,7 @@
  */
 package org.infinispan.loaders.jdbc.binary;
 
-import org.infinispan.loaders.LockSupportCacheStoreConfig;
-import org.infinispan.loaders.jdbc.DatabaseType;
+import org.infinispan.loaders.jdbc.AbstractNonDelegatingJdbcCacheStoreConfig;
 import org.infinispan.loaders.jdbc.TableManipulation;
 import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
 
@@ -31,17 +30,13 @@
  *
  * @author Mircea.Markus at jboss.com
  */
-public class JdbcBinaryCacheStoreConfig extends LockSupportCacheStoreConfig {
+public class JdbcBinaryCacheStoreConfig extends AbstractNonDelegatingJdbcCacheStoreConfig {
 
    /** The serialVersionUID */
    private static final long serialVersionUID = 7659899424935453635L;
-   
-   private ConnectionFactoryConfig connectionFactoryConfig = new ConnectionFactoryConfig();
-   private TableManipulation tableManipulation = new TableManipulation();
-   private boolean createConnectionFatory = true;
 
-   public JdbcBinaryCacheStoreConfig(boolean createConnectionFatory) {
-      this.createConnectionFatory = createConnectionFatory;
+   public JdbcBinaryCacheStoreConfig(boolean manageConnectionFactory) {
+      this.manageConnectionFactory = manageConnectionFactory;
    }
 
    public JdbcBinaryCacheStoreConfig(ConnectionFactoryConfig connectionFactoryConfig, TableManipulation tm) {
@@ -54,27 +49,7 @@
       cacheLoaderClassName = JdbcBinaryCacheStore.class.getName();
    }
 
-   boolean isManageConnectionFactory() {
-      return createConnectionFatory;
-   }
-
    /**
-    * If true, and the table is missing it will be created when starting the cache store. Default to <tt>true</tt>.
-    */
-   public void setCreateTableOnStart(boolean createTableOnStart) {
-      testImmutability("tableManipulation");
-      tableManipulation.setCreateTableOnStart(createTableOnStart);
-   }
-
-   /**
-    * If true, the table will be created when cache store is stopped. Default to <tt>false</tt>.
-    */
-   public void setDropTableOnExit(boolean dropTableOnExit) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setDropTableOnExit(dropTableOnExit);
-   }
-
-   /**
     * Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
     * to this prefix in order to enforce unique table names for each cache.
     */
@@ -82,150 +57,4 @@
       testImmutability("tableManipulation");
       this.tableManipulation.setTableNamePrefix(bucketTableName);
    }
-
-   public void setIdColumnName(String idColumnName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setIdColumnName(idColumnName);
-   }
-
-   public void setIdColumnType(String idColumnType) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setIdColumnType(idColumnType);
-   }
-
-   public void setDataColumnName(String dataColumnName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setDataColumnName(dataColumnName);
-   }
-
-   public void setDataColumnType(String dataColumnType) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setDataColumnType(dataColumnType);
-   }
-
-   public void setTimestampColumnName(String timestampColumnName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setTimestampColumnName(timestampColumnName);
-   }
-
-
-   public void setTimestampColumnType(String timestampColumnType) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setTimestampColumnType(timestampColumnType);
-   }
-
-   /**
-    * Url connection to the database.
-    */
-   
-   public void setConnectionUrl(String connectionUrl) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
-   }
-
-   /**
-    * Database user name.
-    */
-   public void setUserName(String userName) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setUserName(userName);
-   }
-
-   /**
-    * Database username's password.
-    */
-   public void setPassword(String password) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setPassword(password);
-   }
-
-
-   public void setDatasourceJndiLocation(String location) {
-      testImmutability("datasourceJndiLocation");
-      this.connectionFactoryConfig.setDatasourceJndiLocation(location);
-   }
-
-   /**
-    * Driver class, will be loaded before initializing the {@link org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory}
-    */
-   public void setDriverClass(String driverClass) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setDriverClass(driverClass);
-   }
-
-   /**
-    * Name of the connection factory class.
-    *
-    * @see org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory
-    */
-   public void setConnectionFactoryClass(String connectionFactoryClass) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
-   }
-
-
-   @Override
-   public JdbcBinaryCacheStoreConfig clone() {
-      JdbcBinaryCacheStoreConfig result = (JdbcBinaryCacheStoreConfig) super.clone();
-      result.connectionFactoryConfig = connectionFactoryConfig.clone();
-      result.tableManipulation = tableManipulation.clone();
-      return result;
-   }
-
-   public ConnectionFactoryConfig getConnectionFactoryConfig() {
-      return connectionFactoryConfig;
-   }
-
-   public TableManipulation getTableManipulation() {
-      return tableManipulation;
-   }
-
-   public void setTableManipulation(TableManipulation tableManipulation) {
-      testImmutability("tableManipulation");
-      this.tableManipulation = tableManipulation;
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
-    */
-   public void setFetchSize(int fetchSize) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setFetchSize(fetchSize);
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
-    */
-   public void setBatchSize(int batchSize) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setBatchSize(batchSize);
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
-    */
-   public int getFetchSize() {
-      return this.tableManipulation.getFetchSize();
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
-    */
-   public int getBatchSize() {
-      return this.tableManipulation.getBatchSize();
-   }
-
-   public String getDatabaseType() {
-      return this.tableManipulation.databaseType == null ? "" : this.tableManipulation.databaseType.toString();
-   }
-
-   /**
-    * Sets the database dialect.  Valid types are reflected in the DatabaseType enum.  If unspecified, will attempt to
-    * "guess" appropriate dialect from the JDBC driver specified.
-    * @param dbType
-    */
-   public void setDatabaseType(String dbType) {
-      if (dbType != null)
-         this.tableManipulation.databaseType = DatabaseType.valueOf(dbType.toUpperCase().trim());
-   }
 }

Modified: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -23,6 +23,7 @@
 
 import org.infinispan.loaders.AbstractCacheStoreConfig;
 import org.infinispan.loaders.LockSupportCacheStoreConfig;
+import org.infinispan.loaders.jdbc.AbstractJdbcCacheStoreConfig;
 import org.infinispan.loaders.jdbc.DatabaseType;
 import org.infinispan.loaders.jdbc.TableManipulation;
 import org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStoreConfig;
@@ -34,11 +35,10 @@
  *
  * @author Mircea.Markus at jboss.com
  */
-public class JdbcMixedCacheStoreConfig extends AbstractCacheStoreConfig {
+public class JdbcMixedCacheStoreConfig extends AbstractJdbcCacheStoreConfig {
 
    private static final long serialVersionUID = -1343548133363285687L;
-   
-   private ConnectionFactoryConfig connectionFactoryConfig = new ConnectionFactoryConfig();
+
    private TableManipulation binaryTableManipulation = new TableManipulation();
    private TableManipulation stringsTableManipulation = new TableManipulation();
    private String key2StringMapper;
@@ -172,7 +172,7 @@
       testImmutability("binaryTableManipulation");
       this.binaryTableManipulation.setTimestampColumnName(timestampColumnNameForBinary);
    }
-   
+
    public void setTimestampColumnTypeForBinary(String timestampColumnTypeForBinary) {
       this.binaryTableManipulation.setTimestampColumnType(timestampColumnTypeForBinary);
    }
@@ -181,52 +181,12 @@
       testImmutability("binaryTableManipulation");
       this.binaryTableManipulation.setCreateTableOnStart(createTableOnStartForBinary);
    }
-   
+
    public void setDropTableOnExitForBinary(boolean dropTableOnExitForBinary) {
       testImmutability("binaryTableManipulation");
       this.binaryTableManipulation.setDropTableOnExit(dropTableOnExitForBinary);
    }
-   
-   public void setDriverClass(String driverClass) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setDriverClass(driverClass);
-   }
 
-   public void setConnectionUrl(String connectionUrl) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
-   }
-
-   public void setUserName(String userName) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setUserName(userName);
-   }
-
-   public void setPassword(String password) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setPassword(password);
-   }
-
-   /**
-    * Name of the connection factory class.
-    *
-    * @see org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory
-    */
-   public void setConnectionFactoryClass(String connectionFactoryClass) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
-   }
-
-   public void setDatasourceJndiLocation(String location) {
-      testImmutability("datasourceJndiLocation");
-      this.connectionFactoryConfig.setDatasourceJndiLocation(location);
-   }
-
-
-   public ConnectionFactoryConfig getConnectionFactoryConfig() {
-      return connectionFactoryConfig;
-   }
-
    public void setKey2StringMapperClass(String name) {
       testImmutability("key2StringMapper");
       this.key2StringMapper = name;
@@ -272,6 +232,7 @@
    /**
     * Sets the database dialect.  Valid types are reflected in the DatabaseType enum.  If unspecified, will attempt to
     * "guess" appropriate dialect from the JDBC driver specified.
+    *
     * @param dbType
     */
    public void setDatabaseType(String dbType) {
@@ -282,7 +243,6 @@
    @Override
    public JdbcMixedCacheStoreConfig clone() {
       JdbcMixedCacheStoreConfig dolly = (JdbcMixedCacheStoreConfig) super.clone();
-      dolly.connectionFactoryConfig = this.connectionFactoryConfig.clone();
       dolly.binaryTableManipulation = this.binaryTableManipulation.clone();
       dolly.stringsTableManipulation = this.stringsTableManipulation.clone();
       return dolly;

Modified: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -21,8 +21,7 @@
  */
 package org.infinispan.loaders.jdbc.stringbased;
 
-import org.infinispan.loaders.LockSupportCacheStoreConfig;
-import org.infinispan.loaders.jdbc.DatabaseType;
+import org.infinispan.loaders.jdbc.AbstractNonDelegatingJdbcCacheStoreConfig;
 import org.infinispan.loaders.jdbc.TableManipulation;
 import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
 import org.infinispan.util.Util;
@@ -33,17 +32,13 @@
  * @author Mircea.Markus at jboss.com
  * @see org.infinispan.loaders.jdbc.stringbased.Key2StringMapper
  */
-public class JdbcStringBasedCacheStoreConfig extends LockSupportCacheStoreConfig {
+public class JdbcStringBasedCacheStoreConfig extends AbstractNonDelegatingJdbcCacheStoreConfig {
 
    /** The serialVersionUID */
    private static final long serialVersionUID = 8835350707132331983L;
 
    private Key2StringMapper key2StringMapper;
 
-   private ConnectionFactoryConfig connectionFactoryConfig = new ConnectionFactoryConfig();
-   private TableManipulation tableManipulation = new TableManipulation();
-   private boolean manageConnectionFactory = true;
-
    public JdbcStringBasedCacheStoreConfig(ConnectionFactoryConfig connectionFactoryConfig, TableManipulation tableManipulation) {
       this();
       this.connectionFactoryConfig = connectionFactoryConfig;
@@ -93,192 +88,11 @@
       this.tableManipulation.setTableNamePrefix(stringsTableNamePrefix);
    }
 
-   /**
-    * Sets the name of the table where data will be stored.
-    */
-   public void setCacheName(String cacheName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setCacheName(cacheName);
-   }
 
-   /**
-    * Sets the name of the column where the id will be stored. The id is obtained through:
-    * <pre>
-    *   key2StringMapper.getStringMapping(storedEntry.getKey());
-    * </pre>
-    * Mandatory.
-    */
-   public void setIdColumnName(String idColumnName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setIdColumnName(idColumnName);
-   }
-
-   /**
-    * Sets the name of the column where the StoredEntry will be binary stored. Mandatory.
-    */
-   public void setDataColumnName(String dataColumnName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setDataColumnName(dataColumnName);
-   }
-
-   /**
-    * Sets the name of the column where the timestamp (Long in java) will be stored. Mandatory.
-    */
-   public void setTimestampColumnName(String timestampColumnName) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setTimestampColumnName(timestampColumnName);
-   }
-
-   /**
-    * Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
-    * to this prefix in order to enforce unique table names for each cache.
-    */
-   public void setTimestampColumnType(String timestampColumnType) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setTimestampColumnType(timestampColumnType);
-   }
-
-   public void setConnectionFactoryClass(String connectionFactoryClass) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
-   }
-
-   public ConnectionFactoryConfig getConnectionFactoryConfig() {
-      return connectionFactoryConfig;
-   }
-
-   public TableManipulation getTableManipulation() {
-      return tableManipulation;
-   }
-
-   /**
-    * Jdbc connection string for connecting to the database. Mandatory.
-    */
-   public void setConnectionUrl(String connectionUrl) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
-   }
-
-   /**
-    * Database username.
-    */
-   public void setUserName(String userName) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setUserName(userName);
-   }
-
-   public void setDatasourceJndiLocation(String location) {
-      testImmutability("datasourceJndiLocation");
-      this.connectionFactoryConfig.setDatasourceJndiLocation(location);
-   }
-
-   /**
-    * Database username's password.
-    */
-   public void setPassword(String password) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setPassword(password);
-   }
-
-   /**
-    * The name of the driver used for connecting to the database. Mandatory, will be loaded before initiating the first
-    * connection.
-    */
-   public void setDriverClass(String driverClassName) {
-      testImmutability("connectionFactoryConfig");
-      this.connectionFactoryConfig.setDriverClass(driverClassName);
-   }
-
-   /**
-    * sql equivalent for java's String. Mandatory.
-    */
-   public void setIdColumnType(String idColumnType) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setIdColumnType(idColumnType);
-   }
-
-   /**
-    * Sets the type of the column where data will be binary stored. BLOB-like type, DBMS dependent. Mandatory.
-    */
-   public void setDataColumnType(String dataColumnType) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setDataColumnType(dataColumnType);
-   }
-
-   public void setDropTableOnExit(boolean dropTableOnExit) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setDropTableOnExit(dropTableOnExit);
-   }
-
-   public void setCreateTableOnStart(boolean createTableOnStart) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setCreateTableOnStart(createTableOnStart);
-   }
-
-   /**
-    * If this method returns false, then the connection factory should not be created by the {@link
-    * org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore}, but will be injected through {@link
-    * org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore#doConnectionFactoryInitialization(org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory)}
-    */
-   boolean isManageConnectionFactory() {
-      return manageConnectionFactory;
-   }
-
-   public void setTableManipulation(TableManipulation tableManipulation) {
-      testImmutability("tableManipulation");
-      this.tableManipulation = tableManipulation;
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
-    */
-   public void setFetchSize(int fetchSize) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setFetchSize(fetchSize);
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
-    */
-   public void setBatchSize(int batchSize) {
-      testImmutability("tableManipulation");
-      this.tableManipulation.setBatchSize(batchSize);
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
-    */
-   public int getFetchSize() {
-      return this.tableManipulation.getFetchSize();
-   }
-
-   /**
-    * @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
-    */
-   public int getBatchSize() {
-      return this.tableManipulation.getBatchSize();
-   }
-
-   public String getDatabaseType() {
-      return this.tableManipulation.databaseType == null ? "" : this.tableManipulation.databaseType.toString();
-   }
-
-   /**
-    * Sets the database dialect.  Valid types are reflected in the DatabaseType enum.  If unspecified, will attempt to
-    * "guess" appropriate dialect from the JDBC driver specified.
-    * @param dbType
-    */
-   public void setDatabaseType(String dbType) {
-      if (dbType != null)
-         this.tableManipulation.databaseType = DatabaseType.valueOf(dbType.toUpperCase().trim());
-   }
-
-
    @Override
    public JdbcStringBasedCacheStoreConfig clone() {
       JdbcStringBasedCacheStoreConfig result = (JdbcStringBasedCacheStoreConfig) super.clone();
-      result.connectionFactoryConfig = connectionFactoryConfig.clone();
-      result.tableManipulation = tableManipulation.clone();
+      result.key2StringMapper = key2StringMapper;
       return result;
    }   
 }

Modified: trunk/cachestore/jdbc/src/test/java/org/infinispan/config/parsing/JdbcConfigurationTest.java
===================================================================
--- trunk/cachestore/jdbc/src/test/java/org/infinispan/config/parsing/JdbcConfigurationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/test/java/org/infinispan/config/parsing/JdbcConfigurationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -31,7 +31,7 @@
 import org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory;
 import org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore;
 import org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;
@@ -88,7 +88,7 @@
 
    @Test(expectedExceptions={org.infinispan.CacheException.class})
    public void testWrongStoreConfiguration() throws IOException {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = new DefaultCacheManager("configs/illegal.xml");
          cm.start();

Modified: trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/TableNameUniquenessTest.java
===================================================================
--- trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/TableNameUniquenessTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/TableNameUniquenessTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -30,7 +30,7 @@
 import org.infinispan.loaders.jdbc.mixed.JdbcMixedCacheStore;
 import org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore;
 import org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -48,7 +48,7 @@
 public class TableNameUniquenessTest extends AbstractInfinispanTest {
 
    public void testForJdbcStringBasedCacheStore() throws Exception {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = TestCacheManagerFactory.fromXml("configs/string-based.xml");
          Cache<String, String> first = cm.getCache("first");
@@ -73,7 +73,7 @@
    }
 
    public void testForJdbcBinaryCacheStore() throws Exception {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = TestCacheManagerFactory.fromXml("configs/binary.xml");
          Cache<String, String> first = cm.getCache("first");
@@ -93,7 +93,7 @@
 
    @SuppressWarnings("unchecked")
    public void testForMixedCacheStore() throws Exception {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = TestCacheManagerFactory.fromXml("configs/mixed.xml");
          Cache first = cm.getCache("first");

Modified: trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/binary/BinaryStoreWithManagedConnectionTest.java
===================================================================
--- trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/binary/BinaryStoreWithManagedConnectionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/binary/BinaryStoreWithManagedConnectionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -30,7 +30,7 @@
 import org.infinispan.loaders.jdbc.TableManipulation;
 import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
 import org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.test.fwk.UnitTestDatabaseManager;
@@ -56,7 +56,7 @@
 
 
    public void testLoadFromFile() throws Exception {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = TestCacheManagerFactory.fromXml("configs/managed/binary-managed-connection-factory.xml");
          Cache<String, String> first = cm.getCache("first");

Modified: trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/mixed/MixedStoreWithManagedConnectionTest.java
===================================================================
--- trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/mixed/MixedStoreWithManagedConnectionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/mixed/MixedStoreWithManagedConnectionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -30,7 +30,7 @@
 import org.infinispan.loaders.jdbc.TableManipulation;
 import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
 import org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.test.fwk.UnitTestDatabaseManager;
@@ -60,7 +60,7 @@
 
 
    public void testLoadFromFile() throws Exception {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = TestCacheManagerFactory.fromXml("configs/managed/mixed-managed-connection-factory.xml");
          Cache<String, String> first = cm.getCache("first");

Modified: trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/stringbased/StringStoreWithManagedConnectionTest.java
===================================================================
--- trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/stringbased/StringStoreWithManagedConnectionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/stringbased/StringStoreWithManagedConnectionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -30,7 +30,7 @@
 import org.infinispan.loaders.jdbc.TableManipulation;
 import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
 import org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.test.fwk.UnitTestDatabaseManager;
@@ -55,7 +55,7 @@
    }
 
    public void testLoadFromFile() throws Exception {
-      CacheManager cm = null;
+      CacheContainer cm = null;
       try {
          cm = TestCacheManagerFactory.fromXml("configs/managed/str-managed-connection-factory.xml");
          Cache<String, String> first = cm.getCache("first");

Modified: trunk/cachestore/remote/src/main/java/org/infinispan/loaders/remote/RemoteCacheStoreConfig.java
===================================================================
--- trunk/cachestore/remote/src/main/java/org/infinispan/loaders/remote/RemoteCacheStoreConfig.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/remote/src/main/java/org/infinispan/loaders/remote/RemoteCacheStoreConfig.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.CacheException;
 import org.infinispan.loaders.AbstractCacheStoreConfig;
-import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.util.FileLookup;
 
 import java.io.IOException;
@@ -17,7 +17,7 @@
  * <li>HotRodClientPropertiesFile-the file that contains the configuration of hotrod client. See <a href="http://community.jboss.org/wiki/JavaHotRodclient">Hotrod Java Client</a>
  *     for more details on the hotrod client. 
  * <li>remoteCacheName-the name of the remote cache in the remote infinispan cluster, to which to connect to</li>
- * <li>UseDefaultRemoteCache-if set to true, the default remote cache will be used, as obtained by {@link org.infinispan.manager.CacheManager#getCache()}.
+ * <li>UseDefaultRemoteCache-if set to true, the default remote cache will be used, as obtained by {@link org.infinispan.manager.CacheContainer#getCache()}.
  * </ul>
  *
  * @author Mircea.Markus at jboss.com
@@ -43,12 +43,12 @@
 
    public void setUseDefaultRemoteCache(boolean useDefaultRemoteCache) {
       if (useDefaultRemoteCache) {
-         setRemoteCacheName(DefaultCacheManager.DEFAULT_CACHE_NAME);
+         setRemoteCacheName(CacheContainer.DEFAULT_CACHE_NAME);
       }
    }
 
    public boolean isUseDefaultRemoteCache() {
-      return DefaultCacheManager.DEFAULT_CACHE_NAME.equals(getRemoteCacheName());
+      return CacheContainer.DEFAULT_CACHE_NAME.equals(getRemoteCacheName());
    }
 
    @Override

Modified: trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreConfigTest.java
===================================================================
--- trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreConfigTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreConfigTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.loaders.CacheLoader;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
@@ -38,7 +38,7 @@
    }
 
    public void simpleTest() throws IOException {
-      CacheManager cm = new DefaultCacheManager(CACHE_LOADER_CONFIG);
+      CacheContainer cm = new DefaultCacheManager(CACHE_LOADER_CONFIG);
       Cache<Object, Object> cache = cm.getCache();
       CacheLoader cacheLoader = TestingUtil.getCacheLoader(cache);
       assert cacheLoader != null;

Modified: trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreFunctionalTest.java
===================================================================
--- trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import org.infinispan.client.hotrod.TestHelper;
 import org.infinispan.loaders.BaseCacheStoreFunctionalTest;
 import org.infinispan.loaders.CacheStoreConfig;
-import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -27,7 +27,7 @@
       localCacheManager = TestCacheManagerFactory.createLocalCacheManager();
       hrServer = TestHelper.startHotRodServer(localCacheManager);
 
-      remoteCacheStoreConfig.setRemoteCacheName(DefaultCacheManager.DEFAULT_CACHE_NAME);
+      remoteCacheStoreConfig.setRemoteCacheName(CacheContainer.DEFAULT_CACHE_NAME);
       Properties properties = new Properties();
       properties.put("hotrod-servers", "localhost:"+ hrServer.getPort());
       remoteCacheStoreConfig.setHotRodClientProperties(properties);

Modified: trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreTest.java
===================================================================
--- trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/cachestore/remote/src/test/java/org/infinispan/loaders/remote/RemoteCacheStoreTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,8 +2,6 @@
 
 import org.infinispan.client.hotrod.TestHelper;
 import org.infinispan.config.Configuration;
-import org.infinispan.container.entries.InternalCacheEntry;
-import org.infinispan.container.entries.InternalEntryFactory;
 import org.infinispan.eviction.EvictionStrategy;
 import org.infinispan.loaders.BaseCacheStoreTest;
 import org.infinispan.loaders.CacheLoaderException;
@@ -11,8 +9,6 @@
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.Test;
 

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCacheManager.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCacheManager.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCacheManager.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,6 @@
 package org.infinispan.client.hotrod;
 
 import org.infinispan.client.hotrod.exceptions.HotRodClientException;
-import org.infinispan.client.hotrod.HotRodMarshaller;
 import org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory;
 import org.infinispan.client.hotrod.impl.protocol.HotRodOperations;
 import org.infinispan.client.hotrod.impl.protocol.HotRodOperationsImpl;
@@ -11,8 +10,7 @@
 import org.infinispan.client.hotrod.impl.transport.VHelper;
 import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
 import org.infinispan.executors.ExecutorFactory;
-import org.infinispan.manager.CacheManager;
-import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
 
@@ -70,14 +68,14 @@
  *  <li>maxActive - controls the maximum number of connections per server that are allocated (checked out to client threads, or idle in
  * the pool) at one time. When non-positive, there is no limit to the number of connections per server. When maxActive
  * is reached, the connection pool for that server is said to be exhausted. The default setting for this parameter is
- * 2.</li>
+ * -1, i.e. there is no limit.</li>
  * <li>maxTotal - sets a global limit on the number persistent connections that can be in circulation within the combined set of
  * servers. When non-positive, there is no limit to the total number of persistent connections in circulation. When
  * maxTotal is exceeded, all connections pools are exhausted. The default setting for this parameter is -1 (no limit).
  * </li>
  *
  * <li>maxIdle - controls the maximum number of idle persistent connections, per server, at any time. When negative, there is no limit
- * to the number of connections that may be idle per server. The default setting for this parameter is 2.</li>
+ * to the number of connections that may be idle per server. The default setting for this parameter is -1.</li>
  *
  * <li>
  *   whenExhaustedAction - specifies what happens when asking for a connection from a server's pool, and that pool is exhausted. Possible values:
@@ -97,7 +95,7 @@
  * <ul>
  *  <li>timeBetweenEvictionRunsMillis - indicates how long the eviction thread should sleep before "runs" of examining idle
  *  connections. When non-positive, no eviction thread will be launched. The default setting for this parameter is
- *  300000(5 minutes) </li>
+ *  2 minutes </li>
  *   <li> minEvictableIdleTimeMillis - specifies the minimum amount of time that an connection may sit idle in the pool before it
  *   is eligible for eviction due to idle time. When non-positive, no connection will be dropped from the pool due to
  *   idle time alone. This setting has no effect unless timeBetweenEvictionRunsMillis > 0. The default setting for this
@@ -109,7 +107,7 @@
  *   <li>minIdle - sets a target value for the minimum number of idle connections (per server) that should always be available.
  *   If this parameter is set to a positive number and timeBetweenEvictionRunsMillis > 0, each time the idle connection
  *   eviction thread runs, it will try to create enough idle instances so that there will be minIdle idle instances
- *   available for each server.  The default setting for this parameter is 0. </li>
+ *   available for each server.  The default setting for this parameter is 5 minutes. </li>
  * </ul>
  * </li>
  * <li>
@@ -126,7 +124,7 @@
  * @author Mircea.Markus at jboss.com
  * @since 4.1
  */
-public class RemoteCacheManager implements CacheManager {
+public class RemoteCacheManager implements CacheContainer {
 
    private static Log log = LogFactory.getLog(RemoteCacheManager.class);
 
@@ -187,7 +185,8 @@
 
    /**
     * Same as {@link #RemoteCacheManager(java.util.Properties)}, but it will try to lookup the config properties in the
-    * classpath, in a file named <tt>hotrod-client.properties</tt>.
+    * classpath, in a file named <tt>hotrod-client.properties</tt>. If no properties can be found in the classpath, the
+    * server tries to connect to "127.0.0.1:11311" in start.
     *
     * @param start weather or not to start the RemoteCacheManager
     * @throws HotRodClientException if such a file cannot be found in the classpath
@@ -286,6 +285,7 @@
    }
 
    public <K, V> RemoteCache<K, V> getCache(boolean forceReturnValue) {
+      //As per the HotRod protocol specification, the default cache is identified by an empty string
       return createRemoteCache("", forceReturnValue);
    }
 

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -39,6 +39,9 @@
    private volatile boolean forceReturnValue;
 
    public RemoteCacheImpl(RemoteCacheManager rcm, String name, boolean forceReturnValue) {
+      if (log.isTraceEnabled()) {
+         log.trace("Creating remote cache: " + name);
+      }
       this.name = name;
       this.forceReturnValue = forceReturnValue;
       this.remoteCacheManager = rcm;

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheSupport.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheSupport.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheSupport.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,7 @@
 import org.infinispan.client.hotrod.RemoteCache;
 import org.infinispan.config.Configuration;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.util.concurrent.NotifyingFuture;
 
 import java.util.Collection;
@@ -37,7 +37,7 @@
    }
 
    @Override
-   public CacheManager getCacheManager() {
+   public CacheContainer getCacheManager() {
       throw new UnsupportedOperationException("Use getRemoteCacheManager() instead.");
    }
 

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/SerializationMarshaller.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/SerializationMarshaller.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/SerializationMarshaller.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -14,6 +14,7 @@
 
 /**
  * Default marshaller implementation based on object serialization.
+ * todo - the marshaller should only be when writing to the actual transport
  *
  * @author Mircea.Markus at jboss.com
  * @since 4.1

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsHelper.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsHelper.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsHelper.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -20,7 +20,7 @@
  * @since 4.1
  */
 public class HotRodOperationsHelper {
-   static Log log = LogFactory.getLog(HotRodOperationsImpl.class);
+   static Log log = LogFactory.getLog(HotRodOperationsHelper.class);
    static final AtomicLong MSG_ID = new AtomicLong();
    final static byte CLIENT_INTELLIGENCE = HotRodConstants.CLIENT_INTELLIGENCE_HASH_DISTRIBUTION_AWARE;
 

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsImpl.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsImpl.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/protocol/HotRodOperationsImpl.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,9 +2,9 @@
 
 import org.infinispan.client.hotrod.Flag;
 import org.infinispan.client.hotrod.exceptions.InvalidResponseException;
+import org.infinispan.client.hotrod.exceptions.TransportException;
 import org.infinispan.client.hotrod.impl.BinaryVersionedValue;
 import org.infinispan.client.hotrod.impl.VersionedOperationResponse;
-import org.infinispan.client.hotrod.impl.protocol.HotRodConstants;
 import org.infinispan.client.hotrod.impl.transport.Transport;
 import org.infinispan.client.hotrod.impl.transport.TransportFactory;
 import org.infinispan.util.logging.Log;
@@ -34,114 +34,147 @@
    }
 
    public byte[] get(byte[] key, Flag[] flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendKeyOperation(key, transport, GET_REQUEST, flags, GET_RESPONSE);
-         if (status == KEY_DOES_NOT_EXIST_STATUS) {
-            return null;
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         try {
+            Transport transport = getTransport(key, i == 0);
+            try {
+               short status = sendKeyOperation(key, transport, GET_REQUEST, flags, GET_RESPONSE);
+               if (status == KEY_DOES_NOT_EXIST_STATUS) {
+                  return null;
+               }
+               if (status == NO_ERROR_STATUS) {
+                  return transport.readArray();
+               }
+            } finally {
+               releaseTransport(transport);
+            }
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
          }
-         if (status == NO_ERROR_STATUS) {
-            return transport.readArray();
-         }
-      } finally {
-         releaseTransport(transport);
       }
       throw new IllegalStateException("We should not reach here!");
    }
 
    public byte[] remove(byte[] key, Flag[] flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendKeyOperation(key, transport, REMOVE_REQUEST, flags, REMOVE_RESPONSE);
-         if (status == KEY_DOES_NOT_EXIST_STATUS) {
-            return null;
-         } else if (status == NO_ERROR_STATUS) {
-            return returnPossiblePrevValue(transport, flags);
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            short status = sendKeyOperation(key, transport, REMOVE_REQUEST, flags, REMOVE_RESPONSE);
+            if (status == KEY_DOES_NOT_EXIST_STATUS) {
+               return null;
+            } else if (status == NO_ERROR_STATUS) {
+               return returnPossiblePrevValue(transport, flags);
+            }
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         } finally {
+            releaseTransport(transport);
          }
-      } finally {
-         releaseTransport(transport);
       }
       throw new IllegalStateException("We should not reach here!");
    }
 
    public boolean containsKey(byte[] key, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendKeyOperation(key, transport, CONTAINS_KEY_REQUEST, flags, CONTAINS_KEY_RESPONSE);
-         if (status == KEY_DOES_NOT_EXIST_STATUS) {
-            return false;
-         } else if (status == NO_ERROR_STATUS) {
-            return true;
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            short status = sendKeyOperation(key, transport, CONTAINS_KEY_REQUEST, flags, CONTAINS_KEY_RESPONSE);
+            if (status == KEY_DOES_NOT_EXIST_STATUS) {
+               return false;
+            } else if (status == NO_ERROR_STATUS) {
+               return true;
+            }
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
          }
-      } finally {
-         releaseTransport(transport);
+         finally {
+            releaseTransport(transport);
+         }
       }
       throw new IllegalStateException("We should not reach here!");
    }
 
    public BinaryVersionedValue getWithVersion(byte[] key, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendKeyOperation(key, transport, GET_WITH_VERSION, flags, GET_WITH_VERSION_RESPONSE);
-         if (status == KEY_DOES_NOT_EXIST_STATUS) {
-            return null;
-         }
-         if (status == NO_ERROR_STATUS) {
-            long version = transport.readLong();
-            if (log.isTraceEnabled()) {
-               log.trace("Received version: " + version);
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            short status = sendKeyOperation(key, transport, GET_WITH_VERSION, flags, GET_WITH_VERSION_RESPONSE);
+            if (status == KEY_DOES_NOT_EXIST_STATUS) {
+               return null;
             }
-            byte[] value = transport.readArray();
-            return new BinaryVersionedValue(version, value);
+            if (status == NO_ERROR_STATUS) {
+               long version = transport.readLong();
+               if (log.isTraceEnabled()) {
+                  log.trace("Received version: " + version);
+               }
+               byte[] value = transport.readArray();
+               return new BinaryVersionedValue(version, value);
+            }
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         } finally {
+            releaseTransport(transport);
          }
-      } finally {
-         releaseTransport(transport);
       }
       throw new IllegalStateException("We should not reach here!");
    }
 
 
    public byte[] put(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendPutOperation(key, value, transport, PUT_REQUEST, PUT_RESPONSE, lifespan, maxIdle, flags);
-         if (status != NO_ERROR_STATUS) {
-            throw new InvalidResponseException("Unexpected response status: " + Integer.toHexString(status));
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            short status = sendPutOperation(key, value, transport, PUT_REQUEST, PUT_RESPONSE, lifespan, maxIdle, flags);
+            if (status != NO_ERROR_STATUS) {
+               throw new InvalidResponseException("Unexpected response status: " + Integer.toHexString(status));
+            }
+            return returnPossiblePrevValue(transport, flags);
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         } finally {
+            releaseTransport(transport);
          }
-         return returnPossiblePrevValue(transport, flags);
-      } finally {
-         releaseTransport(transport);
       }
+      throw new IllegalStateException("This should not be reached!");
    }
 
    public byte[] putIfAbsent(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendPutOperation(key, value, transport, PUT_IF_ABSENT_REQUEST, PUT_IF_ABSENT_RESPONSE, lifespan, maxIdle, flags);
-         if (status == NO_ERROR_STATUS || status == NOT_PUT_REMOVED_REPLACED_STATUS) {
-            byte[] bytes = returnPossiblePrevValue(transport, flags);
-            if (log.isTraceEnabled()) {
-               log.trace("Returning from putIfAbsent: " + Arrays.toString(bytes));
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            short status = sendPutOperation(key, value, transport, PUT_IF_ABSENT_REQUEST, PUT_IF_ABSENT_RESPONSE, lifespan, maxIdle, flags);
+            if (status == NO_ERROR_STATUS || status == NOT_PUT_REMOVED_REPLACED_STATUS) {
+               byte[] bytes = returnPossiblePrevValue(transport, flags);
+               if (log.isTraceEnabled()) {
+                  log.trace("Returning from putIfAbsent: " + Arrays.toString(bytes));
+               }
+               return bytes;
             }
-            return bytes;
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
          }
-      } finally {
-         releaseTransport(transport);
+         finally {
+            releaseTransport(transport);
+         }
       }
       throw new IllegalStateException("We should not reach here!");
    }
 
    public byte[] replace(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         short status = sendPutOperation(key, value, transport, REPLACE_REQUEST, REPLACE_RESPONSE, lifespan, maxIdle, flags);
-         if (status == NO_ERROR_STATUS || status == NOT_PUT_REMOVED_REPLACED_STATUS) {
-            return returnPossiblePrevValue(transport, flags);
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            short status = sendPutOperation(key, value, transport, REPLACE_REQUEST, REPLACE_RESPONSE, lifespan, maxIdle, flags);
+            if (status == NO_ERROR_STATUS || status == NOT_PUT_REMOVED_REPLACED_STATUS) {
+               return returnPossiblePrevValue(transport, flags);
+            }
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         } finally {
+            releaseTransport(transport);
          }
-      } finally {
-         releaseTransport(transport);
       }
-      throw new IllegalStateException("We should not reach here!");
+      throw new IllegalStateException(" should not reach here!");
    }
 
    /**
@@ -151,52 +184,68 @@
     * was sent, the response would be empty.
     */
    public VersionedOperationResponse replaceIfUnmodified(byte[] key, byte[] value, int lifespan, int maxIdle, long version, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         // 1) write header
-         long messageId = HotRodOperationsHelper.writeHeader(transport, REPLACE_IF_UNMODIFIED_REQUEST, cacheName, topologyId, flags);
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            // 1) write header
+            long messageId = HotRodOperationsHelper.writeHeader(transport, REPLACE_IF_UNMODIFIED_REQUEST, cacheName, topologyId, flags);
 
-         //2) write message body
-         transport.writeArray(key);
-         transport.writeVInt(lifespan);
-         transport.writeVInt(maxIdle);
-         transport.writeLong(version);
-         transport.writeArray(value);
-         return returnVersionedOperationResponse(transport, messageId, REPLACE_IF_UNMODIFIED_RESPONSE, flags);
-      } finally {
-         releaseTransport(transport);
+            //2) write message body
+            transport.writeArray(key);
+            transport.writeVInt(lifespan);
+            transport.writeVInt(maxIdle);
+            transport.writeLong(version);
+            transport.writeArray(value);
+            return returnVersionedOperationResponse(transport, messageId, REPLACE_IF_UNMODIFIED_RESPONSE, flags);
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         }
+         finally {
+            releaseTransport(transport);
+         }
       }
+      throw new IllegalStateException(" should not reach here!");
    }
 
    /**
     * Request: [header][key length][key][entry_version]
     */
    public VersionedOperationResponse removeIfUnmodified(byte[] key, long version, Flag... flags) {
-      Transport transport = transportFactory.getTransport(key);
-      try {
-         // 1) write header
-         long messageId = HotRodOperationsHelper.writeHeader(transport, REMOVE_IF_UNMODIFIED_REQUEST, cacheName, topologyId, flags);
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = getTransport(key, i == 0);
+         try {
+            // 1) write header
+            long messageId = HotRodOperationsHelper.writeHeader(transport, REMOVE_IF_UNMODIFIED_REQUEST, cacheName, topologyId, flags);
 
-         //2) write message body
-         transport.writeArray(key);
-         transport.writeLong(version);
+            //2) write message body
+            transport.writeArray(key);
+            transport.writeLong(version);
 
-         //process response and return
-         return returnVersionedOperationResponse(transport, messageId, REMOVE_IF_UNMODIFIED_RESPONSE, flags);
+            //process response and return
+            return returnVersionedOperationResponse(transport, messageId, REMOVE_IF_UNMODIFIED_RESPONSE, flags);
 
-      } finally {
-         releaseTransport(transport);
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         }
+         finally {
+            releaseTransport(transport);
+         }
       }
+      throw new IllegalStateException("Should not reach this point!");
    }
 
    public void clear(Flag... flags) {
-      Transport transport = transportFactory.getTransport();
-      try {
-         // 1) write header
-         long messageId = HotRodOperationsHelper.writeHeader(transport, CLEAR_REQUEST, cacheName, topologyId, flags);
-         HotRodOperationsHelper.readHeaderAndValidate(transport, messageId, CLEAR_RESPONSE, topologyId);
-      } finally {
-         releaseTransport(transport);
+      for (int i = 0; i < transportFactory.getTransportCount(); i++) {
+         Transport transport = transportFactory.getTransport();
+         try {
+            // 1) write header
+            long messageId = HotRodOperationsHelper.writeHeader(transport, CLEAR_REQUEST, cacheName, topologyId, flags);
+            HotRodOperationsHelper.readHeaderAndValidate(transport, messageId, CLEAR_RESPONSE, topologyId);
+         } catch (TransportException te) {
+            logErrorAndThrowExceptionIfNeeded(i, te);
+         } finally {
+            releaseTransport(transport);
+         }
       }
    }
 
@@ -295,4 +344,22 @@
       byte[] prevValue = returnPossiblePrevValue(transport, flags);
       return new VersionedOperationResponse(prevValue, code);
    }
+
+   private void logErrorAndThrowExceptionIfNeeded(int i, TransportException te) {
+      String message = "Transport exception. Retry " + i + " out of " + transportFactory.getTransportCount();
+      if (i == transportFactory.getTransportCount() - 1) {
+         log.warn(message, te);
+         throw te;
+      } else {
+         log.trace(message + ":" + te);
+      }
+   }
+
+   private Transport getTransport(byte[] key, boolean hashAware) {
+      if (hashAware) {
+         return transportFactory.getTransport(key);
+      } else {
+         return transportFactory.getTransport();
+      }
+   }
 }

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/AbstractTransport.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/AbstractTransport.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/AbstractTransport.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -85,7 +85,7 @@
       if (!string.isEmpty()) {
          writeArray(string.getBytes(CHARSET));
       } else {
-         writeVInt(0);         
+         writeVInt(0);
       }
    }
 

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/TransportFactory.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/TransportFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/TransportFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -32,4 +32,6 @@
    Transport getTransport(byte[] key);
 
    boolean isTcpNoDelay();
+
+   int getTransportCount();
 }

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/netty/NettyTransportFactory.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/netty/NettyTransportFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/netty/NettyTransportFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -66,4 +66,9 @@
    public boolean isTcpNoDelay() {
       return tcpNoDelay;
    }
+
+   @Override
+   public int getTransportCount() {
+      return 1;
+   }
 }

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/PropsKeyedObjectPoolFactory.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/PropsKeyedObjectPoolFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/PropsKeyedObjectPoolFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -19,16 +19,16 @@
 
    public PropsKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, Properties props) {
       super(factory);
-      _maxActive = intProp(props, "maxActive", 2);
+      _maxActive = intProp(props, "maxActive", -1);
       _maxTotal = intProp(props, "maxTotal", -1);
-      _maxIdle = intProp(props, "maxIdle", 2);
+      _maxIdle = intProp(props, "maxIdle", -1);
       _whenExhaustedAction = (byte) intProp(props, "whenExhaustedAction", (int) GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK);
       _testOnBorrow = booleanProp(props, "testOnBorrow", false);
       _testOnReturn = booleanProp(props, "testOnReturn", false);
-      _timeBetweenEvictionRunsMillis = intProp(props, "timeBetweenEvictionRunsMillis", 5 * 60 * 1000);
-      _minEvictableIdleTimeMillis = longProp(props, "minEvictableIdleTimeMillis", 30 * 60 * 1000);
+      _timeBetweenEvictionRunsMillis = intProp(props, "timeBetweenEvictionRunsMillis", 2 * 60 * 1000);
+      _minEvictableIdleTimeMillis = longProp(props, "minEvictableIdleTimeMillis", 5 * 60 * 1000);
       _testWhileIdle = booleanProp(props, "testWhileIdle", true);
-      _minIdle = intProp(props, "minIdle", 0);
+      _minIdle = intProp(props, "minIdle", 1);
       _lifo = booleanProp(props, "lifo", true);
    }
 
@@ -65,3 +65,4 @@
       }
    }
 }
+

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/RoundRobinBalancingStrategy.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/RoundRobinBalancingStrategy.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/RoundRobinBalancingStrategy.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -51,14 +51,34 @@
    public InetSocketAddress nextServer() {
       readLock.lock();
       try {
-         int pos = index.getAndIncrement() % servers.length;
-         InetSocketAddress server = servers[pos];
-         if (log.isTraceEnabled()) {
-            log.trace("Returning server: " + server);
-         }
+         InetSocketAddress server = getServerByIndex(index.getAndIncrement());
          return server;
       } finally {
          readLock.unlock();
       }
    }
+
+   /**
+    * Returns same value as {@link #nextServer()} without modifying indexes/state.
+    */
+   public InetSocketAddress dryRunNextServer() {
+      return getServerByIndex(index.get());
+   }
+
+   private InetSocketAddress getServerByIndex(int val) {
+      int pos = val % servers.length;
+      InetSocketAddress server = servers[pos];
+      if (log.isTraceEnabled()) {
+         log.trace("Returning server: " + server);
+      }
+      return server;
+   }
+
+   public InetSocketAddress[] getServers() {
+      return servers;
+   }
+
+   public int getNextPosition() {
+      return  index.get() % servers.length;
+   }
 }

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -12,6 +12,7 @@
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.nio.channels.SocketChannel;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * Transport implementation based on TCP.
@@ -22,10 +23,14 @@
 @ThreadSafe
 public class TcpTransport extends AbstractTransport {
 
+   //needed for debugging
+   private static AtomicLong ID_COUNTER = new AtomicLong(0);
+
    private static Log log = LogFactory.getLog(TcpTransport.class);
 
    private final Socket socket;
    private final InetSocketAddress serverAddress;
+   private final long id = ID_COUNTER.incrementAndGet();
 
    public TcpTransport(InetSocketAddress serverAddress, TransportFactory transportFactory) {
       super(transportFactory);
@@ -179,6 +184,7 @@
       return "TcpTransport{" +
             "socket=" + socket +
             ", serverAddress=" + serverAddress +
+            ", id =" + id +
             "} ";
    }
 
@@ -212,4 +218,8 @@
          log.warn("Issues closing transport: " + this, e);
       }
    }
+
+   public boolean isValid() {
+      return !socket.isClosed();
+   }
 }

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransportFactory.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransportFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransportFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -98,12 +98,23 @@
    @Override
    public void releaseTransport(Transport transport) {
       TcpTransport tcpTransport = (TcpTransport) transport;
-      try {
-         connectionPool.returnObject(tcpTransport.getServerAddress(), tcpTransport);
-      } catch (Exception e) {
-         log.warn("Could not release connection: " + tcpTransport, e);
-      } finally {
-         logConnectionInfo(tcpTransport.getServerAddress());
+      if (!tcpTransport.isValid()) {
+         try {
+            if (log.isTraceEnabled()) {
+               log.info("Dropping connection as it is no longer valid: " + tcpTransport);
+            }
+            connectionPool.invalidateObject(tcpTransport.getServerAddress(), tcpTransport);
+         } catch (Exception e) {
+            log.warn("Could not invalidate connection: " + tcpTransport, e);
+         }
+      } else {
+         try {
+            connectionPool.returnObject(tcpTransport.getServerAddress(), tcpTransport);
+         } catch (Exception e) {
+            log.warn("Could not release connection: " + tcpTransport, e);
+         } finally {
+            logConnectionInfo(tcpTransport.getServerAddress());
+         }
       }
    }
 
@@ -181,4 +192,20 @@
    public boolean isTcpNoDelay() {
       return tcpNoDelay;
    }
+
+   @Override
+   public int getTransportCount() {
+      if (Thread.currentThread().isInterrupted()) { 
+         return -1;
+      }
+      if (connectionPool.getMaxActive() > 0) {
+         return connectionPool.getMaxActive() * servers.size();
+      } else {
+         return 10 * servers.size();
+      }
+   }
+
+   public RequestBalancingStrategy getBalancer() {
+      return balancer;
+   }
 }

Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TransportObjectFactory.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TransportObjectFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TransportObjectFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -65,6 +65,9 @@
 
    @Override
    public void destroyObject(Object key, Object obj) throws Exception {
+      if (log.isTraceEnabled()) {
+         log.trace("About to destroy tcp transport: "+ obj);
+      }
       TcpTransport transport = (TcpTransport) obj;
       transport.destroy();
    }

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CSAIntegrationTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CSAIntegrationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CSAIntegrationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,25 +4,24 @@
 import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport;
 import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
 import org.infinispan.config.Configuration;
+import org.infinispan.container.DataContainer;
 import org.infinispan.distribution.DistributionManager;
-import org.infinispan.interceptors.CacheMgmtInterceptor;
-import org.infinispan.interceptors.base.CommandInterceptor;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
-import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.server.hotrod.HotRodServer;
-import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
+import org.infinispan.util.ByteArrayKey;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 import java.util.Random;
 
@@ -34,7 +33,7 @@
  * @since 4.1
  */
 @Test(groups = "functional", testName = "client.hotrod.CSAIntegrationTest")
-public class CSAIntegrationTest extends MultipleCacheManagersTest {
+public class CSAIntegrationTest extends HitsAwareCacheManagersTest {
 
    private HotRodServer hotRodServer1;
    private HotRodServer hotRodServer2;
@@ -42,7 +41,6 @@
    private RemoteCacheManager remoteCacheManager;
    private RemoteCache<Object, Object> remoteCache;
    private TcpTransportFactory tcpConnectionFactory;
-   private static final String CACHE_NAME = "distributedCache";
 
    private static Log log = LogFactory.getLog(CSAIntegrationTest.class);
 
@@ -54,40 +52,40 @@
    @Override
    protected void createCacheManagers() throws Throwable {
       Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC);
+      config.setNumOwners(1);
       config.setUnsafeUnreliableReturnValues(true);
-      EmbeddedCacheManager cm1 = addClusterEnabledCacheManager();
-      EmbeddedCacheManager cm2 = addClusterEnabledCacheManager();
-      EmbeddedCacheManager cm3 = addClusterEnabledCacheManager();
-      cm1.defineConfiguration(CACHE_NAME, config);
-      cm2.defineConfiguration(CACHE_NAME, config);
-      cm3.defineConfiguration(CACHE_NAME, config);
+      addClusterEnabledCacheManager(config);
+      addClusterEnabledCacheManager(config);
+      addClusterEnabledCacheManager(config);
 
       hotRodServer1 = TestHelper.startHotRodServer(manager(0));
-         hotRodServer2 = TestHelper.startHotRodServer(manager(1));
+      hrServ2CacheManager.put(new InetSocketAddress(hotRodServer1.getHost(), hotRodServer1.getPort()), manager(0));
+      hotRodServer2 = TestHelper.startHotRodServer(manager(1));
+      hrServ2CacheManager.put(new InetSocketAddress(hotRodServer2.getHost(), hotRodServer2.getPort()), manager(1));
       hotRodServer3 = TestHelper.startHotRodServer(manager(2));
+      hrServ2CacheManager.put(new InetSocketAddress(hotRodServer3.getHost(), hotRodServer3.getPort()), manager(2));
 
-      assert manager(0).getCache(CACHE_NAME) != null;
-      assert manager(1).getCache(CACHE_NAME) != null;
-      assert manager(2).getCache(CACHE_NAME) != null;
+      assert manager(0).getCache() != null;
+      assert manager(1).getCache() != null;
+      assert manager(2).getCache() != null;
 
       TestingUtil.blockUntilViewReceived(manager(0).getCache(), 3, 10000);
       TestingUtil.blockUntilCacheStatusAchieved(manager(0).getCache(), ComponentStatus.RUNNING, 10000);
       TestingUtil.blockUntilCacheStatusAchieved(manager(1).getCache(), ComponentStatus.RUNNING, 10000);
       TestingUtil.blockUntilCacheStatusAchieved(manager(2).getCache(), ComponentStatus.RUNNING, 10000);
 
-      manager(0).getCache(CACHE_NAME).put("k", "v");
-      manager(0).getCache(CACHE_NAME).get("k").equals("v");
-      manager(1).getCache(CACHE_NAME).get("k").equals("v");
-      manager(2).getCache(CACHE_NAME).get("k").equals("v");
+      manager(0).getCache().put("k", "v");
+      manager(0).getCache().get("k").equals("v");
+      manager(1).getCache().get("k").equals("v");
+      manager(2).getCache().get("k").equals("v");
 
       log.info("Local replication test passed!");
 
       //Important: this only connects to one of the two servers!
       Properties props = new Properties();
       props.put("hotrod-servers", "localhost:" + hotRodServer2.getPort() + ";localhost:" + hotRodServer2.getPort());
-//      props.put("marshaller", ByteMarshaller.class.getName());
       remoteCacheManager = new RemoteCacheManager(props);
-      remoteCache = remoteCacheManager.getCache(CACHE_NAME);
+      remoteCache = remoteCacheManager.getCache();
 
       tcpConnectionFactory = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
    }
@@ -112,79 +110,60 @@
 
    @Test(dependsOnMethods = "testCorrectSetup")
    public void testHashFunctionReturnsSameValues() {
-      Map<InetSocketAddress, CacheManager> add2Cm = new HashMap<InetSocketAddress, CacheManager>();
-      add2Cm.put(new InetSocketAddress(hotRodServer1.getHost(), hotRodServer1.getPort()), manager(0));
-      add2Cm.put(new InetSocketAddress(hotRodServer2.getHost(), hotRodServer2.getPort()), manager(1));
-      add2Cm.put(new InetSocketAddress(hotRodServer3.getHost(), hotRodServer3.getPort()), manager(2));
-
       for (int i = 0; i < 1000; i++) {
          byte[] key = generateKey(i);
          TcpTransport transport = (TcpTransport) tcpConnectionFactory.getTransport(key);
          InetSocketAddress serverAddress = transport.getServerAddress();
-         CacheManager cacheManager = add2Cm.get(serverAddress);
-         assertNotNull("For server address " + serverAddress + " found " + cacheManager + ". Map is: " + add2Cm, cacheManager);
-         DistributionManager distributionManager = cacheManager.getCache(CACHE_NAME).getAdvancedCache().getDistributionManager();
+         CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
+         assertNotNull("For server address " + serverAddress + " found " + cacheContainer + ". Map is: " + hrServ2CacheManager, cacheContainer);
+         DistributionManager distributionManager = cacheContainer.getCache().getAdvancedCache().getDistributionManager();
          assert distributionManager.isLocal(key);
          tcpConnectionFactory.releaseTransport(transport);
       }
    }
 
    @Test(dependsOnMethods = "testHashFunctionReturnsSameValues")
-   public void testRequestsGoToExpectedServer() {
-
-      addCacheMgmtInterceptor(manager(0).getCache(CACHE_NAME));
-      addCacheMgmtInterceptor(manager(1).getCache(CACHE_NAME));
-      addCacheMgmtInterceptor(manager(2).getCache(CACHE_NAME));
-
+   public void testRequestsGoToExpectedServer() throws Exception {
+      addInterceptors();
       List<byte[]> keys = new ArrayList<byte[]>();
       for (int i = 0; i < 500; i++) {
          byte[] key = generateKey(i);
          keys.add(key);
-         remoteCache.put(new String(key), "value");
+         String keyStr = new String(key);
+         remoteCache.put(keyStr, "value");
+         byte[] keyBytes = toBytes(keyStr);
+         TcpTransport transport = (TcpTransport) tcpConnectionFactory.getTransport(keyBytes);
+         assertCacheContainsKey(transport.getServerAddress(), keyBytes);
+         tcpConnectionFactory.releaseTransport(transport);
       }
 
-      assertMisses(false);
-
       log.info("Right before first get.");
 
       for (byte[] key : keys) {
-         assert remoteCache.get(new String(key)).equals("value");
-         assertMisses(false);
+         resetStats();
+         String keyStr = new String(key);
+         assert remoteCache.get(keyStr).equals("value");
+         byte[] keyBytes = toBytes(keyStr);
+         TcpTransport transport = (TcpTransport) tcpConnectionFactory.getTransport(keyBytes);
+         assertOnlyServerHit(transport.getServerAddress());
+         tcpConnectionFactory.releaseTransport(transport);
       }
-      assertMisses(false);
-
-      remoteCache.get("noSuchKey");
-      assertMisses(true);
    }
 
-   private void addCacheMgmtInterceptor(Cache<Object, Object> cache) {
-      CacheMgmtInterceptor interceptor = new CacheMgmtInterceptor();
-      cache.getAdvancedCache().addInterceptor(interceptor, 1);
+   private void assertCacheContainsKey(InetSocketAddress serverAddress, byte[] keyBytes) {
+      CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
+      Cache<Object, Object> cache = cacheContainer.getCache();
+      DataContainer dataContainer = cache.getAdvancedCache().getDataContainer();
+      assert dataContainer.keySet().contains(new ByteArrayKey(keyBytes));
    }
 
-   private void assertMisses(boolean expected) {
-      int misses = getMissCount(manager(0).getCache(CACHE_NAME));
-      misses += getMissCount(manager(1).getCache(CACHE_NAME));
-      misses += getMissCount(manager(2).getCache(CACHE_NAME));
-
-      if (expected) {
-         assert misses > 0;
-      } else {
-         assertEquals(0, misses);
-      }
+   private byte[] toBytes(String keyStr) throws IOException {
+      ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+      ObjectOutputStream oos = new ObjectOutputStream(byteArrayOutputStream);
+      oos.writeObject(keyStr);
+      return byteArrayOutputStream.toByteArray();
    }
 
-   private int getMissCount(Cache<Object, Object> cache) {
-      List<CommandInterceptor> interceptorChain = cache.getAdvancedCache().getInterceptorChain();
-      for (CommandInterceptor interceptor : interceptorChain) {
-         if (interceptor instanceof CacheMgmtInterceptor) {
-            CacheMgmtInterceptor cacheMgmtInterceptor = (CacheMgmtInterceptor) interceptor;
-            return (int) cacheMgmtInterceptor.getMisses();
-         }
-      }
-      throw new IllegalStateException();
-   }
-
    private byte[] generateKey(int i) {
       Random r = new Random();
       byte[] result = new byte[i];

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheContainerTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheContainerTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheContainerTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,6 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.SingleCacheManagerTest;

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerNotStartedTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerNotStartedTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerNotStartedTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,6 @@
 
 import org.infinispan.client.hotrod.exceptions.RemoteCacheManagerNotStartedException;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.SingleCacheManagerTest;

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerStoppedTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerStoppedTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerStoppedTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,6 @@
 
 import org.infinispan.client.hotrod.exceptions.RemoteCacheManagerNotStartedException;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.SingleCacheManagerTest;

Deleted: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChange.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChange.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChange.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,15 +0,0 @@
-package org.infinispan.client.hotrod;
-
-import org.infinispan.config.Configuration;
-import org.testng.annotations.Test;
-
-/**
- * @author Mircea.Markus at jboss.com
- * @since 4.1
- */
- at Test(groups = "functional" , testName = "client.hotrod.DistTopologyChangeTest")
-public class DistTopologyChange extends ReplTopologyChangeTest {
-   protected Configuration.CacheMode getCacheMode() {
-      return Configuration.CacheMode.DIST_SYNC;
-   }
-}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChangeTest.java (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChangeTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChangeTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChangeTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,30 @@
+package org.infinispan.client.hotrod;
+
+import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.distribution.BaseDistFunctionalTest;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+ at Test(groups = "functional" , testName = "client.hotrod.DistTopologyChangeTest")
+public class DistTopologyChangeTest extends ReplTopologyChangeTest {
+   protected Configuration.CacheMode getCacheMode() {
+      return Configuration.CacheMode.DIST_SYNC;
+   }
+
+   @Override
+   protected void waitForClusterToForm(int memberCount) {
+      super.waitForClusterToForm(memberCount);
+      List<Cache> caches = new ArrayList<Cache>();
+      for (int i = 0; i < memberCount; i++) {
+         caches.add(manager(i).getCache());
+      }
+      BaseDistFunctionalTest.RehashWaiter.waitForInitRehashToComplete(caches);
+   }
+}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HeavyLoadConnectionPoolingTest.java (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HeavyLoadConnectionPoolingTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HeavyLoadConnectionPoolingTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HeavyLoadConnectionPoolingTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,75 @@
+package org.infinispan.client.hotrod;
+
+import org.apache.commons.pool.impl.GenericKeyedObjectPool;
+import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.server.hotrod.HotRodServer;
+import org.infinispan.test.SingleCacheManagerTest;
+import org.infinispan.test.TestingUtil;
+import org.infinispan.test.fwk.TestCacheManagerFactory;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+ at Test (testName = "client.hotrod.HeavyLoadConnectionPoolingTest", groups = "functional")
+public class HeavyLoadConnectionPoolingTest extends SingleCacheManagerTest {
+   private HotRodServer hotRodServer;
+   private RemoteCacheManager remoteCacheManager;
+   private RemoteCache<Object, Object> remoteCache;
+   private GenericKeyedObjectPool connectionPool;
+
+   @Override
+   protected EmbeddedCacheManager createCacheManager() throws Exception {
+      cacheManager = TestCacheManagerFactory.createLocalCacheManager();
+      cache = cacheManager.getCache();
+
+      hotRodServer = TestHelper.startHotRodServer(cacheManager);
+
+      Properties hotrodClientConf = new Properties();
+      hotrodClientConf.put("hotrod-servers", "localhost:"+hotRodServer.getPort());
+      hotrodClientConf.put("timeBetweenEvictionRunsMillis", "3000");
+      hotrodClientConf.put("minEvictableIdleTimeMillis", "1000");
+      remoteCacheManager = new RemoteCacheManager(hotrodClientConf);
+      remoteCache = remoteCacheManager.getCache();
+
+      TcpTransportFactory tcpConnectionFactory = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
+      connectionPool = (GenericKeyedObjectPool) TestingUtil.extractField(tcpConnectionFactory, "connectionPool");
+
+      return cacheManager;
+   }
+
+   public void testHeavyLoad() throws InterruptedException {
+      List<WorkerThread> workers = new ArrayList<WorkerThread>();
+
+      //create 20 threads and do work with them
+      for (int i =0; i < 20; i++) {
+         WorkerThread workerThread = new WorkerThread(remoteCache);
+         workers.add(workerThread);
+         workerThread.stress();
+      }
+      while (!(connectionPool.getNumActive() > 15)) {
+         Thread.sleep(10);
+      }
+
+      for (WorkerThread wt: workers) {
+         wt.interrupt();
+         wt.waitToFinish();
+      }
+      //now wait for the idle thread to wake up and clean them
+      for (int i = 0; i < 50; i++) {
+         System.out.println("connectionPool = " + connectionPool.getNumActive());
+         if (connectionPool.getNumIdle() == 1) break;
+         Thread.sleep(1000);
+      }
+      assertEquals(1, connectionPool.getNumIdle());
+      assertEquals(0, connectionPool.getNumActive());
+   }
+}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HitsAwareCacheManagersTest.java (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HitsAwareCacheManagersTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HitsAwareCacheManagersTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HitsAwareCacheManagersTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,136 @@
+package org.infinispan.client.hotrod;
+
+import org.infinispan.Cache;
+import org.infinispan.commands.VisitableCommand;
+import org.infinispan.context.InvocationContext;
+import org.infinispan.interceptors.CacheMgmtInterceptor;
+import org.infinispan.interceptors.base.CommandInterceptor;
+import org.infinispan.manager.CacheContainer;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.server.hotrod.HotRodServer;
+import org.infinispan.test.MultipleCacheManagersTest;
+import org.testng.annotations.BeforeMethod;
+
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+public abstract class HitsAwareCacheManagersTest extends MultipleCacheManagersTest {
+
+   protected Map<InetSocketAddress, CacheContainer> hrServ2CacheManager = new HashMap<InetSocketAddress, CacheContainer>();
+   protected Map<InetSocketAddress, HotRodServer> addr2hrServer = new HashMap<InetSocketAddress, HotRodServer>();
+
+   @BeforeMethod
+   public void createBeforeMethod() throws Throwable {
+      if (cleanup == CleanupPhase.AFTER_METHOD) {
+         hrServ2CacheManager.clear();
+         addr2hrServer.clear();
+      }
+      super.createBeforeMethod();
+   }
+
+   protected HitCountInterceptor getHitCountInterceptor(Cache<Object, Object> cache) {
+      HitCountInterceptor hitCountInterceptor = null;
+      List<CommandInterceptor> interceptorChain = cache.getAdvancedCache().getInterceptorChain();
+      for (CommandInterceptor interceptor : interceptorChain) {
+         boolean isHitCountInterceptor = interceptor instanceof HitCountInterceptor;
+         if (hitCountInterceptor != null && isHitCountInterceptor) {
+            throw new IllegalStateException("Two HitCountInterceptors! " + interceptorChain);
+         }
+         if (isHitCountInterceptor) {
+            hitCountInterceptor = (HitCountInterceptor) interceptor;
+         }
+      }
+      return hitCountInterceptor;
+   }
+
+   protected void assertOnlyServerHit(InetSocketAddress serverAddress) {
+      CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
+      HitCountInterceptor interceptor = getHitCountInterceptor(cacheContainer.getCache());
+      assert interceptor.getHits() == 1 : "Expected one hit but received " + interceptor.getHits();
+      for (CacheContainer cm : hrServ2CacheManager.values()) {
+         if (cm != cacheContainer) {
+            interceptor = getHitCountInterceptor(cm.getCache());
+            assert interceptor.getHits() == 0 : "Expected 0 hits but got " + interceptor.getHits();
+         }
+      }
+   }
+
+   protected void assertNoHits() {
+      for (CacheContainer cm : hrServ2CacheManager.values()) {
+         HitCountInterceptor interceptor = getHitCountInterceptor(cm.getCache());
+         assert interceptor.getHits() == 0 : "Expected 0 hits but got " + interceptor.getHits();
+      }
+   }
+
+   protected InetSocketAddress getAddress(HotRodServer hotRodServer) {
+      InetSocketAddress socketAddress = new InetSocketAddress(hotRodServer.getHost(), hotRodServer.getPort());
+      addr2hrServer.put(socketAddress, hotRodServer);
+      return socketAddress;
+   }
+
+   protected void resetStats() {
+      for (EmbeddedCacheManager manager : cacheManagers) {
+         HitCountInterceptor cmi = getHitCountInterceptor(manager.getCache());
+         cmi.reset();
+      }
+   }
+
+   protected void addInterceptors() {
+      for (EmbeddedCacheManager manager : cacheManagers) {
+         addHitCountInterceptor(manager.getCache());
+      }
+   }
+
+   private void addHitCountInterceptor(Cache<Object, Object> cache) {
+      InetSocketAddress addr;
+      addr = getHotRodServerAddress(cache);
+      HitCountInterceptor interceptor = new HitCountInterceptor(addr);
+      cache.getAdvancedCache().addInterceptor(interceptor, 1);
+   }
+
+   private InetSocketAddress getHotRodServerAddress(Cache<Object, Object> cache) {
+      InetSocketAddress addr = null;
+      for (Map.Entry<InetSocketAddress, CacheContainer> entry : hrServ2CacheManager.entrySet()) {
+         if (entry.getValue().equals(cache.getCacheManager())) {
+            addr = entry.getKey();
+         }
+      }
+      return addr;
+   }
+
+   /**
+    * @author Mircea.Markus at jboss.com
+    * @since 4.1
+    */
+   public static class HitCountInterceptor extends CommandInterceptor{
+
+      private volatile int invocationCount;
+      private volatile InetSocketAddress addr;
+
+      public HitCountInterceptor(InetSocketAddress addr) {
+         this.addr = addr;
+      }
+
+      @Override
+      protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable {
+         if (ctx.isOriginLocal()) {
+            invocationCount ++;
+         }
+         return super.handleDefault(ctx, command);
+      }
+
+      public int getHits() {
+         return invocationCount;
+      }
+
+      public void reset() {
+         invocationCount = 0;
+      }
+   }
+}

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodStatisticsTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodStatisticsTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodStatisticsTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.client.hotrod;
 
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.TestingUtil;
@@ -22,16 +22,16 @@
 public class HotRodStatisticsTest {
 
    private HotRodServer hotrodServer;
-   private CacheManager cacheManager;
+   private CacheContainer cacheContainer;
    private RemoteCacheManager rcm;
    private RemoteCache remoteCache;
    long startTime;
 
    @BeforeMethod
    protected void setup() throws Exception {
-      cacheManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(getClass().getSimpleName());
+      cacheContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(getClass().getSimpleName());
 
-      hotrodServer = TestHelper.startHotRodServer((EmbeddedCacheManager) cacheManager);
+      hotrodServer = TestHelper.startHotRodServer((EmbeddedCacheManager) cacheContainer);
       startTime = System.currentTimeMillis();
       rcm = new RemoteCacheManager("localhost", hotrodServer.getPort());
       remoteCache = rcm.getCache();
@@ -39,7 +39,7 @@
 
    @AfterMethod
    void tearDown() {
-      TestingUtil.killCacheManagers(cacheManager);
+      TestingUtil.killCacheManagers(cacheContainer);
       rcm.stop();
       hotrodServer.stop();
    }

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RemoteAsyncAPITest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RemoteAsyncAPITest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RemoteAsyncAPITest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,5 @@
 package org.infinispan.client.hotrod;
 
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.SingleCacheManagerTest;

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ReplTopologyChangeTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ReplTopologyChangeTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ReplTopologyChangeTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,11 +1,9 @@
 package org.infinispan.client.hotrod;
 
-import org.infinispan.Cache;
 import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
 import org.infinispan.config.Configuration;
-import org.infinispan.distribution.BaseDistFunctionalTest;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
@@ -45,8 +43,8 @@
    @Override
    protected void createCacheManagers() throws Throwable {
       config = getDefaultClusteredConfig(getCacheMode());
-      CacheManager cm1 = TestCacheManagerFactory.createClusteredCacheManager(config);
-      CacheManager cm2 = TestCacheManagerFactory.createClusteredCacheManager(config);
+      CacheContainer cm1 = TestCacheManagerFactory.createClusteredCacheManager(config);
+      CacheContainer cm2 = TestCacheManagerFactory.createClusteredCacheManager(config);
       registerCacheManager(cm1);
       registerCacheManager(cm2);
 
@@ -56,13 +54,11 @@
       manager(0).getCache();
       manager(1).getCache();
 
-      TestingUtil.blockUntilViewReceived(manager(0).getCache(), 2, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(0).getCache(), ComponentStatus.RUNNING, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(1).getCache(), ComponentStatus.RUNNING, 10000);
+      waitForClusterToForm(2);
 
-      manager(0).getCache().put("k", "v");
-      manager(0).getCache().get("k").equals("v");
-      manager(1).getCache().get("k").equals("v");
+      manager(0).getCache().put("k_test", "v");
+      manager(0).getCache().get("k_test").equals("v");
+      manager(1).getCache().get("k_test").equals("v");
 
       log.info("Local replication test passed!");
 
@@ -86,15 +82,12 @@
 
    @Test(dependsOnMethods = "testTwoMembers")
    public void testAddNewServer() {
-      CacheManager cm3 = TestCacheManagerFactory.createClusteredCacheManager(config);
+      CacheContainer cm3 = TestCacheManagerFactory.createClusteredCacheManager(config);
       registerCacheManager(cm3);
       hotRodServer3 = TestHelper.startHotRodServer(manager(2));
       manager(2).getCache();
 
-      TestingUtil.blockUntilViewsReceived(10000, true, manager(0), manager(1), manager(2));
-      TestingUtil.blockUntilCacheStatusAchieved(manager(0).getCache(), ComponentStatus.RUNNING, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(1).getCache(), ComponentStatus.RUNNING, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(2).getCache(), ComponentStatus.RUNNING, 10000);
+      waitForClusterToForm(3);
 
       try {
          expectTopologyChange(new InetSocketAddress("localhost", hotRodServer3.getPort()), true);
@@ -110,11 +103,11 @@
    public void testDropServer() {
       hotRodServer3.stop();
       manager(2).stop();
-      TestingUtil.blockUntilViewsReceived(10000, true, manager(0), manager(1));
-      TestingUtil.blockUntilCacheStatusAchieved(manager(0).getCache(), ComponentStatus.RUNNING, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(1).getCache(), ComponentStatus.RUNNING, 10000);
 
-      InetSocketAddress server3Address = new InetSocketAddress("localhost", hotRodServer3.getPort());
+      waitForClusterToForm(2);
+
+      InetSocketAddress server3Address = new InetSocketAddress("localhost", hotRodServer3.getPort());      
+
       try {
          expectTopologyChange(server3Address, false);
          assertEquals(2, tcpConnectionFactory.getServers().size());
@@ -127,15 +120,16 @@
 
    private void expectTopologyChange(InetSocketAddress server1Address, boolean added) {
       for (int i = 0; i < 10; i++) {
-         try {
-            remoteCache.put("k" + i, "v" + i);
-         } catch (Exception e) {
-            if (added) {
-               throw new IllegalStateException(e);
-            } //else it is acceptable, as the transport hasn't changed
-         }
+         remoteCache.put("k" + i, "v" + i);         
          if (added == tcpConnectionFactory.getServers().contains(server1Address)) break;
       }
       assertEquals(server1Address + " not found", added, tcpConnectionFactory.getServers().contains(server1Address));
    }
+   
+   protected void waitForClusterToForm(int memberCount) {
+      TestingUtil.blockUntilViewReceived(manager(0).getCache(), memberCount, 10000);
+      for (int i = 0; i < memberCount; i++) {
+         TestingUtil.blockUntilCacheStatusAchieved(manager(i).getCache(), ComponentStatus.RUNNING, 10000);
+      }
+   }
 }

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RoundRobinBalancingIntegrationTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RoundRobinBalancingIntegrationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/RoundRobinBalancingIntegrationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -169,9 +169,8 @@
          remoteCache.put("k6", "v2");
          remoteCache.put("k7", "v3");
          remoteCache.put("k8", "v4");
-         assert false : "exception expected as balancer is still redirecting to failed node";
-      } catch (TransportException e) {
-         //expected
+      } catch (Exception e) {
+         assert false : "exception should not happen even if the balancer redirects to failed node at the beggining";
       }
    }
 

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ServerShutdownTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ServerShutdownTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ServerShutdownTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,5 @@
 package org.infinispan.client.hotrod;
 
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.hotrod.HotRodServer;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/WorkerThread.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/WorkerThread.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/WorkerThread.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,6 +3,7 @@
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
 
+import java.util.Random;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -20,15 +21,17 @@
    public static final String NULL = "_null_";
    public static final String PUT_SYNC = "_put_sync_";
    public static final String PUT_ASYNC = "_put_async_";
+   public static final String STRESS = "_stress_";
 
-   final RemoteCache<String, String> remoteCache;
+   final RemoteCache remoteCache;
    final BlockingQueue send = new ArrayBlockingQueue(1);
    final BlockingQueue receive = new ArrayBlockingQueue(1);
 
    volatile String key;
    volatile String value;
+   volatile boolean finished = false;
 
-   public WorkerThread(RemoteCache<String, String> remoteCache) {
+   public WorkerThread(RemoteCache remoteCache) {
       super("WorkerThread-" + WORKER_INDEX.getAndIncrement());
       this.remoteCache = remoteCache;
       start();
@@ -45,19 +48,40 @@
                trace("exiting!");
                return;
             }
-            Object result = remoteCache.put(key, value);
-            trace("Added to the cache (" + key + "," + value + ") and returning " + result);
-            if (PUT_SYNC.equals(o)) {
-               receive.put(result == null ? NULL : result);
-               trace("Que now has: " + receive.peek());
+            if (PUT_SYNC.equals(o) || PUT_ASYNC.equals(o)) {
+               Object result = remoteCache.put(key, value);
+               trace("Added to the cache (" + key + "," + value + ") and returning " + result);
+               if (PUT_SYNC.equals(o)) {
+                  receive.put(result == null ? NULL : result);
+                  trace("Que now has: " + receive.peek());
+               }
             }
+            if (STRESS.equals(o)) {
+               stress_();
+            }
          } catch (InterruptedException e) {
             e.printStackTrace();
             throw new IllegalStateException(e);
+         } finally {
+            finished = true;
          }
       }
    }
 
+   private void stress_() {
+      Random rnd = new Random();
+      while (!isInterrupted()) {
+         remoteCache.put(rnd.nextLong(), rnd.nextLong());
+         System.out.println(getName() + " Finished put.");
+         try {
+            Thread.sleep(50);
+         } catch (InterruptedException e) {
+            interrupted();
+            return;
+         }
+      }
+   }
+
    /**
     * Only returns when this thread added the given key value.
     */
@@ -107,7 +131,26 @@
       }
    }
 
+   public void stress() {
+      try {
+         send.put(STRESS);
+      } catch (InterruptedException e) {
+         e.printStackTrace();
+         throw new IllegalStateException(e);
+      }
+   }
+
    private void trace(String message) {
       log.trace("Worker: " + message);
    }
+
+   public void waitToFinish() {
+      while (!finished) {
+         try {
+            Thread.sleep(200);
+         } catch (InterruptedException e) {
+            Thread.interrupted();
+         }
+      }
+   }
 }

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry)

Deleted: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java
===================================================================
--- branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java	2010-07-01 10:59:23 UTC (rev 1947)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,93 +0,0 @@
-package org.infinispan.client.hotrod.retry;
-
-import org.infinispan.client.hotrod.HitsAwareCacheManagersTest;
-import org.infinispan.client.hotrod.RemoteCache;
-import org.infinispan.client.hotrod.RemoteCacheManager;
-import org.infinispan.client.hotrod.TestHelper;
-import org.infinispan.client.hotrod.impl.RemoteCacheImpl;
-import org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy;
-import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
-import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheContainer;
-import org.infinispan.server.hotrod.HotRodServer;
-import org.infinispan.test.TestingUtil;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
-
-import java.util.Properties;
-
-/**
- * @author Mircea.Markus at jboss.com
- * @since 4.1
- */
-public abstract class AbstractRetryTest extends HitsAwareCacheManagersTest {
-   
-   protected HotRodServer hotRodServer1;
-   protected HotRodServer hotRodServer2;
-   protected HotRodServer hotRodServer3;
-
-   RemoteCacheImpl remoteCache;
-   protected RemoteCacheManager remoteCacheManager;
-   protected TcpTransportFactory tcpConnectionFactory;
-   protected Configuration config;
-   protected RoundRobinBalancingStrategy strategy;
-
-   public AbstractRetryTest() {
-      cleanup = CleanupPhase.AFTER_METHOD;
-   }
-
-   @Override
-   protected void assertSupportedConfig() {
-   }
-
-   @Override
-   protected void createCacheManagers() throws Throwable {
-
-      assert cleanup == CleanupPhase.AFTER_METHOD;
-
-
-      config = getCacheConfig();
-      CacheContainer cm1 = TestCacheManagerFactory.createClusteredCacheManager(config);
-      CacheContainer cm2 = TestCacheManagerFactory.createClusteredCacheManager(config);
-      CacheContainer cm3 = TestCacheManagerFactory.createClusteredCacheManager(config);
-      registerCacheManager(cm1);
-      registerCacheManager(cm2);
-      registerCacheManager(cm3);
-
-      hotRodServer1 = TestHelper.startHotRodServer(manager(0));
-      hrServ2CacheManager.put(getAddress(hotRodServer1), cm1);
-      hotRodServer2 = TestHelper.startHotRodServer(manager(1));
-      hrServ2CacheManager.put(getAddress(hotRodServer2), cm2);
-      hotRodServer3 = TestHelper.startHotRodServer(manager(2));
-      hrServ2CacheManager.put(getAddress(hotRodServer3), cm3);
-
-      manager(0).getCache();
-      manager(1).getCache();
-      manager(2).getCache();
-
-      waitForClusterToForm();
-
-      Properties clientConfig = new Properties();
-      clientConfig.put("hotrod-servers", "localhost:" + hotRodServer2.getPort());
-      clientConfig.put("force-return-value", "true");
-      clientConfig.put("maxActive",1); //this ensures that only one server is active at a time
-
-      remoteCacheManager = new RemoteCacheManager(clientConfig);
-      remoteCache = (RemoteCacheImpl) remoteCacheManager.getCache();
-      tcpConnectionFactory = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
-      strategy = (RoundRobinBalancingStrategy) tcpConnectionFactory.getBalancer();
-      addInterceptors();
-
-      assert super.cacheManagers.size() == 3;
-
-   }
-
-   protected abstract Configuration getCacheConfig();
-
-   protected void waitForClusterToForm() {
-      TestingUtil.blockUntilViewReceived(manager(0).getCache(), 3, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(0).getCache(), ComponentStatus.RUNNING, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(1).getCache(), ComponentStatus.RUNNING, 10000);
-      TestingUtil.blockUntilCacheStatusAchieved(manager(2).getCache(), ComponentStatus.RUNNING, 10000);
-   }
-}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,93 @@
+package org.infinispan.client.hotrod.retry;
+
+import org.infinispan.client.hotrod.HitsAwareCacheManagersTest;
+import org.infinispan.client.hotrod.RemoteCache;
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.infinispan.client.hotrod.TestHelper;
+import org.infinispan.client.hotrod.impl.RemoteCacheImpl;
+import org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy;
+import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
+import org.infinispan.config.Configuration;
+import org.infinispan.lifecycle.ComponentStatus;
+import org.infinispan.manager.CacheContainer;
+import org.infinispan.server.hotrod.HotRodServer;
+import org.infinispan.test.TestingUtil;
+import org.infinispan.test.fwk.TestCacheManagerFactory;
+
+import java.util.Properties;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+public abstract class AbstractRetryTest extends HitsAwareCacheManagersTest {
+   
+   protected HotRodServer hotRodServer1;
+   protected HotRodServer hotRodServer2;
+   protected HotRodServer hotRodServer3;
+
+   RemoteCacheImpl remoteCache;
+   protected RemoteCacheManager remoteCacheManager;
+   protected TcpTransportFactory tcpConnectionFactory;
+   protected Configuration config;
+   protected RoundRobinBalancingStrategy strategy;
+
+   public AbstractRetryTest() {
+      cleanup = CleanupPhase.AFTER_METHOD;
+   }
+
+   @Override
+   protected void assertSupportedConfig() {
+   }
+
+   @Override
+   protected void createCacheManagers() throws Throwable {
+
+      assert cleanup == CleanupPhase.AFTER_METHOD;
+
+
+      config = getCacheConfig();
+      CacheContainer cm1 = TestCacheManagerFactory.createClusteredCacheManager(config);
+      CacheContainer cm2 = TestCacheManagerFactory.createClusteredCacheManager(config);
+      CacheContainer cm3 = TestCacheManagerFactory.createClusteredCacheManager(config);
+      registerCacheManager(cm1);
+      registerCacheManager(cm2);
+      registerCacheManager(cm3);
+
+      hotRodServer1 = TestHelper.startHotRodServer(manager(0));
+      hrServ2CacheManager.put(getAddress(hotRodServer1), cm1);
+      hotRodServer2 = TestHelper.startHotRodServer(manager(1));
+      hrServ2CacheManager.put(getAddress(hotRodServer2), cm2);
+      hotRodServer3 = TestHelper.startHotRodServer(manager(2));
+      hrServ2CacheManager.put(getAddress(hotRodServer3), cm3);
+
+      manager(0).getCache();
+      manager(1).getCache();
+      manager(2).getCache();
+
+      waitForClusterToForm();
+
+      Properties clientConfig = new Properties();
+      clientConfig.put("hotrod-servers", "localhost:" + hotRodServer2.getPort());
+      clientConfig.put("force-return-value", "true");
+      clientConfig.put("maxActive",1); //this ensures that only one server is active at a time
+
+      remoteCacheManager = new RemoteCacheManager(clientConfig);
+      remoteCache = (RemoteCacheImpl) remoteCacheManager.getCache();
+      tcpConnectionFactory = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
+      strategy = (RoundRobinBalancingStrategy) tcpConnectionFactory.getBalancer();
+      addInterceptors();
+
+      assert super.cacheManagers.size() == 3;
+
+   }
+
+   protected abstract Configuration getCacheConfig();
+
+   protected void waitForClusterToForm() {
+      TestingUtil.blockUntilViewReceived(manager(0).getCache(), 3, 10000);
+      TestingUtil.blockUntilCacheStatusAchieved(manager(0).getCache(), ComponentStatus.RUNNING, 10000);
+      TestingUtil.blockUntilCacheStatusAchieved(manager(1).getCache(), ComponentStatus.RUNNING, 10000);
+      TestingUtil.blockUntilCacheStatusAchieved(manager(2).getCache(), ComponentStatus.RUNNING, 10000);
+   }
+}

Deleted: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java
===================================================================
--- branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java	2010-07-01 10:59:23 UTC (rev 1947)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,148 +0,0 @@
-package org.infinispan.client.hotrod.retry;
-
-import org.infinispan.Cache;
-import org.infinispan.affinity.KeyAffinityService;
-import org.infinispan.affinity.KeyAffinityServiceFactory;
-import org.infinispan.affinity.KeyGenerator;
-import org.infinispan.client.hotrod.VersionedValue;
-import org.infinispan.client.hotrod.impl.SerializationMarshaller;
-import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport;
-import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
-import org.infinispan.distribution.BaseDistFunctionalTest;
-import org.infinispan.remoting.transport.Address;
-import org.infinispan.test.TestingUtil;
-import org.testng.annotations.Test;
-
-import java.net.InetSocketAddress;
-import java.util.Random;
-import java.util.concurrent.Executors;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Mircea.Markus at jboss.com
- * @since 4.1
- */
- at Test(testName = "hotrod.retry.DistributionRetryTest", groups = "functional")
-public class DistributionRetryTest extends AbstractRetryTest {
-
-   @Override
-   protected Configuration getCacheConfig() {
-      Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC);
-      config.setNumOwners(1);
-      return config;
-   }
-
-   @Override
-   protected void waitForClusterToForm() {
-      super.waitForClusterToForm();
-      BaseDistFunctionalTest.RehashWaiter.waitForInitRehashToComplete(cache(0), cache(1), cache(2));
-   }
-
-   public void testGet() {
-      log.info("Starting actual test");
-      Object key = generateKeyAndShutdownServer();
-      //now make sure that next call won't fail
-      resetStats();
-      assertEquals(remoteCache.get(key), "v");
-   }
-
-   public void testPut() {
-      Object key = generateKeyAndShutdownServer();
-      log.info("Here it starts");
-      assertEquals(remoteCache.put(key, "v0"), "v");
-   }
-
-   public void testRemove() {
-      Object key = generateKeyAndShutdownServer();
-      assertEquals("v", remoteCache.remove(key));
-   }
-
-   public void testContains() {
-      Object key = generateKeyAndShutdownServer();
-      resetStats();
-      assertEquals(true, remoteCache.containsKey(key));
-   }
-
-   public void testGetWithVersion() {
-      Object key = generateKeyAndShutdownServer();
-      resetStats();
-      VersionedValue value = remoteCache.getVersioned(key);
-      assertEquals("v", value.getValue());
-   }
-
-   public void testPutIfAbsent() {
-      Object key = generateKeyAndShutdownServer();
-      assertEquals(null, remoteCache.putIfAbsent("noSuchKey", "someValue"));
-      assertEquals("someValue", remoteCache.get("noSuchKey"));
-   }
-
-   public void testReplace() {
-      Object key = generateKeyAndShutdownServer();
-      assertEquals("v", remoteCache.replace(key, "v2"));
-   }
-
-   public void testReplaceIfUnmodified() {
-      Object key = generateKeyAndShutdownServer();
-      assertEquals(false, remoteCache.replaceWithVersion(key, "v2", 12));
-   }
-
-   public void testRemoveIfUnmodified() {
-      Object key = generateKeyAndShutdownServer();
-      resetStats();
-      assertEquals(false, remoteCache.removeWithVersion(key, 12));
-   }
-
-   public void testClear() {
-      Object key = generateKeyAndShutdownServer();
-      resetStats();
-      remoteCache.clear();
-      assertEquals(false, remoteCache.containsKey(key));
-   }
-
-   private Object generateKeyAndShutdownServer() {
-      resetStats();
-      Cache<Object,Object> cache = manager(1).getCache();
-      KeyAffinityService kaf = KeyAffinityServiceFactory.newKeyAffinityService(cache, Executors.newSingleThreadExecutor(), new ByteKeyGenerator(), 2, true);
-      Address address = cache.getAdvancedCache().getRpcManager().getTransport().getAddress();
-      byte[] keyBytes = (byte[]) kaf.getKeyForAddress(address);
-      String key = ByteKeyGenerator.getStringObject(keyBytes);
-      kaf.stop();
-
-      remoteCache.put(key, "v");
-      assertOnlyServerHit(getAddress(hotRodServer2));
-      TcpTransportFactory tcpTp = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
-
-      SerializationMarshaller sm = new SerializationMarshaller();
-      TcpTransport transport = (TcpTransport) tcpTp.getTransport(sm.marshallObject(key));
-      try {
-      assertEquals(transport.getServerAddress(), new InetSocketAddress("localhost", hotRodServer2.getPort()));
-      } finally {
-         tcpTp.releaseTransport(transport);
-      }
-      
-
-      log.info("About to stop hotrod server 2");
-      hotRodServer2.stop();
-
-
-      return key;
-   }
-
-   static class ByteKeyGenerator implements KeyGenerator {
-      Random r = new Random();
-      @Override
-      public Object getKey() {
-         String result = String.valueOf(r.nextLong());
-         SerializationMarshaller sm = new SerializationMarshaller();
-         return sm.marshallObject(result);
-      }
-
-      static String getStringObject(byte[] bytes) {
-         SerializationMarshaller sm = new SerializationMarshaller();
-         return (String) sm.readObject(bytes);
-      }
-   }
-
-}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,148 @@
+package org.infinispan.client.hotrod.retry;
+
+import org.infinispan.Cache;
+import org.infinispan.affinity.KeyAffinityService;
+import org.infinispan.affinity.KeyAffinityServiceFactory;
+import org.infinispan.affinity.KeyGenerator;
+import org.infinispan.client.hotrod.VersionedValue;
+import org.infinispan.client.hotrod.impl.SerializationMarshaller;
+import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport;
+import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
+import org.infinispan.config.Configuration;
+import org.infinispan.distribution.BaseDistFunctionalTest;
+import org.infinispan.remoting.transport.Address;
+import org.infinispan.test.TestingUtil;
+import org.testng.annotations.Test;
+
+import java.net.InetSocketAddress;
+import java.util.Random;
+import java.util.concurrent.Executors;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+ at Test(testName = "hotrod.retry.DistributionRetryTest", groups = "functional")
+public class DistributionRetryTest extends AbstractRetryTest {
+
+   @Override
+   protected Configuration getCacheConfig() {
+      Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC);
+      config.setNumOwners(1);
+      return config;
+   }
+
+   @Override
+   protected void waitForClusterToForm() {
+      super.waitForClusterToForm();
+      BaseDistFunctionalTest.RehashWaiter.waitForInitRehashToComplete(cache(0), cache(1), cache(2));
+   }
+
+   public void testGet() {
+      log.info("Starting actual test");
+      Object key = generateKeyAndShutdownServer();
+      //now make sure that next call won't fail
+      resetStats();
+      assertEquals(remoteCache.get(key), "v");
+   }
+
+   public void testPut() {
+      Object key = generateKeyAndShutdownServer();
+      log.info("Here it starts");
+      assertEquals(remoteCache.put(key, "v0"), "v");
+   }
+
+   public void testRemove() {
+      Object key = generateKeyAndShutdownServer();
+      assertEquals("v", remoteCache.remove(key));
+   }
+
+   public void testContains() {
+      Object key = generateKeyAndShutdownServer();
+      resetStats();
+      assertEquals(true, remoteCache.containsKey(key));
+   }
+
+   public void testGetWithVersion() {
+      Object key = generateKeyAndShutdownServer();
+      resetStats();
+      VersionedValue value = remoteCache.getVersioned(key);
+      assertEquals("v", value.getValue());
+   }
+
+   public void testPutIfAbsent() {
+      Object key = generateKeyAndShutdownServer();
+      assertEquals(null, remoteCache.putIfAbsent("noSuchKey", "someValue"));
+      assertEquals("someValue", remoteCache.get("noSuchKey"));
+   }
+
+   public void testReplace() {
+      Object key = generateKeyAndShutdownServer();
+      assertEquals("v", remoteCache.replace(key, "v2"));
+   }
+
+   public void testReplaceIfUnmodified() {
+      Object key = generateKeyAndShutdownServer();
+      assertEquals(false, remoteCache.replaceWithVersion(key, "v2", 12));
+   }
+
+   public void testRemoveIfUnmodified() {
+      Object key = generateKeyAndShutdownServer();
+      resetStats();
+      assertEquals(false, remoteCache.removeWithVersion(key, 12));
+   }
+
+   public void testClear() {
+      Object key = generateKeyAndShutdownServer();
+      resetStats();
+      remoteCache.clear();
+      assertEquals(false, remoteCache.containsKey(key));
+   }
+
+   private Object generateKeyAndShutdownServer() {
+      resetStats();
+      Cache<Object,Object> cache = manager(1).getCache();
+      KeyAffinityService kaf = KeyAffinityServiceFactory.newKeyAffinityService(cache, Executors.newSingleThreadExecutor(), new ByteKeyGenerator(), 2, true);
+      Address address = cache.getAdvancedCache().getRpcManager().getTransport().getAddress();
+      byte[] keyBytes = (byte[]) kaf.getKeyForAddress(address);
+      String key = ByteKeyGenerator.getStringObject(keyBytes);
+      kaf.stop();
+
+      remoteCache.put(key, "v");
+      assertOnlyServerHit(getAddress(hotRodServer2));
+      TcpTransportFactory tcpTp = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
+
+      SerializationMarshaller sm = new SerializationMarshaller();
+      TcpTransport transport = (TcpTransport) tcpTp.getTransport(sm.marshallObject(key));
+      try {
+      assertEquals(transport.getServerAddress(), new InetSocketAddress("localhost", hotRodServer2.getPort()));
+      } finally {
+         tcpTp.releaseTransport(transport);
+      }
+      
+
+      log.info("About to stop hotrod server 2");
+      hotRodServer2.stop();
+
+
+      return key;
+   }
+
+   static class ByteKeyGenerator implements KeyGenerator {
+      Random r = new Random();
+      @Override
+      public Object getKey() {
+         String result = String.valueOf(r.nextLong());
+         SerializationMarshaller sm = new SerializationMarshaller();
+         return sm.marshallObject(result);
+      }
+
+      static String getStringObject(byte[] bytes) {
+         SerializationMarshaller sm = new SerializationMarshaller();
+         return (String) sm.readObject(bytes);
+      }
+   }
+
+}

Deleted: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java
===================================================================
--- branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java	2010-07-01 10:59:23 UTC (rev 1947)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,137 +0,0 @@
-package org.infinispan.client.hotrod.retry;
-
-import org.infinispan.client.hotrod.HitsAwareCacheManagersTest;
-import org.infinispan.client.hotrod.RemoteCache;
-import org.infinispan.client.hotrod.RemoteCacheManager;
-import org.infinispan.client.hotrod.TestHelper;
-import org.infinispan.client.hotrod.VersionedValue;
-import org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy;
-import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
-import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheContainer;
-import org.infinispan.server.hotrod.HotRodServer;
-import org.infinispan.test.TestingUtil;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.testng.annotations.Test;
-
-import java.net.InetSocketAddress;
-import java.util.Properties;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Mircea.Markus at jboss.com
- * @since 4.1
- */
- at Test (testName = "client.hotrod.ReplicationRetryTest", groups = "functional")
-public class ReplicationRetryTest extends AbstractRetryTest {
-
-   public void testGet() {
-      validateSequenceAndStopServer();
-      //now make sure that next call won't fail
-      resetStats();
-      for (int i = 0; i < 100; i++) {
-         assert remoteCache.get("k").equals("v");
-      }
-   }
-
-   public void testPut() {
-
-      validateSequenceAndStopServer();
-      resetStats();
-
-      assert "v".equals(remoteCache.put("k", "v0"));
-      for (int i = 1; i < 100; i++) {
-         assertEquals("v" + (i-1), remoteCache.put("k", "v"+i));
-      }
-   }
-
-   public void testRemove() {
-      validateSequenceAndStopServer();
-      resetStats();
-
-      assertEquals("v", remoteCache.remove("k"));
-   }
-
-   public void testContains() {
-      validateSequenceAndStopServer();
-      resetStats();
-      assertEquals(true, remoteCache.containsKey("k"));
-   }
-
-   public void testGetWithVersion() {
-      validateSequenceAndStopServer();
-      resetStats();
-      VersionedValue value = remoteCache.getVersioned("k");
-      assertEquals("v", value.getValue());
-   }
-
-   public void testPutIfAbsent() {
-      validateSequenceAndStopServer();
-      resetStats();
-      assertEquals(null, remoteCache.putIfAbsent("noSuchKey", "someValue"));
-      assertEquals("someValue", remoteCache.get("noSuchKey"));
-   }
-
-   public void testReplace() {
-      validateSequenceAndStopServer();
-      resetStats();
-      assertEquals("v", remoteCache.replace("k", "v2"));
-   }
-
-   public void testReplaceIfUnmodified() {
-      validateSequenceAndStopServer();
-      resetStats();
-      assertEquals(false, remoteCache.replaceWithVersion("k", "v2", 12));
-   }
-
-   public void testRemoveIfUnmodified() {
-      validateSequenceAndStopServer();
-      resetStats();
-      assertEquals(false, remoteCache.removeWithVersion("k", 12));
-   }
-
-   public void testClear() {
-      validateSequenceAndStopServer();
-      resetStats();
-      remoteCache.clear();
-      assertEquals(false, remoteCache.containsKey("k"));
-   }
-
-   private void validateSequenceAndStopServer() {
-      resetStats();
-      assertNoHits();
-      InetSocketAddress expectedServer = strategy.getServers()[strategy.getNextPosition()];
-      assertNoHits();
-      remoteCache.put("k","v");
-
-      assert strategy.getServers().length == 3;
-      assertOnlyServerHit(expectedServer);
-
-      resetStats();
-      expectedServer = strategy.getServers()[strategy.getNextPosition()];
-      remoteCache.put("k2","v2");
-      assertOnlyServerHit(expectedServer);
-
-      resetStats();
-      expectedServer = strategy.getServers()[strategy.getNextPosition()];
-      remoteCache.put("k3","v3");
-      assertOnlyServerHit(expectedServer);
-
-      resetStats();
-      expectedServer = strategy.getServers()[strategy.getNextPosition()];
-      remoteCache.put("k","v");
-      assertOnlyServerHit(expectedServer);
-
-      //this would be the next server to be shutdown
-      expectedServer = strategy.getServers()[strategy.getNextPosition()];
-      HotRodServer toStop = addr2hrServer.get(expectedServer);
-      toStop.stop();
-   }
-
-   @Override
-   protected Configuration getCacheConfig() {
-      return getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
-   }
-}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java (from rev 1947, branches/4.1.x/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,137 @@
+package org.infinispan.client.hotrod.retry;
+
+import org.infinispan.client.hotrod.HitsAwareCacheManagersTest;
+import org.infinispan.client.hotrod.RemoteCache;
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.infinispan.client.hotrod.TestHelper;
+import org.infinispan.client.hotrod.VersionedValue;
+import org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy;
+import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
+import org.infinispan.config.Configuration;
+import org.infinispan.lifecycle.ComponentStatus;
+import org.infinispan.manager.CacheContainer;
+import org.infinispan.server.hotrod.HotRodServer;
+import org.infinispan.test.TestingUtil;
+import org.infinispan.test.fwk.TestCacheManagerFactory;
+import org.testng.annotations.Test;
+
+import java.net.InetSocketAddress;
+import java.util.Properties;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+ at Test (testName = "client.hotrod.ReplicationRetryTest", groups = "functional")
+public class ReplicationRetryTest extends AbstractRetryTest {
+
+   public void testGet() {
+      validateSequenceAndStopServer();
+      //now make sure that next call won't fail
+      resetStats();
+      for (int i = 0; i < 100; i++) {
+         assert remoteCache.get("k").equals("v");
+      }
+   }
+
+   public void testPut() {
+
+      validateSequenceAndStopServer();
+      resetStats();
+
+      assert "v".equals(remoteCache.put("k", "v0"));
+      for (int i = 1; i < 100; i++) {
+         assertEquals("v" + (i-1), remoteCache.put("k", "v"+i));
+      }
+   }
+
+   public void testRemove() {
+      validateSequenceAndStopServer();
+      resetStats();
+
+      assertEquals("v", remoteCache.remove("k"));
+   }
+
+   public void testContains() {
+      validateSequenceAndStopServer();
+      resetStats();
+      assertEquals(true, remoteCache.containsKey("k"));
+   }
+
+   public void testGetWithVersion() {
+      validateSequenceAndStopServer();
+      resetStats();
+      VersionedValue value = remoteCache.getVersioned("k");
+      assertEquals("v", value.getValue());
+   }
+
+   public void testPutIfAbsent() {
+      validateSequenceAndStopServer();
+      resetStats();
+      assertEquals(null, remoteCache.putIfAbsent("noSuchKey", "someValue"));
+      assertEquals("someValue", remoteCache.get("noSuchKey"));
+   }
+
+   public void testReplace() {
+      validateSequenceAndStopServer();
+      resetStats();
+      assertEquals("v", remoteCache.replace("k", "v2"));
+   }
+
+   public void testReplaceIfUnmodified() {
+      validateSequenceAndStopServer();
+      resetStats();
+      assertEquals(false, remoteCache.replaceWithVersion("k", "v2", 12));
+   }
+
+   public void testRemoveIfUnmodified() {
+      validateSequenceAndStopServer();
+      resetStats();
+      assertEquals(false, remoteCache.removeWithVersion("k", 12));
+   }
+
+   public void testClear() {
+      validateSequenceAndStopServer();
+      resetStats();
+      remoteCache.clear();
+      assertEquals(false, remoteCache.containsKey("k"));
+   }
+
+   private void validateSequenceAndStopServer() {
+      resetStats();
+      assertNoHits();
+      InetSocketAddress expectedServer = strategy.getServers()[strategy.getNextPosition()];
+      assertNoHits();
+      remoteCache.put("k","v");
+
+      assert strategy.getServers().length == 3;
+      assertOnlyServerHit(expectedServer);
+
+      resetStats();
+      expectedServer = strategy.getServers()[strategy.getNextPosition()];
+      remoteCache.put("k2","v2");
+      assertOnlyServerHit(expectedServer);
+
+      resetStats();
+      expectedServer = strategy.getServers()[strategy.getNextPosition()];
+      remoteCache.put("k3","v3");
+      assertOnlyServerHit(expectedServer);
+
+      resetStats();
+      expectedServer = strategy.getServers()[strategy.getNextPosition()];
+      remoteCache.put("k","v");
+      assertOnlyServerHit(expectedServer);
+
+      //this would be the next server to be shutdown
+      expectedServer = strategy.getServers()[strategy.getNextPosition()];
+      HotRodServer toStop = addr2hrServer.get(expectedServer);
+      toStop.stop();
+   }
+
+   @Override
+   protected Configuration getCacheConfig() {
+      return getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
+   }
+}

Modified: trunk/client/hotrod-client/src/test/resources/hotrod-client.properties
===================================================================
--- trunk/client/hotrod-client/src/test/resources/hotrod-client.properties	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/client/hotrod-client/src/test/resources/hotrod-client.properties	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,14 +3,14 @@
 
 
 ##bellow is connection pooling config
-maxActive=2
+maxActive= -1
 maxTotal = -1
-maxIdle = 2
+maxIdle = -1
 whenExhaustedAction = 1
-timeBetweenEvictionRunsMillis=300000
-minEvictableIdleTimeMillis=1800000
+timeBetweenEvictionRunsMillis=120000
+minEvictableIdleTimeMillis=300000
 testWhileIdle = true
-minIdle = 0
+minIdle = 1
 
 asyn-executor-factory=org.infinispan.client.hotrod.DefaultAsyncExecutorFactory
 default-executor-factory.poolSize = 1;

Modified: trunk/core/src/main/java/org/infinispan/AbstractDelegatingCache.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/AbstractDelegatingCache.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/AbstractDelegatingCache.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.config.Configuration;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.util.concurrent.NotifyingFuture;
 
 import java.util.Collection;
@@ -55,7 +55,7 @@
       return cache.getVersion();
    }
 
-   public CacheManager getCacheManager() {
+   public CacheContainer getCacheManager() {
       return cache.getCacheManager();
    }
 

Modified: trunk/core/src/main/java/org/infinispan/Cache.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/Cache.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/Cache.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -25,7 +25,7 @@
 import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.lifecycle.Lifecycle;
 import org.infinispan.loaders.CacheStore;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.notifications.Listenable;
 import org.infinispan.util.concurrent.NotifyingFuture;
@@ -82,12 +82,12 @@
  * Also, the use of async operations when within a transaction return your local value only, as expected.  A
  * NotifyingFuture is still returned though for API consistency.
  * <p/>
- * <h3>Constructing a Cache</h3> An instance of the Cache is usually obtained by using a {@link CacheManager}.
+ * <h3>Constructing a Cache</h3> An instance of the Cache is usually obtained by using a {@link org.infinispan.manager.CacheContainer}.
  * <pre>
  *   CacheManager cm = new DefaultCacheManager(); // optionally pass in a default configuration
  *   Cache c = cm.getCache();
  * </pre>
- * See the {@link CacheManager} interface for more details on providing specific configurations, using multiple caches
+ * See the {@link org.infinispan.manager.CacheContainer} interface for more details on providing specific configurations, using multiple caches
  * in the same JVM, etc.
  * <p/>
  * Please see the <a href="http://www.jboss.org/infinispan/docs">Infinispan documentation</a> and/or the <a
@@ -97,7 +97,7 @@
  * @author Mircea.Markus at jboss.com
  * @author Manik Surtani
  * @author Galder Zamarreño
- * @see CacheManager
+ * @see org.infinispan.manager.CacheContainer
  * @see DefaultCacheManager
  * @see <a href="http://www.jboss.org/infinispan/docs">Infinispan documentation</a>
  * @see <a href="http://www.jboss.org/community/wiki/5minutetutorialonInfinispan">5 Minute Usage Tutorial</a>
@@ -183,7 +183,7 @@
     *
     * @return a cache manager
     */
-   CacheManager getCacheManager();
+   CacheContainer getCacheManager();
 
    /**
     * An overloaded form of {@link #put(Object, Object)}, which takes in lifespan parameters.

Modified: trunk/core/src/main/java/org/infinispan/CacheDelegate.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/CacheDelegate.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/CacheDelegate.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -53,7 +53,7 @@
 import org.infinispan.jmx.annotations.ManagedAttribute;
 import org.infinispan.jmx.annotations.ManagedOperation;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.marshall.MarshalledValue;
 import org.infinispan.marshall.Marshaller;
@@ -153,7 +153,18 @@
       this.distributionManager = distributionManager; 
    }
 
+   private void assertKeyNotNull(Object key) {
+      if (key == null) throw new NullPointerException("Null keys are not supported!");
+   }
+
+   private void assertKeysNotNull(Map<?, ?> data) {
+      if (data == null) throw new NullPointerException("Expected map cannot be null");
+      for (Object key: data.keySet())
+         if (key == null) throw new NullPointerException("Null keys are not supported!");
+   }
+
    public final boolean remove(Object key, Object value) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       RemoveCommand command = commandsFactory.buildRemoveCommand(key, value);
       return (Boolean) invoker.invoke(ctx, command);
@@ -169,6 +180,7 @@
    }
 
    public final boolean containsKey(Object key) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       GetKeyValueCommand command = commandsFactory.buildGetKeyValueCommand(key);
       Object response = invoker.invoke(ctx, command);
@@ -176,11 +188,12 @@
    }
 
    public final boolean containsValue(Object value) {
-      throw new UnsupportedOperationException("Go away");
+      throw new UnsupportedOperationException("Not supported");
    }
 
    @SuppressWarnings("unchecked")
    public final V get(Object key) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       GetKeyValueCommand command = commandsFactory.buildGetKeyValueCommand(key);
       return (V) invoker.invoke(ctx, command);
@@ -188,6 +201,7 @@
 
    @SuppressWarnings("unchecked")
    public final V remove(Object key) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       RemoveCommand command = commandsFactory.buildRemoveCommand(key, null);
       return (V) invoker.invoke(ctx, command);
@@ -240,6 +254,7 @@
    }
 
    public final void evict(K key) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(true);
       EvictCommand command = commandsFactory.buildEvictCommand(key);
       invoker.invoke(ctx, command);
@@ -270,8 +285,7 @@
    }
 
    public void lock(K key) {
-      if (key == null)
-         throw new IllegalArgumentException("Cannot lock null key");
+      assertKeyNotNull(key);
       lock(Collections.singletonList(key));
    }
 
@@ -368,7 +382,7 @@
    @ManagedAttribute(description = "Returns the cache name")
    @Metric(displayName = "Cache name", dataType = DataType.TRAIT, displayType = DisplayType.SUMMARY)
    public String getCacheName() {
-      return getName().equals(DefaultCacheManager.DEFAULT_CACHE_NAME) ? "Default Cache" : getName();
+      return getName().equals(CacheContainer.DEFAULT_CACHE_NAME) ? "Default Cache" : getName();
    }
 
    public String getVersion() {
@@ -406,6 +420,7 @@
 
    @SuppressWarnings("unchecked")
    public final V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime));
       return (V) invoker.invoke(ctx, command);
@@ -413,6 +428,7 @@
 
    @SuppressWarnings("unchecked")
    public final V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit) {
+      assertKeyNotNull(key);
       InvocationContext context = getInvocationContext(false);
       PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime));
       command.setPutIfAbsent(true);
@@ -420,12 +436,14 @@
    }
 
    public final void putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit) {
+      assertKeysNotNull(map);
       PutMapCommand command = commandsFactory.buildPutMapCommand(map, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime));
       invoker.invoke(getInvocationContext(false), command);
    }
 
    @SuppressWarnings("unchecked")
    public final V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ReplaceCommand command = commandsFactory.buildReplaceCommand(key, null, value, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime));
       return (V) invoker.invoke(ctx, command);
@@ -433,6 +451,7 @@
    }
 
    public final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ReplaceCommand command = commandsFactory.buildReplaceCommand(key, oldValue, value, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime));
       return (Boolean) invoker.invoke(ctx, command);
@@ -465,6 +484,7 @@
    }
 
    public final NotifyingFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value, lifespanUnit.toMillis(lifespan), maxIdleUnit.toMillis(maxIdle));
@@ -472,6 +492,7 @@
    }
 
    public final NotifyingFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) {
+      assertKeysNotNull(data);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       PutMapCommand command = commandsFactory.buildPutMapCommand(data, lifespanUnit.toMillis(lifespan), maxIdleUnit.toMillis(maxIdle));
@@ -486,6 +507,7 @@
    }
 
    public final NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value, lifespanUnit.toMillis(lifespan), maxIdleUnit.toMillis(maxIdle));
@@ -494,6 +516,7 @@
    }
 
    public final NotifyingFuture<V> removeAsync(Object key) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       RemoveCommand command = commandsFactory.buildRemoveCommand(key, null);
@@ -501,6 +524,7 @@
    }
 
    public final NotifyingFuture<Boolean> removeAsync(Object key, Object value) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       RemoveCommand command = commandsFactory.buildRemoveCommand(key, value);
@@ -508,6 +532,7 @@
    }
 
    public final NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       ReplaceCommand command = commandsFactory.buildReplaceCommand(key, null, value, lifespanUnit.toMillis(lifespan), maxIdleUnit.toMillis(maxIdle));
@@ -515,6 +540,7 @@
    }
 
    public final NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) {
+      assertKeyNotNull(key);
       InvocationContext ctx = getInvocationContext(false);
       ctx.setUseFutureReturnType(true);
       ReplaceCommand command = commandsFactory.buildReplaceCommand(key, oldValue, newValue, lifespanUnit.toMillis(lifespan), maxIdleUnit.toMillis(maxIdle));

Modified: trunk/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/Configuration.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/config/Configuration.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -166,7 +166,7 @@
 
    /**
     *
-    * will be removed, please use {@link org.infinispan.manager.CacheManager#getGlobalConfiguration()}
+    * will be removed, please use {@link org.infinispan.manager.CacheContainer#getGlobalConfiguration()}
     */
    @Deprecated
    public GlobalConfiguration getGlobalConfiguration() {

Modified: trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -50,6 +50,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.Reader;
 import java.io.StringReader;
 import java.net.URL;
 import java.util.ArrayList;
@@ -169,6 +170,18 @@
    }
 
    /**
+    * Factory method to create an instance of Infinispan configuration.
+    *
+    * @param config configuration reader
+    * @return returns infinispan configuration
+    * @throws IOException if there are any issues creating InfinispanConfiguration object
+    */
+   public static InfinispanConfiguration newInfinispanConfiguration(Reader config)
+           throws IOException {
+      return newInfinispanConfiguration(config, null);
+   }
+
+   /**
     * Factory method to create an instance of Infinispan configuration. If users want to verify configuration file
     * correctness against Infinispan schema then appropriate schema input stream should be provided as well.
     *
@@ -186,13 +199,27 @@
     * Factory method to create an instance of Infinispan configuration. If users want to verify configuration file
     * correctness against Infinispan schema then appropriate schema input stream should be provided as well.
     *
-    * @param config configuration input stream
+    * @param config configuration reader
     * @param schema schema inputstream
+    * @return infinispan configuration
+    * @throws IOException if there are any issues creating InfinispanConfiguration object
+    */
+   public static InfinispanConfiguration newInfinispanConfiguration(Reader config,
+                                                                    InputStream schema) throws IOException {
+      return newInfinispanConfiguration(config, schema, null);
+   }
+
+   /**
+    * Factory method to create an instance of Infinispan configuration. If users want to verify configuration file
+    * correctness against Infinispan schema then appropriate schema input stream should be provided as well.
+    *
+    * @param config configuration reader
+    * @param schema schema inputstream
     * @param cbv    configuration bean visitor passed to constructed InfinispanConfiguration
     * @return infinispan configuration
     * @throws IOException if there are any issues creating InfinispanConfiguration object
     */
-   public static InfinispanConfiguration newInfinispanConfiguration(InputStream config,
+   public static InfinispanConfiguration newInfinispanConfiguration(Reader config,
                                                                     InputStream schema, ConfigurationBeanVisitor cbv) throws IOException {
       try {
          JAXBContext jc = JAXBContext.newInstance(InfinispanConfiguration.class);
@@ -234,8 +261,23 @@
       }
    }
 
-   private static SAXSource replaceProperties(InputStream config, XMLFilter filter) throws Exception {
-      BufferedReader br = new BufferedReader(new InputStreamReader(config));
+   /**
+    * Factory method to create an instance of Infinispan configuration. If users want to verify configuration file
+    * correctness against Infinispan schema then appropriate schema input stream should be provided as well.
+    *
+    * @param config configuration input stream
+    * @param schema schema inputstream
+    * @param cbv    configuration bean visitor passed to constructed InfinispanConfiguration
+    * @return infinispan configuration
+    * @throws IOException if there are any issues creating InfinispanConfiguration object
+    */
+   public static InfinispanConfiguration newInfinispanConfiguration(InputStream config,
+                                                                    InputStream schema, ConfigurationBeanVisitor cbv) throws IOException {
+      return newInfinispanConfiguration(new InputStreamReader(config), schema, cbv);
+   }
+
+   private static SAXSource replaceProperties(Reader config, XMLFilter filter) throws Exception {
+      BufferedReader br = new BufferedReader(config);
       StringBuilder w = new StringBuilder();
       String line;
       while ((line = br.readLine()) != null) {
@@ -267,48 +309,48 @@
    public static InputStream findSchemaInputStream() {
       return findSchemaInputStream(null);
    }
-   
-    public static InputStream findSchemaInputStream(String localPathToSchema) {
-        boolean validating = !skipSchemaValidation();
-        if (!validating)
-            return null;
 
-        //1. resolve given path
-        FileLookup fileLookup = new FileLookup();
-        InputStream is = null;
-        if (localPathToSchema != null) {
-            is = fileLookup.lookupFile(localPathToSchema);
-            if (is != null) {
-                log.debug("Using schema " + localPathToSchema);
-                return is;
-            }
-            log.debug("Could not find schema on path " + localPathToSchema + ", resolving "
-                            + SCHEMA_SYSTEM_PROPERTY + " to " + schemaPath());
-        }
+   public static InputStream findSchemaInputStream(String localPathToSchema) {
+      boolean validating = !skipSchemaValidation();
+      if (!validating)
+         return null;
 
-        //2. resolve local schema path in infinispan distro
-        is = fileLookup.lookupFile(schemaPath());
-        if (is != null) {
-            log.debug("Using schema " + schemaPath());
+      //1. resolve given path
+      FileLookup fileLookup = new FileLookup();
+      InputStream is = null;
+      if (localPathToSchema != null) {
+         is = fileLookup.lookupFile(localPathToSchema);
+         if (is != null) {
+            log.debug("Using schema " + localPathToSchema);
             return is;
-        }
-        log.debug("Could not find schema on path " + schemaPath() + ", resolving "
-                        + SCHEMA_URL_SYSTEM_PROPERTY + " to " + schemaURL());
-        
-        //3. resolve URL
-        try {
-            is = new URL(schemaURL()).openStream();
-            log.debug("Using schema " + schemaURL());
-            return is;
-        } catch (Exception e) {
-        }
-        
-        log.warn("Infinispan schema could not be resolved locally nor fetched from URL. Local path="
-                        + localPathToSchema + ", schemaPath=" + schemaPath() + ",schemaURL="
-                        + schemaURL());
-        return null;
-    }
+         }
+         log.debug("Could not find schema on path " + localPathToSchema + ", resolving "
+                 + SCHEMA_SYSTEM_PROPERTY + " to " + schemaPath());
+      }
 
+      //2. resolve local schema path in infinispan distro
+      is = fileLookup.lookupFile(schemaPath());
+      if (is != null) {
+         log.debug("Using schema " + schemaPath());
+         return is;
+      }
+      log.debug("Could not find schema on path " + schemaPath() + ", resolving "
+              + SCHEMA_URL_SYSTEM_PROPERTY + " to " + schemaURL());
+
+      //3. resolve URL
+      try {
+         is = new URL(schemaURL()).openStream();
+         log.debug("Using schema " + schemaURL());
+         return is;
+      } catch (Exception e) {
+      }
+
+      log.warn("Infinispan schema could not be resolved locally nor fetched from URL. Local path="
+              + localPathToSchema + ", schemaPath=" + schemaPath() + ",schemaURL="
+              + schemaURL());
+      return null;
+   }
+
    public static String resolveSchemaPath() {
       boolean validating = !skipSchemaValidation();
       if (!validating)
@@ -324,7 +366,8 @@
       return System.getProperty(SCHEMA_URL_SYSTEM_PROPERTY, DEFAULT_SCHEMA_URL);
    }
 
-   private InfinispanConfiguration() {}
+   private InfinispanConfiguration() {
+   }
 
    public void accept(ConfigurationBeanVisitor v) {
       if (v != null) {

Modified: trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/distribution/DistributionManagerImpl.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -107,7 +107,7 @@
    private InvocationContextContainer icc;
    @ManagedAttribute(description = "If true, the node has successfully joined the grid and is considered to hold state.  If false, the join process is still in progress.")
    @Metric(displayName = "Is join completed?", dataType = DataType.TRAIT)
-   volatile boolean joinComplete = false;
+   private volatile boolean joinComplete = false;
    Future<Void> joinFuture;
    final List<Address> leavers = new CopyOnWriteArrayList<Address>();
    volatile Future<Void> leaveTaskFuture;
@@ -131,12 +131,19 @@
 
    @Start(priority = 20)
    public void start() throws Exception {
+      if (log.isTraceEnabled()) {
+         log.trace("Starting distribution manager on " + getMyAddress());
+      }
       replCount = configuration.getNumOwners();
       listener = new ViewChangeListener();
       notifier.addListener(listener);
       join();
    }
 
+   private Address getMyAddress() {
+      return rpcManager != null? rpcManager.getAddress(): null;
+   }
+
    // To avoid blocking other components' start process, wait last, if necessary, for join to complete.
    @Start(priority = 1000)
    public void waitForJoinToComplete() throws Throwable {
@@ -162,7 +169,7 @@
          JoinTask joinTask = new JoinTask(rpcManager, cf, configuration, dataContainer, this);
          joinFuture = rehashExecutor.submit(joinTask);
       } else {
-         joinComplete = true;
+         setJoinComplete(true);
       }
       startLatch.open();
    }
@@ -171,7 +178,7 @@
    public void stop() {
       notifier.removeListener(listener);
       rehashExecutor.shutdownNow();
-      joinComplete = false;
+      setJoinComplete(false);
    }
 
    public void rehash(List<Address> newMembers, List<Address> oldMembers) {
@@ -368,7 +375,10 @@
    public class ViewChangeListener {
       @ViewChanged
       public void handleViewChange(ViewChangedEvent e) {
-         boolean started = false;
+         if (log.isTraceEnabled()) {
+            log.trace("view change received. Needs to re-join? " + e.isNeedsToRejoin());
+         }
+         boolean started;
          // how long do we wait for a startup?
          if (e.isNeedsToRejoin()) {
             try {
@@ -416,6 +426,13 @@
       return joinComplete;
    }
 
+   public void setJoinComplete(boolean joinComplete) {
+      if (log.isTraceEnabled()) {
+         log.trace("Setting joinComplete to " + joinComplete + " for node " + rpcManager.getAddress());
+      }
+      this.joinComplete = joinComplete;
+   }
+
    void drainLocalTransactionLog() {
       List<WriteCommand> c;
       while (transactionLogger.shouldDrainWithoutLock()) {

Modified: trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/distribution/JoinTask.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -72,13 +72,15 @@
    protected void performRehash() throws Exception {
       long start = System.currentTimeMillis();
       boolean trace = log.isTraceEnabled();
-      if (log.isDebugEnabled()) log.debug("Commencing");
+      if (log.isDebugEnabled()) log.debug("Commencing rehash on node: " + getMyAddress() + ". Before start, dmi.joinComplete = " + dmi.isJoinComplete());
       TransactionLogger transactionLogger = dmi.getTransactionLogger();
       boolean unlocked = false;
       ConsistentHash chOld;
       ConsistentHash chNew;
       try {
-         dmi.joinComplete = false;
+         if (dmi.isJoinComplete()) {
+            throw new IllegalStateException("Join cannot be complete without rehash to finish (node " + getMyAddress() + " )");
+         }
          // 1.  Get chOld from coord.         
          chOld = retrieveOldCH(trace);
 
@@ -142,7 +144,7 @@
          throw new CacheException("Unexpected exception", e);
       } finally {
          if (!unlocked) transactionLogger.unlockAndDisable();
-         dmi.joinComplete = true;
+         dmi.setJoinComplete(true);
       }
    }
 
@@ -230,4 +232,8 @@
       if (!l.contains(plusOne)) l.add(plusOne);
       return l;
    }
+
+   public Address getMyAddress() {
+      return rpcManager != null && rpcManager.getTransport() != null ? rpcManager.getTransport().getAddress() : null;
+   }
 }

Modified: trunk/core/src/main/java/org/infinispan/factories/InternalCacheFactory.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/InternalCacheFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/factories/InternalCacheFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -27,6 +27,7 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.config.ConfigurationException;
 import org.infinispan.jmx.CacheJmxRegistration;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 
 /**
@@ -68,7 +69,7 @@
    }
 
    public Cache<K, V> createDefaultCache(Configuration configuration) throws ConfigurationException {
-      return createCache(configuration, null, DefaultCacheManager.DEFAULT_CACHE_NAME);
+      return createCache(configuration, null, CacheContainer.DEFAULT_CACHE_NAME);
    }
 
    protected AdvancedCache<K, V> createAndWire(Configuration configuration, GlobalComponentRegistry globalComponentRegistry, String cacheName) throws Exception {

Modified: trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStore.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStore.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStore.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -6,7 +6,6 @@
 import org.infinispan.loaders.CacheLoaderException;
 import org.infinispan.loaders.CacheStore;
 import org.infinispan.loaders.modifications.Modification;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachemanagerlistener.annotation.CacheStarted;

Deleted: trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,43 +0,0 @@
-package org.infinispan.manager;
-
-import org.infinispan.Cache;
-
-/**
- * Acts as an container of {@link org.infinispan.Cache}s. Each cache in the container is identified by a name.
- * It also contains a <b>default</b> cache.
- *
- * @author Mircea.Markus at jboss.com
- * @since 4.1
- */
-public interface CacheContainer {
-   /**
-    * Retrieves the default cache associated with this cache container.
-    * <p/>
-    * As such, this method is always guaranteed to return the default cache.
-    * <p />
-    * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
-    * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
-    * that others may be using the cache.
-    *
-    * @return the default cache.
-    */
-   <K, V> Cache<K, V> getCache();
-
-   /**
-    * Retrieves a named cache from the system.  If the cache has been previously created with the same name, the running
-    * cache instance is returned.  Otherwise, this method attempts to create the cache first.
-    * <p/>
-    * In the case of a {@link CacheManager}: when creating a new cache, this method will use the configuration passed in to the CacheManager on construction,
-    * as a template, and then optionally apply any overrides previously defined for the named cache using the {@link
-    * CacheManager#defineConfiguration(String, org.infinispan.config.Configuration)} or {@link CacheManager#defineConfiguration(String, String, org.infinispan.config.Configuration)}
-    * methods, or declared in the configuration file.
-    * <p />
-    * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
-    * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
-    * that others may be using the cache.
-    *
-    * @param cacheName name of cache to retrieve
-    * @return a cache instance identified by cacheName
-    */
-   <K, V> Cache<K, V> getCache(String cacheName);
-}

Copied: trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java (from rev 1947, branches/4.1.x/core/src/main/java/org/infinispan/manager/CacheContainer.java)
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/manager/CacheContainer.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,90 @@
+package org.infinispan.manager;
+
+import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.factories.annotations.SurvivesRestarts;
+import org.infinispan.factories.scopes.Scope;
+import org.infinispan.factories.scopes.Scopes;
+import org.infinispan.lifecycle.ComponentStatus;
+import org.infinispan.lifecycle.Lifecycle;
+import org.infinispan.notifications.Listenable;
+import org.infinispan.remoting.transport.Address;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A <tt>CacheContainer</tt> is the primary mechanism for retrieving a {@link org.infinispan.Cache} instance, and is often
+ * used as a starting point to using the {@link org.infinispan.Cache}.
+ * <p/>
+ * <tt>CacheManager</tt>s are heavyweight objects, and we foresee no more than one <tt>CacheManager</tt> being used per
+ * JVM (unless specific configuration requirements require more than one; but either way, this would be a minimal and
+ * finite number of instances).
+ * <p/>
+ * You obtain <tt>Cache</tt> instances from the <tt>CacheManager</tt> by using one of the overloaded
+ * <tt>getCache()</tt>, methods.  Note that with <tt>getCache()</tt>, there is no guarantee that the instance you get is
+ * brand-new and empty, since caches are named and shared.  Because of this, the <tt>CacheManager</tt> also acts as a
+ * repository of <tt>Cache</tt>s, and is an effective mechanism of looking up or creating <tt>Cache</tt>s on demand.
+ * <p/>
+ * When the system shuts down, it should call {@link #stop()} on the <tt>CacheManager</tt>.  This will ensure all caches
+ * within its scope are properly stopped as well.
+ * <p/>
+ * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
+ * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
+ * that others may be using the cache.
+ * <p />
+ * Sample usage:
+ * <code>
+ * CacheManager manager = new DefaultCacheManager("my-config-file.xml"); 
+ * Cache entityCache = manager.getCache("myEntityCache");
+ * entityCache.put("aPerson", new Person());
+ * <p/>
+ * Configuration myNewConfiguration = new Configuration();
+ * myNewConfiguration.setCacheMode(Configuration.CacheMode.LOCAL);
+ * manager.defineConfiguration("myLocalCache", myNewConfiguration);
+ * Cache localCache = manager.getCache("myLocalCache");
+ * </code>
+ *
+ * @see org.infinispan.manager.EmbeddedCacheManager
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @author Galder Zamarreño
+ * @author Mircea.Markus at jboss.com
+ * @since 4.0
+ */
+public interface CacheContainer extends Lifecycle {
+   String DEFAULT_CACHE_NAME = "___defaultcache";
+
+   /**
+    * Retrieves the default cache associated with this cache container.
+    * <p/>
+    * As such, this method is always guaranteed to return the default cache.
+    * <p />
+    * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
+    * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
+    * that others may be using the cache.
+    *
+    * @return the default cache.
+    */
+   <K, V> Cache<K, V> getCache();
+
+   /**
+    * Retrieves a named cache from the system.  If the cache has been previously created with the same name, the running
+    * cache instance is returned.  Otherwise, this method attempts to create the cache first.
+    * <p/>
+    * In the case of a {@link org.infinispan.manager.EmbeddedCacheManager}: when creating a new cache, this method will
+    * use the configuration passed in to the EmbeddedCacheManager on construction, as a template, and then optionally
+    * apply any overrides previously defined for the named cache using the {@link EmbeddedCacheManager#defineConfiguration(String, org.infinispan.config.Configuration)}
+    * or {@link EmbeddedCacheManager#defineConfiguration(String, String, org.infinispan.config.Configuration)}
+    * methods, or declared in the configuration file.
+    * <p />
+    * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
+    * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
+    * that others may be using the cache.
+    *
+    * @param cacheName name of cache to retrieve
+    * @return a cache instance identified by cacheName
+    */
+   <K, V> Cache<K, V> getCache(String cacheName);
+}

Deleted: trunk/core/src/main/java/org/infinispan/manager/CacheManager.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/CacheManager.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/manager/CacheManager.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,89 +0,0 @@
-package org.infinispan.manager;
-
-import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.factories.annotations.SurvivesRestarts;
-import org.infinispan.factories.scopes.Scope;
-import org.infinispan.factories.scopes.Scopes;
-import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.lifecycle.Lifecycle;
-import org.infinispan.notifications.Listenable;
-import org.infinispan.remoting.transport.Address;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * A <tt>CacheManager</tt> is the primary mechanism for retrieving a {@link org.infinispan.Cache} instance, and is often
- * used as a starting point to using the {@link org.infinispan.Cache}.
- * <p/>
- * <tt>CacheManager</tt>s are heavyweight objects, and we foresee no more than one <tt>CacheManager</tt> being used per
- * JVM (unless specific configuration requirements require more than one; but either way, this would be a minimal and
- * finite number of instances).
- * <p/>
- * You obtain <tt>Cache</tt> instances from the <tt>CacheManager</tt> by using one of the overloaded
- * <tt>getCache()</tt>, methods.  Note that with <tt>getCache()</tt>, there is no guarantee that the instance you get is
- * brand-new and empty, since caches are named and shared.  Because of this, the <tt>CacheManager</tt> also acts as a
- * repository of <tt>Cache</tt>s, and is an effective mechanism of looking up or creating <tt>Cache</tt>s on demand.
- * <p/>
- * When the system shuts down, it should call {@link #stop()} on the <tt>CacheManager</tt>.  This will ensure all caches
- * within its scope are properly stopped as well.
- * <p/>
- * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
- * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
- * that others may be using the cache.
- * <p />
- * Sample usage:
- * <code>
- * CacheManager manager = new DefaultCacheManager("my-config-file.xml"); 
- * Cache entityCache = manager.getCache("myEntityCache");
- * entityCache.put("aPerson", new Person());
- * <p/>
- * Configuration myNewConfiguration = new Configuration();
- * myNewConfiguration.setCacheMode(Configuration.CacheMode.LOCAL);
- * manager.defineConfiguration("myLocalCache", myNewConfiguration);
- * Cache localCache = manager.getCache("myLocalCache");
- * </code>
- *
- * @see org.infinispan.manager.EmbeddedCacheManager
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @author Galder Zamarreño
- * @author Mircea.Markus at jboss.com
- * @since 4.0
- */
-public interface CacheManager extends Lifecycle {
-
-   /**
-    * Retrieves the default cache associated with this cache container.
-    * <p/>
-    * As such, this method is always guaranteed to return the default cache.
-    * <p />
-    * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
-    * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
-    * that others may be using the cache.
-    *
-    * @return the default cache.
-    */
-   <K, V> Cache<K, V> getCache();
-
-   /**
-    * Retrieves a named cache from the system.  If the cache has been previously created with the same name, the running
-    * cache instance is returned.  Otherwise, this method attempts to create the cache first.
-    * <p/>
-    * In the case of a {@link org.infinispan.manager.EmbeddedCacheManager}: when creating a new cache, this method will
-    * use the configuration passed in to the EmbeddedCacheManager on construction, as a template, and then optionally
-    * apply any overrides previously defined for the named cache using the {@link EmbeddedCacheManager#defineConfiguration(String, org.infinispan.config.Configuration)}
-    * or {@link EmbeddedCacheManager#defineConfiguration(String, String, org.infinispan.config.Configuration)}
-    * methods, or declared in the configuration file.
-    * <p />
-    * <b>NB:</b> Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to
-    * ensure that <i>at least one</i> but <i>only one</i> caller calls stop() on the cache, and it does so with the awareness
-    * that others may be using the cache.
-    *
-    * @param cacheName name of cache to retrieve
-    * @return a cache instance identified by cacheName
-    */
-   <K, V> Cache<K, V> getCache(String cacheName);
-}

Copied: trunk/core/src/main/java/org/infinispan/manager/CacheManager.java (from rev 1947, branches/4.1.x/core/src/main/java/org/infinispan/manager/CacheManager.java)
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/CacheManager.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/manager/CacheManager.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,12 @@
+package org.infinispan.manager;
+
+/**
+ * This interface is only for backward compatibility with Infinispan 4.0.Final and it will be removed in a future version.
+ * Use {@link org.infinispan.manager.EmbeddedCacheManager} or {@link CacheContainer}
+ * wherever needed.
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+ at Deprecated public interface CacheManager extends EmbeddedCacheManager {
+}

Modified: trunk/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -105,8 +105,7 @@
 @Scope(Scopes.GLOBAL)
 @SurvivesRestarts
 @MBean(objectName = DefaultCacheManager.OBJECT_NAME, description = "Component that acts as a manager, factory and container for caches in the system.")
-public class DefaultCacheManager implements EmbeddedCacheManager {
-   public static final String DEFAULT_CACHE_NAME = "___defaultcache";
+public class DefaultCacheManager implements EmbeddedCacheManager, CacheManager {
    public static final String OBJECT_NAME = "CacheManager";
    private static final Log log = LogFactory.getLog(DefaultCacheManager.class);
    protected final GlobalConfiguration globalConfiguration;

Modified: trunk/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -36,7 +36,7 @@
  */
 @Scope(Scopes.GLOBAL)
 @SurvivesRestarts
-public interface EmbeddedCacheManager extends CacheManager, Listenable {
+public interface EmbeddedCacheManager extends CacheContainer, Listenable {
 
    /**
     * Defines a named cache's configuration using the following algorithm:

Modified: trunk/core/src/main/java/org/infinispan/notifications/cachemanagerlistener/event/EventImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/notifications/cachemanagerlistener/event/EventImpl.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/notifications/cachemanagerlistener/event/EventImpl.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,5 @@
 package org.infinispan.notifications.cachemanagerlistener.event;
 
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.remoting.transport.Address;
 

Modified: trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -8,7 +8,6 @@
 import org.infinispan.factories.annotations.Inject;
 import org.infinispan.factories.scopes.Scope;
 import org.infinispan.factories.scopes.Scopes;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.NamedCacheNotFoundException;
 import org.infinispan.marshall.Marshaller;
 import org.infinispan.remoting.responses.ExceptionResponse;

Modified: trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManager.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManager.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManager.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -207,4 +207,9 @@
     *         a null otherwise.
     */
    Address getCurrentStateTransferSource();
+
+   /**
+    * Returns the address associated with this RpcManager or null if not part of the cluster.
+    */
+   public Address getAddress();
 }
\ No newline at end of file

Modified: trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -322,7 +322,7 @@
 
    @ManagedAttribute(description = "The network address associated with this instance")
    @Metric(displayName = "Network address", dataType = DataType.TRAIT, displayType = DisplayType.SUMMARY)
-   public String getAddress() {
+   public String getNodeAddress() {
       if (t == null || !isStatisticsEnabled()) return "N/A";
       Address address = t.getAddress();
       return address == null ? "N/A" : address.toString();
@@ -383,5 +383,9 @@
    // mainly for unit testing
    public void setTransport(Transport t) {
       this.t = t;
+   }@Override
+
+   public Address getAddress() {
+      return t != null ? t.getAddress() : null;
    }
 }

Modified: trunk/core/src/main/java/org/infinispan/transaction/xa/TransactionTable.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/transaction/xa/TransactionTable.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/main/java/org/infinispan/transaction/xa/TransactionTable.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -11,7 +11,6 @@
 import org.infinispan.factories.annotations.Start;
 import org.infinispan.factories.annotations.Stop;
 import org.infinispan.interceptors.InterceptorChain;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachelistener.CacheNotifier;

Modified: trunk/core/src/test/java/org/infinispan/affinity/BaseKeyAffinityServiceTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/affinity/BaseKeyAffinityServiceTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/affinity/BaseKeyAffinityServiceTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.distribution.BaseDistFunctionalTest;
 import org.infinispan.distribution.ConsistentHash;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.transport.Address;
 import org.infinispan.test.TestingUtil;
 
@@ -32,7 +32,7 @@
       return topology(caches.get(1).getCacheManager());
    }
 
-   protected List<Address> topology(CacheManager cm) {
+   protected List<Address> topology(CacheContainer cm) {
       return cm.getCache(cacheName).getAdvancedCache().getRpcManager().getTransport().getMembers();
    }
 

Modified: trunk/core/src/test/java/org/infinispan/affinity/KeyAffinityServiceTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/affinity/KeyAffinityServiceTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/affinity/KeyAffinityServiceTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,22 +1,14 @@
 package org.infinispan.affinity;
 
 import org.infinispan.Cache;
-import org.infinispan.distribution.BaseDistFunctionalTest;
 import org.infinispan.distribution.ConsistentHash;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.remoting.transport.Address;
-import org.infinispan.test.TestingUtil;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
 import org.testng.annotations.Test;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Random;
-import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;

Modified: trunk/core/src/test/java/org/infinispan/api/AsyncAPITest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/AsyncAPITest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/AsyncAPITest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,6 @@
 import java.util.concurrent.Future;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Copied: trunk/core/src/test/java/org/infinispan/api/AsyncWithTxTest.java (from rev 1947, branches/4.1.x/core/src/test/java/org/infinispan/api/AsyncWithTxTest.java)
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/AsyncWithTxTest.java	                        (rev 0)
+++ trunk/core/src/test/java/org/infinispan/api/AsyncWithTxTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -0,0 +1,33 @@
+package org.infinispan.api;
+
+import org.infinispan.config.Configuration;
+import org.infinispan.test.MultipleCacheManagersTest;
+import org.infinispan.test.TestingUtil;
+import org.infinispan.util.concurrent.NotifyingFuture;
+import org.testng.annotations.Test;
+
+import javax.transaction.TransactionManager;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+ at Test(groups = "functional", testName = "api.AsyncWithTxTest")
+public class AsyncWithTxTest extends MultipleCacheManagersTest {
+   @Override
+   protected void createCacheManagers() throws Throwable {
+      Configuration defaultConfig = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC, true);
+      addClusterEnabledCacheManager(defaultConfig);
+      addClusterEnabledCacheManager(defaultConfig);
+   }
+
+   public void testWithTx() throws Exception {
+      TransactionManager transactionManager = TestingUtil.getTransactionManager(cache(0));
+      cache(0).put("k","v1");
+      transactionManager.begin();
+      NotifyingFuture future = cache(0).putAsync("k", "v2");
+      "v1".equals(future.get(2000, TimeUnit.MILLISECONDS));
+      transactionManager.commit();
+   }
+}

Modified: trunk/core/src/test/java/org/infinispan/api/CacheAPITest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/CacheAPITest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/CacheAPITest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,6 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.config.ConfigurationException;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/api/CacheClusterJoinTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/CacheClusterJoinTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/CacheClusterJoinTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,6 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.Configuration.CacheMode;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/api/ForceWriteLockTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/ForceWriteLockTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/ForceWriteLockTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,6 @@
 import org.infinispan.container.entries.ReadCommittedEntry;
 import org.infinispan.context.Flag;
 import org.infinispan.context.InvocationContext;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,7 @@
 package org.infinispan.api;
 
 import org.infinispan.config.ConfigurationException;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.Test;
 
@@ -13,7 +13,7 @@
 @Test(groups = "functional", testName = "api.NoFlushFailureTest")
 public class NoFlushFailureTest {
 
-   CacheManager cm1;
+   CacheContainer cm1;
    private static final String FILE = "configs/no-flush.xml";
 
    @Test (expectedExceptions = ConfigurationException.class)

Modified: trunk/core/src/test/java/org/infinispan/api/batch/BatchWithTMTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/batch/BatchWithTMTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/batch/BatchWithTMTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,6 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Modified: trunk/core/src/test/java/org/infinispan/api/batch/BatchWithoutTMTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/batch/BatchWithoutTMTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/batch/BatchWithoutTMTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,6 @@
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.ConfigurationException;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;

Modified: trunk/core/src/test/java/org/infinispan/api/mvcc/LockTestBase.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/mvcc/LockTestBase.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/mvcc/LockTestBase.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.context.InvocationContextContainer;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -28,7 +28,7 @@
    private Log log = LogFactory.getLog(LockTestBase.class);
    protected boolean repeatableRead = true;
    protected boolean lockParentForChildInsertRemove = false;
-   private CacheManager cm;
+   private CacheContainer cm;
 
    protected class LockTestBaseTL {
       public Cache<String, String> cache;

Modified: trunk/core/src/test/java/org/infinispan/api/mvcc/repeatable_read/WriteSkewTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/mvcc/repeatable_read/WriteSkewTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/api/mvcc/repeatable_read/WriteSkewTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,6 @@
 import org.infinispan.api.mvcc.LockAssert;
 import org.infinispan.config.Configuration;
 import org.infinispan.context.InvocationContextContainer;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/atomic/APITest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/atomic/APITest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/atomic/APITest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -25,7 +25,7 @@
 import static org.infinispan.atomic.AtomicHashMapTestAssertions.assertIsEmpty;
 import static org.infinispan.atomic.AtomicHashMapTestAssertions.assertIsEmptyMap;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -43,20 +43,20 @@
 
    Cache<String, Object> cache;
    TransactionManager tm;
-   private CacheManager cacheManager;
+   private CacheContainer cacheContainer;
 
    @BeforeTest
    public void setUp() {
       Configuration c = new Configuration();
       c.setInvocationBatchingEnabled(true);
-      cacheManager = TestCacheManagerFactory.createCacheManager(c, true);
-      cache = cacheManager.getCache();
+      cacheContainer = TestCacheManagerFactory.createCacheManager(c, true);
+      cache = cacheContainer.getCache();
       tm = TestingUtil.getTransactionManager(cache);
    }
 
    @AfterTest
    public void tearDown() {
-      TestingUtil.killCacheManagers(cacheManager);
+      TestingUtil.killCacheManagers(cacheContainer);
       cache =null;
       tm = null;
    }

Modified: trunk/core/src/test/java/org/infinispan/atomic/AtomicHashMapConcurrencyTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/atomic/AtomicHashMapConcurrencyTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/atomic/AtomicHashMapConcurrencyTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -26,7 +26,7 @@
    public static final String KEY = "key";
    Cache<String, Object> cache;
    TransactionManager tm;
-   private CacheManager cm;
+   private CacheContainer cm;
 
    enum Operation {
       PUT,

Modified: trunk/core/src/test/java/org/infinispan/atomic/AtomicMapFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/atomic/AtomicMapFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/atomic/AtomicMapFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,7 @@
 import static org.infinispan.context.Flag.SKIP_LOCKING;
 import org.infinispan.context.InvocationContext;
 import org.infinispan.context.InvocationContextContainer;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -23,7 +23,7 @@
    private static final Log log = LogFactory.getLog(AtomicMapFunctionalTest.class);
    Cache<String, Object> cache;
    TransactionManager tm;
-   private CacheManager cm;
+   private CacheContainer cm;
 
    @BeforeMethod
    @SuppressWarnings("unchecked")

Modified: trunk/core/src/test/java/org/infinispan/config/CustomInterceptorConfigTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/CustomInterceptorConfigTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/config/CustomInterceptorConfigTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import org.infinispan.Cache;
 import org.infinispan.interceptors.InvocationContextInterceptor;
 import org.infinispan.interceptors.base.CommandInterceptor;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.AfterMethod;
@@ -16,7 +16,7 @@
 @Test(testName = "config.CustomInterceptorConfigTest", groups = "functional")
 public class CustomInterceptorConfigTest {
    Cache c;
-   CacheManager cm;
+   CacheContainer cm;
 
    public void testCustomInterceptors() throws IOException {
       String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +

Modified: trunk/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,5 @@
 package org.infinispan.config;
 
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Modified: trunk/core/src/test/java/org/infinispan/config/SampleConfigFilesCorrectnessTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/SampleConfigFilesCorrectnessTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/config/SampleConfigFilesCorrectnessTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,6 @@
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Modified: trunk/core/src/test/java/org/infinispan/config/parsing/Coherence2InfinispanTransformerTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/parsing/Coherence2InfinispanTransformerTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/config/parsing/Coherence2InfinispanTransformerTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,7 @@
 package org.infinispan.config.parsing;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -10,7 +10,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileOutputStream;
 
 /**
  * //todo re-enable test as it makes the suite hang
@@ -33,7 +32,7 @@
     */
    private void testAllFile(String coherenceFileName) throws Exception {
       ClassLoader existingCl = Thread.currentThread().getContextClassLoader();
-      CacheManager dcm = null;
+      CacheContainer dcm = null;
       Cache<Object, Object> sampleDistributedCache2 = null;
       try {
          ClassLoader delegatingCl = new Jbc2InfinispanTransformerTest.TestClassLoader(existingCl);

Modified: trunk/core/src/test/java/org/infinispan/distribution/BaseDistCacheStoreTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/BaseDistCacheStoreTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/BaseDistCacheStoreTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -24,7 +24,6 @@
 import org.infinispan.config.CacheLoaderManagerConfig;
 import org.infinispan.config.Configuration;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 

Modified: trunk/core/src/test/java/org/infinispan/distribution/BaseDistFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/BaseDistFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/BaseDistFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -8,13 +8,15 @@
 import org.infinispan.container.entries.ImmortalCacheEntry;
 import org.infinispan.container.entries.InternalCacheEntry;
 import org.infinispan.container.entries.MortalCacheEntry;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.remoting.transport.Address;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.util.Util;
 import org.infinispan.util.concurrent.IsolationLevel;
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;
@@ -93,16 +95,21 @@
     * This is a separate class because some tools try and run this method as a test 
     */
    public static class RehashWaiter {
+      private static Log log = LogFactory.getLog(RehashWaiter.class);
       public static void waitForInitRehashToComplete(Cache... caches) {
          int gracetime = 60000; // 60 seconds?
          long giveup = System.currentTimeMillis() + gracetime;
          for (Cache c : caches) {
             DistributionManagerImpl dmi = (DistributionManagerImpl) TestingUtil.extractComponent(c, DistributionManager.class);
-            while (!dmi.joinComplete) {
-               if (System.currentTimeMillis() > giveup)
-                  throw new RuntimeException("Timed out waiting for initial join sequence to complete!");
+            while (!dmi.isJoinComplete()) {
+               if (System.currentTimeMillis() > giveup) {
+                  String message = "Timed out waiting for initial join sequence to complete on node " + dmi.rpcManager.getAddress() + " !";
+                  log.error(message);
+                  throw new RuntimeException(message);
+               }
                LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(1));
             }
+            log.trace("Node " + dmi.rpcManager.getAddress() + " finished rehash task.");
          }
       }
 
@@ -120,7 +127,7 @@
    private void reorderBasedOnCHPositions() {
       // wait for all joiners to join
       List<Cache> clist = new ArrayList<Cache>(cacheManagers.size());
-      for (CacheManager cm : cacheManagers) clist.add(cm.getCache(cacheName));
+      for (CacheContainer cm : cacheManagers) clist.add(cm.getCache(cacheName));
       assert clist.size() == INIT_CLUSTER_SIZE;
       waitForJoinTasksToComplete(SECONDS.toMillis(480), clist.toArray(new Cache[clist.size()]));
 
@@ -151,7 +158,7 @@
          boolean allOK = true;
          for (Cache c : joiners) {
             DistributionManagerImpl dmi = (DistributionManagerImpl) getDistributionManager(c);
-            allOK &= dmi.joinComplete;
+            allOK &= dmi.isJoinComplete();
          }
          if (allOK) return;
          TestingUtil.sleepThread(100);

Modified: trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,26 +3,21 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.util.concurrent.AbstractInProcessFuture;
-import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
 
 /**
  * Tests concurrent startup of replicated and distributed caches
@@ -143,7 +138,7 @@
       }
    }
 
-   private Future<Cache<String, String>> startCache(final CacheManager cm, final String cacheName, boolean nonBlockingStartup) {
+   private Future<Cache<String, String>> startCache(final CacheContainer cm, final String cacheName, boolean nonBlockingStartup) {
       final Callable<Cache<String, String>> cacheCreator = new Callable<Cache<String, String>>() {
 
          @Override

Modified: trunk/core/src/test/java/org/infinispan/distribution/SingleOwnerTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/SingleOwnerTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/SingleOwnerTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -26,7 +26,6 @@
 import org.infinispan.Cache;
 import org.infinispan.CacheException;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.remoting.transport.Address;
 import org.infinispan.util.concurrent.IsolationLevel;

Modified: trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,13 +3,8 @@
 import org.infinispan.Cache;
 import org.infinispan.CacheException;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
-import org.infinispan.test.AbstractCacheTest;
 import org.infinispan.test.AbstractInfinispanTest;
-import org.infinispan.test.MultipleCacheManagersTest;
-import org.infinispan.test.TestingUtil;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentJoinTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentJoinTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentJoinTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,6 @@
 package org.infinispan.distribution.rehash;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentNonOverlappingLeaveTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentNonOverlappingLeaveTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentNonOverlappingLeaveTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.distribution.rehash;
 
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.transport.Address;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;
@@ -15,8 +15,8 @@
       l1 = addressOf(c2);
       l2 = addressOf(c4);
 
-      CacheManager cm2 = c2.getCacheManager();
-      CacheManager cm4 = c4.getCacheManager();
+      CacheContainer cm2 = c2.getCacheManager();
+      CacheContainer cm4 = c4.getCacheManager();
 
       cacheManagers.removeAll(Arrays.asList(cm2, cm4));
       caches.removeAll(Arrays.asList(c2, c4));

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentOverlappingLeaveTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentOverlappingLeaveTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/ConcurrentOverlappingLeaveTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.distribution.rehash;
 
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.transport.Address;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;
@@ -15,8 +15,8 @@
       l1 = addressOf(c3);
       l2 = addressOf(c4);
 
-      CacheManager cm3 = c3.getCacheManager();
-      CacheManager cm4 = c4.getCacheManager();
+      CacheContainer cm3 = c3.getCacheManager();
+      CacheContainer cm4 = c4.getCacheManager();
 
       cacheManagers.removeAll(Arrays.asList(cm3, cm4));
       caches.removeAll(Arrays.asList(c3, c4));

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/L1OnRehashTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/L1OnRehashTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/L1OnRehashTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,6 @@
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.distribution.BaseDistFunctionalTest;
-import org.infinispan.manager.CacheManager;
 import org.testng.annotations.Test;
 
 import java.util.ArrayList;

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashAfterPartitionMergeTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashAfterPartitionMergeTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashAfterPartitionMergeTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,9 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.distribution.BaseDistFunctionalTest;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
 import org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent;
@@ -12,23 +10,15 @@
 import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
-import org.infinispan.test.fwk.JGroupsConfigBuilder;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.jgroups.Channel;
 import org.jgroups.protocols.DISCARD;
 import org.jgroups.protocols.TP;
 import org.jgroups.stack.ProtocolStack;
 import org.testng.annotations.Test;
 
-import java.util.Arrays;
 import java.util.List;
-import java.util.Properties;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import static org.infinispan.remoting.transport.jgroups.JGroupsTransport.CONFIGURATION_STRING;
-import static org.infinispan.test.fwk.TestCacheManagerFactory.amendMarshaller;
-import static org.infinispan.test.fwk.TestCacheManagerFactory.minimizeThreads;
-
 @Test(groups = "functional", testName =  "distribution.rehash.RehashAfterPartitionMergeTest")
 public class RehashAfterPartitionMergeTest extends MultipleCacheManagersTest {
 

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,6 @@
 import org.infinispan.Cache;
 import org.infinispan.distribution.BaseDistFunctionalTest;
 import org.infinispan.distribution.DistributionManager;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.testng.annotations.Test;
 
@@ -39,7 +38,7 @@
       joinerManager.defineConfiguration(cacheName, configuration);
       Cache joiner = joinerManager.getCache(cacheName);
       DistributionManager dmi = joiner.getAdvancedCache().getDistributionManager();
-      assert dmi.isJoinComplete() == true;
+      assert dmi.isJoinComplete();
    }
 
 }

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleJoinTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleJoinTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleJoinTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,6 @@
 package org.infinispan.distribution.rehash;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.testng.annotations.Test;
 

Modified: trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleLeaveTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleLeaveTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/distribution/rehash/SingleLeaveTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.distribution.rehash;
 
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.transport.Address;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;
@@ -12,7 +12,7 @@
    void performRehashEvent(boolean offline) {
       // cause a node to LEAVE.  Typically this is c4.
       leaverAddress = addressOf(c4);
-      CacheManager cm4 = c4.getCacheManager();
+      CacheContainer cm4 = c4.getCacheManager();
       cacheManagers.remove(cm4);
       caches.remove(c4);
       TestingUtil.killCacheManagers(cm4);

Modified: trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesEvictionTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesEvictionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesEvictionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -28,7 +28,6 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.context.InvocationContext;
 import org.infinispan.interceptors.MarshalledValueInterceptor;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.marshall.MarshalledValue;
 import org.infinispan.marshall.MarshalledValueTest;

Modified: trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesManualEvictionTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesManualEvictionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/eviction/MarshalledValuesManualEvictionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -25,7 +25,6 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.eviction.MarshalledValuesEvictionTest.MockMarshalledValueInterceptor;
 import org.infinispan.interceptors.MarshalledValueInterceptor;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.marshall.MarshalledValueTest;
 import org.infinispan.marshall.Marshaller;

Modified: trunk/core/src/test/java/org/infinispan/expiry/ExpiryTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/expiry/ExpiryTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/expiry/ExpiryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import org.infinispan.Cache;
 import org.infinispan.container.DataContainer;
 import org.infinispan.container.entries.InternalCacheEntry;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -19,7 +19,7 @@
 @Test(groups = "functional", testName = "expiry.ExpiryTest")
 public class ExpiryTest extends AbstractInfinispanTest {
 
-   CacheManager cm;
+   CacheContainer cm;
 
    @BeforeMethod
    public void setUp() {

Modified: trunk/core/src/test/java/org/infinispan/interceptors/MarshalledValueInterceptorTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/interceptors/MarshalledValueInterceptorTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/interceptors/MarshalledValueInterceptorTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,6 @@
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.marshall.MarshalledValue;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/jmx/CacheMBeanTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jmx/CacheMBeanTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jmx/CacheMBeanTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -30,8 +30,7 @@
 
 import org.infinispan.CacheException;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
-import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -53,7 +52,7 @@
    }
    
    public void testStartStopManagedOperations() throws Exception {
-      ObjectName defaultOn = new ObjectName(JMX_DOMAIN + ":cache-name=" + DefaultCacheManager.DEFAULT_CACHE_NAME + "(local),jmx-resource=Cache");
+      ObjectName defaultOn = new ObjectName(JMX_DOMAIN + ":cache-name=" + CacheContainer.DEFAULT_CACHE_NAME + "(local),jmx-resource=Cache");
       ObjectName managerON = new ObjectName(JMX_DOMAIN + ":cache-name=[global],jmx-resource=CacheManager");
       server.invoke(managerON, "startCache", new Object[]{}, new String[]{});
       assert ComponentStatus.RUNNING.toString().equals(server.getAttribute(defaultOn, "CacheStatus"));
@@ -83,15 +82,15 @@
    
    public void testManagerStopRemovesCacheMBean(Method m) throws Exception {
       final String otherJmxDomain = JMX_DOMAIN + '.' + m.getName();
-      ObjectName defaultOn = new ObjectName(otherJmxDomain + ":cache-name=" + DefaultCacheManager.DEFAULT_CACHE_NAME + "(local),jmx-resource=Cache");
+      ObjectName defaultOn = new ObjectName(otherJmxDomain + ":cache-name=" + CacheContainer.DEFAULT_CACHE_NAME + "(local),jmx-resource=Cache");
       ObjectName galderOn = new ObjectName(otherJmxDomain + ":cache-name=galder(local),jmx-resource=Cache");
       ObjectName managerON = new ObjectName(otherJmxDomain + ":cache-name=[global],jmx-resource=CacheManager");
-      CacheManager otherManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain);
+      CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain);
       server.invoke(managerON, "startCache", new Object[]{}, new String[]{});
       server.invoke(managerON, "startCache", new Object[]{"galder"}, new String[]{String.class.getName()});
       assert ComponentStatus.RUNNING.toString().equals(server.getAttribute(defaultOn, "CacheStatus"));
       assert ComponentStatus.RUNNING.toString().equals(server.getAttribute(galderOn, "CacheStatus"));
-      otherManager.stop();
+      otherContainer.stop();
       try {
          log.info(server.getMBeanInfo(managerON));
          assert false : "Failure expected, " + managerON + " shouldn't be registered in mbean server";
@@ -111,24 +110,24 @@
 
 
    public void testDuplicateJmxDomainOnlyCacheExposesJmxStatistics() throws Exception {
-      CacheManager otherManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(JMX_DOMAIN, false, true);
+      CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(JMX_DOMAIN, false, true);
       try {
-         otherManager.getCache();
+         otherContainer.getCache();
          assert false : "Failure expected, " + JMX_DOMAIN + " is a duplicate!";
       } catch (CacheException e) {
          assert e.getCause().getCause() instanceof JmxDomainConflictException;
       } finally {
-         otherManager.stop();
+         otherContainer.stop();
       }
    }
 
    public void testMalformedCacheName(Method m) throws Exception {
       final String otherJmxDomain = JMX_DOMAIN + '.' + m.getName();
-      CacheManager otherManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain);
+      CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain);
       try {
-         otherManager.getCache("persistence.unit:unitName=#helloworld.MyRegion");
+         otherContainer.getCache("persistence.unit:unitName=#helloworld.MyRegion");
       } finally {
-         otherManager.stop();
+         otherContainer.stop();
       }
    }
 }

Modified: trunk/core/src/test/java/org/infinispan/jmx/CacheManagerMBeanTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jmx/CacheManagerMBeanTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jmx/CacheManagerMBeanTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import java.lang.reflect.Method;
 
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -79,12 +79,12 @@
    
    public void testJmxRegistrationAtStartupAndStop(Method method) throws Exception {
       final String otherJmxDomain = JMX_DOMAIN + '.' + method.getName();
-      CacheManager otherManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain, true, false);
+      CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain, true, false);
       ObjectName otherName = new ObjectName(otherJmxDomain + ":cache-name=[global],jmx-resource=CacheManager");
       try {
          assert server.getAttribute(otherName, "CreatedCacheCount").equals("0");
       } finally {
-         otherManager.stop();
+         otherContainer.stop();
       }
       
       try {

Modified: trunk/core/src/test/java/org/infinispan/jmx/ComponentsJmxRegistrationTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jmx/ComponentsJmxRegistrationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jmx/ComponentsJmxRegistrationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,7 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.factories.AbstractComponentRegistry;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
@@ -32,26 +32,26 @@
 public class ComponentsJmxRegistrationTest extends AbstractInfinispanTest {
 
    private MBeanServer mBeanServer;
-   private List<CacheManager> cacheManagers = new ArrayList<CacheManager>();
+   private List<CacheContainer> cacheContainers = new ArrayList<CacheContainer>();
 
    @BeforeMethod
    public void setUp() {
       mBeanServer = MBeanServerFactory.createMBeanServer();
-      cacheManagers.clear();
+      cacheContainers.clear();
    }
 
    @AfterMethod
    public void tearDown() {
       MBeanServerFactory.releaseMBeanServer(mBeanServer);
-      for (CacheManager cacheManager : cacheManagers) {
-         TestingUtil.killCacheManagers(cacheManager);
+      for (CacheContainer cacheContainer : cacheContainers) {
+         TestingUtil.killCacheManagers(cacheContainer);
       }
-      cacheManagers.clear();
+      cacheContainers.clear();
    }
 
    public void testRegisterLocalCache() throws Exception {
       EmbeddedCacheManager cm = TestCacheManagerFactory.createLocalCacheManager();
-      cacheManagers.add(cm);
+      cacheContainers.add(cm);
       cm.start();
       Configuration configuration = config();
       configuration.setCacheMode(Configuration.CacheMode.LOCAL);
@@ -78,7 +78,7 @@
       GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
       globalConfiguration.setAllowDuplicateDomains(true);
       EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(globalConfiguration);
-      cacheManagers.add(cm);
+      cacheContainers.add(cm);
       cm.start();
       Configuration configurationOverride = config();
       configurationOverride.setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -99,7 +99,7 @@
       GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
       globalConfiguration.setAllowDuplicateDomains(true);
       EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(globalConfiguration);
-      cacheManagers.add(cm);
+      cacheContainers.add(cm);
       cm.start();
       Configuration replicated = config();
       Configuration local = config();

Modified: trunk/core/src/test/java/org/infinispan/jmx/JmxStatsFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jmx/JmxStatsFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jmx/JmxStatsFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
@@ -171,13 +171,13 @@
 
       server = PerThreadMBeanServerLookup.getThreadMBeanServer();
       globalConfiguration2.setAllowDuplicateDomains(true);
-      CacheManager duplicateAllowedManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration2);
+      CacheContainer duplicateAllowedContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration2);
       try {
          final String duplicateName = jmxDomain + "2";
          ObjectName duplicateObjectName = new ObjectName(duplicateName + ":cache-name=[global],jmx-resource=CacheManager");
          server.getAttribute(duplicateObjectName, "CreatedCacheCount").equals("0");
       } finally {
-         duplicateAllowedManager.stop();
+         duplicateAllowedContainer.stop();
       }
    }
 

Modified: trunk/core/src/test/java/org/infinispan/jmx/RpcManagerMBeanTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jmx/RpcManagerMBeanTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jmx/RpcManagerMBeanTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -6,7 +6,7 @@
 import org.infinispan.commands.ReplicableCommand;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.rpc.ResponseFilter;
 import org.infinispan.remoting.rpc.ResponseMode;
 import org.infinispan.remoting.rpc.RpcManager;
@@ -59,7 +59,7 @@
       globalConfiguration.setAllowDuplicateDomains(true);
       globalConfiguration.setJmxDomain(JMX_DOMAIN);
       globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
-      CacheManager cacheManager1 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration);
+      CacheContainer cacheManager1 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration);
       cacheManager1.start();
 
       GlobalConfiguration globalConfiguration2 = GlobalConfiguration.getClusteredDefault();
@@ -67,7 +67,7 @@
       globalConfiguration2.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
       globalConfiguration2.setJmxDomain(JMX_DOMAIN);
       globalConfiguration2.setAllowDuplicateDomains(true);
-      CacheManager cacheManager2 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration2);
+      CacheContainer cacheManager2 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration2);
       cacheManager2.start();
 
       registerCacheManager(cacheManager1, cacheManager2);

Modified: trunk/core/src/test/java/org/infinispan/jmx/TxInterceptorMBeanTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jmx/TxInterceptorMBeanTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jmx/TxInterceptorMBeanTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,6 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/jndi/BindingTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/jndi/BindingTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/jndi/BindingTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -35,7 +35,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -83,7 +83,7 @@
    public void testBindCacheManagerToJndi() throws Exception {
       Context ctx = new InitialContext(props);
       String jndiName = "java:CacheManager";
-      bind(jndiName, cacheManager, CacheManager.class, ctx);
+      bind(jndiName, cacheManager, CacheContainer.class, ctx);
       try {
          Context ctx2 = new InitialContext(props);
          try {

Modified: trunk/core/src/test/java/org/infinispan/loaders/BaseCacheStoreFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/BaseCacheStoreFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/BaseCacheStoreFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -26,10 +26,9 @@
 import org.infinispan.atomic.AtomicMapLookup;
 import org.infinispan.config.CacheLoaderManagerConfig;
 import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.container.DataContainer;
 import org.infinispan.container.entries.InternalCacheEntry;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
@@ -40,7 +39,6 @@
 
 import javax.transaction.TransactionManager;
 import java.lang.reflect.Method;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -107,7 +105,7 @@
       cacheLoaders.addCacheLoaderConfig(csConfig);
       Configuration cfg = TestCacheManagerFactory.getDefaultConfiguration(false);
       cfg.setCacheLoaderManagerConfig(cacheLoaders);
-      CacheManager local = TestCacheManagerFactory.createCacheManager(cfg);
+      CacheContainer local = TestCacheManagerFactory.createCacheManager(cfg);
       try {
          Cache<String, String> cache = local.getCache();
          cacheNames.add(cache.getName());
@@ -136,9 +134,9 @@
    public void testRestoreAtomicMap(Method m) {
       Configuration cfg = new Configuration();
       cfg.getCacheLoaderManagerConfig().addCacheLoaderConfig(csConfig);
-      CacheManager localCacheManager = TestCacheManagerFactory.createCacheManager(cfg, true);
+      CacheContainer localCacheContainer = TestCacheManagerFactory.createCacheManager(cfg, true);
       try {
-         Cache<String, Object> cache = localCacheManager.getCache();
+         Cache<String, Object> cache = localCacheContainer.getCache();
          cacheNames.add(cache.getName());
          AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(cache, m.getName());
          map.put("a", "b");
@@ -149,16 +147,16 @@
          // now re-retrieve the map
          assert AtomicMapLookup.getAtomicMap(cache, m.getName()).get("a").equals("b");
       } finally {
-         TestingUtil.killCacheManagers(localCacheManager);
+         TestingUtil.killCacheManagers(localCacheContainer);
       }
    }
 
    public void testRestoreTransactionalAtomicMap(Method m) throws Exception {
       Configuration cfg = new Configuration();
       cfg.getCacheLoaderManagerConfig().addCacheLoaderConfig(csConfig);
-      CacheManager localCacheManager = TestCacheManagerFactory.createCacheManager(cfg, true);
+      CacheContainer localCacheContainer = TestCacheManagerFactory.createCacheManager(cfg, true);
       try {
-         Cache<String, Object> cache = localCacheManager.getCache();
+         Cache<String, Object> cache = localCacheContainer.getCache();
          cacheNames.add(cache.getName());
          TransactionManager tm = cache.getAdvancedCache().getTransactionManager();
          tm.begin();
@@ -172,7 +170,7 @@
          // now re-retrieve the map and make sure we see the diffs
          assert AtomicMapLookup.getAtomicMap(cache, m.getName()).get("a").equals("b");
       } finally {
-         TestingUtil.killCacheManagers(localCacheManager);
+         TestingUtil.killCacheManagers(localCacheContainer);
       }
    }
 

Modified: trunk/core/src/test/java/org/infinispan/loaders/CacheLoaderFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/CacheLoaderFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/CacheLoaderFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -9,14 +9,12 @@
 import org.infinispan.container.entries.InternalEntryFactory;
 import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterMethod;
-import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 

Modified: trunk/core/src/test/java/org/infinispan/loaders/ClusterCacheLoaderTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/ClusterCacheLoaderTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/ClusterCacheLoaderTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -7,7 +7,6 @@
 import org.infinispan.loaders.cluster.ClusterCacheLoaderConfig;
 import org.infinispan.loaders.decorators.ChainingCacheStore;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Modified: trunk/core/src/test/java/org/infinispan/loaders/ConcurrentLoadAndEvictTxTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/ConcurrentLoadAndEvictTxTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/ConcurrentLoadAndEvictTxTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,6 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.eviction.EvictionStrategy;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.fwk.TestCacheManagerFactory;

Modified: trunk/core/src/test/java/org/infinispan/loaders/PassivationFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/PassivationFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/PassivationFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,7 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.container.entries.InternalCacheEntry;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -31,7 +31,7 @@
    CacheStore store;
    TransactionManager tm;
    Configuration cfg;
-   CacheManager cm;
+   CacheContainer cm;
    long lifespan = 6000000; // very large lifespan so nothing actually expires
 
    @BeforeTest

Modified: trunk/core/src/test/java/org/infinispan/loaders/decorators/SingletonStoreTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/decorators/SingletonStoreTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/decorators/SingletonStoreTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -8,7 +8,6 @@
 import org.infinispan.loaders.CacheLoaderManager;
 import org.infinispan.loaders.CacheStore;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/loaders/file/ClusterFileCacheStoreFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/loaders/file/ClusterFileCacheStoreFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/loaders/file/ClusterFileCacheStoreFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -7,15 +7,11 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.loaders.CacheStoreConfig;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;

Modified: trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/manager/CacheManagerTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -21,10 +21,10 @@
 
       try {
          assert cm.getCache().getStatus() == ComponentStatus.RUNNING;
-         assert cm.getCache().getName().equals(DefaultCacheManager.DEFAULT_CACHE_NAME);
+         assert cm.getCache().getName().equals(CacheContainer.DEFAULT_CACHE_NAME);
 
          try {
-            cm.defineConfiguration(DefaultCacheManager.DEFAULT_CACHE_NAME, new Configuration());
+            cm.defineConfiguration(CacheContainer.DEFAULT_CACHE_NAME, new Configuration());
             assert false : "Should fail";
          }
          catch (IllegalArgumentException e) {
@@ -57,7 +57,7 @@
    }
 
    public void testStartAndStop() {
-      CacheManager cm = TestCacheManagerFactory.createLocalCacheManager();
+      CacheContainer cm = TestCacheManagerFactory.createLocalCacheManager();
       try {
          Cache c1 = cm.getCache("cache1");
          Cache c2 = cm.getCache("cache2");

Modified: trunk/core/src/test/java/org/infinispan/notifications/AsyncNotificationTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/notifications/AsyncNotificationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/notifications/AsyncNotificationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,8 +1,8 @@
 package org.infinispan.notifications;
 
 import org.infinispan.Cache;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
 import org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent;
 import org.infinispan.test.AbstractInfinispanTest;
@@ -16,7 +16,7 @@
 @Test(groups = "functional", testName = "notifications.AsyncNotificationTest")
 public class AsyncNotificationTest extends AbstractInfinispanTest {
    Cache<String, String> c;
-   CacheManager cm;
+   CacheContainer cm;
 
    @BeforeMethod
    public void setUp() {

Modified: trunk/core/src/test/java/org/infinispan/notifications/CacheListenerCacheLoaderTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/notifications/CacheListenerCacheLoaderTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/notifications/CacheListenerCacheLoaderTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,6 @@
 import org.infinispan.config.CacheLoaderManagerConfig;
 import org.infinispan.config.Configuration;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryLoaded;

Modified: trunk/core/src/test/java/org/infinispan/notifications/CacheListenerRemovalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/notifications/CacheListenerRemovalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/notifications/CacheListenerRemovalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryVisited;
 import org.infinispan.notifications.cachelistener.event.Event;
 import org.infinispan.test.AbstractInfinispanTest;
@@ -19,7 +19,7 @@
 @Test(groups = "functional", testName = "notifications.CacheListenerRemovalTest")
 public class CacheListenerRemovalTest extends AbstractInfinispanTest {
    Cache<String, String> cache;
-   CacheManager cm;
+   CacheContainer cm;
 
    @BeforeMethod
    public void setUp() {

Modified: trunk/core/src/test/java/org/infinispan/notifications/ConcurrentNotificationTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/notifications/ConcurrentNotificationTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/notifications/ConcurrentNotificationTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,7 @@
 package org.infinispan.notifications;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved;
@@ -24,7 +24,7 @@
 @Test(groups = "functional", testName = "notifications.ConcurrentNotificationTest")
 public class ConcurrentNotificationTest extends AbstractInfinispanTest {
    Cache<String, String> cache;
-   CacheManager cm;
+   CacheContainer cm;
    CacheListener listener;
    Log log = LogFactory.getLog(ConcurrentNotificationTest.class);
 

Modified: trunk/core/src/test/java/org/infinispan/notifications/cachelistener/CacheNotifierTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/notifications/cachelistener/CacheNotifierTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/notifications/cachelistener/CacheNotifierTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.context.InvocationContext;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -32,7 +32,7 @@
       Configuration c = new Configuration();
       c.setCacheMode(Configuration.CacheMode.LOCAL);
       c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
-      CacheManager cm = TestCacheManagerFactory.createCacheManager(c, true);
+      CacheContainer cm = TestCacheManagerFactory.createCacheManager(c, true);
 
       cache = cm.getCache();
       tm = TestingUtil.getTransactionManager(cache);

Modified: trunk/core/src/test/java/org/infinispan/notifications/cachemanagerlistener/CacheManagerNotifierTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/notifications/cachemanagerlistener/CacheManagerNotifierTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/notifications/cachemanagerlistener/CacheManagerNotifierTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
@@ -18,8 +18,6 @@
 import org.testng.annotations.Test;
 
 import java.util.List;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.CyclicBarrier;
 
 @Test(groups = "unit", testName = "notifications.cachemanagerlistener.CacheManagerNotifierTest")
@@ -94,12 +92,12 @@
       CyclicBarrier barrier = new CyclicBarrier(2);
       GetCacheManagerCheckListener listener = new GetCacheManagerCheckListener(barrier);
       cmA.addListener(listener);
-      CacheManager cmB = TestCacheManagerFactory.createClusteredCacheManager();
+      CacheContainer cmB = TestCacheManagerFactory.createClusteredCacheManager();
       cmB.getCache();
       try {
          barrier.await();
          barrier.await();
-         assert listener.cacheManager != null;
+         assert listener.cacheContainer != null;
       } finally {
          TestingUtil.killCacheManagers(cmA, cmB);
       }
@@ -107,7 +105,7 @@
 
    @Listener
    public class GetCacheManagerCheckListener {
-      CacheManager cacheManager;
+      CacheContainer cacheContainer;
       CyclicBarrier barrier;
       
       public GetCacheManagerCheckListener(CyclicBarrier barrier) {
@@ -117,7 +115,7 @@
       @ViewChanged
       public void onViewChange(ViewChangedEvent e) throws Exception {
          barrier.await();
-         cacheManager = e.getCacheManager();
+         cacheContainer = e.getCacheManager();
          barrier.await();
       }
 

Modified: trunk/core/src/test/java/org/infinispan/profiling/DeadlockDetectionPerformanceTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/profiling/DeadlockDetectionPerformanceTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/profiling/DeadlockDetectionPerformanceTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
@@ -125,7 +125,7 @@
 
    private void runDistributedTest() throws Exception {
       EmbeddedCacheManager cm = null;
-      List<CacheManager> managers = new ArrayList<CacheManager>();
+      List<CacheContainer> containers = new ArrayList<CacheContainer>();
       try {
          CountDownLatch startLatch = new CountDownLatch(1);
          List<ExecutorThread> executorThreads = new ArrayList<ExecutorThread>();
@@ -137,15 +137,15 @@
             Cache distCache = cm.getCache("test");
             ExecutorThread executorThread = new ExecutorThread(startLatch, distCache);
             executorThreads.add(executorThread);
-            managers.add(cm);
+            containers.add(cm);
          }
-         TestingUtil.blockUntilViewsReceived(10000, managers.toArray(new CacheManager[managers.size()]));
+         TestingUtil.blockUntilViewsReceived(10000, containers.toArray(new CacheContainer[containers.size()]));
          startLatch.countDown();
          Thread.sleep(BENCHMARK_DURATION);
          joinThreadsAndPrintResult(executorThreads);
       } finally {
-         log.trace("About to kill cache managers: " + managers);
-         TestingUtil.killCacheManagers(managers);
+         log.trace("About to kill cache managers: " + containers);
+         TestingUtil.killCacheManagers(containers);
       }
    }
 

Modified: trunk/core/src/test/java/org/infinispan/remoting/jgroups/ChannelLookupTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/remoting/jgroups/ChannelLookupTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/remoting/jgroups/ChannelLookupTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import org.easymock.classextension.EasyMock;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.factories.GlobalComponentRegistry;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.transport.Transport;
 import org.infinispan.remoting.transport.jgroups.JGroupsChannelLookup;
 import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
@@ -22,7 +22,7 @@
 @Test(testName = "remoting.jgroups.ChannelLookupTest", groups = "functional")
 public class ChannelLookupTest extends AbstractInfinispanTest {
     public void channelLookupTest() {
-        CacheManager cm = null;
+        CacheContainer cm = null;
         try {
             GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
             Properties p = new Properties();

Modified: trunk/core/src/test/java/org/infinispan/replication/ReplicationQueueTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/replication/ReplicationQueueTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/replication/ReplicationQueueTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,12 +5,11 @@
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.executors.ScheduledExecutorFactory;
 import org.infinispan.factories.KnownComponentNames;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.ReplicationQueue;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;
@@ -38,8 +37,8 @@
       GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
       globalConfiguration.setReplicationQueueScheduledExecutorFactoryClass(ReplQueueTestScheduledExecutorFactory.class.getName());
       globalConfiguration.setReplicationQueueScheduledExecutorProperties(ReplQueueTestScheduledExecutorFactory.myProps);
-      CacheManager first = TestCacheManagerFactory.createCacheManager(globalConfiguration);
-      CacheManager second = TestCacheManagerFactory.createCacheManager(globalConfiguration);
+      CacheContainer first = TestCacheManagerFactory.createCacheManager(globalConfiguration);
+      CacheContainer second = TestCacheManagerFactory.createCacheManager(globalConfiguration);
       registerCacheManager(first, second);
 
       Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.REPL_ASYNC, true);

Modified: trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferCacheLoaderFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferCacheLoaderFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferCacheLoaderFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -6,7 +6,6 @@
 import org.infinispan.loaders.CacheLoaderManager;
 import org.infinispan.loaders.CacheStoreConfig;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;

Modified: trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -29,7 +29,6 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.loaders.CacheStoreConfig;
 import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.testng.annotations.Test;

Modified: trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFileCacheLoaderFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFileCacheLoaderFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFileCacheLoaderFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -33,7 +33,7 @@
 import org.infinispan.config.CacheLoaderManagerConfig;
 import org.infinispan.config.Configuration;
 import org.infinispan.loaders.file.FileCacheStoreConfig;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
@@ -100,7 +100,7 @@
       config.setUseLockStriping(false); // reduces the odd chance of a key collision and deadlock
    }
 
-   protected CacheManager createCacheManager(String tmpDirectory) {
+   protected CacheContainer createCacheManager(String tmpDirectory) {
       // increment the DIMCS store id
       FileCacheStoreConfig cfg = new FileCacheStoreConfig();
       cfg.setLocation(tmpDirectory);
@@ -118,7 +118,7 @@
    }
 
    public void testSharedLoader() throws Exception {
-      CacheManager cm1 = null, cm2 = null;
+      CacheContainer cm1 = null, cm2 = null;
       try {
          sharedCacheLoader.set(true);
          cm1 = createCacheManager(tmpDirectory1);
@@ -148,7 +148,7 @@
    public void testInitialStateTransfer() throws Exception {
       testCount++;
       log.info("testInitialStateTransfer start - " + testCount);
-      CacheManager cm1 = null, cm2 = null;
+      CacheContainer cm1 = null, cm2 = null;
       try {
          Cache<Object, Object> cache1, cache2;
          cm1 = createCacheManager(tmpDirectory1);
@@ -172,7 +172,7 @@
    public void testInitialStateTransferInDifferentThread(Method m) throws Exception {
       testCount++;
       log.info(m.getName() + " start - " + testCount);
-      CacheManager cm1 = null, cm2 = null, cm30 = null;
+      CacheContainer cm1 = null, cm2 = null, cm30 = null;
       try {
          Cache<Object, Object> cache1 = null, cache2 = null, cache3 = null;
          cm1 = createCacheManager(tmpDirectory1);
@@ -188,7 +188,7 @@
          TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
          verifyInitialData(cache2);
 
-         final CacheManager cm3 = createCacheManager(tmpDirectory3);
+         final CacheContainer cm3 = createCacheManager(tmpDirectory3);
 
          cm30 = cm3;
 
@@ -220,7 +220,7 @@
    public void testConcurrentStateTransfer() throws Exception {
       testCount++;
       log.info("testConcurrentStateTransfer start - " + testCount);
-      CacheManager cm1 = null, cm2 = null, cm30 = null, cm40 = null;
+      CacheContainer cm1 = null, cm2 = null, cm30 = null, cm40 = null;
       try {
          Cache<Object, Object> cache1 = null, cache2 = null, cache3 = null, cache4 = null;
          cm1 = createCacheManager(tmpDirectory1);
@@ -236,8 +236,8 @@
          TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
          verifyInitialData(cache2);
 
-         final CacheManager cm3 = createCacheManager(tmpDirectory3);
-         final CacheManager cm4 = createCacheManager(tmpDirectory4);
+         final CacheContainer cm3 = createCacheManager(tmpDirectory3);
+         final CacheContainer cm4 = createCacheManager(tmpDirectory4);
 
          cm30 = cm3;
          cm40 = cm4;

Modified: trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
@@ -186,8 +186,8 @@
       TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
       verifyInitialData(cache2);
 
-      final CacheManager cm3 = createCacheManager();
-      final CacheManager cm4 = createCacheManager();
+      final CacheContainer cm3 = createCacheManager();
+      final CacheContainer cm4 = createCacheManager();
 
       Thread t1 = new Thread(new Runnable() {
          public void run() {

Modified: trunk/core/src/test/java/org/infinispan/stress/PutIfAbsentStressTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/stress/PutIfAbsentStressTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/stress/PutIfAbsentStressTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -23,7 +23,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.Test;
@@ -70,7 +70,7 @@
     * Testing putIfAbsent's behaviour on a Local cache.
     */
    protected void testonInfinispanLocal() throws Exception {
-      CacheManager cm = TestCacheManagerFactory.createLocalCacheManager(false);
+      CacheContainer cm = TestCacheManagerFactory.createLocalCacheManager(false);
       ConcurrentMap<String, String> map = cm.getCache();
       try {
          testConcurrentLocking(map);
@@ -101,13 +101,13 @@
     * Adapter to run the test on any configuration
     */
    private void testConcurrentLockingOnMultipleManagers(Configuration cfg) throws IOException, InterruptedException {
-      List<CacheManager> cacheManagers = new ArrayList<CacheManager>(NODES_NUM);
+      List<CacheContainer> cacheContainers = new ArrayList<CacheContainer>(NODES_NUM);
       List<Cache<String, String>> caches = new ArrayList<Cache<String, String>>();
       List<ConcurrentMap<String, String>> maps = new ArrayList<ConcurrentMap<String, String>>(NODES_NUM
                * THREAD_PER_NODE);
       for (int nodeNum = 0; nodeNum < NODES_NUM; nodeNum++) {
-         CacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(cfg);
-         cacheManagers.add(cm);
+         CacheContainer cm = TestCacheManagerFactory.createClusteredCacheManager(cfg);
+         cacheContainers.add(cm);
          Cache<String, String> cache = cm.getCache();
          caches.add(cache);
          for (int threadNum = 0; threadNum < THREAD_PER_NODE; threadNum++) {
@@ -118,7 +118,7 @@
       try {
          testConcurrentLocking(maps);
       } finally {
-         for (CacheManager cm : cacheManagers) {
+         for (CacheContainer cm : cacheContainers) {
             try {
                TestingUtil.killCacheManagers(cm);
             } catch (Exception e) {

Modified: trunk/core/src/test/java/org/infinispan/test/AbstractCacheTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/AbstractCacheTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/AbstractCacheTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.util.logging.Log;
@@ -30,16 +30,16 @@
     * use TestingUtil.clearContent(cacheManager);
     */
    @Deprecated
-   public void clearContent(CacheManager cacheManager) {
-      TestingUtil.clearContent(cacheManager);
+   public void clearContent(CacheContainer cacheContainer) {
+      TestingUtil.clearContent(cacheContainer);
    }
 
    /**
     * use TestingUtil.getRunningCaches(cacheManager);
     */
    @Deprecated
-   protected Set<Cache> getRunningCaches(CacheManager cacheManager) {
-      return TestingUtil.getRunningCaches(cacheManager);
+   protected Set<Cache> getRunningCaches(CacheContainer cacheContainer) {
+      return TestingUtil.getRunningCaches(cacheContainer);
    }
 
    /**

Modified: trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.AfterClass;
@@ -12,8 +12,6 @@
 import org.testng.annotations.Test;
 
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
 import java.util.IdentityHashMap;
 import java.util.List;
 
@@ -112,8 +110,8 @@
       }
    }
 
-   final protected void registerCacheManager(CacheManager... cacheManagers) {
-      for (CacheManager ecm : cacheManagers) {
+   final protected void registerCacheManager(CacheContainer... cacheContainers) {
+      for (CacheContainer ecm : cacheContainers) {
          this.cacheManagers.add((EmbeddedCacheManager) ecm);
       }
    }
@@ -202,6 +200,13 @@
    }
 
    /**
+    * Returns the default cache from that manager.
+    */
+   protected Cache cache(int index) {
+      return manager(index).getCache();
+   }
+
+   /**
     * Create the cache managers you need for your test.  Note that the cache managers you create *must* be created using
     * {@link #addClusterEnabledCacheManager()}
     */

Modified: trunk/core/src/test/java/org/infinispan/test/ReplListener.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/ReplListener.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/ReplListener.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -8,7 +8,6 @@
 import org.infinispan.context.InvocationContext;
 import org.infinispan.context.impl.TxInvocationContext;
 import org.infinispan.interceptors.base.CommandInterceptor;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;

Modified: trunk/core/src/test/java/org/infinispan/test/SingleCacheManagerTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/SingleCacheManagerTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/SingleCacheManagerTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,11 +2,8 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeClass;

Modified: trunk/core/src/test/java/org/infinispan/test/TestingUtil.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/TestingUtil.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/TestingUtil.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -23,7 +23,7 @@
 import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.loaders.CacheLoader;
 import org.infinispan.loaders.CacheLoaderManager;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.remoting.ReplicationQueue;
@@ -146,28 +146,28 @@
    /**
     * Version of blockUntilViewsReceived that uses varargsa and cache managers
     */
-   public static void blockUntilViewsReceived(long timeout, CacheManager... cacheManagers) {
-      blockUntilViewsReceived(timeout, true, cacheManagers);
+   public static void blockUntilViewsReceived(long timeout, CacheContainer... cacheContainers) {
+      blockUntilViewsReceived(timeout, true, cacheContainers);
    }
 
    /**
     * Waits for the given memebrs to be removed from the cluster. The difference between this and {@link
-    * #blockUntilViewsReceived(long, org.infinispan.manager.CacheManager...)} methods(s) is that it does not barf if
+    * #blockUntilViewsReceived(long, org.infinispan.manager.CacheContainer...)} methods(s) is that it does not barf if
     * more than expected memebers is in the cluster - this is because we expect to start with a grater number fo
     * memebers than we eventually expect. It will barf though, if the number of members is not the one expected but
     * only after the timeout expieres.
     */
-   public static void blockForMemberToFail(long timeout, CacheManager... cacheManagers) {
-      blockUntilViewsReceived(timeout, false, cacheManagers);
-      areCacheViewsComplete(true, cacheManagers);
+   public static void blockForMemberToFail(long timeout, CacheContainer... cacheContainers) {
+      blockUntilViewsReceived(timeout, false, cacheContainers);
+      areCacheViewsComplete(true, cacheContainers);
    }
 
-   public static void blockUntilViewsReceived(long timeout, boolean barfIfTooManyMembers, CacheManager... cacheManagers) {
+   public static void blockUntilViewsReceived(long timeout, boolean barfIfTooManyMembers, CacheContainer... cacheContainers) {
       long failTime = System.currentTimeMillis() + timeout;
 
       while (System.currentTimeMillis() < failTime) {
          sleepThread(100);
-         if (areCacheViewsComplete(barfIfTooManyMembers, cacheManagers)) {
+         if (areCacheViewsComplete(barfIfTooManyMembers, cacheContainers)) {
             return;
          }
       }
@@ -273,12 +273,12 @@
       return true;
    }
 
-   public static boolean areCacheViewsComplete(boolean barfIfTooManyMembers, CacheManager... cacheManagers) {
-      if (cacheManagers == null) throw new NullPointerException("Cache Manager array is null");
-      int memberCount = cacheManagers.length;
+   public static boolean areCacheViewsComplete(boolean barfIfTooManyMembers, CacheContainer... cacheContainers) {
+      if (cacheContainers == null) throw new NullPointerException("Cache Manager array is null");
+      int memberCount = cacheContainers.length;
 
       for (int i = 0; i < memberCount; i++) {
-         EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) cacheManagers[i];
+         EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) cacheContainers[i];
          if (!isCacheViewComplete(cacheManager.getMembers(), cacheManager.getAddress(), memberCount, barfIfTooManyMembers)) {
             return false;
          }
@@ -396,26 +396,26 @@
       f.delete();
    }
 
-   public static void killCacheManagers(CacheManager... cacheManagers) {
-      if (cacheManagers != null) {
-         for (CacheManager cm : cacheManagers) {
+   public static void killCacheManagers(CacheContainer... cacheContainers) {
+      if (cacheContainers != null) {
+         for (CacheContainer cm : cacheContainers) {
             if (cm != null) 
                cm.stop();
          }
       }
    }
 
-   public static void killCacheManagers(Collection<? extends CacheManager> cacheManagers) {
-      killCacheManagers(cacheManagers.toArray(new CacheManager[cacheManagers.size()]));
+   public static void killCacheManagers(Collection<? extends CacheContainer> cacheManagers) {
+      killCacheManagers(cacheManagers.toArray(new CacheContainer[cacheManagers.size()]));
    }
    
-   public static void clearContent(CacheManager cacheManager) {
-      if (cacheManager != null) {
-         Set<Cache> runningCaches = getRunningCaches(cacheManager);
+   public static void clearContent(CacheContainer cacheContainer) {
+      if (cacheContainer != null) {
+         Set<Cache> runningCaches = getRunningCaches(cacheContainer);
          for (Cache cache : runningCaches) {
             clearRunningTx(cache);
          }
-         if (!((EmbeddedCacheManager)cacheManager).getStatus().allowInvocations()) return;
+         if (!((EmbeddedCacheManager) cacheContainer).getStatus().allowInvocations()) return;
          for (Cache cache : runningCaches) {
             removeInMemoryData(cache);
             clearCacheLoader(cache);
@@ -425,8 +425,8 @@
       }
    }
    
-   protected static Set<Cache> getRunningCaches(CacheManager cacheManager) {
-      ConcurrentMap<String, Cache> caches = (ConcurrentMap<String, Cache>) TestingUtil.extractField(DefaultCacheManager.class, cacheManager, "caches");
+   protected static Set<Cache> getRunningCaches(CacheContainer cacheContainer) {
+      ConcurrentMap<String, Cache> caches = (ConcurrentMap<String, Cache>) TestingUtil.extractField(DefaultCacheManager.class, cacheContainer, "caches");
       if (caches == null) return Collections.emptySet();
       Set<Cache> result = new HashSet<Cache>();
       for (Cache cache : caches.values()) {
@@ -550,8 +550,8 @@
       return (ComponentRegistry) extractField(cache, "componentRegistry");
    }
 
-   public static GlobalComponentRegistry extractGlobalComponentRegistry(CacheManager cacheManager) {
-      return (GlobalComponentRegistry) extractField(cacheManager, "globalComponentRegistry");
+   public static GlobalComponentRegistry extractGlobalComponentRegistry(CacheContainer cacheContainer) {
+      return (GlobalComponentRegistry) extractField(cacheContainer, "globalComponentRegistry");
    }
 
    public static LockManager extractLockManager(Cache cache) {
@@ -683,8 +683,8 @@
    /**
     * Extracts a component of a given type from the cache's internal component registry
     */
-   public static <T> T extractGlobalComponent(CacheManager cacheManager, Class<T> componentType) {
-      GlobalComponentRegistry gcr = extractGlobalComponentRegistry(cacheManager);
+   public static <T> T extractGlobalComponent(CacheContainer cacheContainer, Class<T> componentType) {
+      GlobalComponentRegistry gcr = extractGlobalComponentRegistry(cacheContainer);
       return gcr.getComponent(componentType);
    }
 
@@ -712,14 +712,14 @@
    /**
     * Replaces a component in a running cache manager (global component registry)
     *
-    * @param cacheManager         cache in which to replace component
+    * @param cacheContainer         cache in which to replace component
     * @param componentType        component type of which to replace
     * @param replacementComponent new instance
     * @param rewire               if true, ComponentRegistry.rewire() is called after replacing.
     * @return the original component that was replaced
     */
-   public static <T> T replaceComponent(CacheManager cacheManager, Class<T> componentType, T replacementComponent, boolean rewire) {
-      GlobalComponentRegistry cr = extractGlobalComponentRegistry(cacheManager);
+   public static <T> T replaceComponent(CacheContainer cacheContainer, Class<T> componentType, T replacementComponent, boolean rewire) {
+      GlobalComponentRegistry cr = extractGlobalComponentRegistry(cacheContainer);
       T old = cr.getComponent(componentType);
       cr.registerComponent(replacementComponent, componentType);
       if (rewire) {

Modified: trunk/core/src/test/java/org/infinispan/test/ViewChangeListener.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/ViewChangeListener.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/ViewChangeListener.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,7 @@
 package org.infinispan.test;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
@@ -16,7 +16,7 @@
  */
 @Listener
 public class ViewChangeListener {
-   CacheManager cm;
+   CacheContainer cm;
    final CountDownLatch latch = new CountDownLatch(1);
 
    public ViewChangeListener(Cache c) {

Modified: trunk/core/src/test/java/org/infinispan/test/fwk/DebuggingUnitTestNGListener.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/fwk/DebuggingUnitTestNGListener.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/test/fwk/DebuggingUnitTestNGListener.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -24,9 +24,8 @@
 import java.util.Set;
 
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.util.concurrent.ConcurrentHashSet;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
@@ -56,7 +55,7 @@
    }
    
    private void checkCleanedUp(ITestContext testCxt) {
-      CacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(new Configuration());
+      CacheContainer cm = TestCacheManagerFactory.createClusteredCacheManager(new Configuration());
       try {
          cm.start();
          try {

Modified: trunk/core/src/test/java/org/infinispan/tx/LargeTransactionTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/LargeTransactionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/LargeTransactionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -32,18 +32,18 @@
       c.setSyncRollbackPhase(true);
       c.setUseLockStriping(false);
 
-      CacheManager manager = TestCacheManagerFactory.createClusteredCacheManager(c);
-      manager.start();
-      manager.getCache();
-      registerCacheManager(manager);
-      Cache cache1 = manager.getCache("TestCache");
+      CacheContainer container = TestCacheManagerFactory.createClusteredCacheManager(c);
+      container.start();
+      container.getCache();
+      registerCacheManager(container);
+      Cache cache1 = container.getCache("TestCache");
       assert cache1.getConfiguration().getCacheMode().equals(Configuration.CacheMode.REPL_SYNC);
       cache1.start();
 
-      manager = TestCacheManagerFactory.createClusteredCacheManager(c);
-      manager.start();
-      registerCacheManager(manager);
-      Cache cache2 = manager.getCache("TestCache");
+      container = TestCacheManagerFactory.createClusteredCacheManager(c);
+      container.start();
+      registerCacheManager(container);
+      Cache cache2 = container.getCache("TestCache");
       assert cache1.getConfiguration().getCacheMode().equals(Configuration.CacheMode.REPL_SYNC);
    }
 

Modified: trunk/core/src/test/java/org/infinispan/tx/MarkAsRollbackTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/MarkAsRollbackTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/MarkAsRollbackTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,6 @@
 package org.infinispan.tx;
 
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/tx/OnePhaseXATest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/OnePhaseXATest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/OnePhaseXATest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -18,7 +18,7 @@
 @Test(groups = "functional", testName = "tx.OnePhaseXATest", description = "See ISPN-156 for details.", enabled = false)
 public class OnePhaseXATest extends AbstractInfinispanTest {
    private List<Cache> caches;
-   private List<CacheManager> cacheManagers;
+   private List<CacheContainer> cacheContainers;
    public static final int CACHES_NUM = 2;
 
    public void testMultipleCaches() throws Exception {
@@ -45,13 +45,13 @@
    @BeforeTest
    public void setUp() throws Exception {
       caches = new ArrayList<Cache>();
-      cacheManagers = new ArrayList<CacheManager>();
+      cacheContainers = new ArrayList<CacheContainer>();
       for (int i = 0; i < CACHES_NUM; i++) caches.add(getCache());
    }
 
    @AfterTest
    public void tearDown() {
-      if (caches != null) TestingUtil.killCacheManagers(cacheManagers);
+      if (caches != null) TestingUtil.killCacheManagers(cacheContainers);
    }
 
    private Cache getCache() {
@@ -64,8 +64,8 @@
       c.setLockAcquisitionTimeout(60000);
       c.setUseLockStriping(false);
       c.setSyncCommitPhase(true);
-      CacheManager manager = TestCacheManagerFactory.createCacheManager(gc, c, true);
-      cacheManagers.add(manager);
-      return manager.getCache("TestCache");
+      CacheContainer container = TestCacheManagerFactory.createCacheManager(gc, c, true);
+      cacheContainers.add(container);
+      return container.getCache("TestCache");
    }
 }
\ No newline at end of file

Modified: trunk/core/src/test/java/org/infinispan/tx/ReplDeadlockDetectionTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/ReplDeadlockDetectionTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/ReplDeadlockDetectionTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -87,7 +87,7 @@
       replicationLatch = new CountDownLatch(1);
       controlledRpcManager1.setReplicationLatch(replicationLatch);
       controlledRpcManager2.setReplicationLatch(replicationLatch);
-      log.trace("_________________________ Here is beggins");
+      log.trace("_________________________ Here it begins");
    }
 
    @AfterMethod
@@ -310,5 +310,10 @@
       public Address getCurrentStateTransferSource() {
          return realOne.getCurrentStateTransferSource();
       }
+
+      @Override
+      public Address getAddress() {
+         return null;
+      }
    }
 }

Modified: trunk/core/src/test/java/org/infinispan/tx/StaleLockRecoveryTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/StaleLockRecoveryTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/StaleLockRecoveryTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,6 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningCaches.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningCaches.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningCaches.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,6 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;

Modified: trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningReplicatedCaches.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningReplicatedCaches.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/java/org/infinispan/tx/TransactionsSpanningReplicatedCaches.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.MultipleCacheManagersTest;
 import org.infinispan.test.TestingUtil;
 import org.testng.annotations.Test;
@@ -14,7 +14,7 @@
 @Test(groups = "functional", sequential = true, testName = "tx.TransactionsSpanningReplicatedCaches")
 public class TransactionsSpanningReplicatedCaches extends MultipleCacheManagersTest {
 
-   CacheManager cm1, cm2;
+   CacheContainer cm1, cm2;
 
    public TransactionsSpanningReplicatedCaches() {
       cleanup = CleanupPhase.AFTER_METHOD;

Modified: trunk/core/src/test/resources/log4j.xml
===================================================================
--- trunk/core/src/test/resources/log4j.xml	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/core/src/test/resources/log4j.xml	2010-07-01 15:00:41 UTC (rev 1951)
@@ -8,7 +8,7 @@
 
    <!-- A time/date based rolling appender -->
    <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
-      <param name="File" value="infinispan.log"/>
+      <param name="File" value="infinispan_test.log"/>
       <param name="Append" value="false"/>
 
       <!-- Rollover at midnight each day -->
@@ -65,7 +65,7 @@
    <!-- ======================= -->
 
    <root>
-      <priority value="WARN"/>
+      <priority value="TRACE"/>
       <!--<appender-ref ref="CONSOLE"/>-->
       <appender-ref ref="FILE"/>
    </root>

Modified: trunk/demos/directory/src/main/java/org/infinispan/demos/directory/FilesystemDirectory.java
===================================================================
--- trunk/demos/directory/src/main/java/org/infinispan/demos/directory/FilesystemDirectory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/directory/src/main/java/org/infinispan/demos/directory/FilesystemDirectory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,6 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.jgroups.util.Util;

Modified: trunk/demos/ec2/src/main/java/org/infinispan/ec2demo/CacheBuilder.java
===================================================================
--- trunk/demos/ec2/src/main/java/org/infinispan/ec2demo/CacheBuilder.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/ec2/src/main/java/org/infinispan/ec2demo/CacheBuilder.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,7 @@
 
 import java.io.IOException;
 
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.util.logging.Log;
@@ -38,13 +38,13 @@
 }
 
 class ShutdownHook extends Thread {
-	private CacheManager currCache;
+	private CacheContainer currCache;
 
 	/**
-	 * @param cache_manager
+	 * @param cache_container
 	 */
-	public ShutdownHook(CacheManager cache_manager) {
-		currCache = cache_manager;
+	public ShutdownHook(CacheContainer cache_container) {
+		currCache = cache_container;
 	}
 
 	public void run() {

Modified: trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/CacheManagerHolder.java
===================================================================
--- trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/CacheManagerHolder.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/CacheManagerHolder.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.demos.gridfs;
 
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
@@ -21,7 +21,7 @@
    private static final String DATA_CACHE_NAME_PROPERTY = "infinispan.gridfs.cache.data";
    private static final String METADATA_CACHE_NAME_PROPERTY = "infinispan.gridfs.cache.metadata";
 
-   public static CacheManager cacheManager;
+   public static CacheContainer cacheContainer;
    public static String dataCacheName, metadataCacheName;
 
    @Override
@@ -29,13 +29,13 @@
       super.init(cfg);
       String cfgFile = System.getProperty(CFG_PROPERTY, cfg.getInitParameter(CFG_PROPERTY));
       if (cfgFile == null)
-         cacheManager = new DefaultCacheManager();
+         cacheContainer = new DefaultCacheManager();
       else {
          try {
-            cacheManager = new DefaultCacheManager(cfgFile);
+            cacheContainer = new DefaultCacheManager(cfgFile);
          } catch (IOException e) {
             log.error("Unable to start cache manager with config file " + cfgFile + ".  Using DEFAULTS!");
-            cacheManager = new DefaultCacheManager();
+            cacheContainer = new DefaultCacheManager();
          }
       }
 

Modified: trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/GridStore.java
===================================================================
--- trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/GridStore.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/gridfs-webdav/src/main/java/org/infinispan/demos/gridfs/GridStore.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -31,8 +31,8 @@
    private File root = null;
 
    public GridStore(File root) {
-      data = CacheManagerHolder.cacheManager.getCache(CacheManagerHolder.dataCacheName);
-      metadata = CacheManagerHolder.cacheManager.getCache(CacheManagerHolder.metadataCacheName);
+      data = CacheManagerHolder.cacheContainer.getCache(CacheManagerHolder.dataCacheName);
+      metadata = CacheManagerHolder.cacheContainer.getCache(CacheManagerHolder.metadataCacheName);
       
       try {
          data.start();

Modified: trunk/demos/gui/src/main/java/org/infinispan/demo/InfinispanDemo.java
===================================================================
--- trunk/demos/gui/src/main/java/org/infinispan/demo/InfinispanDemo.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/gui/src/main/java/org/infinispan/demo/InfinispanDemo.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -3,7 +3,6 @@
 import org.infinispan.Cache;
 import org.infinispan.container.entries.InternalCacheEntry;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.Listener;

Modified: trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DemoActions.java
===================================================================
--- trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DemoActions.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DemoActions.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -42,7 +42,6 @@
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.infinispan.lucene.InfinispanDirectory;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.remoting.transport.Address;
 

Modified: trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java
===================================================================
--- trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/demos/lucene-directory-demo/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -26,7 +26,7 @@
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.lucene.CacheKey;
 import org.infinispan.lucene.InfinispanDirectory;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
 import org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup;
@@ -46,16 +46,16 @@
 
    public static final String CACHE_NAME_FOR_INDEXES = "LuceneIndex";
 
-   private static CacheManager manager = null;
+   private static CacheContainer container = null;
    private static final Map<String, InfinispanDirectory> directories = new HashMap<String, InfinispanDirectory>();
 
    private static Cache<CacheKey, Object> buildCacheForIndexes() {
       return getCacheManager().getCache(CACHE_NAME_FOR_INDEXES);
    }
 
-   public static synchronized CacheManager getCacheManager() {
-      if (manager != null)
-         return manager;
+   public static synchronized CacheContainer getCacheManager() {
+      if (container != null)
+         return container;
       GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
       gc.setClusterName("infinispan-lucene-demo-cluster");
       gc.setTransportClass(JGroupsTransport.class.getName());
@@ -69,8 +69,8 @@
       config.setL1CacheEnabled(true);
       config.setInvocationBatchingEnabled(true);
       config.setL1Lifespan(6000000);
-      manager = new DefaultCacheManager(gc, config, false);
-      return manager;
+      container = new DefaultCacheManager(gc, config, false);
+      return container;
    }
 
    public static synchronized InfinispanDirectory getIndex(String indexName) {
@@ -83,8 +83,8 @@
    }
    
    public static synchronized void close() {
-      if (manager!=null) {
-         manager.stop();
+      if (container !=null) {
+         container.stop();
       }
    }
 

Modified: trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml	2010-07-01 15:00:41 UTC (rev 1951)
@@ -61,12 +61,18 @@
           >
 
 
-           <operation name="CacheLoader.resetStatistics" displayName="[CacheLoader] Reset Statistics" description="Resets statistics gathered by this component">
+           <operation name="DeadlockDetectingLockManager.resetStatistics" displayName="[DeadlockDetectingLockManager] Reset statistics" description="Resets statistics gathered by this component">
            </operation>
+           <operation name="Passivation.resetStatistics" displayName="[Passivation] Reset statistics" description="Resets statistics gathered by this component">
+           </operation>
            <operation name="Cache.start" displayName="[Cache] Starts cache." description="Starts the cache.">
            </operation>
            <operation name="Cache.stop" displayName="[Cache] Stops cache." description="Stops the cache.">
            </operation>
+           <operation name="Statistics.resetStatistics" displayName="[Statistics] Reset Statistics (Statistics)" description="Resets statistics gathered by this component">
+           </operation>
+           <operation name="Activation.resetStatistics" displayName="[Activation] Reset statistics" description="Resets statistics gathered by this component">
+           </operation>
            <operation name="Transactions.resetStatistics" displayName="[Transactions] Reset Statistics" description="Resets statistics gathered by this component">
            </operation>
            <operation name="Transactions.setStatisticsEnabled" displayName="[Transactions] Enable/disable statistics" description="Enable/disable statistics">
@@ -74,18 +80,21 @@
                  <c:simple-property name="enabled" description="Whether statistics should be enabled or disabled (true/false)"/>
               </parameters>
            </operation>
-           <operation name="Invalidation.resetStatistics" displayName="[Invalidation] Reset statistics" description="Resets statistics gathered by this component">
+           <operation name="RpcManager.resetStatistics" displayName="[RpcManager] Reset statistics" description="Resets statistics gathered by this component">
            </operation>
-           <operation name="Invalidation.setStatisticsEnabled" displayName="[Invalidation] Enable/disable statistics" description="Enable/disable statistics">
+           <operation name="RpcManager.setStatisticsEnabled" displayName="[RpcManager] Enable/disable statistics" description="Enable/disable statistics">
               <parameters>
                  <c:simple-property name="enabled" description="Whether statistics should be enabled or disabled (true/false)"/>
               </parameters>
            </operation>
-           <operation name="Statistics.resetStatistics" displayName="[Statistics] Reset Statistics (Statistics)" description="Resets statistics gathered by this component">
+           <operation name="CacheStore.resetStatistics" displayName="[CacheStore] Reset statistics" description="Resets statistics gathered by this component">
            </operation>
-           <operation name="DeadlockDetectingLockManager.resetStatistics" displayName="[DeadlockDetectingLockManager] Reset statistics" description="Resets statistics gathered by this component">
+           <operation name="Invalidation.resetStatistics" displayName="[Invalidation] Reset statistics" description="Resets statistics gathered by this component">
            </operation>
-           <operation name="CacheStore.resetStatistics" displayName="[CacheStore] Reset statistics" description="Resets statistics gathered by this component">
+           <operation name="Invalidation.setStatisticsEnabled" displayName="[Invalidation] Enable/disable statistics" description="Enable/disable statistics">
+              <parameters>
+                 <c:simple-property name="enabled" description="Whether statistics should be enabled or disabled (true/false)"/>
+              </parameters>
            </operation>
            <operation name="DistributionManager.isAffectedByRehash" displayName="[DistributionManager] Could key be affected by reshah?" description="Determines whether a given key is affected by an ongoing rehash, if any.">
               <parameters>
@@ -111,38 +120,37 @@
                  <c:simple-property name="operationResult" />
               </results>
            </operation>
-           <operation name="Activation.resetStatistics" displayName="[Activation] Reset statistics" description="Resets statistics gathered by this component">
+           <operation name="CacheLoader.resetStatistics" displayName="[CacheLoader] Reset Statistics" description="Resets statistics gathered by this component">
            </operation>
-           <operation name="Passivation.resetStatistics" displayName="[Passivation] Reset statistics" description="Resets statistics gathered by this component">
-           </operation>
-           <operation name="RpcManager.resetStatistics" displayName="[RpcManager] Reset statistics" description="Resets statistics gathered by this component">
-           </operation>
-           <operation name="RpcManager.setStatisticsEnabled" displayName="[RpcManager] Enable/disable statistics" description="Enable/disable statistics">
-              <parameters>
-                 <c:simple-property name="enabled" description="Whether statistics should be enabled or disabled (true/false)"/>
-              </parameters>
-           </operation>
 
-           <metric property="CacheLoader.CacheLoaderLoads" displayName="[CacheLoader] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
-                   description="Number of entries loaded from cache store" />
-           <metric property="CacheLoader.CacheLoaderMisses" displayName="[CacheLoader] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
-                   description="Number of entries that did not exist in cache store" />
+           <metric property="LockManager.ConcurrencyLevel" displayName="[LockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
+                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
+           <metric property="LockManager.NumberOfLocksHeld" displayName="[LockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are held." />
+           <metric property="LockManager.NumberOfLocksAvailable" displayName="[LockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are available." />
+           <metric property="DeadlockDetectingLockManager.OverlapWithNotDeadlockAwareLockOwners" displayName="[DeadlockDetectingLockManager] Number of unsolvable deadlock situations" displayType="detail" units="none" dataType="measurement"
+                   description="Number of situtations when we try to determine a deadlock and the other lock owner is e.g. a local tx. In this scenario we cannot run the deadlock detection mechanism" />
+           <metric property="DeadlockDetectingLockManager.LocallyInterruptedTransactions" displayName="[DeadlockDetectingLockManager] Number of interrupted local transactions" displayType="detail" units="none" dataType="measurement"
+                   description="Number of locally originated transactions that were interrupted as a deadlock situation was detected" />
+           <metric property="DeadlockDetectingLockManager.DetectedRemoteDeadlocks" displayName="[DeadlockDetectingLockManager] Number of detected remote deadlocks" displayType="detail" units="none" dataType="measurement"
+                   description="Number of remote deadlocks detected" />
+           <metric property="DeadlockDetectingLockManager.DetectedLocalDeadlocks" displayName="[DeadlockDetectingLockManager] Number of detected local deadlocks" displayType="detail" units="none" dataType="measurement"
+                   description="Number of local detected deadlocks" />
+           <metric property="DeadlockDetectingLockManager.TotalNumberOfDetectedDeadlocks" displayName="[DeadlockDetectingLockManager] Number of total detected deadlocks" displayType="detail" units="none" dataType="measurement"
+                   description="Total number of local detected deadlocks" />
+           <metric property="DeadlockDetectingLockManager.ConcurrencyLevel" displayName="[DeadlockDetectingLockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
+                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
+           <metric property="DeadlockDetectingLockManager.NumberOfLocksHeld" displayName="[DeadlockDetectingLockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are held." />
+           <metric property="DeadlockDetectingLockManager.NumberOfLocksAvailable" displayName="[DeadlockDetectingLockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are available." />
+           <metric property="Passivation.Passivations" displayName="[Passivation] Number of cache passivations" displayType="detail" units="none" dataType="measurement"
+                   description="Number of passivation events" />
            <metric property="Cache.CacheStatus" displayName="[Cache] Cache status" displayType="summary" units="none" dataType="trait"
                    description="Returns the cache status" />
            <metric property="Cache.CacheName" displayName="[Cache] Cache name" displayType="summary" units="none" dataType="trait"
                    description="Returns the cache name" />
-           <metric property="Transactions.StatisticsEnabled" displayName="[Transactions] Statistics enabled" displayType="detail" units="none" dataType="trait"
-                   description="Statistics enabled" />
-           <metric property="Transactions.Prepares" displayName="[Transactions] Prepares" displayType="summary" units="none" dataType="measurement"
-                   description="Number of transaction prepares performed since last reset" />
-           <metric property="Transactions.Commits" displayName="[Transactions] Commits" displayType="summary" units="none" dataType="measurement"
-                   description="Number of transaction commits performed since last reset" />
-           <metric property="Transactions.Rollbacks" displayName="[Transactions] Rollbacks" displayType="summary" units="none" dataType="measurement"
-                   description="Number of transaction rollbacks performed since last reset" />
-           <metric property="Invalidation.StatisticsEnabled" displayName="[Invalidation] Statistics enabled" displayType="detail" units="none" dataType="trait"
-                   description="Statistics enabled" />
-           <metric property="Invalidation.Invalidations" displayName="[Invalidation] Number of invalidations" displayType="detail" units="none" dataType="measurement"
-                   description="Number of invalidations" />
            <metric property="Statistics.Hits" displayName="[Statistics] Number of cache hits" displayType="summary" units="none" dataType="measurement"
                    description="Number of cache attribute hits" />
            <metric property="Statistics.Misses" displayName="[Statistics] Number of cache misses" displayType="summary" units="none" dataType="measurement"
@@ -169,44 +177,20 @@
                    description="Number of seconds since cache started" />
            <metric property="Statistics.TimeSinceReset" displayName="[Statistics] Seconds since cache statistics were reset" displayType="summary" units="seconds" dataType="measurement"
                    description="Number of seconds since the cache statistics were last reset" />
-           <metric property="DeadlockDetectingLockManager.OverlapWithNotDeadlockAwareLockOwners" displayName="[DeadlockDetectingLockManager] Number of unsolvable deadlock situations" displayType="detail" units="none" dataType="measurement"
-                   description="Number of situtations when we try to determine a deadlock and the other lock owner is e.g. a local tx. In this scenario we cannot run the deadlock detection mechanism" />
-           <metric property="DeadlockDetectingLockManager.LocallyInterruptedTransactions" displayName="[DeadlockDetectingLockManager] Number of interrupted local transactions" displayType="detail" units="none" dataType="measurement"
-                   description="Number of locally originated transactions that were interrupted as a deadlock situation was detected" />
-           <metric property="DeadlockDetectingLockManager.DetectedRemoteDeadlocks" displayName="[DeadlockDetectingLockManager] Number of detected remote deadlocks" displayType="detail" units="none" dataType="measurement"
-                   description="Number of remote deadlocks detected" />
-           <metric property="DeadlockDetectingLockManager.DetectedLocalDeadlocks" displayName="[DeadlockDetectingLockManager] Number of detected local deadlocks" displayType="detail" units="none" dataType="measurement"
-                   description="Number of local detected deadlocks" />
-           <metric property="DeadlockDetectingLockManager.TotalNumberOfDetectedDeadlocks" displayName="[DeadlockDetectingLockManager] Number of total detected deadlocks" displayType="detail" units="none" dataType="measurement"
-                   description="Total number of local detected deadlocks" />
-           <metric property="DeadlockDetectingLockManager.ConcurrencyLevel" displayName="[DeadlockDetectingLockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
-                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
-           <metric property="DeadlockDetectingLockManager.NumberOfLocksHeld" displayName="[DeadlockDetectingLockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are held." />
-           <metric property="DeadlockDetectingLockManager.NumberOfLocksAvailable" displayName="[DeadlockDetectingLockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are available." />
-           <metric property="CacheStore.CacheLoaderStores" displayName="[CacheStore] Number of cache stores" displayType="detail" units="none" dataType="measurement"
-                   description="number of cache loader stores" />
-           <metric property="DistributionManager.RehashInProgress" displayName="[DistributionManager] Is rehash in progress?" displayType="detail" units="none" dataType="trait"
-                   description="Checks whether the node is involved in a rehash." />
-           <metric property="DistributionManager.JoinComplete" displayName="[DistributionManager] Is join completed?" displayType="detail" units="none" dataType="trait"
-                   description="If true, the node has successfully joined the grid and is considered to hold state.  If false, the join process is still in progress." />
            <metric property="Activation.Activations" displayName="[Activation] Number of cache entries activated" displayType="detail" units="none" dataType="measurement"
                    description="Number of activation events" />
            <metric property="Activation.CacheLoaderLoads" displayName="[Activation] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
                    description="Number of entries loaded from cache store" />
            <metric property="Activation.CacheLoaderMisses" displayName="[Activation] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
                    description="Number of entries that did not exist in cache store" />
-           <metric property="Passivation.Passivations" displayName="[Passivation] Number of cache passivations" displayType="detail" units="none" dataType="measurement"
-                   description="Number of passivation events" />
-           <metric property="LockManager.ConcurrencyLevel" displayName="[LockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
-                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
-           <metric property="LockManager.NumberOfLocksHeld" displayName="[LockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are held." />
-           <metric property="LockManager.NumberOfLocksAvailable" displayName="[LockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are available." />
-           <metric property="RpcManager.Address" displayName="[RpcManager] Network address" displayType="summary" units="none" dataType="trait"
-                   description="The network address associated with this instance" />
+           <metric property="Transactions.StatisticsEnabled" displayName="[Transactions] Statistics enabled" displayType="detail" units="none" dataType="trait"
+                   description="Statistics enabled" />
+           <metric property="Transactions.Prepares" displayName="[Transactions] Prepares" displayType="summary" units="none" dataType="measurement"
+                   description="Number of transaction prepares performed since last reset" />
+           <metric property="Transactions.Commits" displayName="[Transactions] Commits" displayType="summary" units="none" dataType="measurement"
+                   description="Number of transaction commits performed since last reset" />
+           <metric property="Transactions.Rollbacks" displayName="[Transactions] Rollbacks" displayType="summary" units="none" dataType="measurement"
+                   description="Number of transaction rollbacks performed since last reset" />
            <metric property="RpcManager.Members" displayName="[RpcManager] Cluster members" displayType="summary" units="none" dataType="trait"
                    description="List of members in the cluster" />
            <metric property="RpcManager.StatisticsEnabled" displayName="[RpcManager] Statistics enabled" displayType="detail" units="none" dataType="trait"
@@ -215,6 +199,8 @@
                    description="Number of successful replications" />
            <metric property="RpcManager.ReplicationFailures" displayName="[RpcManager] Number of failed replications" displayType="summary" units="none" dataType="measurement"
                    description="Number of failed replications" />
+           <metric property="RpcManager.NodeAddress" displayName="[RpcManager] Network address" displayType="summary" units="none" dataType="trait"
+                   description="The network address associated with this instance" />
            <metric property="RpcManager.PhysicalAddresses" displayName="[RpcManager] Physical network addresses" displayType="summary" units="none" dataType="trait"
                    description="The physical network addresses associated with this instance" />
            <metric property="RpcManager.ClusterSize" displayName="[RpcManager] Cluster size" displayType="summary" units="none" dataType="measurement"
@@ -223,6 +209,20 @@
                    description="Successful replications as a ratio of total replications in numeric double format" />
            <metric property="RpcManager.AverageReplicationTime" displayName="[RpcManager] Average time spent in the transport layer" displayType="summary" units="milliseconds" dataType="measurement"
                    description="The average time spent in the transport layer, in milliseconds" />
+           <metric property="CacheStore.CacheLoaderStores" displayName="[CacheStore] Number of cache stores" displayType="detail" units="none" dataType="measurement"
+                   description="number of cache loader stores" />
+           <metric property="Invalidation.StatisticsEnabled" displayName="[Invalidation] Statistics enabled" displayType="detail" units="none" dataType="trait"
+                   description="Statistics enabled" />
+           <metric property="Invalidation.Invalidations" displayName="[Invalidation] Number of invalidations" displayType="detail" units="none" dataType="measurement"
+                   description="Number of invalidations" />
+           <metric property="DistributionManager.RehashInProgress" displayName="[DistributionManager] Is rehash in progress?" displayType="detail" units="none" dataType="trait"
+                   description="Checks whether the node is involved in a rehash." />
+           <metric property="DistributionManager.JoinComplete" displayName="[DistributionManager] Is join completed?" displayType="detail" units="none" dataType="trait"
+                   description="If true, the node has successfully joined the grid and is considered to hold state.  If false, the join process is still in progress." />
+           <metric property="CacheLoader.CacheLoaderLoads" displayName="[CacheLoader] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
+                   description="Number of entries loaded from cache store" />
+           <metric property="CacheLoader.CacheLoaderMisses" displayName="[CacheLoader] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
+                   description="Number of entries that did not exist in cache store" />
 
 
        </service>

Modified: trunk/lucene-directory/src/test/java/org/infinispan/lucene/CacheTestSupport.java
===================================================================
--- trunk/lucene-directory/src/test/java/org/infinispan/lucene/CacheTestSupport.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/lucene-directory/src/test/java/org/infinispan/lucene/CacheTestSupport.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -35,7 +35,7 @@
 import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.lucene.testutils.LuceneSettings;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
@@ -53,7 +53,7 @@
 
    private static final Log log = LogFactory.getLog(CacheTestSupport.class);
 
-   protected static CacheManager createTestCacheManager() {
+   protected static CacheContainer createTestCacheManager() {
       return TestCacheManagerFactory.createClusteredCacheManager( createTestConfiguration() );
    }
 
@@ -130,7 +130,7 @@
       }
    }
 
-   public static CacheManager createLocalCacheManager() {
+   public static CacheContainer createLocalCacheManager() {
       GlobalConfiguration globalConfiguration = GlobalConfiguration.getNonClusteredDefault();
       Configuration cfg = new Configuration();
       cfg.setCacheMode(CacheMode.LOCAL);

Modified: trunk/lucene-directory/src/test/java/org/infinispan/lucene/InfinispanDirectoryStressTest.java
===================================================================
--- trunk/lucene-directory/src/test/java/org/infinispan/lucene/InfinispanDirectoryStressTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/lucene-directory/src/test/java/org/infinispan/lucene/InfinispanDirectoryStressTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -35,7 +35,7 @@
 import org.apache.lucene.search.TopDocs;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
 import org.testng.annotations.Test;
@@ -57,8 +57,8 @@
 
    public void testInfinispanDirectory() throws Exception {
       final int OPERATIONS = 100;
-      CacheManager cacheManager = CacheTestSupport.createTestCacheManager();
-      Cache<CacheKey, Object> cache = cacheManager.getCache();
+      CacheContainer cacheContainer = CacheTestSupport.createTestCacheManager();
+      Cache<CacheKey, Object> cache = cacheContainer.getCache();
       Directory directory = new InfinispanDirectory(cache, "indexName");
       CacheTestSupport.initializeDirectory(directory);
       File document = CacheTestSupport.createDummyDocToIndex("document.lucene", 10000);
@@ -76,7 +76,7 @@
       assert OPERATIONS == hits.totalHits;
 
       directory.close();
-      cacheManager.stop();
+      cacheContainer.stop();
    }
 
    public void testDirectoryWithMultipleThreads() throws Exception {

Modified: trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/IndexReadingStressTest.java
===================================================================
--- trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/IndexReadingStressTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/IndexReadingStressTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -43,7 +43,7 @@
 import org.infinispan.lucene.InfinispanDirectory;
 import org.infinispan.lucene.testutils.ClusteredCacheFactory;
 import org.infinispan.lucene.testutils.LuceneSettings;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -55,30 +55,30 @@
  * changed during the searches.
  * To use it set a DURATION_MS as long as you can afford; choose thread number and terms number
  * according to your use case as they will affect the results.
- * 
+ *
  * @author Sanne Grinovero
  * @since 4.0
  */
 @Test(groups = "profiling", testName = "lucene.profiling.IndexReadingStressTest")
 public class IndexReadingStressTest {
-   
+
    /** Concurrent IndexSearchers used during tests */
    private static final int THREADS = 20;
-   
+
    /** Test duration **/
    private static final long DURATION_MS = 350000;
-   
+
    /** Number of Terms written in the index **/
    private static final int TERMS_NUMBER = 200000;
 
    private static final ClusteredCacheFactory cacheFactory = new ClusteredCacheFactory(CacheTestSupport.createTestConfiguration());
-   
+
    @Test
    public void profileTestRAMDirectory() throws InterruptedException, IOException {
       RAMDirectory dir = new RAMDirectory();
       testDirectory(dir, "RAMDirectory");
    }
-   
+
    @Test
    public void profileTestFSDirectory() throws InterruptedException, IOException {
       File indexDir = new File(new File("."), "tempindex");
@@ -86,7 +86,7 @@
       FSDirectory dir = FSDirectory.open(indexDir);
       testDirectory(dir, "FSDirectory");
    }
-   
+
    @Test
    public void profileTestInfinispanDirectory() throws InterruptedException, IOException {
       //theses default are not for performance settings but meant for problem detection:
@@ -94,10 +94,10 @@
       InfinispanDirectory dir = new InfinispanDirectory(cache, "iname");
       testDirectory(dir, "InfinispanClustered");
    }
-   
+
    @Test
    public void profileInfinispanLocalDirectory() throws InterruptedException, IOException {
-      CacheManager cacheManager = CacheTestSupport.createLocalCacheManager();
+      CacheContainer cacheManager = CacheTestSupport.createLocalCacheManager();
       try {
          Cache<CacheKey, Object> cache = cacheManager.getCache();
          InfinispanDirectory dir = new InfinispanDirectory(cache, "iname");
@@ -106,7 +106,7 @@
          cacheManager.stop();
       }
    }
-   
+
    private void testDirectory(Directory dir, String testLabel) throws InterruptedException, IOException {
       SharedState state = fillDirectory(dir);
       ExecutorService e = Executors.newFixedThreadPool(THREADS);
@@ -123,7 +123,7 @@
       System.out.println(
                "Test " + testLabel +" run in " + DURATION_MS + "ms:\n\tSearches: " + searchesCount + "\n\t" + "Writes: " + writerTaskCount);
    }
-   
+
    private SharedState fillDirectory(Directory directory) throws CorruptIndexException, LockObtainFailedException, IOException {
       CacheTestSupport.initializeDirectory(directory);
       SharedState state = new SharedState(0);

Modified: trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/PerformanceCompareStressTest.java
===================================================================
--- trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/PerformanceCompareStressTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/lucene-directory/src/test/java/org/infinispan/lucene/profiling/PerformanceCompareStressTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -35,7 +35,7 @@
 import org.infinispan.lucene.CacheTestSupport;
 import org.infinispan.lucene.InfinispanDirectory;
 import org.infinispan.lucene.testutils.ClusteredCacheFactory;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -85,13 +85,13 @@
    
    @Test
    public void profileInfinispanLocalDirectory() throws InterruptedException, IOException {
-      CacheManager cacheManager = CacheTestSupport.createLocalCacheManager();
+      CacheContainer cacheContainer = CacheTestSupport.createLocalCacheManager();
       try {
-         Cache<CacheKey, Object> cache = cacheManager.getCache();
+         Cache<CacheKey, Object> cache = cacheContainer.getCache();
          InfinispanDirectory dir = new InfinispanDirectory(cache, "iname");
          testDirectory(dir, "InfinispanLocal");
       } finally {
-         cacheManager.stop();
+         cacheContainer.stop();
       }
    }
    

Modified: trunk/lucene-directory/src/test/java/org/infinispan/lucene/testutils/ClusteredCacheFactory.java
===================================================================
--- trunk/lucene-directory/src/test/java/org/infinispan/lucene/testutils/ClusteredCacheFactory.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/lucene-directory/src/test/java/org/infinispan/lucene/testutils/ClusteredCacheFactory.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -32,7 +32,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.lucene.CacheKey;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 
@@ -108,8 +108,8 @@
          while (true) {
             try {
                Configuration configuration = requests.take();
-               CacheManager cacheManager = TestCacheManagerFactory.createClusteredCacheManager(configuration);
-               Cache<CacheKey, Object> cache = cacheManager.getCache();
+               CacheContainer cacheContainer = TestCacheManagerFactory.createClusteredCacheManager(configuration);
+               Cache<CacheKey, Object> cache = cacheContainer.getCache();
                results.put(cache);
             } catch (InterruptedException e) {
                return;

Modified: trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java
===================================================================
--- trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -24,7 +24,7 @@
 import org.infinispan.Cache;
 import org.infinispan.CacheException;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.query.test.Person;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -45,7 +45,7 @@
 @Test(groups = "unit")
 public class QueryHelperTest {
    Configuration cfg;
-   List<CacheManager> cacheManagers;
+   List<CacheContainer> cacheContainers;
 
    @BeforeMethod
    public void setUp() {
@@ -53,17 +53,17 @@
       cfg.setIndexingEnabled(true);
       cfg.setIndexLocalOnly(true);
 
-      cacheManagers = new LinkedList<CacheManager>();
+      cacheContainers = new LinkedList<CacheContainer>();
    }
 
    @AfterMethod
    public void tearDown() {
-      TestingUtil.killCacheManagers(cacheManagers);
+      TestingUtil.killCacheManagers(cacheContainers);
    }
 
    private Cache<?, ?> createCache(Configuration c) {
-      CacheManager cm = TestCacheManagerFactory.createCacheManager(c);
-      cacheManagers.add(cm);
+      CacheContainer cm = TestCacheManagerFactory.createCacheManager(c);
+      cacheContainers.add(cm);
       return cm.getCache();
    }
 

Modified: trunk/query/src/test/java/org/infinispan/query/blackbox/KeyTypeTest.java
===================================================================
--- trunk/query/src/test/java/org/infinispan/query/blackbox/KeyTypeTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/query/src/test/java/org/infinispan/query/blackbox/KeyTypeTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -25,7 +25,6 @@
 import org.apache.lucene.search.TermQuery;
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.query.CacheQuery;
 import org.infinispan.query.QueryFactory;
@@ -34,14 +33,10 @@
 import org.infinispan.query.test.CustomKey;
 import org.infinispan.query.test.Person;
 import org.infinispan.test.SingleCacheManagerTest;
-import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import java.util.List;
-import java.util.Properties;
 
 import static org.infinispan.config.Configuration.CacheMode.LOCAL;
 

Modified: trunk/query/src/test/java/org/infinispan/query/blackbox/LocalCacheTest.java
===================================================================
--- trunk/query/src/test/java/org/infinispan/query/blackbox/LocalCacheTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/query/src/test/java/org/infinispan/query/blackbox/LocalCacheTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -22,7 +22,6 @@
 package org.infinispan.query.blackbox;
 
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.query.helper.TestQueryHelperFactory;
 import org.infinispan.query.test.Person;

Modified: trunk/query/src/test/java/org/infinispan/query/config/QueryParsingTest.java
===================================================================
--- trunk/query/src/test/java/org/infinispan/query/config/QueryParsingTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/query/src/test/java/org/infinispan/query/config/QueryParsingTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -25,7 +25,7 @@
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.config.InfinispanConfiguration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
 import org.infinispan.test.AbstractInfinispanTest;
 import org.infinispan.test.TestingUtil;
@@ -80,7 +80,7 @@
       assert other.isIndexingEnabled();
       assert other.isIndexLocalOnly();
 
-      CacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(def);
+      CacheContainer cm = TestCacheManagerFactory.createClusteredCacheManager(def);
       try {
          Cache<Object, Object> cache = cm.getCache("test");
          cache.stop();

Modified: trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala
===================================================================
--- trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -9,8 +9,9 @@
 import java.util.concurrent.{ThreadFactory, ExecutionException, Callable, Executors}
 import gnu.getopt.{Getopt, LongOpt}
 import org.infinispan.Version
-import org.infinispan.manager.{CacheManager, DefaultCacheManager}
+import org.infinispan.manager.{CacheContainer, DefaultCacheManager}
 import java.util.Properties
+import java.util.Properties
 
 /**
  * Main class for server startup.
@@ -277,7 +278,7 @@
    }
 }
 
-private class ShutdownHook(server: ProtocolServer, cacheManager: CacheManager) extends Thread {
+private class ShutdownHook(server: ProtocolServer, cacheManager: CacheContainer) extends Thread {
    override def run {
       if (server != null) {
          System.out.println("Posting Shutdown Request to the server...")

Modified: trunk/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodIdleTimeoutTest.scala
===================================================================
--- trunk/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodIdleTimeoutTest.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodIdleTimeoutTest.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -5,7 +5,7 @@
 import test.HotRodTestingUtil._
 import org.testng.Assert._
 import test.{HotRodClient, UniquePortThreadLocal}
-import org.infinispan.manager.{EmbeddedCacheManager, CacheManager}
+import org.infinispan.manager.{EmbeddedCacheManager, CacheContainer}
 
 /**
  * // TODO: Document this

Modified: trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedDecoder.scala
===================================================================
--- trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedDecoder.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedDecoder.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.server.memcached
 
-import org.infinispan.manager.{CacheManager}
+import org.infinispan.manager.{CacheContainer}
 import org.infinispan.server.core.Operation._
 import org.infinispan.server.memcached.MemcachedOperation._
 import org.infinispan.context.Flag

Modified: trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala
===================================================================
--- trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.server.core.AbstractProtocolServer
 import org.infinispan.server.core.transport.{Decoder, Encoder}
-import org.infinispan.manager.CacheManager
+import org.infinispan.manager.CacheContainer
 import java.util.concurrent.{Executors, ScheduledExecutorService}
 
 /**

Modified: trunk/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedFunctionalTest.scala
===================================================================
--- trunk/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedFunctionalTest.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedFunctionalTest.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,6 +1,6 @@
 package org.infinispan.server.memcached
 
-import org.infinispan.manager.CacheManager
+import org.infinispan.manager.CacheContainer
 import java.lang.reflect.Method
 import java.util.concurrent.TimeUnit
 import org.testng.Assert._

Modified: trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala
===================================================================
--- trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -137,10 +137,10 @@
    var instance: EmbeddedCacheManager = null
 
    def getCache(name: String): Cache[String, Any] = {
-      if (name != DefaultCacheManager.DEFAULT_CACHE_NAME && !instance.getCacheNames.contains(name))
+      if (name != CacheContainer.DEFAULT_CACHE_NAME && !instance.getCacheNames.contains(name))
          throw new CacheNotFoundException("Cache with name '" + name + "' not found amongst the configured caches")
 
-      if (name == DefaultCacheManager.DEFAULT_CACHE_NAME) instance.getCache[String, Any]
+      if (name == CacheContainer.DEFAULT_CACHE_NAME) instance.getCache[String, Any]
       else instance.getCache(name)
    }
 

Modified: trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala
===================================================================
--- trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/rest/src/test/scala/org/infinispan/rest/IntegrationTest.scala	2010-07-01 15:00:41 UTC (rev 1951)
@@ -10,9 +10,8 @@
 import org.testng.annotations.Test
 import org.testng.Assert._
 import java.lang.reflect.Method
-import org.infinispan.manager.DefaultCacheManager
+import org.infinispan.manager.{CacheContainer, DefaultCacheManager}
 
-
 /**
  * This tests using the Apache HTTP commons client library - but you could use anything
  * Decided to do this instead of testing the Server implementation itself, as testing the impl directly was kind of too easy.
@@ -25,7 +24,7 @@
 @Test(groups = Array("functional"), testName = "rest.IntegrationTest")
 class IntegrationTest {
    val HOST = "http://localhost:8888/"
-   val cacheName = DefaultCacheManager.DEFAULT_CACHE_NAME
+   val cacheName = CacheContainer.DEFAULT_CACHE_NAME
    val fullPath = HOST + "rest/" + cacheName
    //val HOST = "http://localhost:8080/infinispan/"
 
@@ -221,9 +220,9 @@
 
       val obj = new MySer
       obj.name = "mic"
-      ManagerInstance getCache(DefaultCacheManager.DEFAULT_CACHE_NAME) put (m.getName, obj)
-      ManagerInstance getCache(DefaultCacheManager.DEFAULT_CACHE_NAME) put (m.getName + "2", "hola")
-      ManagerInstance getCache(DefaultCacheManager.DEFAULT_CACHE_NAME) put (m.getName + "3", new MyNonSer)
+      ManagerInstance getCache(CacheContainer.DEFAULT_CACHE_NAME) put (m.getName, obj)
+      ManagerInstance getCache(CacheContainer.DEFAULT_CACHE_NAME) put (m.getName + "2", "hola")
+      ManagerInstance getCache(CacheContainer.DEFAULT_CACHE_NAME) put (m.getName + "3", new MyNonSer)
 
       //check we can get it back as an object...
       val get = new GetMethod(fullPathKey);
@@ -269,7 +268,7 @@
       put.setRequestBody(new ByteArrayInputStream(bout.toByteArray))
       Client.call(put)
 
-      val x = ManagerInstance.getCache(DefaultCacheManager.DEFAULT_CACHE_NAME).get(m.getName).asInstanceOf[MySer]
+      val x = ManagerInstance.getCache(CacheContainer.DEFAULT_CACHE_NAME).get(m.getName).asInstanceOf[MySer]
       assertTrue(x.name == "mic")
    }
 
@@ -290,5 +289,5 @@
    /**These are needed for Jackson to Do Its Thing */
    def getName = name
 
-   def setName(s: String) = {name = s}
+   def setName(s: String) r1875 through r1949= {name = s}
 }
\ No newline at end of file

Modified: trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java
===================================================================
--- trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -34,7 +34,7 @@
 import java.util.concurrent.Executors;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.server.core.AbstractProtocolServer;
 import org.infinispan.server.websocket.handlers.GetHandler;
@@ -117,12 +117,12 @@
 
    private static class WebSocketServerPipelineFactory implements ChannelPipelineFactory {
 
-      private CacheManager cacheManager;
+      private CacheContainer cacheContainer;
       private Map<String, OpHandler> operationHandlers;
       private Map<String, Cache> startedCaches = new ConcurrentHashMap<String, Cache>();
 
-      public WebSocketServerPipelineFactory(CacheManager cacheManager) {
-         this.cacheManager = cacheManager;
+      public WebSocketServerPipelineFactory(CacheContainer cacheContainer) {
+         this.cacheContainer = cacheContainer;
 
          operationHandlers = new HashMap<String, OpHandler>();
          operationHandlers.put("put", new PutHandler());
@@ -140,7 +140,7 @@
          pipeline.addLast("decoder", new HttpRequestDecoder());
          pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
          pipeline.addLast("encoder", new HttpResponseEncoder());
-         pipeline.addLast("handler", new WebSocketServerHandler(cacheManager, operationHandlers, startedCaches));
+         pipeline.addLast("handler", new WebSocketServerHandler(cacheContainer, operationHandlers, startedCaches));
 
          return pipeline;
       }

Modified: trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServerHandler.java
===================================================================
--- trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServerHandler.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServerHandler.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -32,7 +32,7 @@
 import java.util.Map;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.ChannelFuture;
@@ -64,13 +64,13 @@
 public class WebSocketServerHandler extends SimpleChannelUpstreamHandler {
 
 	private static final String INFINISPAN_WS_JS_FILENAME = "infinispan-ws.js";
-	private CacheManager cacheManager;
+	private CacheContainer cacheContainer;
 	private Map<String, OpHandler> operationHandlers;
 	private boolean connectionUpgraded;
 	private Map<String, Cache> startedCaches;
 
-	public WebSocketServerHandler(CacheManager cacheManager, Map<String, OpHandler> operationHandlers, Map<String, Cache> startedCaches) {
-		this.cacheManager = cacheManager;		
+	public WebSocketServerHandler(CacheContainer cacheContainer, Map<String, OpHandler> operationHandlers, Map<String, Cache> startedCaches) {
+		this.cacheContainer = cacheContainer;
 		this.operationHandlers = operationHandlers;
 		this.startedCaches = startedCaches;
 	}
@@ -160,9 +160,9 @@
 				cache = startedCaches.get(key);
 				if(cache == null) {
 					if(cacheName != null) {
-						cache = cacheManager.getCache(key);
+						cache = cacheContainer.getCache(key);
 					} else {
-						cache = cacheManager.getCache();
+						cache = cacheContainer.getCache();
 					}
 					startedCaches.put(key, cache);
 					cache.start();

Modified: trunk/server/websocket/src/test/java/org/infinispan/server/websocket/handlers/MockClient.java
===================================================================
--- trunk/server/websocket/src/test/java/org/infinispan/server/websocket/handlers/MockClient.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/server/websocket/src/test/java/org/infinispan/server/websocket/handlers/MockClient.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -22,7 +22,7 @@
 package org.infinispan.server.websocket.handlers;
 
 import org.infinispan.Cache;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.server.websocket.OpHandler;
 import org.infinispan.websocket.MockChannel;
@@ -37,7 +37,7 @@
 public class MockClient {
 	
 	private String cacheName;
-	private CacheManager cacheManager;
+	private CacheContainer cacheContainer;
 	private Cache<Object, Object> cache;
 
 	private OpHandler putHandler = new PutHandler(); 
@@ -50,8 +50,8 @@
 		this.cacheName = cacheName;
 		this.ctx = new MockChannelHandlerContext(mockChannel);
 		
-		cacheManager = new DefaultCacheManager();
-		cache = cacheManager.getCache(cacheName);
+		cacheContainer = new DefaultCacheManager();
+		cache = cacheContainer.getCache(cacheName);
 	}
 	
 	public void put(String key, String value) {

Modified: trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java
===================================================================
--- trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -1,7 +1,6 @@
 package org.infinispan.api.tree;
 
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;
@@ -11,8 +10,7 @@
 import org.infinispan.tree.TreeCache;
 import org.infinispan.tree.TreeCacheImpl;
 import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
+
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;

Modified: trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java
===================================================================
--- trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -4,7 +4,6 @@
 import org.infinispan.atomic.AtomicMap;
 import org.infinispan.atomic.AtomicMapLookup;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;
@@ -18,8 +17,7 @@
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;
 import static org.testng.AssertJUnit.*;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
+
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;

Modified: trunk/tree/src/test/java/org/infinispan/profiling/TreeProfileTest.java
===================================================================
--- trunk/tree/src/test/java/org/infinispan/profiling/TreeProfileTest.java	2010-07-01 14:53:01 UTC (rev 1950)
+++ trunk/tree/src/test/java/org/infinispan/profiling/TreeProfileTest.java	2010-07-01 15:00:41 UTC (rev 1951)
@@ -2,7 +2,7 @@
 
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.CacheContainer;
 import org.infinispan.profiling.testinternals.FqnGenerator;
 import org.infinispan.profiling.testinternals.Generator;
 import org.infinispan.profiling.testinternals.TaskRunner;
@@ -52,7 +52,7 @@
    protected static final int WARMUP_LOOPS = 20000;
 
    protected static final boolean USE_SLEEP = false; // throttle generation a bit
-   private CacheManager cacheManager;
+   private CacheContainer cacheContainer;
 
 
    protected TreeCache cache;
@@ -66,15 +66,15 @@
       cfg.setConcurrencyLevel(2000);
       cfg.setLockAcquisitionTimeout(120000);
       cfg.setIsolationLevel(IsolationLevel.READ_COMMITTED);
-      cacheManager = TestCacheManagerFactory.createCacheManager(cfg);
-      Cache c = cacheManager.getCache();
+      cacheContainer = TestCacheManagerFactory.createCacheManager(cfg);
+      Cache c = cacheContainer.getCache();
       cache = new TreeCacheImpl(c);
    }
 
    @AfterMethod
    public void tearDown() {
       TreeTestingUtil.killTreeCaches(cache);
-      TestingUtil.killCacheManagers(cacheManager);
+      TestingUtil.killCacheManagers(cacheContainer);
    }
 
 



More information about the infinispan-commits mailing list