[jbosscache-commits] JBoss Cache SVN: r4879 - in core/trunk/src: main/java/org/jboss/cache/factories and 9 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Dec 19 10:09:58 EST 2007
Author: manik.surtani at jboss.com
Date: 2007-12-19 10:09:57 -0500 (Wed, 19 Dec 2007)
New Revision: 4879
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
core/trunk/src/test/java/org/jboss/cache/FqnTest.java
core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java
Log:
Updated usage of singletons in DefaultCacheFactory and InterceptorChainFactory
Modified: core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/CacheManagerImpl.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -116,7 +116,7 @@
{
config.getRuntimeConfig().setMuxChannelFactory(channelFactory);
}
- cache = DefaultCacheFactory.getInstance().createCache(config, false);
+ cache = new DefaultCacheFactory().createCache(config, false);
registerCache(cache, configName);
}
else if (cache != null)
Modified: core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/ConsoleListener.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -1,18 +1,6 @@
package org.jboss.cache;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheStarted;
-import org.jboss.cache.notifications.annotation.CacheStopped;
-import org.jboss.cache.notifications.annotation.NodeActivated;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.notifications.annotation.NodeEvicted;
-import org.jboss.cache.notifications.annotation.NodeLoaded;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodePassivated;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.annotation.ViewChanged;
+import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.NodeEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
@@ -33,8 +21,8 @@
@CacheListener
public class ConsoleListener
{
- private CacheImpl _cache;
- private boolean _startCache;
+ private CacheSPI cache;
+ private boolean startCache;
/**
* Constructor.
@@ -44,8 +32,8 @@
*
* @param cache the cache to monitor for replication events.
*/
- public ConsoleListener(CacheImpl cache)
- throws Exception
+ public ConsoleListener(CacheSPI cache)
+ throws Exception
{
this(cache, true, true);
}
@@ -59,12 +47,12 @@
* @param stopCache indicates whether or not the cache should be stopped by
* this class.
*/
- public ConsoleListener(CacheImpl cache,
+ public ConsoleListener(CacheSPI cache,
boolean startCache, boolean stopCache)
- throws Exception
+ throws Exception
{
- _cache = cache;
- _startCache = startCache;
+ this.cache = cache;
+ this.startCache = startCache;
if (stopCache)
{
@@ -80,7 +68,7 @@
* method to return.
*/
public void listen()
- throws Exception
+ throws Exception
{
listen(true);
}
@@ -95,13 +83,13 @@
* notification semantics) will cause this method to return.
*/
public void listen(boolean wait)
- throws Exception
+ throws Exception
{
- _cache.getNotifier().addCacheListener(this);
+ cache.getNotifier().addCacheListener(this);
- if (_startCache)
+ if (startCache)
{
- _cache.start();
+ cache.start();
}
synchronized (this)
@@ -181,7 +169,7 @@
public void run()
{
- _cache.stop();
+ cache.stop();
}
}
@@ -218,7 +206,7 @@
System.out.print("No xml config file argument is supplied. Will use jboss-cache.xml from classpath");
}
- CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(configFileName);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(configFileName);
ConsoleListener listener = new ConsoleListener(cache);
listener.listen();
}
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -16,22 +16,23 @@
import java.io.InputStream;
/**
- * Default (singleton) implementation of the {@link org.jboss.cache.CacheFactory} interface.
- * Use {@link #getInstance()} to obtain an instance.
+ * Default implementation of the {@link org.jboss.cache.CacheFactory} interface.
* <p/>
* This is a special instance of a {@link ComponentFactory} which contains bootstrap information for the
* {@link ComponentRegistry}.
* <p/>
- * E.g., {@link #bootstrap(CacheImpl, CacheSPI, org.jboss.cache.config.Configuration)} is used to create a cache, a {@link ComponentRegistry}, and then wire dependencies as needed.
+ * E.g., {@link #bootstrap(CacheImpl, CacheSPI, org.jboss.cache.config.Configuration)} is used to create a cache, a
+ * {@link ComponentRegistry}, and then wire dependencies as needed.
+ * <p/>
+ * In JBoss Cache 2.0.x, this was a singleton and you had to use {@link #getInstance()} to obtain an instance. From
+ * JBoss Cache 2.1.x onwards, this is no longer a singleton and you can use the default no-arg constructor to obtain
+ * a reference. {@link #getInstance()} has been deprecated and modified to return a new instance of this class.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @see org.jboss.cache.factories.ComponentFactory
*/
-//@DefaultFactoryFor(classes = {CacheSPI.class})
public class DefaultCacheFactory<K, V> extends ComponentFactory implements CacheFactory<K, V>
{
- private volatile static CacheFactory<?, ?> singleton = new DefaultCacheFactory();
-
/**
* Note - this method used to return a singleton instance, and since 2.1.0 returns a new instance. The method is
* deprecated and you should use the no-arg constructor to create a new instance of this factory.
Modified: core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -22,6 +22,13 @@
@DefaultFactoryFor(classes = Interceptor.class)
public class InterceptorChainFactory extends ComponentFactory
{
+ /**
+ * Note - this method used to return a singleton instance, and since 2.1.0 returns a new instance. The method is
+ * deprecated and you should use the no-arg constructor to create a new instance of this factory.
+ *
+ * @return a NEW instance of this class.
+ */
+ @Deprecated
public static InterceptorChainFactory getInstance()
{
return new InterceptorChainFactory();
@@ -39,7 +46,7 @@
}
}
- public Interceptor setLastInterceptorPointer(Interceptor first, Interceptor last)
+ public static Interceptor setLastInterceptorPointer(Interceptor first, Interceptor last)
{
Interceptor i = first;
while (i != null)
@@ -533,7 +540,7 @@
return setLastInterceptorPointer(first, invokerInterceptor);
}
- public List<Interceptor> asList(Interceptor interceptor)
+ public static List<Interceptor> asList(Interceptor interceptor)
{
if (interceptor == null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -99,7 +99,7 @@
public List<Interceptor> getInterceptorChain()
{
- return InterceptorChainFactory.getInstance().asList(interceptorChain);
+ return InterceptorChainFactory.asList(interceptorChain);
}
public void addInterceptor(Interceptor i, int position)
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -918,7 +918,7 @@
protected void constructCache() throws ConfigurationException
{
log.debug("Constructing Cache");
- CacheFactory<K, V> cf = DefaultCacheFactory.getInstance();
+ CacheFactory<K, V> cf = new DefaultCacheFactory<K, V>();
setCache(cf.createCache(config, false));
if (multiplexerService != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -120,7 +120,7 @@
}
else if (config != null)
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(this.config);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(this.config);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -46,7 +46,7 @@
public void testFromConfigFileStarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(configFile);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(configFile);
// can't test for this anymore since the RuntimeConfig is attached to the running cache
//assertEquals(expected, cache.getConfiguration());
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -55,7 +55,7 @@
public void testFromConfigFileUnstarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(configFile, false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(configFile, false);
// can't test for this anymore since the RuntimeConfig is attached to the running cache
// assertEquals(expected, cache.getConfiguration());
@@ -66,7 +66,7 @@
public void testFromConfigObjStarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(expected);
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -75,7 +75,7 @@
public void testFromConfigObjUnstarted()
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected, false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(expected, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
@@ -94,7 +94,7 @@
public void testLifecycle() throws Exception
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected, false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(expected, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
cache.start();
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
@@ -105,7 +105,7 @@
public void testCreationFromStreamStarted() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = DefaultCacheFactory.getInstance();
+ CacheFactory cf = new DefaultCacheFactory();
cache = (CacheSPI) cf.createCache(is);
assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
doSimpleConfTests(cache.getConfiguration());
@@ -114,7 +114,7 @@
public void testCreationFromStream() throws Exception
{
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
- CacheFactory cf = DefaultCacheFactory.getInstance();
+ CacheFactory cf = new DefaultCacheFactory();
cache = (CacheSPI) cf.createCache(is, false);
assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
doSimpleConfTests(cache.getConfiguration());
@@ -122,7 +122,7 @@
public void testComponentsInjected() throws Exception
{
- CacheFactory cf = DefaultCacheFactory.getInstance();
+ CacheFactory cf = new DefaultCacheFactory();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -117,7 +117,7 @@
c.setCacheMode(mode);
c.setIsolationLevel(level);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
+ return (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
}
private TransactionManager startTransaction()
Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -350,7 +350,7 @@
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
- cache = DefaultCacheFactory.getInstance().createCache(c);
+ cache = new DefaultCacheFactory().createCache(c);
cache.put(f, "key", "value");
Modified: core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -24,7 +24,7 @@
@Test(groups = {"functional"})
public void testGetKeys() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put("/a/b/c", "name", "Bela Ban");
cache.put("/a/b/c", "age", 40);
cache.put("/a/b/c", "city", "Kreuzlingen");
@@ -42,7 +42,7 @@
@Test(groups = {"functional"})
public void testGetChildren() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put("/a/b/c", null);
cache.put("/a/b/c/1", null);
cache.put("/a/b/c/2", null);
@@ -61,7 +61,7 @@
@Test(groups = {"functional"})
public void testGetKeysOnNode()
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
cache.put("/a/b/c", "key", "value");
Node node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
Set keySet = node.getKeys();
Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -424,7 +424,7 @@
private CacheSPI<Object, Object> createCache(Configuration.CacheMode cache_mode)
{
- CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
retval.getConfiguration().setCacheMode(cache_mode);
retval.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
return retval;
Modified: core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -25,7 +25,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
Modified: core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -20,7 +20,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -48,7 +48,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- CacheFactory<String, String> cf = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> cf = new DefaultCacheFactory();
cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -30,14 +30,13 @@
@Test(groups = {"functional"})
public class ComponentRegistryFunctionalTest
{
- private ComponentFactory cf;
private ComponentRegistry cr;
private Configuration configuration;
@BeforeMethod
public void setUp() throws Exception
{
- cf = (ComponentFactory) DefaultCacheFactory.getInstance();
+ ComponentFactory cf = (ComponentFactory) new DefaultCacheFactory();
CacheSPI spi = new CacheInvocationDelegate();
Constructor ctor = CacheImpl.class.getDeclaredConstructor();
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -1,18 +1,17 @@
package org.jboss.cache.factories;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.interceptors.Interceptor;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.fail;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
+
/**
* @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
*/
@@ -25,7 +24,7 @@
public void setUp() throws Exception
{
Configuration c = new Configuration();
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(c);
cache.create();
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -28,7 +28,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setCacheMode("LOCAL");
}
@@ -197,7 +197,7 @@
public void testOptimisticChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
@@ -223,7 +223,7 @@
public void testOptimisticReplicatedChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
cache.getConfiguration().setCacheMode("REPL_SYNC");
@@ -251,7 +251,7 @@
public void testOptimisticCacheLoaderChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
@@ -280,7 +280,7 @@
public void testOptimisticPassivationCacheLoaderChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setNodeLockingOptimistic(true);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(true, false));
@@ -309,7 +309,7 @@
public void testInvalidationInterceptorChain() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setCacheMode("REPL_ASYNC");
@@ -332,7 +332,7 @@
// ok, my replication chain looks good.
// now for my invalidation chain.
- cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setExposeManagementStatistics(false);
cache.getConfiguration().setCacheMode("INVALIDATION_ASYNC");
chain = getInterceptorChainFactory(cache).buildInterceptorChain();
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -683,7 +683,7 @@
protected CacheSPI<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setClusterName("MyCluster");
cache.getConfiguration().setStateRetrievalTimeout(3000);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -33,7 +33,7 @@
@BeforeMethod
public void setUp() throws Exception
{
- c1 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ c1 = (CacheSPI) new DefaultCacheFactory().createCache(false);
// the FIFO policy cfg
FIFOConfiguration cfg = new FIFOConfiguration();
@@ -59,7 +59,7 @@
c1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c1.getConfiguration().setEvictionConfig(ec);
- c2 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(c1.getConfiguration().clone(), false);
+ c2 = (CacheSPI) new DefaultCacheFactory().createCache(c1.getConfiguration().clone(), false);
c1.start();
c2.start();
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -32,8 +32,8 @@
@BeforeTest
public void setUp()
{
- cache1 = DefaultCacheFactory.getInstance().createCache(false);
- cache2 = DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = new DefaultCacheFactory().createCache(false);
+ cache2 = new DefaultCacheFactory().createCache(false);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -58,7 +58,7 @@
protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
@@ -135,7 +135,7 @@
protected CacheSPI createPessimisticCache() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName("name");
@@ -153,7 +153,7 @@
protected CacheSPI createPessimisticCacheLocal() throws Exception
{
- CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName("name");
@@ -199,7 +199,7 @@
protected CacheSPI<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode, boolean start) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName(name);
@@ -241,7 +241,7 @@
protected CacheSPI<Object, Object> createReplicatedCacheWithLoader(String name, boolean shared, Configuration.CacheMode cacheMode) throws Exception
{
- CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setClusterName(name);
c.setStateRetrievalTimeout(5000);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -32,7 +32,7 @@
@BeforeMethod
public void setUp()
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.start();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionPersistenceTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -30,7 +30,7 @@
public void setUp()
{
- cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache = new DefaultCacheFactory().createCache(false);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/DataVersionTransferTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -29,13 +29,13 @@
public void setUp()
{
- caches.add(DefaultCacheFactory.getInstance().createCache(false));
+ caches.add(new DefaultCacheFactory().createCache(false));
caches.get(0).getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
caches.get(0).getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
caches.get(0).getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
caches.get(0).start();
- caches.add(DefaultCacheFactory.getInstance().createCache(false));
+ caches.add(new DefaultCacheFactory().createCache(false));
caches.get(1).getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
caches.get(1).getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
caches.get(1).getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -46,7 +46,7 @@
{
if (caches != null)
{
- for (Cache cache: caches)
+ for (Cache cache : caches)
{
try
{
@@ -128,7 +128,7 @@
assert n.getData().size() == 1;
}
- public void testStateTransferIntermediateNodeDefaultVersions() throws Exception
+ public void testStateTransferIntermediateNodeDefaultVersions() throws Exception
{
Fqn f = Fqn.fromString("/one/two/three");
Fqn intermediate = f.getParent();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -60,7 +60,7 @@
prev.setNext(dummy);
- InterceptorChainFactory.getInstance().setLastInterceptorPointer(interceptor, dummy);
+ InterceptorChainFactory.setLastInterceptorPointer(interceptor, dummy);
mgr = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -31,12 +31,12 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache1.getConfiguration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
c = cache2.getConfiguration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -55,7 +55,7 @@
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- return (CacheSPI) DefaultCacheFactory.getInstance().createCache(c);
+ return (CacheSPI) new DefaultCacheFactory().createCache(c);
}
@AfterMethod(alwaysRun = true)
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -41,7 +41,7 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
Modified: core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -40,7 +40,7 @@
{
if (cache != null)
tearDown();
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI) instance.createCache(false);
// very short acquisition timeout
cache.getConfiguration().setLockAcquisitionTimeout(100);
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -54,13 +54,13 @@
private void createCaches(NodeLockingScheme scheme, CacheMode mode)
{
- cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache1.getConfiguration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
c = cache2.getConfiguration();
c.setNodeLockingScheme(scheme);
c.setCacheMode(mode);
Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -33,7 +33,7 @@
{
Configuration c = new Configuration();
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(c);
tm = cache.getTransactionManager();
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -43,7 +43,7 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
Configuration c = cache.getConfiguration();
c.setCacheMode("REPL_SYNC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
Modified: core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java 2007-12-19 13:17:43 UTC (rev 4878)
+++ core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java 2007-12-19 15:09:57 UTC (rev 4879)
@@ -42,7 +42,7 @@
Configuration config = new Configuration();
config.setCacheMode(Configuration.CacheMode.LOCAL);
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
+ CacheFactory<String, String> instance = new DefaultCacheFactory();
cache = (CacheSPI<String, String>) instance.createCache(config);
m = cache.getTransactionManager();
}
More information about the jbosscache-commits
mailing list