[jboss-cvs] JBossAS SVN: r106623 - in projects/cluster/ha-server-cache-jbc/trunk/src: main/java/org/jboss/web/tomcat/service/session/distributedcache/impl and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 12 23:12:17 EDT 2010
Author: smarlow at redhat.com
Date: 2010-07-12 23:12:17 -0400 (Mon, 12 Jul 2010)
New Revision: 106623
Removed:
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/PojoCacheManagerManagedPojoCache.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/FieldFqnTestCase.java
Modified:
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManagerMBean.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/TestDistributedCacheManagerFactoryImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/CacheListener.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/Util.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/ha/cachemanager/CacheManagerUnitTestCase.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/CacheListenerUnitTestCase.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManagerUnitTestCase.java
Log:
JBCLUSTER-258 eliminate field oriented methods from web session DistributedCacheManager SPI
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -52,12 +52,7 @@
import org.jboss.cache.notifications.annotation.CacheStopped;
import org.jboss.cache.notifications.event.CacheStartedEvent;
import org.jboss.cache.notifications.event.CacheStoppedEvent;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper;
import org.jboss.ha.framework.server.CacheManagerLocator;
-import org.jboss.ha.framework.server.PojoCacheManager;
-import org.jboss.ha.framework.server.PojoCacheManagerLocator;
import org.jboss.logging.Logger;
import org.jboss.util.naming.NonSerializableFactory;
import org.jgroups.Channel;
@@ -66,27 +61,25 @@
/**
* JBoss AS specific implementation of {@link CacheManager}. Extends the core JBoss Cache
- * cache manager by also handling, PojoCache, by registering created caches
+ * cache manager by also registering created caches
* in JMX, and by registering itself in JNDI.
*
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
* @version $Revision: 1.1 $
*/
public class CacheManager
- implements org.jboss.cache.CacheManager, PojoCacheManager, MBeanRegistration, CacheManagerMBean
+ implements org.jboss.cache.CacheManager, MBeanRegistration, CacheManagerMBean
{
private static final Logger log = Logger.getLogger(CacheManager.class);
public static final String DEFAULT_CORE_CACHE_JMX_ATTRIBUTES = "service=Cache,config=";
- public static final String DEFAULT_POJO_CACHE_JMX_ATTRIBUTES = "service=Cache,cacheType=PojoCache,config=";
-
+
private static final ThreadLocal<Boolean> starting = new ThreadLocal<Boolean>();
private MBeanServer mbeanServer;
private String jmxDomain;
private String coreCacheJmxAttributes = DEFAULT_CORE_CACHE_JMX_ATTRIBUTES;
- private String pojoCacheJmxAttributes = DEFAULT_POJO_CACHE_JMX_ATTRIBUTES;
-
+
private ConfigurationRegistry configRegistry;
private boolean configRegistryInjected;
@@ -97,10 +90,6 @@
private final Map<String, Integer> plainCacheCheckouts = new HashMap<String, Integer>();
- private Map<String, PojoCache> pojoCaches = new HashMap<String, PojoCache>();
-
- private Map<String, Integer> pojoCacheCheckouts = new HashMap<String, Integer>();
-
private Map<String, String> configAliases = new HashMap<String, String>();
private boolean registerCachesInJmx = true;
@@ -143,84 +132,6 @@
this.channelFactory = factory;
}
- // -------------------------------------------------------- PojoCacheManager
-
- public Set<String> getPojoCacheNames()
- {
- synchronized (pojoCaches)
- {
- return new HashSet<String>(pojoCaches.keySet());
- }
- }
-
- public PojoCache getPojoCache(String configName, boolean create) throws Exception
- {
- if (create)
- {
- checkStarted();
- }
-
- // Check if there's an alias involved
- configName = resolveAlias(configName);
-
- PojoCache cache = null;
- synchronized (pojoCaches)
- {
- if (getCacheNames().contains(configName))
- throw new IllegalStateException("Cannot create PojoCache: plain cache already created for config " + configName);
-
- cache = pojoCaches.get(configName);
- if (cache == null && create)
- {
- Configuration config = getConfigurationRegistry().getConfiguration(configName);
- if (getChannelFactory() != null && config.getMultiplexerStack() != null)
- {
- config.getRuntimeConfig().setMuxChannelFactory(getChannelFactory());
- }
- cache = createPojoCache(config);
- registerPojoCache(cache, configName);
- }
- else if (cache != null)
- {
- incrementPojoCacheCheckout(configName);
- }
- }
-
- // Wrap the pojocache to control classloading and disable stop/destroy
- return cache == null ? null : new PojoCacheManagerManagedPojoCache(cache);
- }
-
- public void registerPojoCache(PojoCache cache, String configName)
- {
- checkStarted();
-
- synchronized (pojoCaches)
- {
- if (pojoCaches.containsKey(configName) || getCacheNames().contains(configName))
- throw new IllegalStateException(configName + " already registered");
-
- pojoCaches.put(configName, cache);
- incrementPojoCacheCheckout(configName);
-
- if (registerCachesInJmx && mbeanServer != null)
- {
- String oName = getObjectName(getPojoCacheJmxAttributes(), configName);
- PojoCacheJmxWrapper wrapper = new PojoCacheJmxWrapper(cache);
- try
- {
- mbeanServer.registerMBean(wrapper, new ObjectName(oName));
- }
- catch (JMException e)
- {
- throw new RuntimeException("Cannot register cache under name " + oName, e);
- }
-
- // Synchronize the start/stop of the plain and pojo cache
- cache.getCache().addCacheListener(new StartStopListener(wrapper));
- }
- }
- }
-
// ------------------------------------------------------------ CacheManager
public ChannelFactory getChannelFactory()
@@ -230,13 +141,12 @@
public Set<String> getConfigurationNames()
{
- synchronized (pojoCaches)
+ Set<String> configNames = getPlainCacheConfigurationNames();
+ synchronized(configAliases)
{
- Set<String> configNames = getPlainCacheConfigurationNames();
- configNames.addAll(getPojoCacheNames());
configNames.addAll(configAliases.keySet());
- return configNames;
}
+ return configNames;
}
public Set<String> getCacheNames()
@@ -257,20 +167,8 @@
// Check if there's an alias involved
configName = resolveAlias(configName);
- synchronized (pojoCaches)
+ synchronized (plainCaches)
{
- if (create && pojoCaches.containsKey(configName))
- {
- log.debug("Plain cache requested for config " + configName +
- " but a PojoCache is already registered; returning " +
- " the PojoCache's underlying plain cache");
- PojoCache pc = getPojoCache(configName, false);
- if (pc != null)
- {
- return wrapCache(pc.getCache());
- }
- }
-
return wrapCache(getPlainCache(configName, create));
}
}
@@ -279,11 +177,8 @@
{
checkStarted();
- synchronized (pojoCaches)
+ synchronized (plainCaches)
{
- if (pojoCaches.containsKey(configName))
- throw new IllegalStateException(configName + " already registered");
-
registerPlainCache(cache, configName);
if (registerCachesInJmx && mbeanServer != null)
@@ -300,7 +195,7 @@
throw new RuntimeException("Cannot register cache under name " + oName, e);
}
- // Synchronize the start/stop of the plain and pojo cache
+ // Synchronize the start/stop of the cache
cache.addCacheListener(new StartStopListener(wrapper));
}
}
@@ -311,29 +206,15 @@
// Check if there's an alias involved
configName = resolveAlias(configName);
- synchronized (pojoCaches)
+ synchronized (plainCaches)
{
- if (pojoCaches.containsKey(configName))
+ if (!plainCaches.containsKey(configName))
+ throw new IllegalStateException(configName + " not registered");
+ if (decrementPlainCacheCheckout(configName) == 0)
{
- if (decrementPojoCacheCheckout(configName) == 0)
- {
- PojoCache cache = pojoCaches.remove(configName);
- destroyPojoCache(configName, cache);
- }
+ Cache<Object, Object> cache = plainCaches.remove(configName);
+ destroyPlainCache(cache, configName);
}
- else
- {
- synchronized (plainCaches)
- {
- if (!plainCaches.containsKey(configName))
- throw new IllegalStateException(configName + " not registered");
- if (decrementPlainCacheCheckout(configName) == 0)
- {
- Cache<Object, Object> cache = plainCaches.remove(configName);
- destroyPlainCache(cache, configName);
- }
- };
- }
}
}
@@ -363,10 +244,6 @@
if (locator.getDirectlyRegisteredManager() == null)
locator.registerCacheManager(this);
- PojoCacheManagerLocator pclocator = PojoCacheManagerLocator.getCacheManagerLocator();
- if (pclocator.getDirectlyRegisteredManager() == null)
- pclocator.registerCacheManager(this);
-
// Bind ourself in the public JNDI space if configured to do so
if (jndiName != null)
{
@@ -389,19 +266,7 @@
if (started)
{
releaseEagerStartCaches();
-
-// synchronized (pojoCaches)
-// {
-// for (Iterator<Map.Entry<String, PojoCache>> it = pojoCaches.entrySet().iterator(); it.hasNext();)
-// {
-// Map.Entry<String, PojoCache> entry = it.next();
-// destroyPojoCache(entry.getKey(), entry.getValue());
-// it.remove();
-// }
-// pojoCaches.clear();
-// pojoCacheCheckouts.clear();
-// }
-
+
// synchronized (plainCaches)
// {
// for (Iterator<Map.Entry<String, Cache<Object, Object>>> it = plainCaches.entrySet().iterator(); it.hasNext();)
@@ -460,10 +325,6 @@
if (locator.getDirectlyRegisteredManager() == this)
locator.deregisterCacheManager();
- PojoCacheManagerLocator pclocator = PojoCacheManagerLocator.getCacheManagerLocator();
- if (pclocator.getDirectlyRegisteredManager() == this)
- pclocator.deregisterCacheManager();
-
started = false;
}
}
@@ -506,16 +367,6 @@
this.coreCacheJmxAttributes = coreCacheJmxAttributes;
}
- public String getPojoCacheJmxAttributes()
- {
- return pojoCacheJmxAttributes;
- }
-
- public void setPojoCacheJmxAttributes(String pojoCacheJmxAttributes)
- {
- this.pojoCacheJmxAttributes = pojoCacheJmxAttributes;
- }
-
public boolean getRegisterCachesInJmx()
{
return registerCachesInJmx;
@@ -566,19 +417,7 @@
}
}
- public void setEagerStartPojoCaches(Set<String> configNames)
- {
- if (configNames != null)
- {
- for (String name : configNames)
- {
- startupCaches.put(name, Boolean.TRUE);
- }
- }
- }
-
-
-
+
// ------------------------------------------------------ MBeanRegistration
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
@@ -609,19 +448,6 @@
// -------------------------------------------------------------- Protected
- /**
- * Extension point for subclasses, where we actually use a
- * {@link PojoCacheFactory} to create a PojoCache.
- *
- * @param config the Configuration for the cache
- * @return the PojoCache
- */
- protected PojoCache createPojoCache(Configuration config) throws Exception
- {
- PojoCache pc = PojoCacheFactory.createCache(config, false);
- configureMuxUpHandlerChannel(pc.getCache());
- return pc;
- }
/**
* Extension point for subclasses, where we actually use a
@@ -754,70 +580,13 @@
}
/**
- * Wrap the pojocache to control classloading and disable stop/destroy
+ * Wrap the cache to control classloading and disable stop/destroy
*/
private Cache<Object, Object> wrapCache(Cache<Object, Object> toWrap)
{
return toWrap == null ? null : new CacheManagerManagedCache<Object, Object>(toWrap);
}
- private int incrementPojoCacheCheckout(String configName)
- {
- synchronized (pojoCacheCheckouts)
- {
- Integer count = pojoCacheCheckouts.get(configName);
- if (count == null)
- count = Integer.valueOf(0);
- Integer newVal = Integer.valueOf(count.intValue() + 1);
- pojoCacheCheckouts.put(configName, newVal);
- return newVal.intValue();
- }
- }
-
- private int decrementPojoCacheCheckout(String configName)
- {
- synchronized (pojoCacheCheckouts)
- {
- Integer count = pojoCacheCheckouts.get(configName);
- if (count == null || count.intValue() < 1)
- throw new IllegalStateException("invalid count of " + count + " for " + configName);
-
- Integer newVal = Integer.valueOf(count.intValue() - 1);
- pojoCacheCheckouts.put(configName, newVal);
- return newVal.intValue();
- }
- }
-
- private void destroyPojoCache(String configName, PojoCache pojoCache)
- {
- Cache<Object, Object> cache = pojoCache.getCache();
- if (cache.getCacheStatus() == CacheStatus.STARTED)
- {
- pojoCache.stop();
- }
- if (cache.getCacheStatus() != CacheStatus.DESTROYED && cache.getCacheStatus() != CacheStatus.INSTANTIATED)
- {
- pojoCache.destroy();
- }
-
- if (registerCachesInJmx && mbeanServer != null)
- {
- String oNameStr = getObjectName(getPojoCacheJmxAttributes(), configName);
- try
- {
- ObjectName oName = new ObjectName(oNameStr);
- if (mbeanServer.isRegistered(oName))
- {
- mbeanServer.unregisterMBean(oName);
- }
- }
- catch (JMException e)
- {
- log.error("Problem unregistering PojoCacheJmxWrapper " + oNameStr, e);
- }
- }
- }
-
private String getObjectName(String attributesBase, String configName)
{
String base = getJmxDomain() == null ? "" : getJmxDomain();
@@ -866,39 +635,23 @@
public static class StartStopListener
{
private final org.jboss.cache.jmx.CacheJmxWrapper<Object, Object> plainWrapper;
- private final PojoCacheJmxWrapper pojoWrapper;
-
+
private StartStopListener(org.jboss.cache.jmx.CacheJmxWrapper<Object, Object> wrapper)
{
assert wrapper != null : "wrapper is null";
this.plainWrapper = wrapper;
- this.pojoWrapper = null;
}
- private StartStopListener(PojoCacheJmxWrapper wrapper)
- {
- assert wrapper != null : "wrapper is null";
- this.pojoWrapper = wrapper;
- this.plainWrapper = null;
- }
-
@CacheStarted
public void cacheStarted(CacheStartedEvent event)
{
- if (plainWrapper != null)
- plainWrapper.start();
- else
- pojoWrapper.start();
+ plainWrapper.start();
}
@CacheStopped
public void cacheStopped(CacheStoppedEvent event)
{
- if (plainWrapper != null)
- plainWrapper.stop();
- else
- pojoWrapper.stop();
-
+ plainWrapper.stop();
}
}
@@ -950,15 +703,7 @@
for (Map.Entry<String, Boolean> entry : startupCaches.entrySet())
{
Cache<Object, Object> cache = null;
- if (entry.getValue().booleanValue())
- {
- PojoCache pc = getPojoCache(entry.getKey(), true);
- cache = pc.getCache();
- }
- else
- {
- cache = getCache(entry.getKey(), true);
- }
+ cache = getCache(entry.getKey(), true);
if (cache.getCacheStatus() != CacheStatus.STARTED)
{
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManagerMBean.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManagerMBean.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManagerMBean.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -34,8 +34,6 @@
{
String getJmxDomain();
String getCoreCacheJmxAttributes();
- String getPojoCacheJmxAttributes();
- Set<String> getPojoCacheNames();
Set<String> getCacheNames();
Set<String> getConfigurationNames();
boolean getRegisterCachesInJmx();
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/PojoCacheManagerManagedPojoCache.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/PojoCacheManagerManagedPojoCache.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/PojoCacheManagerManagedPojoCache.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -1,230 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ha.cachemanager;
-
-import java.security.AccessController;
-import java.util.Collection;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheException;
-import org.jboss.cache.pojo.PojoCacheThreadContext;
-import org.jboss.cache.pojo.Reference;
-import org.jboss.logging.Logger;
-import org.jboss.util.loading.ContextClassLoaderSwitcher;
-
-/**
- * Wrapper around a PojoCache that 1) ensures the calling thread's TCCL doesn't
- * leak to cache threads via calls to create/start; and 2) logs WARNS about calls
- * to stop/destroy as these should be handled by the PojoCacheManager.
- *
- * TODO disable calls to stop/destroy once testsuite cleanup code is fixed
- * to not call those methods.
- *
- * @author Brian Stansberry
- *
- */
-class PojoCacheManagerManagedPojoCache implements PojoCache
-{
- private static final Logger log = Logger.getLogger(PojoCacheManagerManagedPojoCache.class);
-
- private final PojoCache delegate;
- private final ContextClassLoaderSwitcher switcher;
-
- PojoCacheManagerManagedPojoCache(PojoCache delegate)
- {
- assert delegate != null : "delegate is null";
- this.delegate = delegate;
- @SuppressWarnings("unchecked")
- ContextClassLoaderSwitcher unchecked = (ContextClassLoaderSwitcher) AccessController.doPrivileged(ContextClassLoaderSwitcher.INSTANTIATOR);
- this.switcher = unchecked;
- }
-
- /**
- * Switches the TCCL to the delegate's classloader before calling create()
- * on the delegate.
- */
- public void create() throws CacheException
- {
- ContextClassLoaderSwitcher.SwitchContext switchContext = switcher.getSwitchContext();
- try
- {
- switchContext.setClassLoader(delegate.getClass().getClassLoader());
- delegate.create();
- }
- finally
- {
- switchContext.reset();
- }
- }
-
- /**
- * Switches the TCCL to the delegate's classloader before calling start()
- * on the delegate.
- */
- public void start() throws CacheException
- {
- ContextClassLoaderSwitcher.SwitchContext switchContext = switcher.getSwitchContext();
- try
- {
- switchContext.setClassLoader(delegate.getClass().getClassLoader());
- delegate.start();
- }
- finally
- {
- switchContext.reset();
- }
- }
-
- /**
- * TODO: Log a WARN and do nothing else; currently logs and then calls
- * through to delegate.
- */
- public void stop() throws PojoCacheException
- {
- log.warn("stop() should not be directly called on caches obtained from a PojoCacheManager -- use CacheManager.releaseCache()",
- new UnsupportedOperationException("stop() is not supported"));
- delegate.stop();
- }
-
- /**
- * TODO: Log a WARN and do nothing else; currently logs and then calls
- * through to delegate.
- */
- public void destroy() throws PojoCacheException
- {
- log.warn("destroy() should not be directly called on caches obtained from a PojoCacheManager -- use CacheManager.releaseCache()",
- new UnsupportedOperationException("destroy() is not supported"));
- delegate.destroy();
- }
-
- public void addListener(Object arg0)
- {
- delegate.addListener(arg0);
- }
-
- public void addListener(Object arg0, Pattern arg1)
- {
- delegate.addListener(arg0, arg1);
- }
-
- public Object attach(String arg0, Object arg1) throws PojoCacheException
- {
- return delegate.attach(arg0, arg1);
- }
-
- public Object attach(Fqn<?> arg0, Object arg1) throws PojoCacheException
- {
- return delegate.attach(arg0, arg1);
- }
-
- public Object detach(String arg0) throws PojoCacheException
- {
- return delegate.detach(arg0);
- }
-
- public Object detach(Fqn<?> arg0) throws PojoCacheException
- {
- return delegate.detach(arg0);
- }
-
- public boolean exists(Fqn<?> arg0)
- {
- return delegate.exists(arg0);
- }
-
- public Object find(String arg0) throws PojoCacheException
- {
- return delegate.find(arg0);
- }
-
- public Object find(Fqn<?> arg0) throws PojoCacheException
- {
- return delegate.find(arg0);
- }
-
- public Map<Fqn<?>, Object> findAll(String arg0) throws PojoCacheException
- {
- return delegate.findAll(arg0);
- }
-
- public Map<Fqn<?>, Object> findAll(Fqn<?> arg0) throws PojoCacheException
- {
- return delegate.findAll(arg0);
- }
-
- public Cache<Object, Object> getCache()
- {
- Cache<Object, Object> c = delegate.getCache();
- return c == null ? null : new CacheManagerManagedCache<Object, Object>(c);
- }
-
- public Fqn<?> getInternalFqn(Object arg0)
- {
- return delegate.getInternalFqn(arg0);
- }
-
- public Collection<Reference> getReferences(Object arg0)
- {
- return delegate.getReferences(arg0);
- }
-
- public Collection<Object> getListeners()
- {
- return delegate.getListeners();
- }
-
- public PojoCacheThreadContext getThreadContext()
- {
- return delegate.getThreadContext();
- }
-
- public void removeListener(Object arg0)
- {
- delegate.removeListener(arg0);
- }
-
- // -------------------------------------------------------------- Overrides
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof PojoCacheManagerManagedPojoCache)
- {
- PojoCacheManagerManagedPojoCache other = (PojoCacheManagerManagedPojoCache) obj;
- return delegate.equals(other.delegate);
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return delegate.hashCode();
- }
-
-}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -29,14 +29,11 @@
import javax.management.ObjectName;
import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper;
-import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean;
+import org.jboss.cache.jmx.CacheJmxWrapper;
import org.jboss.metadata.web.jboss.ReplicationGranularity;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.AttributeBasedJBossCacheService;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.FieldBasedJBossCacheService;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.SessionBasedJBossCacheService;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.Util;
import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
@@ -68,9 +65,7 @@
org.jboss.cache.transaction.BatchModeTransactionManagerLookup.class.getName();
private TomcatClusterConfig tomcatConfig;
- private boolean pojoCacheLocal = false;
-
- private PojoCache pojoCache;
+ private boolean cacheLocal = false;
private Cache<Object, Object> plainCache;
@SuppressWarnings("unchecked")
@@ -84,8 +79,6 @@
return plainCache == null? new SessionBasedJBossCacheService(localManager) : new SessionBasedJBossCacheService(localManager, plainCache);
case ATTRIBUTE:
return plainCache == null? new AttributeBasedJBossCacheService(localManager) : new AttributeBasedJBossCacheService(localManager, plainCache);
- case FIELD:
- return pojoCache == null? new FieldBasedJBossCacheService(localManager) : new FieldBasedJBossCacheService(localManager, pojoCache);
default:
throw new IllegalStateException("Unknown ReplicationGranularity " + granularity);
}
@@ -105,40 +98,25 @@
{
if (tomcatConfig != null)
{
- initializePojoCache();
+ initializeCache();
}
}
public void stop() throws Exception
{
- if (pojoCache != null)
+ if (plainCache != null)
{
- pojoCache.stop();
- pojoCache.destroy();
-
- if (pojoCacheLocal && tomcatConfig.getMBeanServer() != null && tomcatConfig.getCacheObjectName() != null)
+ plainCache.stop();
+ plainCache.destroy();
+
+ if (cacheLocal && tomcatConfig.getMBeanServer() != null && tomcatConfig.getCacheObjectName() != null)
{
tomcatConfig.getMBeanServer().unregisterMBean(new ObjectName(tomcatConfig.getCacheObjectName()));
}
- }
- }
+ }
- public PojoCache getPojoCache()
- {
- return pojoCache;
}
- /**
- * Hook for test fixtures to inject a PojoCache, which if present will
- * be used to create the DistributedCacheManager in preference to any
- * passed <code>cacheConfigName</code>.
- */
- public void setPojoCache(PojoCache pojoCache)
- {
- this.pojoCache = pojoCache;
- this.plainCache = pojoCache.getCache();
- }
-
public Cache<Object, Object> getPlainCache()
{
return plainCache;
@@ -152,7 +130,6 @@
public void setPlainCache(Cache<Object, Object> plainCache)
{
this.plainCache = plainCache;
- this.pojoCache = null;
}
/**
@@ -161,26 +138,25 @@
public void clearCaches()
{
this.plainCache = null;
- this.pojoCache = null;
}
/**
- * Gets our PojCache, either from a local reference or the JMX
+ * Gets our Cache, either from a local reference or the JMX
* server. If one is not found, creates and configures it.
*/
- private void initializePojoCache() throws Exception
+ private void initializeCache() throws Exception
{
- if (pojoCache == null) {
+ if (plainCache == null) {
- PojoCacheJmxWrapperMBean pcWrapper = null;
+ CacheJmxWrapper pcWrapper = null;
MBeanServer server = tomcatConfig.getMBeanServer();
String cfgName = tomcatConfig.getCacheObjectName();
ObjectName objName = cfgName == null ? null : new ObjectName(tomcatConfig.getCacheObjectName());
if (server != null && objName != null && server.isRegistered(objName))
{
// Get a proxy to the existing TreeCache
- pcWrapper = ((PojoCacheJmxWrapperMBean)
- MBeanServerInvocationHandler.newProxyInstance(server, objName, PojoCacheJmxWrapperMBean.class, false));
+ pcWrapper = ((CacheJmxWrapper)
+ MBeanServerInvocationHandler.newProxyInstance(server, objName, CacheJmxWrapper.class, false));
}
else
{
@@ -190,14 +166,14 @@
if (configFile != null)
{
- pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(configFile.getAbsolutePath(), false));
+ pcWrapper = new CacheJmxWrapper(DefaultCacheFactory.getInstance().createCache(configFile.getAbsolutePath(), false));
if (clusterName != null)
{
// Override the XML config with the name provided in
// server.xml. Method setClusterName is specified in the
// Cluster interface, otherwise we would not do this
- pcWrapper.getPojoCache().getCache().getConfiguration().setClusterName(clusterName);
+ pcWrapper.getCache().getConfiguration().setClusterName(clusterName);
}
}
else
@@ -213,8 +189,8 @@
config.setCacheMode(DEFAULT_CACHE_MODE);
config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
-
- pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(config, false));
+ pcWrapper = new CacheJmxWrapper(DefaultCacheFactory.getInstance().createCache(config, false));
+
}
if (server != null && objName != null)
@@ -222,11 +198,11 @@
server.registerMBean(pcWrapper, objName);
}
- pojoCacheLocal = true;
+ cacheLocal = true;
}
-
- setPojoCache(pcWrapper.getPojoCache());
+ setPlainCache(pcWrapper.getCache());
}
}
+
}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/TestDistributedCacheManagerFactoryImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/TestDistributedCacheManagerFactoryImpl.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/TestDistributedCacheManagerFactoryImpl.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -25,7 +25,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.cache.Cache;
import org.jboss.cache.CacheStatus;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.buddyreplication.NextMemberBuddyLocatorConfig;
import org.jboss.cache.config.BuddyReplicationConfig;
@@ -36,8 +38,6 @@
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.loader.FileCacheLoaderConfig;
import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.transaction.BatchModeTransactionManagerLookup;
import org.jboss.logging.Logger;
import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
@@ -62,8 +62,8 @@
public void configure(boolean local, String passivationDir, boolean totalReplication, boolean marshalling,
boolean purgeCacheLoader)
{
- PojoCache pc = createCache(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
- delegate.setPojoCache(pc);
+ Cache pc = createCache(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
+ delegate.setPlainCache(pc);
}
@SuppressWarnings("unchecked")
@@ -75,18 +75,18 @@
public void cleanup(boolean doRemove)
{
- PojoCache cache = delegate.getPojoCache();
+ Cache cache = delegate.getPlainCache();
if (cache == null)
return;
- if (doRemove && CacheStatus.STARTED.equals(cache.getCache().getCacheStatus()))
+ if (doRemove && CacheStatus.STARTED.equals(cache.getCacheStatus()))
{
// Try to clean up so we avoid loading sessions
// from storage in later tests
try
{
- log.info("Removing /JSESSION from " + cache.getCache().getLocalAddress());
- cache.getCache().removeNode(Fqn.fromString("/JSESSION"));
+ log.info("Removing /JSESSION from " + cache.getLocalAddress());
+ cache.removeNode(Fqn.fromString("/JSESSION"));
}
catch (Exception e)
{
@@ -109,11 +109,11 @@
- private static PojoCache createCache(boolean local, String passivationDir,
+ private static Cache createCache(boolean local, String passivationDir,
boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
{
Configuration cfg = getConfiguration(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
- return PojoCacheFactory.createCache(cfg, true);
+ return DefaultCacheFactory.getInstance().createCache(cfg, true);
}
private static Configuration getConfiguration(boolean local, String passivationDir,
@@ -181,14 +181,14 @@
public Object getLocalAddress()
{
- PojoCache pc = delegate.getPojoCache();
- return pc == null ? null : pc.getCache().getLocalAddress();
+ Cache pc = delegate.getPlainCache();
+ return pc == null ? null : pc.getLocalAddress();
}
public List<Object> getMembers()
{
- PojoCache pc = delegate.getPojoCache();
- return pc == null ? null : new ArrayList<Object>(pc.getCache().getMembers());
+ Cache pc = delegate.getPlainCache();
+ return pc == null ? null : new ArrayList<Object>(pc.getMembers());
}
}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -45,7 +45,6 @@
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.pojo.impl.InternalConstant;
import org.jboss.cache.transaction.BatchModeTransactionManager;
import org.jboss.ha.framework.server.MarshalledValueHelper;
import org.jboss.ha.framework.server.SimpleCachableMarshalledValue;
@@ -107,8 +106,7 @@
protected Logger log_ = Logger.getLogger(getClass());
private CacheManager cacheManager_;
- // FIXME make private when FieldBasedJBossCacheService is gone
- protected Cache<Object, Object> plainCache_;
+ private Cache<Object, Object> plainCache_;
/** Context path for webapp + hostName; this + session id is a unique combo. */
protected String combinedPath_;
@@ -705,10 +703,7 @@
{
for (String id : ids)
{
- if (!InternalConstant.JBOSS_INTERNAL_STRING.equals(id))
- {
- map.put(id, owner);
- }
+ map.put(id, owner);
}
}
}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/CacheListener.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/CacheListener.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/CacheListener.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -89,16 +89,7 @@
String sessId = getIdFromFqn(fqn, baseIdx);
manager_.notifyRemoteInvalidation(sessId);
}
- else if (local && !isBuddy
- && isPossibleInternalPojoFqn(fqn, baseIdx)
- && isFqnForOurWebapp(fqn, baseIdx))
- {
- // One of our sessions' pojos is modified; need to inform
- // the manager so it can mark the session dirty
- String sessId = getIdFromFqn(fqn, baseIdx);
- manager_.notifyLocalAttributeModification(sessId);
- }
- }
+ }
@NodeModified
@@ -162,82 +153,6 @@
log_.warn("No version attribute found in " + fqn);
}
}
- else if (local && !isBuddy
- && isPossibleInternalPojoFqn(fqn, baseIdx)
- && isFqnForOurWebapp(fqn, baseIdx))
- {
- // One of our sessions' pojos is modified; need to inform
- // the manager so it can mark the session dirty
- String sessId = getIdFromFqn(fqn, baseIdx);
- manager_.notifyLocalAttributeModification(sessId);
- }
}
-
- public static String getPojoKeyFromFqn(Fqn<String> fqn, int jsessionIndex)
- {
- return (String) fqn.get(jsessionIndex + POJO_KEY_FQN_INDEX);
- }
- @Deprecated
- public static String getPojoKeyFromFqn(Fqn<String> fqn, boolean isBuddy)
- {
- int index = Util.getJSessionIndex(fqn, isBuddy);
- return getPojoKeyFromFqn(fqn, index);
- }
-
- /**
- * Check if the fqn is big enough to be in the internal pojo area but
- * isn't in the regular attribute area.
- *
- * Structure in the cache is:
- *
- * /JSESSION
- * ++ /contextPath_hostname
- * ++++ /sessionid
- * ++++++ /ATTRIBUTE
- * ++++++ /_JBossInternal_
- * ++++++++ etc etc
- *
- * If the Fqn size is big enough to be "etc etc" or lower, but the 4th
- * level is not "ATTRIBUTE", it must be under _JBossInternal_. We discriminate
- * based on != ATTRIBUTE to avoid having to code to the internal PojoCache
- * _JBossInternal_ name.
- *
- * @param fqn the
- * @param
- * @return
- */
- public static boolean isPossibleInternalPojoFqn(Fqn<String> fqn, int jsessionIndex)
- {
- return (jsessionIndex > -1 && fqn.size() > jsessionIndex + POJO_INTERNAL_FQN_SIZE
- && FieldBasedJBossCacheService.ATTRIBUTE.equals(fqn.get(jsessionIndex + POJO_INTERNAL_FQN_INDEX)) == false);
- }
-
- /**
- * Check if the fqn is big enough to be in the internal pojo area but
- * isn't in the regular attribute area.
- *
- * Structure in the cache is:
- *
- * /JSESSION
- * ++ /contextPath_hostname
- * ++++ /sessionid
- * ++++++ /ATTRIBUTE
- * ++++++ /_JBossInternal_
- * ++++++++ etc etc
- *
- * If the Fqn size is big enough to be "etc etc" or lower, but the 4th
- * level is not "ATTRIBUTE", it must be under _JBossInternal_. We discriminate
- * based on != ATTRIBUTE to avoid having to code to the internal PojoCache
- * _JBossInternal_ name.
- *
- * @param fqn
- * @return
- */
- @Deprecated
- public static boolean isPossibleInternalPojoFqn(Fqn<String> fqn)
- {
- int index = Util.getJSessionIndex(fqn, false);
- return isPossibleInternalPojoFqn(fqn, index);
- }
}
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -1,313 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.web.tomcat.service.session.distributedcache.impl.jbc;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.ha.framework.server.PojoCacheManager;
-import org.jboss.ha.framework.server.PojoCacheManagerLocator;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
-
-/**
- * DistributedCacheManager impl for ReplicationGranularity.FIELD.
- *
- * @author Brian Stansberry *
- */
-public class FieldBasedJBossCacheService extends AbstractJBossCacheService<OutgoingDistributableSessionData>
-{
- public static final String ATTRIBUTE = "ATTRIBUTE";
-
- public static Fqn<String> getAttributeFqn(String contextHostPath, String sessionId)
- {
- return Fqn.fromElements(SESSION, contextHostPath, sessionId, ATTRIBUTE);
- }
-
- public static Fqn<String> getFieldFqn(String contextHostPath, String sessionId, String attributeKey)
- {
- StringTokenizer token = new StringTokenizer(attributeKey, FQN_DELIMITER);
- int count = token.countTokens();
- if (count == 1)
- {
- return Fqn.fromElements(SESSION, contextHostPath, sessionId, ATTRIBUTE, attributeKey);
- }
- else
- {
- String[] args = new String[4 + count];
- args[0] = SESSION;
- args[1] = contextHostPath;
- args[2] = sessionId;
- args[3] = ATTRIBUTE;
- for (int i = 0; i < count; i++)
- {
- args[4 + i] = token.nextToken();
- }
- return Fqn.fromElements(args);
- }
- }
-
- private PojoCacheManager pojoCacheManager_;
- private PojoCache pojoCache_;
-
- public FieldBasedJBossCacheService(LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException
- {
- super(localManager);
- }
-
- /**
- * Create a new FieldBasedJBossCacheService.
- *
- * @param cache
- */
- public FieldBasedJBossCacheService(LocalDistributableSessionManager localManager, PojoCache cache)
- {
- super(localManager, cache.getCache());
- this.pojoCache_ = cache;
- }
-
- public boolean getSupportsAttributeOperations()
- {
- return true;
- }
-
- public void putAttribute(String realId, String key, Object value)
- {
- if(log_.isTraceEnabled())
- {
- log_.trace("putAttribute(): session id: " + Util.maskId(realId) + " key: " + key +
- " object: " + value.toString());
- }
-
- Fqn<String> fqn = getFieldFqn(combinedPath_, realId, key);
- try
- {
- pojoCache_.attach(fqn.toString(), value);
- }
- catch (CacheException e)
- {
- throw new RuntimeException("Exception occurred in PojoCache attach " +
- "for session + " + Util.maskId(realId) + " key" + key, e);
- }
- }
-
- /**
- * Remove pojo from the underlying cache store.
- * @param realId the session id with any jvmRoute removed
- * @param key the attribute key
- * @return pojo that just removed. Null if there none.
- */
- public Object removeAttribute(String realId, String key)
- {
- if(log_.isTraceEnabled())
- {
- log_.trace("removeAttribute(): session id: " + Util.maskId(realId) + " key: " +key);
- }
- // Construct the fqn.
- Fqn<String> fqn = getFieldFqn(combinedPath_, realId, key);
- try {
- return pojoCache_.detach(fqn.toString());
- }
- catch (CacheException e)
- {
- throw new RuntimeException("Exception occurred in PojoCache detach ... ", e);
- }
- }
-
- public void removeAttributeLocal(String realId, String key)
- {
- if(log_.isTraceEnabled())
- {
- log_.trace("removeAttributeLocal(): session id: " + Util.maskId(realId) + " key: " +key);
- }
-
- Fqn<String> fqn = getFieldFqn(combinedPath_, realId, key);
- cacheWrapper_.removeLocal(fqn);
- }
-
- public Set<String> getAttributeKeys(String realId)
- {
- Set<String> keys = null;
- Fqn<String> fqn = getAttributeFqn(combinedPath_, realId);
- try
- {
- keys = getChildrenNames(fqn);
- }
- catch (CacheException e)
- {
- log_.error("getAttributeKeys(): Exception getting keys for session " + Util.maskId(realId), e);
- }
-
- return keys;
- }
-
-
- /**
- *
- * @param realId the session id with any jvmRoute removed
- * @param key the attribute key
- * @return Pojo that is associated with the attribute
- */
- public Object getAttribute(String realId, String key)
- {
- Fqn<String> fqn = getFieldFqn(combinedPath_, realId, key);
- if(log_.isTraceEnabled())
- {
- log_.trace("getAttribute(): session id: " + Util.maskId(realId) + " key: " + key +
- " parent fqn: " + fqn.getParent());
- }
-
- try
- {
- return pojoCache_.find(fqn);
- }
- catch (CacheException e)
- {
- throw new RuntimeException("Exception occurred in PojoCache find ... ", e);
- }
- }
-
- public void sessionCreated(String realId)
- {
- Fqn<String> fqn = getSessionFqn(combinedPath_, realId);
- setupSessionRegion(fqn);
- }
-
-
- @Override
- protected void establishCacheManager() throws ClusteringNotSupportedException
- {
- this.pojoCacheManager_ = Util.findPojoCacheManager();
- }
-
- @Override
- protected void obtainCacheFromManager()
- {
- if (this.pojoCacheManager_ == null)
- {
- throw new IllegalStateException("No PojoCacheManager available");
- }
- if (this.cacheConfigName_ == null)
- {
- throw new IllegalStateException("No cache configuration name available");
- }
- this.pojoCache_ = Util.findPojoCache(this.cacheConfigName_, this.pojoCacheManager_);
- this.plainCache_ = this.pojoCache_.getCache();
- }
-
- @Override
- protected void establishCache()
- {
- super.establishCache();
- if (!isMarshallingAvailable())
- {
- // BES 16/8/2006 -- throw ISE, not ClusteringNotSupportedException, as a
- // misconfig should be treated differently from the absence of clustering
- // services
- throw new IllegalStateException("replication-granularity value is set to " +
- "'FIELD' but is not supported by the cache service configuration. " +
- "Must set 'useRegionBasedMarshalling' to 'true' in the cache configuration");
- }
- }
-
- @Override
- protected void setupSessionRegion(Fqn<String> fqn)
- {
- getCache().getRegion(fqn, true);
- if (log_.isTraceEnabled())
- {
- String id = Util.maskId(fqn.getLastElementAsString());
- log_.trace("Created region for session " + id + " under parent fqn " + fqn.getParent());
- }
- }
-
- @Override
- protected void removeSessionRegion(String realId, Fqn<String> fqn)
- {
- getCache().removeRegion(fqn);
- if (log_.isTraceEnabled())
- {
- log_.trace("Removed region for session + " + Util.maskId(realId) +
- " under parent fqn " + fqn.getParent());
- }
- }
-
- @Override
- protected void releaseCacheToManager(String cacheConfigName)
- {
- try
- {
- this.pojoCacheManager_.releaseCache(cacheConfigName);
- }
- catch (Exception e)
- {
- log_.error("Problem releasing cache to CacheManager -- config is " + cacheConfigName, e);
- }
- finally
- {
- this.plainCache_ = null;
- this.pojoCache_ = null;
- }
- }
-
- public Map<String, Object> getAttributes(String realId)
- {
- Map<String, Object> attrs = new HashMap<String, Object>();
- Set<String> keys = getAttributeKeys(realId);
- for (String key : keys)
- {
- attrs.put(key, getAttribute(realId, key));
- }
- return attrs;
- }
-
- public void putAttribute(String realId, Map<String, Object> map)
- {
- for (Map.Entry<String, Object> entry : map.entrySet())
- {
- putAttribute(realId, entry.getKey(), entry.getValue());
- }
- }
-
- /**
- * Overrides the superclass to pull in attributes via PojoCache API.
- */
- @Override
- protected Map<String, Object> getSessionAttributes(String realId, Map<Object, Object> distributedCacheData)
- {
- return getAttributes(realId);
- }
-
- @Override
- protected void storeSessionAttributes(Map<Object, Object> dataMap, OutgoingDistributableSessionData sessionData)
- {
- // no-op; attributes are stored individually
- }
-
-}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/Util.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/Util.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/Util.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -27,10 +27,7 @@
import org.jboss.cache.CacheManager;
import org.jboss.cache.Fqn;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.pojo.PojoCache;
import org.jboss.ha.framework.server.CacheManagerLocator;
-import org.jboss.ha.framework.server.PojoCacheManager;
-import org.jboss.ha.framework.server.PojoCacheManagerLocator;
import org.jboss.metadata.web.jboss.ReplicationConfig;
import org.jboss.metadata.web.jboss.ReplicationGranularity;
import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
@@ -61,53 +58,6 @@
}
/**
- * Gets a pojo cache with the named configuration
- *
- * @param cacheConfigName the name of the configuration
- * @return the cache
- * @throws ClusteringNotSupportedException
- *
- * @deprecated use {@link #findPojoCache(String, PojoCacheManager)
- */
- @Deprecated
- public static PojoCache findPojoCache(String cacheConfigName) throws ClusteringNotSupportedException
- {
- PojoCacheManager pcm = getManagerForPojoCache(cacheConfigName);
-
- try
- {
- return pcm.getPojoCache(cacheConfigName, true);
- }
- catch (RuntimeException re)
- {
- throw re;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Problem accessing cache " + cacheConfigName, e);
- }
- }
-
- public static PojoCache findPojoCache(String cacheConfigName, PojoCacheManager pcm)
- {
- if (!pcm.getConfigurationNames().contains(cacheConfigName))
- throw new IllegalStateException("PojoCacheManager does not recognize config " + cacheConfigName);
-
- try
- {
- return pcm.getPojoCache(cacheConfigName, true);
- }
- catch (RuntimeException re)
- {
- throw re;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Problem accessing cache " + cacheConfigName, e);
- }
- }
-
- /**
* Gets a plain cache with the named configuration
*
* @param cacheConfigName the name of the configuration
@@ -154,18 +104,7 @@
}
}
- public static PojoCacheManager findPojoCacheManager() throws ClusteringNotSupportedException
- {
- try
- {
- return PojoCacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
- }
- catch (Throwable t)
- {
- throw new ClusteringNotSupportedException("Could not access CacheManager for JBossWeb clustering", t);
- }
- }
-
+
public static CacheManager findPlainCacheManager() throws ClusteringNotSupportedException
{
try
@@ -178,28 +117,9 @@
}
}
- private static PojoCacheManager getManagerForPojoCache(String cacheConfigName)
+ private static CacheManager getManagerForCache(String cacheConfigName)
throws ClusteringNotSupportedException
{
- PojoCacheManager pcm = null;
- try
- {
- pcm = PojoCacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
- }
- catch (Throwable t)
- {
- throw new ClusteringNotSupportedException("Could not access PojoCacheManager for JBossWeb clustering", t);
- }
-
- if (!pcm.getConfigurationNames().contains(cacheConfigName))
- throw new IllegalStateException("PojoCacheManager does not recognize config " + cacheConfigName);
-
- return pcm;
- }
-
- private static CacheManager getManagerForCache(String cacheConfigName)
- throws ClusteringNotSupportedException
- {
CacheManager cm = null;
try
{
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -53,7 +53,6 @@
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.notifications.event.NodeRemovedEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
-import org.jboss.cache.pojo.PojoCache;
import org.jboss.ha.framework.server.CacheManagerLocator;
import org.jboss.logging.Logger;
import org.jboss.util.NestedRuntimeException;
@@ -1175,14 +1174,8 @@
MBeanAttributeInfo[] attrs = info.getAttributes();
for (MBeanAttributeInfo attr : attrs)
{
- // Determine if our cache is a PojoCache or a plain Cache
- if ("PojoCache".equals(attr.getName()))
+ if ("Cache".equals(attr.getName()))
{
- cache = ((PojoCache) getMBeanServer().getAttribute(cacheObjectName, "PojoCache")).getCache();
- break;
- }
- else if ("Cache".equals(attr.getName()))
- {
@SuppressWarnings("unchecked")
Cache<Object, Object> unchecked = (Cache<Object, Object>) getMBeanServer().getAttribute(cacheObjectName, "Cache");
cache = unchecked;
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/ha/cachemanager/CacheManagerUnitTestCase.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/ha/cachemanager/CacheManagerUnitTestCase.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/ha/cachemanager/CacheManagerUnitTestCase.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -19,9 +19,7 @@
import org.jboss.cache.CacheStatus;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationRegistry;
-import org.jboss.cache.pojo.PojoCache;
import org.jboss.ha.framework.server.CacheManagerLocator;
-import org.jboss.ha.framework.server.PojoCacheManagerLocator;
import org.jgroups.JChannelFactory;
/**
@@ -54,7 +52,6 @@
caches.clear();
CacheManagerLocator.getCacheManagerLocator().deregisterCacheManager();
- PojoCacheManagerLocator.getCacheManagerLocator().deregisterCacheManager();
}
/**
@@ -246,8 +243,6 @@
assertEquals(0, registry.getCacheNames().size());
- assertEquals(0, registry.getPojoCacheNames().size());
-
Map<String, String> aliases = new HashMap<String, String>();
aliases.put("alias", DEFAULT_CONFIG);
registry.setConfigAliases(aliases);
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/CacheListenerUnitTestCase.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/CacheListenerUnitTestCase.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/CacheListenerUnitTestCase.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -29,7 +29,6 @@
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.AbstractJBossCacheService;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.CacheListener;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.CacheListenerBase;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.FieldBasedJBossCacheService;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.SessionBasedJBossCacheService;
import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.Util;
@@ -96,24 +95,11 @@
test = BUDDY_BASE;
idx = Util.getJSessionIndex(test, true);
assertTrue("Buddy session root correct", CacheListenerBase.isFqnSessionRootSized(test, idx));
-
- test = Fqn.fromRelativeElements(BASE, FieldBasedJBossCacheService.ATTRIBUTE);
- idx = Util.getJSessionIndex(test, false);
- assertFalse("Non-buddy non-session root correct", CacheListenerBase.isFqnSessionRootSized(test, idx));
-
- test = BUDDY_BASE;
- test = Fqn.fromRelativeElements(test, FieldBasedJBossCacheService.ATTRIBUTE);
- idx = Util.getJSessionIndex(test, true);
- assertFalse("Buddy non-session root correct", CacheListenerBase.isFqnSessionRootSized(test, idx));
-
+
test = DEAD_BUDDY_BASE;
idx = Util.getJSessionIndex(test, true);
assertTrue("Buddy session root correct", CacheListenerBase.isFqnSessionRootSized(test, idx));
- test = Fqn.fromRelativeElements(test, FieldBasedJBossCacheService.ATTRIBUTE);
- idx = Util.getJSessionIndex(test, true);
- assertFalse("Buddy non-session root correct", CacheListenerBase.isFqnSessionRootSized(test, idx));
-
test = Fqn.ROOT;
idx = Util.getJSessionIndex(test, false);
assertFalse("Fqn.ROOT correct", CacheListenerBase.isFqnSessionRootSized(test, idx));
@@ -130,95 +116,12 @@
assertTrue("Buddy session root correct", CacheListenerBase.isFqnSessionRootSized(test, true));
assertFalse("Buddy session root correct with wrong isBuddy", CacheListenerBase.isFqnSessionRootSized(test, false));
- test = Fqn.fromRelativeElements(BASE, FieldBasedJBossCacheService.ATTRIBUTE);
- assertFalse("Non-buddy non-session root correct", CacheListenerBase.isFqnSessionRootSized(test, false));
-
- test = BUDDY_BASE;
- test = Fqn.fromRelativeElements(test, FieldBasedJBossCacheService.ATTRIBUTE);
- assertFalse("Buddy non-session root correct", CacheListenerBase.isFqnSessionRootSized(test, true));
-
test = DEAD_BUDDY_BASE;
assertTrue("Buddy session root correct", CacheListenerBase.isFqnSessionRootSized(test, true));
assertFalse("Buddy session root correct with wrong isBuddy", CacheListenerBase.isFqnSessionRootSized(test, false));
-
- test = Fqn.fromRelativeElements(test, FieldBasedJBossCacheService.ATTRIBUTE);
- assertFalse("Buddy non-session root correct", CacheListenerBase.isFqnSessionRootSized(test, true));
}
- public void testIsPossibleInternalPojoFqn()
- {
- Fqn<String> test = BASE;
- int idx = Util.getJSessionIndex(test, false);
- assertFalse("Session root correct", CacheListener.isPossibleInternalPojoFqn(test, idx));
-
- test = FieldBasedJBossCacheService.getAttributeFqn(CONTEXT_HOST_PATH, "123");
- idx = Util.getJSessionIndex(test, false);
- assertFalse("ATTRIBUTE fqn correct", CacheListener.isPossibleInternalPojoFqn(test, idx));
-
- test = FieldBasedJBossCacheService.getFieldFqn(CONTEXT_HOST_PATH, "123", "person");
- idx = Util.getJSessionIndex(test, false);
- assertFalse("Pojo attach point correct", CacheListener.isPossibleInternalPojoFqn(test, idx));
-
- test = Fqn.fromRelativeElements(BASE, "_JBossInternal_");
- test = Fqn.fromRelativeElements(test, "person");
- idx = Util.getJSessionIndex(test, false);
- assertTrue("Internal pojo correct", CacheListener.isPossibleInternalPojoFqn(test, idx));
- }
-
- @SuppressWarnings("deprecation")
- public void testIsPossibleInternalPojoFqnDeprecated()
- {
- Fqn<String> test = BASE;
- assertFalse("Session root correct", CacheListener.isPossibleInternalPojoFqn(test));
-
- test = FieldBasedJBossCacheService.getAttributeFqn(CONTEXT_HOST_PATH, "123");
- assertFalse("ATTRIBUTE fqn correct", CacheListener.isPossibleInternalPojoFqn(test));
-
- test = FieldBasedJBossCacheService.getFieldFqn(CONTEXT_HOST_PATH, "123", "person");
- assertFalse("Pojo attach point correct", CacheListener.isPossibleInternalPojoFqn(test));
-
- test = Fqn.fromRelativeElements(BASE, "_JBossInternal_");
- test = Fqn.fromRelativeElements(test, "person");
- assertTrue("Internal pojo correct", CacheListener.isPossibleInternalPojoFqn(test));
- }
-
- public void testGetPojoKeyFromFqn()
- {
- Fqn<String> test = FieldBasedJBossCacheService.getFieldFqn(CONTEXT_HOST_PATH, "123", "person");
- int idx = Util.getJSessionIndex(test, false);
- assertEquals("Non-buddy pojo field correct", "person", CacheListener.getPojoKeyFromFqn(test, idx));
-
- test = FieldBasedJBossCacheService.getFieldFqn(CONTEXT_HOST_PATH, "123", "person");
- test = Fqn.fromRelativeElements(test, "subobject");
- idx = Util.getJSessionIndex(test, false);
- assertEquals("Non-buddy pojo field correct with subobject", "person", CacheListener.getPojoKeyFromFqn(test, idx));
-
- test = Fqn.fromRelativeElements(BUDDY_BASE, FieldBasedJBossCacheService.ATTRIBUTE);
- test = Fqn.fromRelativeElements(test, "person");
- idx = Util.getJSessionIndex(test, true);
- assertEquals("Buddy pojo field correct", "person", CacheListener.getPojoKeyFromFqn(test, idx));
-
- test = Fqn.fromRelativeElements(test, "subobject");
- idx = Util.getJSessionIndex(test, true);
- assertEquals("Buddy pojo field correct with subobject", "person", CacheListener.getPojoKeyFromFqn(test, idx));
- }
-
- @SuppressWarnings("deprecation")
- public void testGetPojoKeyFromFqnDeprecated()
- {
- Fqn<String> test = FieldBasedJBossCacheService.getFieldFqn(CONTEXT_HOST_PATH, "123", "person");
- assertEquals("Non-buddy pojo field correct", "person", CacheListener.getPojoKeyFromFqn(test, false));
-
- test = FieldBasedJBossCacheService.getFieldFqn(CONTEXT_HOST_PATH, "123", "person");
- test = Fqn.fromRelativeElements(test, "subobject");
- assertEquals("Non-buddy pojo field correct with subobject", "person", CacheListener.getPojoKeyFromFqn(test, false));
-
- test = Fqn.fromRelativeElements(BUDDY_BASE, FieldBasedJBossCacheService.ATTRIBUTE);
- test = Fqn.fromRelativeElements(test, "person");
- assertEquals("Buddy pojo field correct", "person", CacheListener.getPojoKeyFromFqn(test, true));
-
- test = Fqn.fromRelativeElements(test, "subobject");
- assertEquals("Buddy pojo field correct with subobject", "person", CacheListener.getPojoKeyFromFqn(test, true));
- }
-
+
+
+
}
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/FieldFqnTestCase.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/FieldFqnTestCase.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/FieldFqnTestCase.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.web.tomcat.service.session.distributedcache.impl;
-
-import org.jboss.cache.Fqn;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.AbstractJBossCacheService;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.FieldBasedJBossCacheService;
-
-import junit.framework.TestCase;
-
-/**
- * Test of {@link FieldBasedJBossCacheService#getFieldFqn(String, String, String)}
- *
- * @author Brian Stansberry
- *
- * @version $Revision: $
- */
-public class FieldFqnTestCase extends TestCase
-{
- public void testGetFieldFqn()
- {
- String contextHostPath = "webapp_localhost";
- String sessionId = "XYZ123";
- Fqn<String> base = Fqn.fromElements(AbstractJBossCacheService.SESSION,
- contextHostPath, sessionId, FieldBasedJBossCacheService.ATTRIBUTE);
-
- Fqn<String> testee = FieldBasedJBossCacheService.getFieldFqn(contextHostPath, sessionId, "a");
- assertTrue(testee.isChildOf(base));
- assertEquals("a", testee.getLastElement());
-
- testee = FieldBasedJBossCacheService.getFieldFqn(contextHostPath, sessionId, "a/b/c");
- assertTrue(testee.isChildOf(base));
- assertEquals("a", testee.get(base.size()));
- assertEquals("b", testee.get(base.size() + 1));
- assertEquals("c", testee.getLastElement());
- }
-}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManagerUnitTestCase.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManagerUnitTestCase.java 2010-07-13 03:08:27 UTC (rev 106622)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManagerUnitTestCase.java 2010-07-13 03:12:17 UTC (rev 106623)
@@ -38,18 +38,13 @@
import org.jboss.cache.jmx.CacheJmxWrapper;
import org.jboss.cache.notifications.event.EventImpl;
import org.jboss.cache.notifications.event.Event.Type;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper;
import org.jboss.cache.transaction.BatchModeTransactionManager;
import org.jboss.cache.transaction.TransactionManagerLookup;
import org.jboss.ha.cachemanager.CacheManager;
import org.jboss.ha.cachemanager.DependencyInjectedConfigurationRegistry;
import org.jboss.ha.framework.server.CacheManagerLocator;
-import org.jboss.ha.framework.server.PojoCacheManagerLocator;
import org.jboss.logging.Logger;
import org.jboss.util.threadpool.BasicThreadPool;
-import org.jboss.web.tomcat.service.sso.jbc.JBossCacheSSOClusterManager;
import org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId;
import org.jboss.web.tomcat.service.sso.spi.SSOClusterManager;
import org.jboss.web.tomcat.service.sso.spi.SSOCredentials;
@@ -114,7 +109,6 @@
cacheManager.stop();
cacheManager = null;
CacheManagerLocator.getCacheManagerLocator().deregisterCacheManager();
- PojoCacheManagerLocator.getCacheManagerLocator().deregisterCacheManager();
}
if (mbeanServer != null)
@@ -176,93 +170,7 @@
}
}
- public void testPojoCacheJmxIntegration() throws Exception
- {
- log.debug("+++ testPojoCacheJmxIntegration()");
-
- mbeanServer = MBeanServerFactory.createMBeanServer("pojoCacheTest");
- PojoCacheJmxWrapper wrapper = null;
- try
- {
- // Register a cache
- wrapper = new PojoCacheJmxWrapper();
- // JBAS-4097 -- don't use a TransactionManagerLookup that will
- // bind DummyTransactionManager into JNDI, as that will screw
- // up other tests
- wrapper.setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
- wrapper.setCacheMode("REPL_SYNC");
- mbeanServer.registerMBean(wrapper, new ObjectName(CACHE_OBJECT_NAME));
- wrapper.create();
- wrapper.start();
-
- // Build up an SSO infrastructure based on LOCAL_ADDRESS
- JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
-
- MockSSOValve localValve = new MockSSOValve(mbeanServer, localSSOManager, CACHE_OBJECT_NAME);
- localSSOManager.setSSOLocalManager(localValve);
- localSSOManager.start();
-
- // Create an SSO that will have two sessions from local valve
- localSSOManager.register("1", "FORM", "Brian", "password");
-
- localSSOManager.addSession("1", getFullyQualifiedSessionId("A", "1"));
-
- localSSOManager.addSession("1", getFullyQualifiedSessionId("B", "2"));
-
- // Confirm that data is cached properly
- assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
- }
- finally
- {
- try
- {
- if (wrapper != null)
- {
- wrapper.stop();
- wrapper.destroy();
- }
- }
- catch (Exception ignored)
- {
- }
- }
- }
- public void testPojoCacheIntegration() throws Exception
- {
- log.debug("+++ testPojoCacheIntegration()");
-
- CacheManager cacheManager = getCacheManager();
-
- // Register a cache
- Configuration config = new Configuration();
- // JBAS-4097 -- don't use a TransactionManagerLookup that will
- // bind DummyTransactionManager into JNDI, as that will screw
- // up other tests
- config.setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
- config.setCacheMode("REPL_SYNC");
- PojoCache pc = PojoCacheFactory.createCache(config, false);
-
- cacheManager.registerPojoCache(pc, DEFAULT_CACHE_NAME);
-
- // Build up an SSO infrastructure based on LOCAL_ADDRESS
- JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
-
- MockSSOValve localValve = new MockSSOValve(mbeanServer, localSSOManager);
- localSSOManager.setSSOLocalManager(localValve);
- localSSOManager.start();
-
- // Create an SSO that will have two sessions from local valve
- localSSOManager.register("1", "FORM", "Brian", "password");
-
- localSSOManager.addSession("1", getFullyQualifiedSessionId("A", "1"));
-
- localSSOManager.addSession("1", getFullyQualifiedSessionId("B", "2"));
-
- // Confirm that data is cached properly
- assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
- }
-
public void testDeadMemberCleanupWithPool() throws Exception
{
log.debug("+++ testDeadMemberCleanupWithPool()");
More information about the jboss-cvs-commits
mailing list