[jboss-cvs] JBossAS SVN: r107274 - in projects/cluster/ha-server-cache-jbc/trunk/src: main/java/org/jboss/ha/framework/server/jbc and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 2 12:59:56 EDT 2010
Author: pferraro
Date: 2010-08-02 12:59:55 -0400 (Mon, 02 Aug 2010)
New Revision: 107274
Added:
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImplMBean.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/HAPartitionCacheHandlerImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManager.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManagerMBean.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/DistributedCacheManagerFactoryImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/TestDistributedCacheManagerFactoryImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/jbc/
Removed:
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImplMBean.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/HAPartitionCacheHandlerImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/impl/jbc/
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/BatchingManagerImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/IncomingDistributableSessionDataImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/
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/AttributeBasedJBossCacheService.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/SessionBasedJBossCacheService.java
projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/jbc/CacheListenerUnitTestCase.java
Log:
Refactor spi impls into jbc subpackages.
Refactor BatchingManagerImpl and IncomingDistributableSessionDataImpl into ha-server-cache-spi.
Utilize SessionAttributeMarshaller for marshalling/unmarshalling of session attributes.
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,593 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.framework.server;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType;
-import org.jboss.ha.core.framework.server.ChannelSource;
-import org.jboss.ha.framework.server.spi.ManagedDistributedState;
-import org.jboss.logging.Logger;
-import org.jgroups.Channel;
-
-/**
- * This class manages distributed state across the cluster.
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
- * @author Scott.Stark at jboss.org
- * @version $Revision:77673 $
- */
- at CacheListener
-public class DistributedStateImpl
- implements ManagedDistributedState, DistributedStateImplMBean, ChannelSource
-{
- // Constants -----------------------------------------------------
-
- public static final Serializable ROOT = "__DISTRIBUTED_STATE__";
- public static final Fqn<Serializable> ROOTFQN = Fqn.fromElements(ROOT);
- public static final int ROOTFQNSIZE = ROOTFQN.size();
-
- protected static final String SERVICE_NAME = "DistributedState";
-
- // Attributes ----------------------------------------------------
-
- protected Map<String, List<Object>> keyListeners = new HashMap<String, List<Object>>();
- protected Logger log = Logger.getLogger(this.getClass());
- protected String name = null;
- protected Cache<Serializable, Serializable> cache;
- protected boolean replAsync;
- protected HAPartitionCacheHandlerImpl cacheHandler;
- protected boolean acquiredCache = false;
-
- // Public --------------------------------------------------------
-
- public void createService() throws Exception
- {
- }
-
- public void startService() throws Exception
- {
- if (this.cache == null)
- {
- if (cacheHandler == null)
- {
- throw new IllegalStateException("No clustered cache available");
- }
-
- @SuppressWarnings("unchecked")
- Cache c = null;
- synchronized (cacheHandler)
- {
- c = cacheHandler.getCache();
- if (c == null)
- {
- cacheHandler.acquireCache();
- c = cacheHandler.getCache();
- acquiredCache = true;
- }
- }
- cacheHandler.startCache();
- @SuppressWarnings("unchecked")
- Cache<Serializable, Serializable> unchecked = c;
- internalSetClusteredCache(unchecked);
- }
-
- this.cache.addCacheListener(this);
- }
-
- public void stopService() throws Exception
- {
- this.cache.removeCacheListener(this);
-
- if (acquiredCache)
- {
- cacheHandler.releaseCache();
- cache = null;
- acquiredCache = false;
- }
- }
-
- public void destroyService() throws Exception
- {
- }
-
- public String listContent() throws Exception
- {
- StringBuilder result = new StringBuilder();
- Collection<String> cats = this.getAllCategories();
- if (cats == null) return result.toString();
-
- Iterator<String> catsIter = cats.iterator();
- while (catsIter.hasNext())
- {
- String category = (String) catsIter.next();
- Iterator<Serializable> keysIter = this.getAllKeys(category).iterator();
-
- result.append("-----------------------------------------------\n");
- result.append("Logger : ").append(category).append("\n\n");
- result.append("KEY\t:\tVALUE\n");
-
- while (keysIter.hasNext())
- {
- Serializable key = (Serializable) keysIter.next();
- String value = this.get(category, key).toString();
- result.append("'").append(key);
- result.append("'\t:\t'");
- result.append(value);
- result.append("'\n");
- }
- result.append("\n");
- }
- return result.toString();
- }
-
- public String listXmlContent() throws Exception
- {
- StringBuilder result = new StringBuilder();
- result.append("<DistributedState>\n");
- Collection<String> cats = this.getAllCategories();
- if (cats != null)
- {
- Iterator<String> catsIter = cats.iterator();
- while (catsIter.hasNext())
- {
- String category = (String) catsIter.next();
- Iterator<Serializable> keysIter = this.getAllKeys(category).iterator();
-
- result.append("\t<Logger>\n");
- result.append("\t\t<LoggerName>").append(category).append("</LoggerName>\n");
-
- while (keysIter.hasNext())
- {
- Serializable key = (Serializable) keysIter.next();
- String value = this.get(category, key).toString();
- result.append("\t\t<Entry>\n");
- result.append("\t\t\t<Key>").append(key).append("</Key>\n");
- result.append("\t\t\t<Value>").append(value).append("</Value>\n");
- result.append("\t\t</Entry>\n");
- }
- result.append("\t</Logger>\n");
- }
- }
-
- result.append("</DistributedState>\n");
-
- return result.toString();
- }
-
- public Cache<Serializable, Serializable> getClusteredCache()
- {
- return this.cache;
- }
-
- /**
- * Sets the cache to use.
- *
- * @param cache the cache
- *
- * @throws IllegalStateException if the cache isn't configured for replication
- */
- public void setClusteredCache(Cache<Serializable, Serializable> cache)
- {
- internalSetClusteredCache(cache);
- acquiredCache = false;
- }
-
- public HAPartitionCacheHandlerImpl getCacheHandler()
- {
- return cacheHandler;
- }
-
- public void setCacheHandler(HAPartitionCacheHandlerImpl cacheHandler)
- {
- this.cacheHandler = cacheHandler;
- }
-
-
-
-
- // DistributedState implementation ----------------------------------------------
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#set(java.lang.String,
- * java.io.Serializable, java.io.Serializable)
- */
- public void set(String category, Serializable key, Serializable value) throws Exception
- {
- this.set(category, key, value, true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#set(java.lang.String,
- * java.io.Serializable, java.io.Serializable, boolean) @param
- * asynchronousCall is not supported yet. TreeCache cannot switch this
- * on the fly. Will take value from TreeCache-config instead.
- */
- public void set(String category, Serializable key, Serializable value, boolean asynchronousCall) throws Exception
- {
- if (this.replAsync != asynchronousCall)
- {
- if (asynchronousCall)
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
- }
- else
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceSynchronous(true);
- }
- }
- this.cache.put(this.buildFqn(category), key, value);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#remove(java.lang.String,
- * java.io.Serializable) @return - returns null in case of
- * CacheException
- */
- public Serializable remove(String category, Serializable key) throws Exception
- {
- return this.remove(category, key, true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#remove(java.lang.String,
- * java.io.Serializable, boolean)
- */
- public Serializable remove(String category, Serializable key, boolean asynchronousCall) throws Exception
- {
- Serializable retVal = this.get(category, key);
- if (retVal != null)
- {
- if (this.replAsync != asynchronousCall)
- {
- if (asynchronousCall)
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
- }
- else
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceSynchronous(true);
- }
- }
- this.cache.remove(this.buildFqn(category), key);
- }
- return retVal;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#get(java.lang.String,
- * java.io.Serializable)
- */
- public Serializable get(String category, Serializable key)
- {
- try
- {
- return (Serializable) this.cache.get(this.buildFqn(category), key);
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- public Collection<String> getAllCategories()
- {
- try
- {
- @SuppressWarnings("unchecked")
- Node base = this.cache.getRoot().getChild(ROOTFQN);
- @SuppressWarnings("unchecked")
- Collection<String> keys = (base == null ? null : base.getChildrenNames());
- if (keys != null && keys.size() > 0)
- {
- keys = Collections.unmodifiableCollection(keys);
- }
- return keys;
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#getAllKeys(java.lang.String)
- * @return - returns null in case of CacheException
- */
- public Collection<Serializable> getAllKeys(String category)
- {
- try
- {
- Node<Serializable, Serializable> node = this.getNode(category);
- if (node == null) return null;
- return node.getKeys();
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#getAllValues(java.lang.String)
- * @return - returns null in case of CacheException
- */
- public Collection<Serializable> getAllValues(String category)
- {
- try
- {
- Node<Serializable, Serializable> categoryNode = this.getNode(category);
- if (categoryNode == null) return null;
- Set<Serializable> childNodes = categoryNode.getKeys();
- if (childNodes == null) return null;
- Map<Serializable, Serializable> entries = categoryNode.getData();
- if (entries == null) return null;
- Collection<Serializable> retVal = new HashSet<Serializable>(entries.values());
- return Collections.unmodifiableCollection(retVal);
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- @SuppressWarnings("deprecation")
- public void registerDSListenerEx(String category, DSListenerEx subscriber)
- {
- this.registerListener(category, subscriber);
- }
-
- @SuppressWarnings("deprecation")
- public void unregisterDSListenerEx(String category, DSListenerEx subscriber)
- {
- this.unregisterListener(category, subscriber);
- }
-
- @SuppressWarnings("deprecation")
- public void registerDSListener(String category, DSListener subscriber)
- {
- this.registerListener(category, subscriber);
- }
-
- @SuppressWarnings("deprecation")
- public void unregisterDSListener(String category, DSListener subscriber)
- {
- this.unregisterListener(category, subscriber);
- }
-
- // ChannelSource -------------------------------------------------
-
- public Channel getChannel()
- {
- Channel result = null;
- if (cache != null)
- {
- result = cache.getConfiguration().getRuntimeConfig().getChannel();
- }
- return result;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- protected void registerListener(String category, Object subscriber)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null)
- {
- listeners = new ArrayList<Object>();
- this.keyListeners.put(category, listeners);
- }
- listeners.add(subscriber);
- }
- }
-
- protected void unregisterListener(String category, Object subscriber)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null) return;
-
- listeners.remove(subscriber);
- if (listeners.size() == 0)
- {
- this.keyListeners.remove(category);
- }
- }
- }
-
- @SuppressWarnings("deprecation")
- protected void notifyKeyListeners(String category, Serializable key, Serializable value, boolean locallyModified)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null) return;
- String strKey = key.toString();
-
- for (Object listener: listeners)
- {
- if (listener instanceof DSListener)
- {
- DSListener dslistener = (DSListener) listener;
- dslistener.valueHasChanged(category, strKey, value, locallyModified);
- }
- else
- {
- DSListenerEx dslistener = (DSListenerEx) listener;
- dslistener.valueHasChanged(category, key, value, locallyModified);
- }
- }
- }
- }
-
- @SuppressWarnings("deprecation")
- protected void notifyKeyListenersOfRemove(String category, Serializable key, Serializable oldContent,
- boolean locallyModified)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null) return;
- String strKey = key.toString();
-
- for (Object listener: listeners)
- {
- if (listener instanceof DSListener)
- {
- DSListener dslistener = (DSListener) listener;
- dslistener.keyHasBeenRemoved(category, strKey, oldContent, locallyModified);
- }
- else
- {
- DSListenerEx dslistener = (DSListenerEx) listener;
- dslistener.keyHasBeenRemoved(category, key, oldContent, locallyModified);
- }
- }
- }
- }
-
- protected void cleanupKeyListeners()
- {
- // NOT IMPLEMENTED YET
- }
-
- /** ExtendedTreeCacheListener methods */
-
- // Private -------------------------------------------------------
- protected Fqn<Serializable> buildFqn(String category)
- {
- return Fqn.fromRelativeElements(ROOTFQN, category);
- }
-
- protected Fqn<Serializable> buildFqn(String category, Serializable key)
- {
- return Fqn.fromElements(ROOT, category, key);
- }
-
- protected Fqn<Serializable> buildFqn(String category, Serializable key, Serializable value)
- {
- return Fqn.fromElements(ROOT, category, key, value);
- }
-
- protected Node<Serializable, Serializable> getNode(String category) throws CacheException
- {
- return this.cache.getRoot().getChild(this.buildFqn(category));
- }
-
- // @CacheListener -------------------------------------------------
-
- @NodeModified
- public void nodeModified(NodeModifiedEvent event)
- {
- if (event.isPre()) return;
-
- // we're only interested in put and remove data operations
- ModificationType modType = event.getModificationType();
- if (!modType.equals(ModificationType.PUT_DATA) && !modType.equals(ModificationType.REMOVE_DATA)) return;
-
- // ignore changes for other roots in a shared cache
- @SuppressWarnings("unchecked")
- Fqn<Serializable> fqn = event.getFqn();
- if (!fqn.isChildOf(ROOTFQN)) return;
-
- Serializable key = null;
- Serializable value = null;
-
- // there should be exactly one key/value pair in the map
- @SuppressWarnings("unchecked")
- Map<Serializable, Serializable> data = event.getData();
- if (data != null && !data.isEmpty())
- {
- key = (Serializable) data.keySet().iterator().next();
- value = (Serializable) data.get(key);
- }
-
- if (modType.equals(ModificationType.PUT_DATA))
- {
- DistributedStateImpl.this.notifyKeyListeners((String) fqn.get(ROOTFQNSIZE), key, value, event.isOriginLocal());
- }
- else
- {
- DistributedStateImpl.this.notifyKeyListenersOfRemove((String) fqn.get(ROOTFQNSIZE), key, value, event.isOriginLocal());
- }
- }
-
- // Private ------------------------------------------------------------
-
- private void internalSetClusteredCache(Cache<Serializable, Serializable> cache)
- {
- this.cache = cache;
- if (this.cache != null)
- {
- CacheMode cm = cache.getConfiguration().getCacheMode();
- if (CacheMode.REPL_ASYNC == cm)
- {
- this.replAsync = true;
- }
- else if (CacheMode.REPL_SYNC == cm)
- {
- this.replAsync = false;
- }
- else
- {
- throw new IllegalStateException("Cache must be configured for replication, not " + cm);
- }
- }
- }
-
-}
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImplMBean.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImplMBean.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImplMBean.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.framework.server;
-
-
-/**
- * MBean interface for the Distributed State (DS) service
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @version $Revision:77673 $
- *
- * <p><b>Revisions:</b>
- *
- * <p><b>29. d�cembre 2001 Sacha Labourey:</b>
- * <ul>
- * <li> First implementation </li>
- * </ul>
- */
- at SuppressWarnings("deprecation")
-public interface DistributedStateImplMBean
- extends org.jboss.ha.framework.interfaces.DistributedState
-{
- String listContent () throws Exception;
- String listXmlContent () throws Exception;
-}
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/HAPartitionCacheHandlerImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/HAPartitionCacheHandlerImpl.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/HAPartitionCacheHandlerImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,163 +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.framework.server;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheManager;
-import org.jboss.cache.CacheStatus;
-import org.jboss.ha.core.framework.server.ChannelSource;
-import org.jboss.ha.framework.server.spi.HAPartitionCacheHandler;
-import org.jgroups.Channel;
-import org.jgroups.ChannelFactory;
-
-/**
- * Standard implementation of HAPartitionCacheHandler
- *
- * @author Brian Stansberry
- */
-public class HAPartitionCacheHandlerImpl implements HAPartitionCacheHandler, ChannelSource
-{
- private CacheManager cacheManager;
- private String cacheConfigName;
- private Cache<Object, Object> cache;
- private AtomicInteger acquireCount = new AtomicInteger();
-
- // CacheHandler ------------------------------------------------------------
-
- public synchronized void acquireCache() throws Exception
- {
- if (cache == null)
- {
- validateState();
-
- cache = cacheManager.getCache(cacheConfigName, true);
- }
- acquireCount.incrementAndGet();
- }
-
- public synchronized void startCache() throws Exception
- {
- if (cache == null)
- {
- throw new IllegalStateException("Must acquire cache before starting it");
- }
-
- if (cache.getCacheStatus() != CacheStatus.STARTED)
- cache.start();
- }
-
- public synchronized void releaseCache() throws Exception
- {
- if (cache != null)
- {
- validateState();
-
- if (acquireCount.decrementAndGet() == 0)
- {
- cacheManager.releaseCache(cacheConfigName);
- cache = null;
- }
- }
- }
-
- public synchronized String getCacheConfigName()
- {
- return cacheConfigName;
- }
-
- public synchronized String getChannelStackName()
- {
- if (cache == null)
- {
- throw new IllegalStateException("Must acquire cache before getting channel stack name");
- }
- return cache.getConfiguration().getMultiplexerStack();
- }
-
- public synchronized ChannelFactory getCacheChannelFactory()
- {
- if (cache == null)
- {
- throw new IllegalStateException("Must acquire cache before getting cache channel factory");
- }
- return cache.getConfiguration().getRuntimeConfig().getMuxChannelFactory();
- }
-
- public synchronized Channel getChannel()
- {
- if (cache == null)
- {
- throw new IllegalStateException("Must acquire cache before getting cache channel");
- }
- return cache.getConfiguration().getRuntimeConfig().getChannel();
- }
-
- // Properties -------------------------------------------------------------
-
- public synchronized void setCacheConfigName(String cacheConfigName)
- {
- this.cacheConfigName = cacheConfigName;
- }
-
- public synchronized CacheManager getCacheManager()
- {
- return cacheManager;
- }
-
- public synchronized void setCacheManager(CacheManager cacheManager)
- {
- this.cacheManager = cacheManager;
- }
-
- public synchronized Cache<Object, Object> getCache()
- {
- return cache;
- }
-
- // Public ------------------------------------------------------------------
-
- public synchronized void start() throws Exception
- {
- }
-
- public synchronized void stop() throws Exception
- {
- }
-
- // Private -----------------------------------------------------------------
-
- private void validateState()
- {
- if (cacheManager == null)
- {
- throw new IllegalStateException("Must set cacheManager");
- }
-
- if (cacheConfigName == null)
- {
- throw new IllegalStateException("Must set cacheConfigName");
- }
- }
-}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImpl.java (from rev 106793, projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java)
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImpl.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,593 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.framework.server.jbc;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeModified;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType;
+import org.jboss.ha.core.framework.server.ChannelSource;
+import org.jboss.ha.framework.server.spi.ManagedDistributedState;
+import org.jboss.logging.Logger;
+import org.jgroups.Channel;
+
+/**
+ * This class manages distributed state across the cluster.
+ *
+ * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:77673 $
+ */
+ at CacheListener
+public class DistributedStateImpl
+ implements ManagedDistributedState, DistributedStateImplMBean, ChannelSource
+{
+ // Constants -----------------------------------------------------
+
+ public static final Serializable ROOT = "__DISTRIBUTED_STATE__";
+ public static final Fqn<Serializable> ROOTFQN = Fqn.fromElements(ROOT);
+ public static final int ROOTFQNSIZE = ROOTFQN.size();
+
+ protected static final String SERVICE_NAME = "DistributedState";
+
+ // Attributes ----------------------------------------------------
+
+ protected Map<String, List<Object>> keyListeners = new HashMap<String, List<Object>>();
+ protected Logger log = Logger.getLogger(this.getClass());
+ protected String name = null;
+ protected Cache<Serializable, Serializable> cache;
+ protected boolean replAsync;
+ protected HAPartitionCacheHandlerImpl cacheHandler;
+ protected boolean acquiredCache = false;
+
+ // Public --------------------------------------------------------
+
+ public void createService() throws Exception
+ {
+ }
+
+ public void startService() throws Exception
+ {
+ if (this.cache == null)
+ {
+ if (cacheHandler == null)
+ {
+ throw new IllegalStateException("No clustered cache available");
+ }
+
+ @SuppressWarnings("unchecked")
+ Cache c = null;
+ synchronized (cacheHandler)
+ {
+ c = cacheHandler.getCache();
+ if (c == null)
+ {
+ cacheHandler.acquireCache();
+ c = cacheHandler.getCache();
+ acquiredCache = true;
+ }
+ }
+ cacheHandler.startCache();
+ @SuppressWarnings("unchecked")
+ Cache<Serializable, Serializable> unchecked = c;
+ internalSetClusteredCache(unchecked);
+ }
+
+ this.cache.addCacheListener(this);
+ }
+
+ public void stopService() throws Exception
+ {
+ this.cache.removeCacheListener(this);
+
+ if (acquiredCache)
+ {
+ cacheHandler.releaseCache();
+ cache = null;
+ acquiredCache = false;
+ }
+ }
+
+ public void destroyService() throws Exception
+ {
+ }
+
+ public String listContent() throws Exception
+ {
+ StringBuilder result = new StringBuilder();
+ Collection<String> cats = this.getAllCategories();
+ if (cats == null) return result.toString();
+
+ Iterator<String> catsIter = cats.iterator();
+ while (catsIter.hasNext())
+ {
+ String category = (String) catsIter.next();
+ Iterator<Serializable> keysIter = this.getAllKeys(category).iterator();
+
+ result.append("-----------------------------------------------\n");
+ result.append("Logger : ").append(category).append("\n\n");
+ result.append("KEY\t:\tVALUE\n");
+
+ while (keysIter.hasNext())
+ {
+ Serializable key = (Serializable) keysIter.next();
+ String value = this.get(category, key).toString();
+ result.append("'").append(key);
+ result.append("'\t:\t'");
+ result.append(value);
+ result.append("'\n");
+ }
+ result.append("\n");
+ }
+ return result.toString();
+ }
+
+ public String listXmlContent() throws Exception
+ {
+ StringBuilder result = new StringBuilder();
+ result.append("<DistributedState>\n");
+ Collection<String> cats = this.getAllCategories();
+ if (cats != null)
+ {
+ Iterator<String> catsIter = cats.iterator();
+ while (catsIter.hasNext())
+ {
+ String category = (String) catsIter.next();
+ Iterator<Serializable> keysIter = this.getAllKeys(category).iterator();
+
+ result.append("\t<Logger>\n");
+ result.append("\t\t<LoggerName>").append(category).append("</LoggerName>\n");
+
+ while (keysIter.hasNext())
+ {
+ Serializable key = (Serializable) keysIter.next();
+ String value = this.get(category, key).toString();
+ result.append("\t\t<Entry>\n");
+ result.append("\t\t\t<Key>").append(key).append("</Key>\n");
+ result.append("\t\t\t<Value>").append(value).append("</Value>\n");
+ result.append("\t\t</Entry>\n");
+ }
+ result.append("\t</Logger>\n");
+ }
+ }
+
+ result.append("</DistributedState>\n");
+
+ return result.toString();
+ }
+
+ public Cache<Serializable, Serializable> getClusteredCache()
+ {
+ return this.cache;
+ }
+
+ /**
+ * Sets the cache to use.
+ *
+ * @param cache the cache
+ *
+ * @throws IllegalStateException if the cache isn't configured for replication
+ */
+ public void setClusteredCache(Cache<Serializable, Serializable> cache)
+ {
+ internalSetClusteredCache(cache);
+ acquiredCache = false;
+ }
+
+ public HAPartitionCacheHandlerImpl getCacheHandler()
+ {
+ return cacheHandler;
+ }
+
+ public void setCacheHandler(HAPartitionCacheHandlerImpl cacheHandler)
+ {
+ this.cacheHandler = cacheHandler;
+ }
+
+
+
+
+ // DistributedState implementation ----------------------------------------------
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#set(java.lang.String,
+ * java.io.Serializable, java.io.Serializable)
+ */
+ public void set(String category, Serializable key, Serializable value) throws Exception
+ {
+ this.set(category, key, value, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#set(java.lang.String,
+ * java.io.Serializable, java.io.Serializable, boolean) @param
+ * asynchronousCall is not supported yet. TreeCache cannot switch this
+ * on the fly. Will take value from TreeCache-config instead.
+ */
+ public void set(String category, Serializable key, Serializable value, boolean asynchronousCall) throws Exception
+ {
+ if (this.replAsync != asynchronousCall)
+ {
+ if (asynchronousCall)
+ {
+ this.cache.getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
+ }
+ else
+ {
+ this.cache.getInvocationContext().getOptionOverrides().setForceSynchronous(true);
+ }
+ }
+ this.cache.put(this.buildFqn(category), key, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#remove(java.lang.String,
+ * java.io.Serializable) @return - returns null in case of
+ * CacheException
+ */
+ public Serializable remove(String category, Serializable key) throws Exception
+ {
+ return this.remove(category, key, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#remove(java.lang.String,
+ * java.io.Serializable, boolean)
+ */
+ public Serializable remove(String category, Serializable key, boolean asynchronousCall) throws Exception
+ {
+ Serializable retVal = this.get(category, key);
+ if (retVal != null)
+ {
+ if (this.replAsync != asynchronousCall)
+ {
+ if (asynchronousCall)
+ {
+ this.cache.getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
+ }
+ else
+ {
+ this.cache.getInvocationContext().getOptionOverrides().setForceSynchronous(true);
+ }
+ }
+ this.cache.remove(this.buildFqn(category), key);
+ }
+ return retVal;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#get(java.lang.String,
+ * java.io.Serializable)
+ */
+ public Serializable get(String category, Serializable key)
+ {
+ try
+ {
+ return (Serializable) this.cache.get(this.buildFqn(category), key);
+ }
+ catch (CacheException ce)
+ {
+ return null;
+ }
+ }
+
+ public Collection<String> getAllCategories()
+ {
+ try
+ {
+ @SuppressWarnings("unchecked")
+ Node base = this.cache.getRoot().getChild(ROOTFQN);
+ @SuppressWarnings("unchecked")
+ Collection<String> keys = (base == null ? null : base.getChildrenNames());
+ if (keys != null && keys.size() > 0)
+ {
+ keys = Collections.unmodifiableCollection(keys);
+ }
+ return keys;
+ }
+ catch (CacheException ce)
+ {
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#getAllKeys(java.lang.String)
+ * @return - returns null in case of CacheException
+ */
+ public Collection<Serializable> getAllKeys(String category)
+ {
+ try
+ {
+ Node<Serializable, Serializable> node = this.getNode(category);
+ if (node == null) return null;
+ return node.getKeys();
+ }
+ catch (CacheException ce)
+ {
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.ha.framework.interfaces.DistributedState#getAllValues(java.lang.String)
+ * @return - returns null in case of CacheException
+ */
+ public Collection<Serializable> getAllValues(String category)
+ {
+ try
+ {
+ Node<Serializable, Serializable> categoryNode = this.getNode(category);
+ if (categoryNode == null) return null;
+ Set<Serializable> childNodes = categoryNode.getKeys();
+ if (childNodes == null) return null;
+ Map<Serializable, Serializable> entries = categoryNode.getData();
+ if (entries == null) return null;
+ Collection<Serializable> retVal = new HashSet<Serializable>(entries.values());
+ return Collections.unmodifiableCollection(retVal);
+ }
+ catch (CacheException ce)
+ {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void registerDSListenerEx(String category, DSListenerEx subscriber)
+ {
+ this.registerListener(category, subscriber);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void unregisterDSListenerEx(String category, DSListenerEx subscriber)
+ {
+ this.unregisterListener(category, subscriber);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void registerDSListener(String category, DSListener subscriber)
+ {
+ this.registerListener(category, subscriber);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void unregisterDSListener(String category, DSListener subscriber)
+ {
+ this.unregisterListener(category, subscriber);
+ }
+
+ // ChannelSource -------------------------------------------------
+
+ public Channel getChannel()
+ {
+ Channel result = null;
+ if (cache != null)
+ {
+ result = cache.getConfiguration().getRuntimeConfig().getChannel();
+ }
+ return result;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void registerListener(String category, Object subscriber)
+ {
+ synchronized (this.keyListeners)
+ {
+ List<Object> listeners = this.keyListeners.get(category);
+ if (listeners == null)
+ {
+ listeners = new ArrayList<Object>();
+ this.keyListeners.put(category, listeners);
+ }
+ listeners.add(subscriber);
+ }
+ }
+
+ protected void unregisterListener(String category, Object subscriber)
+ {
+ synchronized (this.keyListeners)
+ {
+ List<Object> listeners = this.keyListeners.get(category);
+ if (listeners == null) return;
+
+ listeners.remove(subscriber);
+ if (listeners.size() == 0)
+ {
+ this.keyListeners.remove(category);
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void notifyKeyListeners(String category, Serializable key, Serializable value, boolean locallyModified)
+ {
+ synchronized (this.keyListeners)
+ {
+ List<Object> listeners = this.keyListeners.get(category);
+ if (listeners == null) return;
+ String strKey = key.toString();
+
+ for (Object listener: listeners)
+ {
+ if (listener instanceof DSListener)
+ {
+ DSListener dslistener = (DSListener) listener;
+ dslistener.valueHasChanged(category, strKey, value, locallyModified);
+ }
+ else
+ {
+ DSListenerEx dslistener = (DSListenerEx) listener;
+ dslistener.valueHasChanged(category, key, value, locallyModified);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void notifyKeyListenersOfRemove(String category, Serializable key, Serializable oldContent,
+ boolean locallyModified)
+ {
+ synchronized (this.keyListeners)
+ {
+ List<Object> listeners = this.keyListeners.get(category);
+ if (listeners == null) return;
+ String strKey = key.toString();
+
+ for (Object listener: listeners)
+ {
+ if (listener instanceof DSListener)
+ {
+ DSListener dslistener = (DSListener) listener;
+ dslistener.keyHasBeenRemoved(category, strKey, oldContent, locallyModified);
+ }
+ else
+ {
+ DSListenerEx dslistener = (DSListenerEx) listener;
+ dslistener.keyHasBeenRemoved(category, key, oldContent, locallyModified);
+ }
+ }
+ }
+ }
+
+ protected void cleanupKeyListeners()
+ {
+ // NOT IMPLEMENTED YET
+ }
+
+ /** ExtendedTreeCacheListener methods */
+
+ // Private -------------------------------------------------------
+ protected Fqn<Serializable> buildFqn(String category)
+ {
+ return Fqn.fromRelativeElements(ROOTFQN, category);
+ }
+
+ protected Fqn<Serializable> buildFqn(String category, Serializable key)
+ {
+ return Fqn.fromElements(ROOT, category, key);
+ }
+
+ protected Fqn<Serializable> buildFqn(String category, Serializable key, Serializable value)
+ {
+ return Fqn.fromElements(ROOT, category, key, value);
+ }
+
+ protected Node<Serializable, Serializable> getNode(String category) throws CacheException
+ {
+ return this.cache.getRoot().getChild(this.buildFqn(category));
+ }
+
+ // @CacheListener -------------------------------------------------
+
+ @NodeModified
+ public void nodeModified(NodeModifiedEvent event)
+ {
+ if (event.isPre()) return;
+
+ // we're only interested in put and remove data operations
+ ModificationType modType = event.getModificationType();
+ if (!modType.equals(ModificationType.PUT_DATA) && !modType.equals(ModificationType.REMOVE_DATA)) return;
+
+ // ignore changes for other roots in a shared cache
+ @SuppressWarnings("unchecked")
+ Fqn<Serializable> fqn = event.getFqn();
+ if (!fqn.isChildOf(ROOTFQN)) return;
+
+ Serializable key = null;
+ Serializable value = null;
+
+ // there should be exactly one key/value pair in the map
+ @SuppressWarnings("unchecked")
+ Map<Serializable, Serializable> data = event.getData();
+ if (data != null && !data.isEmpty())
+ {
+ key = (Serializable) data.keySet().iterator().next();
+ value = (Serializable) data.get(key);
+ }
+
+ if (modType.equals(ModificationType.PUT_DATA))
+ {
+ DistributedStateImpl.this.notifyKeyListeners((String) fqn.get(ROOTFQNSIZE), key, value, event.isOriginLocal());
+ }
+ else
+ {
+ DistributedStateImpl.this.notifyKeyListenersOfRemove((String) fqn.get(ROOTFQNSIZE), key, value, event.isOriginLocal());
+ }
+ }
+
+ // Private ------------------------------------------------------------
+
+ private void internalSetClusteredCache(Cache<Serializable, Serializable> cache)
+ {
+ this.cache = cache;
+ if (this.cache != null)
+ {
+ CacheMode cm = cache.getConfiguration().getCacheMode();
+ if (CacheMode.REPL_ASYNC == cm)
+ {
+ this.replAsync = true;
+ }
+ else if (CacheMode.REPL_SYNC == cm)
+ {
+ this.replAsync = false;
+ }
+ else
+ {
+ throw new IllegalStateException("Cache must be configured for replication, not " + cm);
+ }
+ }
+ }
+
+}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImplMBean.java (from rev 106793, projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImplMBean.java)
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImplMBean.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/DistributedStateImplMBean.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.framework.server.jbc;
+
+
+/**
+ * MBean interface for the Distributed State (DS) service
+ *
+ * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
+ * @version $Revision:77673 $
+ *
+ * <p><b>Revisions:</b>
+ *
+ * <p><b>29. d�cembre 2001 Sacha Labourey:</b>
+ * <ul>
+ * <li> First implementation </li>
+ * </ul>
+ */
+ at SuppressWarnings("deprecation")
+public interface DistributedStateImplMBean
+ extends org.jboss.ha.framework.interfaces.DistributedState
+{
+ String listContent () throws Exception;
+ String listXmlContent () throws Exception;
+}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/HAPartitionCacheHandlerImpl.java (from rev 106793, projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/HAPartitionCacheHandlerImpl.java)
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/HAPartitionCacheHandlerImpl.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/jbc/HAPartitionCacheHandlerImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,163 @@
+/*
+ * 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.framework.server.jbc;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.CacheStatus;
+import org.jboss.ha.core.framework.server.ChannelSource;
+import org.jboss.ha.framework.server.spi.HAPartitionCacheHandler;
+import org.jgroups.Channel;
+import org.jgroups.ChannelFactory;
+
+/**
+ * Standard implementation of HAPartitionCacheHandler
+ *
+ * @author Brian Stansberry
+ */
+public class HAPartitionCacheHandlerImpl implements HAPartitionCacheHandler, ChannelSource
+{
+ private CacheManager cacheManager;
+ private String cacheConfigName;
+ private Cache<Object, Object> cache;
+ private AtomicInteger acquireCount = new AtomicInteger();
+
+ // CacheHandler ------------------------------------------------------------
+
+ public synchronized void acquireCache() throws Exception
+ {
+ if (cache == null)
+ {
+ validateState();
+
+ cache = cacheManager.getCache(cacheConfigName, true);
+ }
+ acquireCount.incrementAndGet();
+ }
+
+ public synchronized void startCache() throws Exception
+ {
+ if (cache == null)
+ {
+ throw new IllegalStateException("Must acquire cache before starting it");
+ }
+
+ if (cache.getCacheStatus() != CacheStatus.STARTED)
+ cache.start();
+ }
+
+ public synchronized void releaseCache() throws Exception
+ {
+ if (cache != null)
+ {
+ validateState();
+
+ if (acquireCount.decrementAndGet() == 0)
+ {
+ cacheManager.releaseCache(cacheConfigName);
+ cache = null;
+ }
+ }
+ }
+
+ public synchronized String getCacheConfigName()
+ {
+ return cacheConfigName;
+ }
+
+ public synchronized String getChannelStackName()
+ {
+ if (cache == null)
+ {
+ throw new IllegalStateException("Must acquire cache before getting channel stack name");
+ }
+ return cache.getConfiguration().getMultiplexerStack();
+ }
+
+ public synchronized ChannelFactory getCacheChannelFactory()
+ {
+ if (cache == null)
+ {
+ throw new IllegalStateException("Must acquire cache before getting cache channel factory");
+ }
+ return cache.getConfiguration().getRuntimeConfig().getMuxChannelFactory();
+ }
+
+ public synchronized Channel getChannel()
+ {
+ if (cache == null)
+ {
+ throw new IllegalStateException("Must acquire cache before getting cache channel");
+ }
+ return cache.getConfiguration().getRuntimeConfig().getChannel();
+ }
+
+ // Properties -------------------------------------------------------------
+
+ public synchronized void setCacheConfigName(String cacheConfigName)
+ {
+ this.cacheConfigName = cacheConfigName;
+ }
+
+ public synchronized CacheManager getCacheManager()
+ {
+ return cacheManager;
+ }
+
+ public synchronized void setCacheManager(CacheManager cacheManager)
+ {
+ this.cacheManager = cacheManager;
+ }
+
+ public synchronized Cache<Object, Object> getCache()
+ {
+ return cache;
+ }
+
+ // Public ------------------------------------------------------------------
+
+ public synchronized void start() throws Exception
+ {
+ }
+
+ public synchronized void stop() throws Exception
+ {
+ }
+
+ // Private -----------------------------------------------------------------
+
+ private void validateState()
+ {
+ if (cacheManager == null)
+ {
+ throw new IllegalStateException("Must set cacheManager");
+ }
+
+ if (cacheConfigName == null)
+ {
+ throw new IllegalStateException("Must set cacheConfigName");
+ }
+ }
+}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManager.java (from rev 106793, projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/impl/jbc/JBossCacheDistributedTreeManager.java)
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManager.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManager.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,625 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jndi.jbc;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NameClassPair;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.naming.NotContextException;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.ha.framework.server.jbc.HAPartitionCacheHandlerImpl;
+import org.jboss.ha.jndi.spi.DistributedTreeManager;
+import org.jboss.logging.Logger;
+import org.jnp.interfaces.Naming;
+import org.jnp.interfaces.NamingContext;
+import org.jnp.interfaces.NamingParser;
+
+/**
+ * This class utilizes JBossCache to provide a DistributedTreeManager implementation.
+ *
+ * @author <a href="mailto:jgauthier at novell.com">Jerry Gauthier</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 74736 $
+ */
+public class JBossCacheDistributedTreeManager
+ implements org.jnp.interfaces.Naming, DistributedTreeManager
+{
+ static final long serialVersionUID = 6342802270002172451L;
+
+ private static Logger log = Logger.getLogger(JBossCacheDistributedTreeManager.class);
+
+ private static final NamingParser parser = new NamingParser();
+
+ public static final String DEFAULT_ROOT = "__HA_JNDI__";
+
+ // Attributes --------------------------------------------------------
+
+ private Cache<String, Binding> m_cache;
+ private Fqn<String> m_root;
+ private Naming haStub;
+ private boolean treeRootSet;
+ protected HAPartitionCacheHandlerImpl cacheHandler;
+ protected boolean acquiredCache = false;
+
+ // Constructor --------------------------------------------------------
+
+ public JBossCacheDistributedTreeManager()
+ {
+ super();
+ }
+
+ // Properties --------------------------------------------------------
+
+
+ public HAPartitionCacheHandlerImpl getCacheHandler()
+ {
+ return cacheHandler;
+ }
+
+ public void setCacheHandler(HAPartitionCacheHandlerImpl cacheHandler)
+ {
+ this.cacheHandler = cacheHandler;
+ }
+
+ public Cache<String, Binding> getClusteredCache()
+ {
+ return m_cache;
+ }
+
+ public void setClusteredCache(Cache<String, Binding> cache)
+ {
+ if (treeRootSet)
+ {
+ throw new IllegalStateException("Cannot change clusteredCache after call to init()");
+ }
+ this.m_cache = cache;
+ }
+
+ public void setRootFqn(String rootFqn)
+ {
+ if (treeRootSet)
+ {
+ throw new IllegalStateException("Cannot change rootFqn after call to init()");
+ }
+
+ m_root = (rootFqn == null) ? null : Fqn.fromString(rootFqn);
+ }
+
+ // JBossCacheDistributedTreeManagerMBean ----------------------------------
+
+ public String getRootFqn()
+ {
+ return m_root == null ? DEFAULT_ROOT : m_root.toString();
+ }
+
+ // Public -----------------------------------------------------------------
+
+ @SuppressWarnings("unchecked")
+ public void init()
+ {
+ if (this.haStub == null)
+ {
+ throw new IllegalStateException("Must call setHAStub before starting");
+ }
+
+ if (this.m_cache == null)
+ {
+ if (cacheHandler == null)
+ {
+ throw new IllegalStateException("No clustered cache available");
+ }
+
+ try
+ {
+ Cache c = null;
+ synchronized (cacheHandler)
+ {
+ c = cacheHandler.getCache();
+ if (c == null)
+ {
+ cacheHandler.acquireCache();
+ c = cacheHandler.getCache();
+ acquiredCache = true;
+ }
+ }
+ cacheHandler.startCache();
+ setClusteredCache(c);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ log.debug("initializing HAJNDITreeCache root");
+ this.putTreeRoot();
+ }
+
+ public void shutdown()
+ {
+ if (acquiredCache)
+ {
+ try
+ {
+ cacheHandler.releaseCache();
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception releasing cache", e);
+ }
+ }
+ }
+
+ public Naming getHAStub()
+ {
+ return this.haStub;
+ }
+
+ public void setHAStub(Naming stub)
+ {
+ this.haStub = stub;
+ }
+
+ // Naming implementation -----------------------------------------
+
+ public void bind(Name name, Object obj, String className) throws NamingException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("bind, name="+name);
+ }
+
+ this.internalBind(name, obj, className, false);
+ }
+
+ public void rebind(Name name, Object obj, String className) throws NamingException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("rebind, name="+name);
+ }
+
+ this.internalBind(name, obj, className, true);
+ }
+
+ public void unbind(Name name) throws NamingException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("unbind, name="+name);
+ }
+ if (name.isEmpty())
+ {
+ // Empty names are not allowed
+ throw new InvalidNameException();
+ }
+
+ // is the name a context?
+ try
+ {
+ Fqn<String> temp = Fqn.fromRelativeFqn(this.m_root, Fqn.fromString(name.toString()));
+ // TODO why not jst call remove -- why hasChild first?
+ if (this.m_cache.getRoot().hasChild(temp))
+ {
+ this.m_cache.removeNode(temp);
+ return;
+ }
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+
+ int size = name.size();
+
+ // get the context and key
+ Fqn<String> ctx;
+ String key = name.get(size - 1);
+ if (size > 1) // find subcontext to which the key is bound
+ {
+ String prefix = name.getPrefix(size - 1).toString();
+ Fqn<String> fqn = Fqn.fromString(prefix);
+ ctx = Fqn.fromRelativeFqn(this.m_root, fqn);
+ }
+ else
+ {
+ ctx = this.m_root;
+ }
+
+ try
+ {
+ Object removed = this.m_cache.remove(ctx, key);
+ if (removed == null)
+ {
+ if (!this.m_cache.getRoot().hasChild(ctx))
+ {
+ throw new NotContextException(name.getPrefix(size - 1).toString() + " not a context");
+ }
+
+ throw new NameNotFoundException(key + " not bound");
+ }
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+ }
+
+ public Object lookup(Name name) throws NamingException
+ {
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ {
+ log.trace("lookup, name="+name);
+ }
+
+ if (name.isEmpty())
+ {
+ // Return this
+ return new NamingContext(null, parser.parse(""), this.getHAStub());
+ }
+
+ // is the name a context?
+ try
+ {
+ Node<String, Binding> n = this.m_cache.getRoot().getChild(Fqn.fromRelativeFqn(this.m_root, Fqn.fromString(name.toString())));
+ if (n != null)
+ {
+ Name fullName = (Name) name.clone();
+ return new NamingContext(null, fullName, this.getHAStub());
+ }
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+
+ int size = name.size();
+
+ // get the context and key
+ Fqn<String> ctx;
+ String key = name.get(size - 1);
+ if (size > 1) // find subcontext to which the key is bound
+ {
+ String prefix = name.getPrefix(size - 1).toString();
+ Fqn<String> fqn = Fqn.fromString(prefix);
+ ctx = Fqn.fromRelativeFqn(this.m_root, fqn);
+ }
+ else
+ {
+ ctx = this.m_root;
+ }
+
+ try
+ {
+ Binding b = this.m_cache.get(ctx, key);
+
+ // if key not in cache, return null
+ return (b != null) ? b.getObject() : null;
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+ }
+
+ public Collection<NameClassPair> list(Name name) throws NamingException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("list, name="+name);
+ }
+
+ // get the context
+ Fqn<String> ctx;
+ String ctxName = "";
+ int size = name.size();
+ if (size >= 1)
+ {
+ ctxName = name.toString();
+ Fqn<String> fqn = Fqn.fromString(ctxName);
+ ctx = Fqn.fromRelativeFqn(this.m_root, fqn);
+ }
+ else
+ {
+ ctx = this.m_root;
+ }
+
+ boolean exists = this.m_cache.getRoot().hasChild(ctx);
+ if (!exists)
+ {
+ try
+ {
+ return Collections.list(new InitialContext().list(name));
+ }
+ catch (NamingException e)
+ {
+ throw new NotContextException(ctxName+ " not a context");
+ }
+ }
+
+ try
+ {
+ List<NameClassPair> list = new LinkedList<NameClassPair>();
+
+ Node<String, Binding> base = this.m_cache.getRoot().getChild(ctx);
+ if (base != null)
+ {
+ for (Binding b: base.getData().values())
+ {
+ list.add(new NameClassPair(b.getName(),b.getClassName(),true));
+ }
+
+ // Why doesn't this return Set<String>?
+ Set<Object> children = base.getChildrenNames();
+ if (children != null && !children.isEmpty())
+ {
+ for (Object child: children)
+ {
+ String node = (String) child;
+ Name fullName = (Name) name.clone();
+ fullName.add(node);
+ list.add(new NameClassPair(node, NamingContext.class.getName(),true));
+ }
+ }
+ }
+
+ return list;
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+ }
+
+ public Collection<Binding> listBindings(Name name) throws NamingException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("listBindings, name="+name);
+ }
+
+ // get the context
+ Fqn<String> ctx;
+ String ctxName = "";
+ int size = name.size();
+ if (size >= 1)
+ {
+ ctxName = name.toString();
+ Fqn<String> fqn = Fqn.fromString(ctxName);
+ ctx = Fqn.fromRelativeFqn(this.m_root, fqn);
+ }
+ else
+ {
+ ctx = this.m_root;
+ }
+
+ boolean exists = this.m_cache.getRoot().hasChild(ctx);
+ if (!exists)
+ {
+ // not found in global jndi, look in local.
+ try
+ {
+ return Collections.list(new InitialContext().listBindings(name));
+ }
+ catch (NamingException e)
+ {
+ throw new NotContextException(ctxName+ " not a context");
+ }
+ }
+
+ try
+ {
+ List<Binding> list = new LinkedList<Binding>();
+
+ Node<String, Binding> node = this.m_cache.getRoot().getChild(ctx);
+ if (node != null)
+ {
+ Map<String, Binding> data = node.getData();
+ if (data != null && !data.isEmpty())
+ {
+ list.addAll(data.values());
+ }
+
+ // Why doesn't this return Set<String>?
+ Set<Object> children = node.getChildrenNames();
+ if (children != null && !children.isEmpty())
+ {
+ for (Object obj: children)
+ {
+ String child = (String) obj;
+ Name fullName = (Name) name.clone();
+ fullName.add(child);
+ NamingContext subCtx = new NamingContext(null, fullName, this.getHAStub());
+ list.add(new Binding(child, NamingContext.class.getName(), subCtx, true));
+ }
+ }
+ }
+
+ return list;
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+ }
+
+ public Context createSubcontext(Name name) throws NamingException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("createSubcontext, name="+name);
+ }
+
+ int size = name.size();
+
+ if (size == 0)
+ {
+ throw new InvalidNameException("Cannot pass an empty name to createSubcontext");
+ }
+
+ // does the new context already exist?
+ String str = name.toString();
+ Fqn<String> fqn = Fqn.fromString(str);
+ Fqn<String> ctx = Fqn.fromRelativeFqn(this.m_root, fqn);
+ if (this.m_cache.getRoot().hasChild(ctx))
+ {
+ throw new NameAlreadyBoundException();
+ }
+
+ // does the prefix context already exist?
+ Fqn<String> pctx;
+ String newctx = name.get(size - 1);
+ if (size > 1) // find subcontext to which the context will be added
+ {
+ String prefix = name.getPrefix(size - 1).toString();
+ Fqn<String> fqn2 = Fqn.fromString(prefix);
+ pctx = Fqn.fromRelativeFqn(this.m_root, fqn2);
+ }
+ else
+ {
+ pctx = this.m_root;
+ }
+
+ boolean exists = this.m_cache.getRoot().hasChild(pctx);
+ if (!exists)
+ {
+ throw new NotContextException(name.getPrefix(size - 1).toString());
+ }
+
+ Fqn<String> newf = Fqn.fromRelativeFqn(pctx, Fqn.fromString(newctx));
+ try
+ {
+ this.m_cache.put(newf, new HashMap<String, Binding>());
+ }
+ catch (CacheException ce)
+ {
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.setStackTrace(ce.getStackTrace());
+ throw ne;
+ }
+
+ Name fullName = parser.parse("");
+ fullName.addAll(name);
+
+ return new NamingContext(null, fullName, this.getHAStub());
+ }
+
+ private void putTreeRoot() throws CacheException
+ {
+ if (this.m_root == null)
+ {
+ setRootFqn(DEFAULT_ROOT);
+ }
+
+ if (!this.m_cache.getRoot().hasChild(this.m_root))
+ {
+ this.m_cache.put(this.m_root, null);
+ this.treeRootSet = true;
+ }
+ }
+
+ private void internalBind(Name name, Object obj, String className, boolean rebind) throws NamingException
+ {
+ if (name.isEmpty())
+ { // Empty names are not allowed
+ throw new InvalidNameException();
+ }
+
+ int size = name.size();
+
+ // get the context and key
+ Fqn<String> ctx;
+ String key = name.get(size - 1);
+ if (size > 1) // find subcontext to which the key will be added
+ {
+ String prefix = name.getPrefix(size - 1).toString();
+ Fqn<String> fqn = Fqn.fromString(prefix);
+ ctx = Fqn.fromRelativeFqn(this.m_root, fqn);
+ }
+ else
+ {
+ ctx = this.m_root;
+ }
+
+ boolean exists = this.m_cache.getRoot().hasChild(ctx);
+ if (!exists)
+ {
+ throw new NotContextException(name.getPrefix(size - 1).toString() + " not a context");
+ // note - NamingServer throws a CannotProceedException if the client attempts to bind
+ // to a Reference object having an "nns" address. This implementation simply
+ // throws the NotContextException that's used when "nns" isn't present.
+ }
+ if (!rebind)
+ {
+ Node<String, Binding> node = this.m_cache.getRoot().getChild(ctx);
+ if ((node != null) && (node.get(key) != null))
+ {
+ throw new NameAlreadyBoundException(key);
+ }
+ }
+
+ this.m_cache.put(ctx, key, new Binding(key, className, obj, true));
+ }
+}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManagerMBean.java (from rev 106793, projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/impl/jbc/JBossCacheDistributedTreeManagerMBean.java)
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManagerMBean.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/jndi/jbc/JBossCacheDistributedTreeManagerMBean.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,34 @@
+/*
+ * 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.jndi.jbc;
+
+
+/**
+ * StandardMBean interface for JBossCacheDistributedTreeManager.
+ *
+ * @author Brian Stansberry
+ */
+public interface JBossCacheDistributedTreeManagerMBean
+{
+ String getRootFqn();
+}
Deleted: 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-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,106 +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;
-
-import org.jboss.cache.Cache;
-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.SessionBasedJBossCacheService;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.Util;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class DistributedCacheManagerFactoryImpl implements DistributedCacheManagerFactory
-{
- public static final String DEFAULT_CLUSTER_NAME = "Tomcat-Cluster";
-
- /** TreeCache's isolation level */
- public static final String DEFAULT_ISOLATION_LEVEL = "REPEATABLE_READ";
-
- /** TreeCache's cache mode */
- public static final String DEFAULT_CACHE_MODE = "REPL_ASYNC";
-
- /** TreeCache's lock aquisition timeout */
- public static final long DEFAULT_LOCK_TIMEOUT = 15000;
-
- /** TransactionManagerLookup implementation that the TreeCache should use. */
- @SuppressWarnings("deprecation")
- public static final String DEFAULT_TM_LOOKUP =
- org.jboss.cache.transaction.BatchModeTransactionManagerLookup.class.getName();
-
- private Cache<Object, Object> plainCache;
-
- @SuppressWarnings("unchecked")
- public DistributedCacheManager getDistributedCacheManager(LocalDistributableSessionManager localManager)
- throws ClusteringNotSupportedException
- {
- ReplicationGranularity granularity = Util.getReplicationGranularity(localManager);
- switch(granularity)
- {
- case SESSION:
- return plainCache == null? new SessionBasedJBossCacheService(localManager) : new SessionBasedJBossCacheService(localManager, plainCache);
- case ATTRIBUTE:
- return plainCache == null? new AttributeBasedJBossCacheService(localManager) : new AttributeBasedJBossCacheService(localManager, plainCache);
- default:
- throw new IllegalStateException("Unknown ReplicationGranularity " + granularity);
- }
- }
-
- public void stop() throws Exception
- {
- if (plainCache != null)
- {
- plainCache.stop();
- plainCache.destroy();
- }
- }
-
- public Cache<Object, Object> getPlainCache()
- {
- return plainCache;
- }
-
- /**
- * Hook for test fixtures to inject a Cache, which if present will
- * be used to create the DistributedCacheManager in preference to any
- * passed <code>cacheConfigName</code>.
- */
- public void setPlainCache(Cache<Object, Object> plainCache)
- {
- this.plainCache = plainCache;
- }
-
- /**
- * Convenience method for test fixtures to clear any injected cache.
- */
- public void clearCaches()
- {
- this.plainCache = null;
- }
-}
Deleted: 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-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/TestDistributedCacheManagerFactoryImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,194 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc. 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 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;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.loader.FileCacheLoaderConfig;
-import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.transaction.BatchModeTransactionManagerLookup;
-import org.jboss.logging.Logger;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.TestDistributedCacheManagerFactory;
-
-/**
- *
- *
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class TestDistributedCacheManagerFactoryImpl implements TestDistributedCacheManagerFactory
-{
- private static final Logger log = Logger.getLogger(TestDistributedCacheManagerFactoryImpl.class);
-
- private DistributedCacheManagerFactoryImpl delegate = new DistributedCacheManagerFactoryImpl();
-
- public void configure(boolean local, String passivationDir, boolean totalReplication, boolean marshalling,
- boolean purgeCacheLoader)
- {
- Cache pc = createCache(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
- delegate.setPlainCache(pc);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(
- LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException
- {
- return delegate.getDistributedCacheManager(localManager);
- }
-
- public void cleanup(boolean doRemove)
- {
- Cache cache = delegate.getPlainCache();
- if (cache == null)
- return;
-
- 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.getLocalAddress());
- cache.removeNode(Fqn.fromString("/JSESSION"));
- }
- catch (Exception e)
- {
- log.error("Cache " + cache + ": " + e.getMessage(), e);
- }
- }
-
- try
- {
- cache.stop();
- cache.destroy();
- }
- catch (Exception e)
- {
- log.error("Cache " + cache + ": " + e.getMessage(), e);
- }
-
- }
-
-
-
-
- private static Cache createCache(boolean local, String passivationDir,
- boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
- {
- Configuration cfg = getConfiguration(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
- return DefaultCacheFactory.getInstance().createCache(cfg, true);
- }
-
- private static Configuration getConfiguration(boolean local, String passivationDir,
- boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
- {
- Configuration config = new Configuration();
- config.setClusterName("Tomcat-TestCluster");
- config.setTransactionManagerLookupClass(BatchModeTransactionManagerLookup.class.getName());
- config.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
- config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- config.setSyncReplTimeout(20000);
- config.setLockAcquisitionTimeout(15000);
-
- config.setCacheMode(local ? CacheMode.LOCAL : CacheMode.REPL_SYNC);
-
- config.setUseRegionBasedMarshalling(marshalling);
- config.setInactiveOnStartup(marshalling);
-
- // No async marshalling or notifications
- config.setSerializationExecutorPoolSize(0);
- config.setListenerAsyncPoolSize(0);
-
- // Block for commits -- no races between test driver and replication
- config.setSyncCommitPhase(true);
- config.setSyncRollbackPhase(true);
-
- if (passivationDir != null)
- {
- CacheLoaderConfig clc = new CacheLoaderConfig();
- clc.setPassivation(true);
- clc.setShared(false);
- FileCacheLoaderConfig fclc = new FileCacheLoaderConfig();
- fclc.setLocation(passivationDir);
- fclc.setFetchPersistentState(true);
- fclc.setPurgeOnStartup(purgeCacheLoader);
- fclc.setAsync(false);
- fclc.setIgnoreModifications(false);
- ArrayList<IndividualCacheLoaderConfig> iclcs = new ArrayList<IndividualCacheLoaderConfig>();
- iclcs.add(fclc);
- clc.setIndividualCacheLoaderConfigs(iclcs);
-
- config.setCacheLoaderConfig(clc);
- }
-
- if (!local && !totalReplication)
- {
- BuddyReplicationConfig brc = new BuddyReplicationConfig();
- brc.setEnabled(true);
- NextMemberBuddyLocatorConfig blc = new NextMemberBuddyLocatorConfig();
- blc.setNumBuddies(1);
- blc.setIgnoreColocatedBuddies(true);
- brc.setBuddyLocatorConfig(blc);
-
- brc.setBuddyPoolName("default");
- brc.setBuddyCommunicationTimeout(20000);
- brc.setAutoDataGravitation(false);
- brc.setDataGravitationRemoveOnFind(true);
- brc.setDataGravitationSearchBackupTrees(true);
-
- config.setBuddyReplicationConfig(brc);
- }
-
- return config;
- }
-
- public Object getLocalAddress()
- {
- Cache pc = delegate.getPlainCache();
- return pc == null ? null : pc.getLocalAddress();
- }
-
- public List<Object> 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-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -21,8 +21,6 @@
*/
package org.jboss.web.tomcat.service.session.distributedcache.impl.jbc;
-import java.io.IOException;
-import java.io.Serializable;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -46,18 +44,18 @@
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.transaction.BatchModeTransactionManager;
-import org.jboss.ha.framework.server.MarshalledValueHelper;
-import org.jboss.ha.framework.server.MarshalledValueObjectStreamSource;
-import org.jboss.ha.framework.server.SimpleCachableMarshalledValue;
import org.jboss.logging.Logger;
import org.jboss.util.loading.ContextClassLoaderSwitcher;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.BatchingManagerImpl;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.IncomingDistributableSessionDataImpl;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.SessionAttributeMarshallerFactoryImpl;
import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata;
import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData;
import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.SessionAttributeMarshaller;
import org.jboss.web.tomcat.service.session.distributedcache.spi.SessionOwnershipSupport;
/**
@@ -132,6 +130,8 @@
private boolean purgeOnStartStop_ = true;
+ final SessionAttributeMarshaller marshaller;
+
protected AbstractJBossCacheService(LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException
{
if (localManager == null)
@@ -141,6 +141,7 @@
this.manager_ = localManager;
establishCacheManager();
this.cacheConfigName_ = Util.getCacheConfigName(localManager);
+ this.marshaller = new SessionAttributeMarshallerFactoryImpl().createMarshaller(localManager);
}
protected AbstractJBossCacheService(LocalDistributableSessionManager localManager, Cache<Object, Object> cache)
@@ -156,6 +157,7 @@
this.manager_ = localManager;
this.plainCache_ = cache;
+ this.marshaller = new SessionAttributeMarshallerFactoryImpl().createMarshaller(localManager);
}
protected LocalDistributableSessionManager getManager()
@@ -343,7 +345,7 @@
// no-op by default
}
- public IncomingDistributableSessionData getSessionData(String realId, boolean initialLoad)
+ public IncomingDistributableSessionDataImpl getSessionData(String realId, boolean initialLoad)
{
if (realId == null)
{
@@ -375,7 +377,7 @@
setupSessionRegion(fqn);
}
- IncomingDistributableSessionData dsd = null;
+ IncomingDistributableSessionDataImpl dsd = null;
try
{
@@ -600,7 +602,7 @@
}
}
- public IncomingDistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes)
+ public IncomingDistributableSessionDataImpl getSessionData(String realId, String dataOwner, boolean includeAttributes)
{
boolean ourBatch = false;
boolean loadCompleted = false;
@@ -626,7 +628,7 @@
}
}
}
- IncomingDistributableSessionData result = distributedCacheData == null ? null : getDistributableSessionData(realId, distributedCacheData, includeAttributes);
+ IncomingDistributableSessionDataImpl result = distributedCacheData == null ? null : getDistributableSessionData(realId, distributedCacheData, includeAttributes);
loadCompleted = true;
return result;
}
@@ -748,23 +750,18 @@
* <strong>Note:</strong> This operation may alter the contents of the
* passed in map. If this is unacceptable, pass in a defensive copy.
*/
- protected IncomingDistributableSessionData getDistributableSessionData(String realId,
+ protected IncomingDistributableSessionDataImpl getDistributableSessionData(String realId,
Map<Object, Object> distributedCacheData,
boolean includeAttributes)
{
Integer version = (Integer) distributedCacheData.get(VERSION_KEY);
Long timestamp = (Long) distributedCacheData.get(TIMESTAMP_KEY);
DistributableSessionMetadata metadata = (DistributableSessionMetadata) distributedCacheData.get(METADATA_KEY);
- IncomingDistributableSessionData result = null;
+ IncomingDistributableSessionDataImpl result = new IncomingDistributableSessionDataImpl(version, timestamp, metadata);
if (includeAttributes)
{
- Map<String, Object> attrs = getSessionAttributes(realId, distributedCacheData);
- result = new IncomingDistributableSessionDataImpl(version, timestamp, metadata, attrs);
+ result.setSessionAttributes(getSessionAttributes(realId, distributedCacheData));
}
- else
- {
- result = new IncomingDistributableSessionDataImpl(version, timestamp, metadata);
- }
return result;
}
@@ -792,69 +789,6 @@
this.plainCache_ = null;
}
}
-
- protected Object getMarshalledValue(Object value)
- {
- // JBAS-2920. For now, continue using MarshalledValue, as
- // it allows lazy deserialization of the attribute on remote nodes
- // For Branch_4_0 this is what we have to do anyway for backwards
- // compatibility. For HEAD we'll follow suit for now.
- // TODO consider only using MV for complex objects (i.e. not primitives)
- // and Strings longer than X.
-
-// if (useTreeCacheMarshalling_)
-// {
-// return value;
-// }
-// else
-// {
-
- // JBAS-2921 - replaced MarshalledValue calls with SessionSerializationFactory calls
- // to allow for switching between JBossSerialization and JavaSerialization using
- // system property -D=session.serialization.jboss=true / false
- // MarshalledValue mv = new MarshalledValue(value);
- if (MarshalledValueHelper.isTypeExcluded(value.getClass()))
- {
- return value;
- }
- else
- {
- try
- {
- return new SimpleCachableMarshalledValue((Serializable) value, new MarshalledValueObjectStreamSource(), true);
- }
- catch (ClassCastException e)
- {
- throw new IllegalArgumentException(value + " does not implement java.io.Serializable");
- }
- }
-// }
- }
-
- protected Object getUnMarshalledValue(Object obj) throws IOException, ClassNotFoundException
- {
- if (!(obj instanceof SimpleCachableMarshalledValue))
- return obj;
-
- // Swap in/out the tcl for this web app. Needed only for un marshalling.
- ContextClassLoaderSwitcher.SwitchContext switcher = null;
- try
- {
- switcher = getContextClassLoaderSwitcher().getSwitchContext();
- switcher.setClassLoader(webAppClassLoader_);
-
- SimpleCachableMarshalledValue mv = (SimpleCachableMarshalledValue) obj;
- mv.setObjectStreamSource(new MarshalledValueObjectStreamSource());
- return mv.get();
- }
- finally
- {
- if (switcher != null)
- {
- switcher.reset();
- }
- }
- }
private List<Fqn<Object>> getBuddyBackupSessionFqns(String dataOwner, String contextHostPath, String sessionId)
{
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AttributeBasedJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AttributeBasedJBossCacheService.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AttributeBasedJBossCacheService.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -58,7 +58,7 @@
public void putAttribute(String realId, String key, Object value)
{
Fqn<String> fqn = getSessionFqn(combinedPath_, realId);
- cacheWrapper_.put(fqn, key, getMarshalledValue(value));
+ cacheWrapper_.put(fqn, key, this.marshaller.marshal(value));
}
public void putAttribute(String realId, Map<String, Object> map)
@@ -67,7 +67,7 @@
Map<Object, Object> marshalled = new HashMap<Object, Object>(map.size());
for (Map.Entry<String, Object> entry : map.entrySet())
{
- marshalled.put(entry.getKey(), getMarshalledValue(entry.getValue()));
+ marshalled.put(entry.getKey(), this.marshaller.marshal(entry.getValue()));
}
Fqn<String> fqn = getSessionFqn(combinedPath_, realId);
@@ -182,7 +182,7 @@
Map<Object, Object> marshalled = new HashMap<Object, Object>(map.size());
for (Map.Entry<String, Object> entry : map.entrySet())
{
- marshalled.put(entry.getKey(), getMarshalledValue(entry.getValue()));
+ marshalled.put(entry.getKey(), this.marshaller.marshal(entry.getValue()));
}
fqn = getSessionFqn(combinedPath_, sessionData.getRealId());
cacheWrapper_.put(fqn, marshalled);
@@ -218,7 +218,7 @@
{
try
{
- return getUnMarshalledValue(toUnmarshall);
+ return this.marshaller.unmarshal(toUnmarshall);
}
catch (RuntimeException e)
{
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/BatchingManagerImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/BatchingManagerImpl.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/BatchingManagerImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,96 +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 javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.TransactionManager;
-
-import org.jboss.logging.Logger;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
-
-/**
- * @author Brian Stansberry
- *
- */
-class BatchingManagerImpl implements BatchingManager
-{
- private static final Logger log = Logger.getLogger(BatchingManagerImpl.class);
-
- private final TransactionManager tm;
-
- BatchingManagerImpl(TransactionManager tm)
- {
- assert tm != null : " batchingManager is null";
-
- this.tm = tm;
- }
-
- public boolean isBatchInProgress() throws Exception
- {
- return (tm.getTransaction() != null);
- }
-
- public void startBatch() throws Exception
- {
- tm.begin();
- }
-
- public void setBatchRollbackOnly() throws Exception
- {
- tm.setRollbackOnly();
- }
-
- public void endBatch()
- {
- try
- {
- if(tm.getTransaction().getStatus() != Status.STATUS_MARKED_ROLLBACK)
- {
- tm.commit();
- }
- else
- {
- log.debug("endBatch(): rolling back batch");
- tm.rollback();
- }
- }
- catch (RollbackException re)
- {
- // Do nothing here since cache may rollback automatically.
- log.warn("endBatch(): rolling back transaction with exception: " +re);
- }
- catch (RuntimeException re)
- {
- throw re;
- }
- catch (Exception e)
- {
- throw new RuntimeException("endTransaction(): Caught Exception ending batch: ", e);
- }
-
- }
-
-
-
-}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/DistributedCacheManagerFactoryImpl.java (from rev 107120, 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/jbc/DistributedCacheManagerFactoryImpl.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/DistributedCacheManagerFactoryImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,103 @@
+/*
+ * 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 org.jboss.cache.Cache;
+import org.jboss.metadata.web.jboss.ReplicationGranularity;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class DistributedCacheManagerFactoryImpl implements DistributedCacheManagerFactory
+{
+ public static final String DEFAULT_CLUSTER_NAME = "Tomcat-Cluster";
+
+ /** TreeCache's isolation level */
+ public static final String DEFAULT_ISOLATION_LEVEL = "REPEATABLE_READ";
+
+ /** TreeCache's cache mode */
+ public static final String DEFAULT_CACHE_MODE = "REPL_ASYNC";
+
+ /** TreeCache's lock aquisition timeout */
+ public static final long DEFAULT_LOCK_TIMEOUT = 15000;
+
+ /** TransactionManagerLookup implementation that the TreeCache should use. */
+ @SuppressWarnings("deprecation")
+ public static final String DEFAULT_TM_LOOKUP =
+ org.jboss.cache.transaction.BatchModeTransactionManagerLookup.class.getName();
+
+ private Cache<Object, Object> plainCache;
+
+ @SuppressWarnings("unchecked")
+ public DistributedCacheManager getDistributedCacheManager(LocalDistributableSessionManager localManager)
+ throws ClusteringNotSupportedException
+ {
+ ReplicationGranularity granularity = Util.getReplicationGranularity(localManager);
+ switch(granularity)
+ {
+ case SESSION:
+ return plainCache == null? new SessionBasedJBossCacheService(localManager) : new SessionBasedJBossCacheService(localManager, plainCache);
+ case ATTRIBUTE:
+ return plainCache == null? new AttributeBasedJBossCacheService(localManager) : new AttributeBasedJBossCacheService(localManager, plainCache);
+ default:
+ throw new IllegalStateException("Unknown ReplicationGranularity " + granularity);
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ if (plainCache != null)
+ {
+ plainCache.stop();
+ plainCache.destroy();
+ }
+ }
+
+ public Cache<Object, Object> getPlainCache()
+ {
+ return plainCache;
+ }
+
+ /**
+ * Hook for test fixtures to inject a Cache, which if present will
+ * be used to create the DistributedCacheManager in preference to any
+ * passed <code>cacheConfigName</code>.
+ */
+ public void setPlainCache(Cache<Object, Object> plainCache)
+ {
+ this.plainCache = plainCache;
+ }
+
+ /**
+ * Convenience method for test fixtures to clear any injected cache.
+ */
+ public void clearCaches()
+ {
+ this.plainCache = null;
+ }
+}
Deleted: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/IncomingDistributableSessionDataImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/IncomingDistributableSessionDataImpl.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/IncomingDistributableSessionDataImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -1,125 +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.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData;
-
-/**
- * Base implementation of {@link DistributableSessionData}.
- *
- * @author Brian Stansberry
- */
-public class IncomingDistributableSessionDataImpl implements IncomingDistributableSessionData
-{
- private final int version;
- private final long timestamp;
- private final DistributableSessionMetadata metadata;
- private final Map<String, Object> attributes;
-
- public IncomingDistributableSessionDataImpl(Integer version, Long timestamp,
- DistributableSessionMetadata metadata)
- {
- if (version == null)
- throw new IllegalStateException("version is null");
- if (timestamp == null)
- throw new IllegalStateException("timestamp is null");
- if (metadata == null)
- throw new IllegalStateException("metadata is null");
-
- this.version = version.intValue();
- this.timestamp = timestamp.longValue();
- this.metadata = metadata;
- this.attributes = null;
- }
-
- public IncomingDistributableSessionDataImpl(Integer version, Long timestamp,
- DistributableSessionMetadata metadata,
- Map<String, Object> attributes)
- {
- if (version == null)
- throw new IllegalStateException("version is null");
- if (timestamp == null)
- throw new IllegalStateException("timestamp is null");
- if (metadata == null)
- throw new IllegalStateException("metadata is null");
- if (attributes == null)
- throw new IllegalStateException("attributes is null");
-
- this.version = version.intValue();
- this.timestamp = timestamp.longValue();
- this.metadata = metadata;
- this.attributes = attributes;
- }
-
- public IncomingDistributableSessionDataImpl(AtomicInteger version, AtomicLong timestamp,
- DistributableSessionMetadata metadata,
- Map<String, Object> attributes)
- {
- if (version == null)
- throw new IllegalStateException("version is null");
- if (timestamp == null)
- throw new IllegalStateException("timestamp is null");
- if (metadata == null)
- throw new IllegalStateException("metadata is null");
-
- this.version = version.get();
- this.timestamp = timestamp.get();
- this.metadata = metadata;
- this.attributes = attributes;
- }
-
- public boolean providesSessionAttributes()
- {
- return attributes != null;
- }
-
- public Map<String, Object> getSessionAttributes()
- {
- if (attributes == null)
- {
- throw new IllegalStateException("Not configured to provide session attributes");
- }
- return attributes;
- }
-
- public DistributableSessionMetadata getMetadata()
- {
- return metadata;
- }
-
- public long getTimestamp()
- {
- return timestamp;
- }
-
- public int getVersion()
- {
- return version;
- }
-
-}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/SessionBasedJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/SessionBasedJBossCacheService.java 2010-08-02 16:52:56 UTC (rev 107273)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/SessionBasedJBossCacheService.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -106,7 +106,7 @@
{
try
{
- return (Map<String, Object>) getUnMarshalledValue(distributedCacheData.get(ATTRIBUTE_KEY));
+ return (Map<String, Object>) this.marshaller.unmarshal(distributedCacheData.get(ATTRIBUTE_KEY));
}
catch (RuntimeException e)
{
@@ -124,7 +124,7 @@
Map<String, Object> attrs = sessionData.getSessionAttributes();
if (attrs != null)
{
- dataMap.put(ATTRIBUTE_KEY, getMarshalledValue(attrs));
+ dataMap.put(ATTRIBUTE_KEY, this.marshaller.marshal(attrs));
}
}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/TestDistributedCacheManagerFactoryImpl.java (from rev 106793, 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/TestDistributedCacheManagerFactoryImpl.java (rev 0)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/TestDistributedCacheManagerFactoryImpl.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. 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.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;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.loader.FileCacheLoaderConfig;
+import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.transaction.BatchModeTransactionManagerLookup;
+import org.jboss.logging.Logger;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.TestDistributedCacheManagerFactory;
+
+/**
+ *
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class TestDistributedCacheManagerFactoryImpl implements TestDistributedCacheManagerFactory
+{
+ private static final Logger log = Logger.getLogger(TestDistributedCacheManagerFactoryImpl.class);
+
+ private DistributedCacheManagerFactoryImpl delegate = new DistributedCacheManagerFactoryImpl();
+
+ public void configure(boolean local, String passivationDir, boolean totalReplication, boolean marshalling,
+ boolean purgeCacheLoader)
+ {
+ Cache pc = createCache(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
+ delegate.setPlainCache(pc);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(
+ LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException
+ {
+ return delegate.getDistributedCacheManager(localManager);
+ }
+
+ public void cleanup(boolean doRemove)
+ {
+ Cache cache = delegate.getPlainCache();
+ if (cache == null)
+ return;
+
+ 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.getLocalAddress());
+ cache.removeNode(Fqn.fromString("/JSESSION"));
+ }
+ catch (Exception e)
+ {
+ log.error("Cache " + cache + ": " + e.getMessage(), e);
+ }
+ }
+
+ try
+ {
+ cache.stop();
+ cache.destroy();
+ }
+ catch (Exception e)
+ {
+ log.error("Cache " + cache + ": " + e.getMessage(), e);
+ }
+
+ }
+
+
+
+
+ private static Cache createCache(boolean local, String passivationDir,
+ boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
+ {
+ Configuration cfg = getConfiguration(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
+ return DefaultCacheFactory.getInstance().createCache(cfg, true);
+ }
+
+ private static Configuration getConfiguration(boolean local, String passivationDir,
+ boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
+ {
+ Configuration config = new Configuration();
+ config.setClusterName("Tomcat-TestCluster");
+ config.setTransactionManagerLookupClass(BatchModeTransactionManagerLookup.class.getName());
+ config.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
+ config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
+ config.setSyncReplTimeout(20000);
+ config.setLockAcquisitionTimeout(15000);
+
+ config.setCacheMode(local ? CacheMode.LOCAL : CacheMode.REPL_SYNC);
+
+ config.setUseRegionBasedMarshalling(marshalling);
+ config.setInactiveOnStartup(marshalling);
+
+ // No async marshalling or notifications
+ config.setSerializationExecutorPoolSize(0);
+ config.setListenerAsyncPoolSize(0);
+
+ // Block for commits -- no races between test driver and replication
+ config.setSyncCommitPhase(true);
+ config.setSyncRollbackPhase(true);
+
+ if (passivationDir != null)
+ {
+ CacheLoaderConfig clc = new CacheLoaderConfig();
+ clc.setPassivation(true);
+ clc.setShared(false);
+ FileCacheLoaderConfig fclc = new FileCacheLoaderConfig();
+ fclc.setLocation(passivationDir);
+ fclc.setFetchPersistentState(true);
+ fclc.setPurgeOnStartup(purgeCacheLoader);
+ fclc.setAsync(false);
+ fclc.setIgnoreModifications(false);
+ ArrayList<IndividualCacheLoaderConfig> iclcs = new ArrayList<IndividualCacheLoaderConfig>();
+ iclcs.add(fclc);
+ clc.setIndividualCacheLoaderConfigs(iclcs);
+
+ config.setCacheLoaderConfig(clc);
+ }
+
+ if (!local && !totalReplication)
+ {
+ BuddyReplicationConfig brc = new BuddyReplicationConfig();
+ brc.setEnabled(true);
+ NextMemberBuddyLocatorConfig blc = new NextMemberBuddyLocatorConfig();
+ blc.setNumBuddies(1);
+ blc.setIgnoreColocatedBuddies(true);
+ brc.setBuddyLocatorConfig(blc);
+
+ brc.setBuddyPoolName("default");
+ brc.setBuddyCommunicationTimeout(20000);
+ brc.setAutoDataGravitation(false);
+ brc.setDataGravitationRemoveOnFind(true);
+ brc.setDataGravitationSearchBackupTrees(true);
+
+ config.setBuddyReplicationConfig(brc);
+ }
+
+ return config;
+ }
+
+ public Object getLocalAddress()
+ {
+ Cache pc = delegate.getPlainCache();
+ return pc == null ? null : pc.getLocalAddress();
+ }
+
+ public List<Object> getMembers()
+ {
+ Cache pc = delegate.getPlainCache();
+ return pc == null ? null : new ArrayList<Object>(pc.getMembers());
+ }
+
+}
Copied: projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/jbc (from rev 106793, projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl)
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/jbc/CacheListenerUnitTestCase.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/impl/CacheListenerUnitTestCase.java 2010-07-16 20:42:27 UTC (rev 106793)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/jbc/CacheListenerUnitTestCase.java 2010-08-02 16:59:55 UTC (rev 107274)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.web.tomcat.service.session.distributedcache.impl;
+package org.jboss.web.tomcat.service.session.distributedcache.jbc;
import junit.framework.TestCase;
More information about the jboss-cvs-commits
mailing list