[jboss-cvs] JBossAS SVN: r73316 - in projects/ejb3/trunk: core/src/main/java/org/jboss/ejb3/entity and 13 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 12 18:01:42 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-05-12 18:01:40 -0400 (Mon, 12 May 2008)
New Revision: 73316

Removed:
   projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-beans.xml
   projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-service.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-beans.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-service.xml
Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JBCCacheFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TransactionalCacheFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TreeCacheProviderHook.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticBulkOperationsUnitTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEmbeddedIdClassloaderTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityUnitTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java
   projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/classloader/optimistic/META-INF/persistence.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/META-INF/persistence.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/providedprefix/META-INF/persistence.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/ejb-jar.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/jboss.xml
   projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/islocal/foreign/testlocal-beans.xml
   projects/ejb3/trunk/core/src/test/resources/test/ejbthree1136/jboss-service.xml
   projects/ejb3/trunk/installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-deploy-clustered.txt
Log:
[EJBTHREE-1344][EJBTHREE-1354] Use JBC CacheManager for clustered caches

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -29,19 +29,17 @@
 
 import javax.ejb.EJBException;
 import javax.ejb.NoSuchEJBException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.CacheStatus;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionNotEmptyException;
 import org.jboss.cache.config.EvictionPolicyConfig;
 import org.jboss.cache.eviction.LRUConfiguration;
-import org.jboss.cache.jmx.CacheJmxWrapperMBean;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeActivated;
 import org.jboss.cache.notifications.annotation.NodePassivated;
@@ -54,9 +52,8 @@
 import org.jboss.ejb3.stateful.NestedStatefulBeanContext;
 import org.jboss.ejb3.stateful.ProxiedStatefulBeanContext;
 import org.jboss.ejb3.stateful.StatefulBeanContext;
+import org.jboss.ha.framework.server.CacheManagerLocator;
 import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.util.id.GUID;
 
 /**
@@ -102,7 +99,10 @@
    protected RemovalTimeoutTask removalTask = null;
    protected boolean running = true;
    protected Map<Object, Long> beans = new ConcurrentHashMap<Object, Long>();
+   protected CacheConfig cacheConfig;
+   protected CacheManager cacheManager;
    protected EJBContainer ejbContainer;
+   protected Object shutdownLock = new Object();
 
    public StatefulBeanContext create()
    {
@@ -302,34 +302,72 @@
       log = Logger.getLogger(getClass().getName() + "." + this.ejbContainer.getEjbName());
 
       this.pool = this.ejbContainer.getPool();
-      ClassLoader cl = this.ejbContainer.getClassloader();
-      this.classloader = new WeakReference<ClassLoader>(cl);
+      this.classloader = new WeakReference<ClassLoader>(this.ejbContainer.getClassloader());
       
-      CacheConfig config = (CacheConfig) ejbContainer.resolveAnnotation(CacheConfig.class);
-      MBeanServer server = MBeanServerLocator.locateJBoss();
-      String name = config.name();
+      cacheConfig = (CacheConfig) this.ejbContainer.getAnnotation(CacheConfig.class);
+
+      this.cacheManager = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
+
+      removalTimeout = cacheConfig.removalTimeoutSeconds();
+      if (removalTimeout > 0)
+         removalTask = new RemovalTimeoutTask("SFSB Removal Thread - " + this.ejbContainer.getObjectName().getCanonicalName());
+   }
+
+   protected EvictionPolicyConfig getEvictionPolicyConfig()
+   {
+      LRUConfiguration epc = new LRUConfiguration();
+      // Override the standard policy class
+      epc.setEvictionPolicyClass(AbortableLRUPolicy.class.getName());
+      epc.setTimeToLiveSeconds((int) cacheConfig.idleTimeoutSeconds());
+      epc.setMaxNodes(cacheConfig.maxSize());
+      return epc;
+   }
+
+   public void start()
+   {      
+      // Get our cache
+      String name = cacheConfig.name();
       if (name == null || name.trim().length() == 0)
          name = CacheConfig.DEFAULT_CLUSTERED_OBJECT_NAME;
-      ObjectName cacheON = new ObjectName(name);
-      CacheJmxWrapperMBean mbean = (CacheJmxWrapperMBean) MBeanProxyExt.create(CacheJmxWrapperMBean.class, cacheON, server);
-      cache = mbean.getCache();
+      try
+      {
+         cache = cacheManager.getCache(name, true);
+      }
+      catch (CacheException ce)
+      {
+         throw convertToRuntimeException(ce);
+      }
+      catch (RuntimeException re)
+      {
+         throw re;
+      }
+      catch (Exception e1)
+      {
+         throw new RuntimeException("Cannot get cache with name " + name, e1);
+      }
 
       cacheNode = new Fqn(new Object[] { this.ejbContainer.getDeploymentPropertyListString() });
       
       // Try to create an eviction region per ejb
       region = cache.getRegion(cacheNode, true);
-      EvictionPolicyConfig epc = getEvictionPolicyConfig((int) config.idleTimeoutSeconds(),
-            config.maxSize());
+      EvictionPolicyConfig epc = getEvictionPolicyConfig();
       region.setEvictionPolicy(epc);
 
+      if (cache.getCacheStatus() != CacheStatus.STARTED)
+      {
+         if (cache.getCacheStatus() != CacheStatus.CREATED)
+            cache.create();
+         cache.start();
+      }
+      
       // JBCACHE-1136.  There's no reason to have state in an inactive region
       cleanBeanRegion();
 
       // Transfer over the state for the region
-      region.registerContextClassLoader(cl);
+      region.registerContextClassLoader(classloader.get());
       try
       {
-      	region.activate();
+        region.activate();
       }
       catch (RegionNotEmptyException e)
       {
@@ -339,26 +377,9 @@
          cleanBeanRegion();
          region.activate();
       }
-
-      log.debug("initialize(): created region: " +region + " for ejb: " + this.ejbContainer.getEjbName());
-
-      removalTimeout = config.removalTimeoutSeconds();
-      if (removalTimeout > 0)
-         removalTask = new RemovalTimeoutTask("SFSB Removal Thread - " + this.ejbContainer.getObjectName().getCanonicalName());
-   }
-
-   protected EvictionPolicyConfig getEvictionPolicyConfig(int timeToLiveSeconds, int maxNodes)
-   {
-      LRUConfiguration epc = new LRUConfiguration();
-      // Override the standard policy class
-      epc.setEvictionPolicyClass(AbortableLRUPolicy.class.getName());
-      epc.setTimeToLiveSeconds(timeToLiveSeconds);
-      epc.setMaxNodes(maxNodes);
-      return epc;
-   }
-
-   public void start()
-   {
+      
+      log.debug("started(): created region: " +region + " for ejb: " + ejbContainer.getEjbName());
+      
       // register to listen for cache events
 
       // TODO this approach may not be scalable when there are many beans
@@ -377,6 +398,13 @@
    {
       running = false;
 
+      // Block until the removalTask is done removing a bean (if it is)
+      synchronized (shutdownLock)
+      {
+         if (removalTask != null && removalTask.isAlive())
+            removalTask.interrupt();
+      }
+      
       if (cache != null)
       {
          // Remove the listener
@@ -387,24 +415,12 @@
          // which is not affected by the inactivateRegion call below.
          cleanBeanRegion();
 
-         try {
-            // Remove locally. We do this to clean up the persistent store,
-            // which is not affected by the region.deactivate call below.
-            cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
-            cache.removeNode(cacheNode);
-         }
-         catch (CacheException e)
-         {
-            log.error("stop(): can't remove bean from the underlying distributed cache");
-         }
-
          if (region != null)
          {
             region.deactivate();
             region.unregisterContextClassLoader();
 
-            // FIXME this method needs to be in Cache
-            ((CacheSPI) cache).getRegionManager().removeRegion(region.getFqn());
+            cache.removeRegion(region.getFqn());
             // Clear any queues
             region.resetEvictionQueues();
             region = null;
@@ -413,8 +429,11 @@
 
       classloader = null;
 
-      if (removalTask != null)
-         removalTask.interrupt();
+      // Return the cache
+      String name = cacheConfig.name();
+      if (name == null || name.trim().length() == 0)
+         name = CacheConfig.DEFAULT_CLUSTERED_OBJECT_NAME;
+      cacheManager.releaseCache(name);
 
       log.debug("stop(): StatefulTreeCache stopped successfully for " +cacheNode);
    }
@@ -704,13 +723,18 @@
                long now = System.currentTimeMillis();
 
                Iterator<Map.Entry<Object, Long>> it = beans.entrySet().iterator();
-               while (it.hasNext())
+               
+               // Block stop() processing while we process
+               synchronized (shutdownLock)
                {
-                  Map.Entry<Object, Long> entry = it.next();
-                  long lastUsed = entry.getValue().longValue();
-                  if (now - lastUsed >= removalTimeout * 1000)
+                  while (running && it.hasNext())
                   {
-                     remove(entry.getKey());
+                     Map.Entry<Object, Long> entry = it.next();
+                     long lastUsed = entry.getValue().longValue();
+                     if (now - lastUsed >= removalTimeout * 1000)
+                     {
+                        remove(entry.getKey());
+                     }
                   }
                }
             }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JBCCacheFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JBCCacheFactory.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JBCCacheFactory.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -2,17 +2,17 @@
 
 import java.util.Properties;
 
-import javax.management.ObjectName;
-
 import org.hibernate.cache.Cache;
 import org.hibernate.cache.CacheException;
-import org.jboss.cache.jmx.CacheJmxWrapperMBean;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.CacheStatus;
 import org.jboss.ejb3.tx.TxUtil;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ha.framework.server.CacheManagerLocator;
 
 class JBCCacheFactory extends TransactionalCacheFactory
 {
+   private CacheManager cacheManager;
+   private String cacheName;
    private org.jboss.cache.Cache cache;
    private boolean optimistic;
    
@@ -25,15 +25,17 @@
    {
        try
        {
-          String cacheName = (String) hibernateConfig.get(TreeCacheProviderHook.HIBERNATE_CACHE_OBJECT_NAME_PROPERTY);
+          cacheManager = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
+          
+          cacheName = (String) hibernateConfig.get(TreeCacheProviderHook.HIBERNATE_CACHE_CONFIG_NAME_PROPERTY);
           if (cacheName == null)
           {
+             cacheName = (String) hibernateConfig.get(TreeCacheProviderHook.HIBERNATE_CACHE_OBJECT_NAME_PROPERTY);
+          }
+          if (cacheName == null)
+          {
              cacheName = TreeCacheProviderHook.DEFAULT_MBEAN_OBJECT_NAME;
-          }
-          ObjectName mbeanObjectName = new ObjectName(cacheName);
-          CacheJmxWrapperMBean mbean = (CacheJmxWrapperMBean) MBeanProxyExt.create(CacheJmxWrapperMBean.class, mbeanObjectName, MBeanServerLocator.locateJBoss());
-          cache = mbean.getCache();
-          optimistic = cache.getConfiguration().isNodeLockingOptimistic();
+          }          
        }
        catch (Exception e)
        {
@@ -41,6 +43,33 @@
        }      
    }
    
+   public void start()
+   {
+      try
+      {
+         cache = cacheManager.getCache(cacheName, true);
+         optimistic = cache.getConfiguration().isNodeLockingOptimistic();
+         if (cache.getCacheStatus() != CacheStatus.STARTED)
+         {
+            if (cache.getCacheStatus() != CacheStatus.CREATED)
+            {
+               cache.create();
+            }
+            
+            if (cache.getConfiguration().getRuntimeConfig().getTransactionManager() == null
+                  && cache.getConfiguration().getTransactionManagerLookupClass() == null)
+            {
+               cache.getConfiguration().getRuntimeConfig().setTransactionManager(TxUtil.getTransactionManager());
+            }
+            cache.start();
+         }
+      }
+      catch (Exception e)
+      {
+         throw new CacheException("Problem accessing cache " + cacheName, e);
+      }
+   }
+   
    public Cache buildCache(String regionName, Properties properties) throws CacheException
    {
       String regionPrefix = properties.getProperty(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX);
@@ -56,6 +85,12 @@
       }
    }
    
+   public void stop()
+   {
+      if (cache != null)
+         cacheManager.releaseCache(cacheName);
+   }
+   
    public boolean isOptimistic()
    {
       return optimistic;

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TransactionalCacheFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TransactionalCacheFactory.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TransactionalCacheFactory.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -54,6 +54,10 @@
       
    }
    
+   public abstract void start();
+   
+   public abstract void stop();
+   
    /**
     * Construct and configure the Cache representation of a named cache region.
     *

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TreeCacheProviderHook.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TreeCacheProviderHook.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/TreeCacheProviderHook.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -45,7 +45,16 @@
 {
    /**
     * Name of the Hibernate configuration property used to provide
+    * the name of the JBoss Cache instance.
+    */
+   public static final String HIBERNATE_CACHE_CONFIG_NAME_PROPERTY = 
+      "hibernate.cache.jbc2.config.name";
+   
+   /**
+    * Name of the Hibernate configuration property used to provide
     * the ObjectName of the JBoss Cache instance.
+    * 
+    * @deprecated use {@link #HIBERNATE_CACHE_CONFIG_NAME_PROPERTY}
     */
    public static final String HIBERNATE_CACHE_OBJECT_NAME_PROPERTY = 
       "hibernate.treecache.mbean.object_name";
@@ -85,7 +94,7 @@
    }
 
    /**
-    * Find the underlying JBoss Cache TreeCache instance.
+    * Find the underlying JBoss Cache instance.
     *
     * @param properties  All current config settings. 
     *                    If {@link #HIBERNATE_CACHE_OBJECT_NAME_PROPERTY} is provided,
@@ -97,10 +106,13 @@
    public void start(Properties properties)
    {
       cacheFactory = TransactionalCacheFactory.getFactory(properties);
+      cacheFactory.start();
    }
 
    public void stop()
    {
+      if (cacheFactory != null)
+         cacheFactory.stop();
    }
    
    protected TransactionalCacheFactory getCacheFactory()

Deleted: projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-beans.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-beans.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <!-- First we create a Configuration object for the cache -->
-   <bean name="EJB3SFSBCacheConfig"
-   		 class="org.jboss.cache.config.Configuration">
-      
-      <!-- Externally injected services -->  
-      <property name="runtimeConfig">
-         <bean name="EJB3SFSBCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
-            <!--property name="transactionManager"><inject bean="jboss:service=TransactionManager" property="transactionManager"/></property-->
-            <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
-         </bean>
-      </property>
-      
-      <property name="multiplexerStack">${jboss.multiplexer.stack:udp}</property>
-
-      <property name="clusterName">${jboss.partition.name:DefaultPartition}-SFSBCache</property>
-      
-      <!--
-              Node locking level : SERIALIZABLE
-                                   REPEATABLE_READ (default)
-                                   READ_COMMITTED
-                                   READ_UNCOMMITTED
-                                   NONE
-      -->
-      <property name="isolationLevelString">REPEATABLE_READ</property>
-
-      <!--     Valid modes are LOCAL
-                               REPL_ASYNC
-                               REPL_SYNC
-      -->
-      <property name="cacheModeString">REPL_ASYNC</property>
-
-      <!--    Number of milliseconds to wait until all responses for a
-              synchronous call have been received.
-      -->
-      <property name="syncReplTimeout">17500</property>
-      <!--  Max number of milliseconds to wait for a lock acquisition -->
-      <property name="lockAcquisitionTimeout">15000</property>
-      <property name="stateRetrievalTimeout">60000</property>
-        
-      <property name="exposeManagementStatistics">true</property>
-
-      <!-- We want to activate/inactivate regions as beans are deployed -->
-      <property name="useRegionBasedMarshalling">true</property>
-      <!-- Must match the value of "useRegionBasedMarshalling" -->
-      <property name="inactiveOnStartup">true</property>
-
-      <property name="evictionConfig">
-      	 <bean name="EJB3SFSBEvictionConfig" class="org.jboss.cache.config.EvictionConfig">
-      	   <property name="defaultEvictionPolicyClass">org.jboss.cache.eviction.NullEvictionPolicyConfig</property>
-            <property name="wakeupIntervalSeconds">5</property>
-            <property name="evictionRegionConfigs">
-            	<list>
-            		<!-- Default region would never timeout -->
-            		<bean name="EJB3SFSBDefaultEvictionRegionConfig" class="org.jboss.cache.config.EvictionRegionConfig">
-            			<property name="regionName">/_default_</property>
-            			<property name="evictionPolicyConfig">
-            				<bean name="EJB3SFSBDefaultLRUConfig" 
-            				      class="org.jboss.cache.eviction.NullEvictionPolicyConfig"/>
-               			</property>
-            		</bean>
-            		<!-- EJB3 integration code will programatically create other
-                       regions as beans are deployed -->
-            	</list>
-			</property>
-         </bean>
-      </property>
-   
-      <property name="buddyReplicationConfig">
-      	<bean name="EJB3SFSBBuddyReplicationConfig" 
-      		class="org.jboss.cache.config.BuddyReplicationConfig">
-      		
-      		<property name="enabled">true</property>
-            <property name="buddyPoolName">default</property>
-            <property name="buddyCommunicationTimeout">17500</property>
-
-            <property name="autoDataGravitation">false</property>
-            <property name="dataGravitationRemoveOnFind">true</property>
-            <property name="dataGravitationSearchBackupTrees">true</property>
-            
-            <property name="buddyLocatorConfig">
-            	<bean name="EJB3SFSBBuddyLocatorConfig" class="org.jboss.cache.buddyreplication.NextMemberBuddyLocatorConfig">
-            		<property name="numBuddies">1</property>
-            		<property name="ignoreColocatedBuddies">true</property>
-                </bean>
-      		</property>
-      	</bean>
-      </property>
-      
-      <property name="cacheLoaderConfig">
-      	<bean name="EJB3SFSBCacheLoaderConfig" 
-      		class="org.jboss.cache.config.CacheLoaderConfig">
-      		
-      		<property name="passivation">true</property>
-            <property name="shared">false</property>
-            <property name="individualCacheLoaderConfigs">
-              	<list>
-              		<bean name="EJB3SFSBFileCacheLoader" class="org.jboss.cache.loader.FileCacheLoaderConfig">
-               			<!-- Temporary workaround to a bug in JBC 2.0.0.ALPHA1 -->
-               			<property name="className">org.jboss.ejb3.cache.tree.SFSBFileCacheLoader</property>
-               			<property name="location">${jboss.server.data.dir}${/}sfsb</property>
-                   		<property name="async">false</property>
-                   		<property name="fetchPersistentState">true</property>
-                   		<property name="ignoreModifications">false</property>
-                        <property name="checkCharacterPortability">false</property>
-               		</bean>
-               	</list>
-            </property>
-      	 </bean>
-      </property>     
-   </bean>
-    
-   <!-- Now we use the above configuration to construct the cache itself -->
-   <bean name="EJB3SFSBClusteredCache" class="org.jboss.cache.jmx.CacheJmxWrapper">
-      
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=EJB3SFSBClusteredCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true)</annotation>
-      
-      <property name="configuration"><inject bean="EJB3SFSBCacheConfig"/></property>
-        
-   </bean>
-
-</deployment>
-

Deleted: projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-service.xml
===================================================================
--- projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-service.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/main/resources/ejb3-clustered-sfsbcache-service.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
-
-   <!-- ========================================================== -->
-   <!-- Clustered SFSB cache config for use with JBoss Cache 1.4.x --> 
-   <!-- ========================================================== -->
-   <mbean code="org.jboss.cache.TreeCache" 
-          name="jboss.cache:service=EJB3SFSBClusteredCache">
-        
-      <attribute name="ClusterName">${jboss.partition.name:DefaultPartition}-SFSBCache</attribute>
-      
-      <!--
-              Node locking level : SERIALIZABLE
-                                   REPEATABLE_READ (default)
-                                   READ_COMMITTED
-                                   READ_UNCOMMITTED
-                                   NONE
-      -->
-      <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
-
-      <!--     Valid modes are LOCAL
-                               REPL_ASYNC
-                               REPL_SYNC
-      -->
-      <attribute name="CacheMode">REPL_ASYNC</attribute>
-
-	  <!-- We want to activate/inactivate regions as beans are deployed -->
-      <attribute name="UseRegionBasedMarshalling">true</attribute>
-      <!-- Must match the value of "useRegionBasedMarshalling" -->
-      <attribute name="InactiveOnStartup">true</attribute>
-
-	  <!-- 
-	       JGroups protocol stack config in XML format.
-		   If your CacheMode is set to REPL_SYNC we recommend you comment
-           out the FC (flow control) protocol
-			 
-           On Windows machines, because of the media sense feature
-           being broken with multicast (even after disabling media sense)
-           set the UDP.loopback attribute to true
-	  -->     
-      <attribute name="ClusterConfig">
-         <config>
-            <UDP mcast_addr="${jgroups.udp.mcast_addr:228.1.2.3}" 
-             mcast_port="${jboss.ejb3sfsbpartition.mcast_port:45551}"
-             tos="8"
-             ucast_recv_buf_size="20000000"
-             ucast_send_buf_size="640000"
-             mcast_recv_buf_size="25000000"
-             mcast_send_buf_size="640000"
-             loopback="false"
-             discard_incompatible_packets="true"
-             max_bundle_size="64000"
-             max_bundle_timeout="30"
-             use_incoming_packet_handler="true"
-             use_outgoing_packet_handler="false"
-             ip_ttl="${jgroups.udp.ip_ttl:2}"
-             down_thread="false" up_thread="false"
-             enable_bundling="true"/>
-          <PING timeout="2000"
-             down_thread="false" up_thread="false" num_initial_members="3"/>
-          <MERGE2 max_interval="100000"
-             down_thread="false" up_thread="false" min_interval="20000"/>
-          <FD_SOCK down_thread="false" up_thread="false"/>
-          <FD timeout="10000" max_tries="5" down_thread="false" up_thread="false" shun="true"/>
-          <VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false"/>
-          <pbcast.NAKACK max_xmit_size="60000"
-                   use_mcast_xmit="false" gc_lag="0"
-                   retransmit_timeout="300,600,1200,2400,4800"
-                   down_thread="false" up_thread="false"
-                   discard_delivered_msgs="true"/>
-          <UNICAST timeout="300,600,1200,2400,3600"
-             down_thread="false" up_thread="false"/>
-          <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
-                   down_thread="false" up_thread="false"
-                   max_bytes="400000"/>
-          <pbcast.GMS print_local_addr="true" join_timeout="3000"
-                   down_thread="false" up_thread="false"
-                   join_retry_timeout="2000" shun="true"
-                   view_bundling="true"
-                   view_ack_collection_timeout="5000"/>
-          <FC max_credits="2000000" down_thread="false" up_thread="false"
-              min_threshold="0.10"/>
-          <FRAG2 frag_size="60000" down_thread="false" up_thread="false"/>
-          <pbcast.STATE_TRANSFER down_thread="false" up_thread="false" use_flush="false"/>
-        </config>
-      </attribute>
-
-      <!--    The max amount of time (in milliseconds) we wait until the
-            initial state (ie. the contents of the cache) are retrieved from
-            existing members.
-      -->
-      <attribute name="InitialStateRetrievalTimeout">17500</attribute>
-
-      <!--    Number of milliseconds to wait until all responses for a
-              synchronous call have been received.
-      -->
-      <attribute name="SyncReplTimeout">17500</attribute>
-
-      <!--  Max number of milliseconds to wait for a lock acquisition -->
-      <attribute name="LockAcquisitionTimeout">15000</attribute>
-
-      <!--  Name of the eviction policy class. -->
-      <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
-
-      <!--  Specific eviction policy configurations. -->
-      <attribute name="EvictionPolicyConfig">
-         <config>
-            <attribute name="wakeUpIntervalSeconds">5</attribute>
-            <name>statefulClustered</name>
-            <!-- So default region would never timeout -->
-            <region name="/_default_">
-               <attribute name="maxNodes">0</attribute>
-               <attribute name="timeToIdleSeconds">0</attribute>
-            </region>
-
-         </config>
-      </attribute>
-
-      <!-- Store passivated sessions to the file system -->
-      <attribute name="CacheLoaderConfiguration">
-          <config>
-              
-              <passivation>true</passivation>
-              <shared>false</shared>
-
-              <cacheloader>
-                  <class>org.jboss.cache.loader.FileCacheLoader</class>
-                  <!-- Passivate to the server data dir -->
-                  <properties>
-                       location=${jboss.server.data.dir}${/}sfsb 
-                  </properties>
-                  <async>false</async>
-                  <fetchPersistentState>true</fetchPersistentState>
-                  <ignoreModifications>false</ignoreModifications>
-              </cacheloader>
-
-          </config>
-      </attribute>
-   </mbean>
-
-</server>
-

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -29,20 +29,18 @@
 import javax.ejb.Remote;
 import javax.ejb.Remove;
 import javax.ejb.Stateless;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 
 import org.jboss.cache.Cache;
+import org.jboss.cache.CacheManager;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.jmx.CacheJmxWrapperMBean;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeVisited;
 import org.jboss.cache.notifications.event.NodeVisitedEvent;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ha.framework.server.CacheManagerLocator;
 import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
 
 /**
  * Comment
@@ -52,6 +50,7 @@
  */
 @Stateless
 @Remote(EntityTest.class)
+ at RemoteBinding(jndiBinding="EntityTestBean/remote")
 public class EntityTestBean implements EntityTest
 {
    private static final Logger log = Logger.getLogger(EntityTestBean.class);
@@ -59,7 +58,7 @@
    @PersistenceContext
    private EntityManager manager;
    
-   private String cacheObjectName;
+   private String cacheConfigName;
    
    private transient Cache cache;
    
@@ -72,9 +71,9 @@
    public void getCache(boolean optimistic)
    {
       if (optimistic)
-         cacheObjectName = "jboss.cache:service=OptimisticEJB3EntityTreeCache";
+         cacheConfigName = "optimistic-shared";
       else
-         cacheObjectName = "jboss.cache:service=EJB3EntityTreeCache";
+         cacheConfigName = "pessimistic-shared";
 
       try
       {
@@ -220,15 +219,25 @@
       {
          log.error("Caught exception in cleanup", e);
       }
+      
+      try
+      {
+         if (cache != null)
+            CacheManagerLocator.getCacheManagerLocator().getCacheManager(null).releaseCache(cacheConfigName);
+      }
+      catch (Exception e)
+      {
+         log.error("Caught exception releasing cache", e);
+      }
    }
 
    private Cache getCache() throws Exception
    {
-      if (cache == null && cacheObjectName != null)
+      if (cache == null && cacheConfigName != null)
       {
-         MBeanServer server = MBeanServerLocator.locateJBoss();
-         CacheJmxWrapperMBean proxy = (CacheJmxWrapperMBean)MBeanProxyExt.create(CacheJmxWrapperMBean.class, new ObjectName(cacheObjectName), server);
-         cache = proxy.getCache();
+         CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
+         cache = cm.getCache(cacheConfigName, true);
+         cache.start();
       }
       return cache;
    }

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -30,15 +30,13 @@
 import javax.ejb.Remote;
 import javax.ejb.Remove;
 import javax.ejb.Stateful;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 import javax.persistence.Query;
 
 import org.jboss.cache.Cache;
+import org.jboss.cache.CacheManager;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.jmx.CacheJmxWrapperMBean;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeCreated;
 import org.jboss.cache.notifications.annotation.NodeModified;
@@ -46,9 +44,9 @@
 import org.jboss.cache.notifications.event.NodeCreatedEvent;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.notifications.event.NodeVisitedEvent;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ha.framework.server.CacheManagerLocator;
 import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
 
 /**
  * Comment
@@ -58,6 +56,7 @@
  */
 @Stateful
 @Remote(EntityQueryTest.class)
+ at RemoteBinding(jndiBinding="EntityQueryTestBean/remote")
 public class EntityQueryTestBean implements EntityQueryTest
 {
    private static final Logger log = Logger.getLogger(EntityQueryTestBean.class);
@@ -65,8 +64,10 @@
    @PersistenceContext
    private EntityManager manager;
    
-   private String cacheObjectName;
+   private String cacheConfigName;
    
+   private transient Cache cache;
+   
    private MyListener listener;
 
    public EntityQueryTestBean()
@@ -76,9 +77,9 @@
    public void getCache(boolean optimistic)
    {
       if (optimistic)
-         cacheObjectName = "jboss.cache:service=OptimisticEJB3EntityTreeCache";
+         cacheConfigName = "optimistic-shared";
       else
-         cacheObjectName = "jboss.cache:service=EJB3EntityTreeCache";
+         cacheConfigName = "pessimistic-shared";
 
       try
       {
@@ -295,14 +296,26 @@
       {
         log.error("Caught exception in remove", e);
       }
+      
+      try
+      {
+         if (cache != null)
+            CacheManagerLocator.getCacheManagerLocator().getCacheManager(null).releaseCache(cacheConfigName);
+      }
+      catch (Exception e)
+      {
+         log.error("Caught exception releasing cache", e);
+      }
    }
 
    private Cache getCache() throws Exception
    {
-      MBeanServer server = MBeanServerLocator.locateJBoss();
-      CacheJmxWrapperMBean proxy = (CacheJmxWrapperMBean)MBeanProxyExt.create(CacheJmxWrapperMBean.class, new ObjectName(cacheObjectName), server);
-      Cache cache = proxy.getCache();
-      
+      if (cache == null && cacheConfigName != null)
+      {
+         CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
+         cache = cm.getCache(cacheConfigName, true);
+         cache.start();
+      }
       return cache;
    }
 

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -101,7 +101,7 @@
       InitialContext ctx1 = new InitialContext(prop1);
    
       log.info("Lookup sfsb from " + nodeJNDIAddress);
-      return (EmbeddedIdTest) ctx1.lookup(getEarName() + "/EmbeddedIdTestBean/remote");
+      return (EmbeddedIdTest) ctx1.lookup("EmbeddedIdTestBean/remote");
       
    }
    

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -24,8 +24,6 @@
 import java.util.Properties;
 import javax.naming.InitialContext;
 
-import org.hibernate.cache.StandardQueryCache;
-import org.jboss.ejb3.entity.SecondLevelCacheUtil;
 import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
 import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
 import org.jboss.test.JBossClusteredTestCase;
@@ -43,6 +41,7 @@
    public static final String EAR_NAME = "clusteredentity-classloader-test";
    public static final String JAR_NAME = "clusteredentity-classloader-test";
    public static final String PERSISTENCE_UNIT_NAME = "tempdb";
+   public static final String STD_QUERY_CACHE_NAME = "org.hibernate.cache.StandardQueryCache";
    
    protected org.jboss.logging.Logger log = getLog();
 
@@ -88,7 +87,7 @@
       InitialContext ctx1 = new InitialContext(prop1);
    
       log.info("Lookup sfsb from " + nodeJNDIAddress);
-      EntityQueryTest eqt = (EntityQueryTest)ctx1.lookup(getEarName() + "/EntityQueryTestBean/remote");
+      EntityQueryTest eqt = (EntityQueryTest)ctx1.lookup("EntityQueryTestBean/remote");
       eqt.getCache(isOptimistic());
       
       return eqt;
@@ -138,7 +137,7 @@
    
    protected void resetRegionUsageState()
    {  
-      String stdName = createRegionName(StandardQueryCache.class.getName());
+      String stdName = createRegionName(STD_QUERY_CACHE_NAME);
       String acctName = createRegionName("AccountRegion");
       
       sfsb0.getSawRegionModification(stdName);
@@ -204,7 +203,7 @@
       
       // Initial ops on node 0
       
-      String regionName = createRegionName(useNamedRegion ? "AccountRegion" : StandardQueryCache.class.getName());
+      String regionName = createRegionName(useNamedRegion ? "AccountRegion" : STD_QUERY_CACHE_NAME);
       
       // Query on post code count
       assertEquals("63088 has correct # of accounts", 6, sfsb0.getCountForBranch("63088", useNamedQuery, useNamedRegion));

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticBulkOperationsUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticBulkOperationsUnitTestCase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticBulkOperationsUnitTestCase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -43,7 +43,7 @@
    public static Test suite() throws Exception
    {
       return getDeploySetup(OptimisticBulkOperationsUnitTestCase.class, 
-            "optimistic-entity-cache-beans.xml, clusteredentity-optimistic-test.jar");
+                            "clusteredentity-optimistic-test.jar");
    }
 
 }

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEmbeddedIdClassloaderTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEmbeddedIdClassloaderTestCase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEmbeddedIdClassloaderTestCase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -49,7 +49,7 @@
       TestSuite suite = new TestSuite();
       // Deploy an optimistic cache before the ear
       Test t1 = getDeploySetup(OptimisticEmbeddedIdClassloaderTestCase.class, 
-                               "optimistic-entity-cache-beans.xml, clusteredentity-embeddedid-optimistic-test.ear");
+                               "clusteredentity-embeddedid-optimistic-test.ear");
 
       suite.addTest(t1);
 

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -51,7 +51,7 @@
       TestSuite suite = new TestSuite();
       //  Deploy an optimistic cache before the ear
       Test t1 = getDeploySetup(OptimisticEntityQueryRedeployUnitTestCase.class, 
-            "optimistic-entity-cache-beans.xml, " + EAR_NAME + ".ear");
+                               EAR_NAME + ".ear");
 
       suite.addTest(t1);
 

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -48,7 +48,6 @@
       TestSuite suite = new TestSuite();
       // Deploy an optimistic cache before the ear
       Test t1 = getDeploySetup(OptimisticEntityQueryUnitTestCase.class, 
-                               "optimistic-entity-cache-beans.xml, " + 
                                EAR_NAME + ".ear");
 
       suite.addTest(t1);

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityUnitTestCase.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityUnitTestCase.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -42,7 +42,7 @@
    public static Test suite() throws Exception
    {
       return getDeploySetup(OptimisticEntityUnitTestCase.class, 
-            "optimistic-entity-cache-beans.xml, clusteredentity-optimistic-test.jar");
+            "clusteredentity-optimistic-test.jar");
    }
 
    @Override

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -24,6 +24,8 @@
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.CacheStatus;
 import org.jboss.cache.Fqn;
 
 /**
@@ -38,18 +40,30 @@
    public static final String VALUE = "VALUE";
    
    private Cache clusteredBeanCache;
+   private CacheManager cacheManager;
+   private String cacheConfigName;
    private String regionRoot;
    
    public Cache getClusteredBeanCache()
    {
       return clusteredBeanCache;
+   } 
+      
+   public String getCacheConfigName()
+   {
+      return cacheConfigName;
    }
 
-   public void setClusteredBeanCache(Cache clusteredBeanCache)
+   public void setCacheConfigName(String name)
    {
-      this.clusteredBeanCache = clusteredBeanCache;
+      cacheConfigName = name;      
    }
-   
+
+   public void setCacheManager(CacheManager cacheManager)
+   {
+      this.cacheManager = cacheManager;      
+   }
+
    public String getRegionRoot()
    {
       return regionRoot;
@@ -68,6 +82,10 @@
 
    public void start() throws Exception
    {
+      clusteredBeanCache = cacheManager.getCache(cacheConfigName, true);
+      if (clusteredBeanCache.getCacheStatus() != CacheStatus.STARTED)
+         clusteredBeanCache.start();
+      
       Fqn fqn = getTestFqn();
       clusteredBeanCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
       clusteredBeanCache.put(fqn, "key", VALUE);
@@ -79,6 +97,8 @@
    {
       clusteredBeanCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
       clusteredBeanCache.removeNode(getTestFqn());
+      
+      cacheManager.releaseCache(cacheConfigName);
    }
    
    public Object getFromBeanCache() throws CacheException

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java	2008-05-12 22:01:40 UTC (rev 73316)
@@ -24,6 +24,7 @@
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheManager;
 import org.jboss.cache.Fqn;
 
 /**
@@ -37,7 +38,11 @@
 {
    Cache getClusteredBeanCache();
 
-   void setClusteredBeanCache(Cache clusteredBeanCache);
+   void setCacheManager(CacheManager cacheManager);
+   
+   String getCacheConfigName();
+   
+   void setCacheConfigName(String name);
 
    String getRegionRoot();
 

Modified: projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/classloader/optimistic/META-INF/persistence.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/classloader/optimistic/META-INF/persistence.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/classloader/optimistic/META-INF/persistence.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -4,7 +4,7 @@
       <jta-data-source>java:/ClusteredEntityTestDS</jta-data-source>
       <properties>
          <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.OptimisticTreeCacheProviderHook"/>
-         <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=OptimisticEJB3EntityTreeCache"/>
+         <property name="hibernate.cache.jbc2.config.name" value="optimistic-shared"/>
          <!-- Must use "update" here as we do a test of redeployment and don't want to drop the db -->
          <property name="hibernate.hbm2ddl.auto" value="update"/>
          <property name="hibernate.cache.use_query_cache" value="true"/>

Modified: projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/META-INF/persistence.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/META-INF/persistence.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/META-INF/persistence.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -4,7 +4,7 @@
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <properties>
          <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.OptimisticTreeCacheProviderHook"/>
-         <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=OptimisticEJB3EntityTreeCache"/>
+         <property name="hibernate.cache.jbc2.config.name" value="optimistic-shared"/>
          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
          <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
       </properties>

Deleted: projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-beans.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-beans.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <!-- First we create a Configuration object for the cache -->
-   <bean name="OptimisticTestEJB3EntityCacheConfig"
-   		 class="org.jboss.cache.config.Configuration">
-      
-      <!-- Externally injected services -->  
-      <property name="runtimeConfig">
-         <bean name="OptimisticTestEJB3EntityCacheRuntimeConfig" 
-               class="org.jboss.cache.config.RuntimeConfig">
-            <property name="transactionManager">
-               <inject bean="jboss:service=TransactionManager" property="TransactionManager"/>
-            </property>
-            <property name="muxChannelFactory">
-               <inject bean="JChannelFactory"/>
-            </property>
-         </bean>
-      </property>
-      
-      <property name="multiplexerStack">${jboss.multiplexer.stack:udp}</property>
-
-      <property name="clusterName">${jboss.partition.name:DefaultPartition}-OptimisticEntityCache</property>
-      
-      <property name="nodeLockingScheme">OPTIMISTIC</property>
-      
-      <!--
-              Node locking level : SERIALIZABLE
-                                   REPEATABLE_READ (default)
-                                   READ_COMMITTED
-                                   READ_UNCOMMITTED
-                                   NONE
-      -->
-      <property name="isolationLevelString">REPEATABLE_READ</property>
-
-      <!--     Valid modes are LOCAL
-                               REPL_ASYNC
-                               REPL_SYNC
-      -->
-      <property name="cacheModeString">REPL_SYNC</property>
-
-      <!--  The max amount of time (in milliseconds) we wait until the
-            initial state (ie. the contents of the cache) are retrieved from
-            existing members in a clustered environment
-      -->
-      <property name="stateRetrievalTimeout">15000</property>
-
-      <!--    Number of milliseconds to wait until all responses for a
-              synchronous call have been received.
-      -->
-      <property name="syncReplTimeout">20000</property>
-
-      <!--  Max number of milliseconds to wait for a lock acquisition -->
-      <property name="lockAcquisitionTimeout">15000</property>
-        
-      <property name="exposeManagementStatistics">true</property>
-      
-      <!-- Must be true if any entity deployment uses a scoped classloader -->
-      <property name="useRegionBasedMarshalling">true</property>
-      <!-- Must match the value of "useRegionBasedMarshalling" -->
-      <property name="inactiveOnStartup">true</property>
-
-      <!--  Specific eviction policy configurations. This is LRU -->
-      <property name="evictionConfig">
-      	 <bean name="OptimisticTestEJB3EntityEvictionConfig" class="org.jboss.cache.config.EvictionConfig">
-      	    <property name="defaultEvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</property>
-            <property name="wakeupIntervalSeconds">5</property>
-            <property name="evictionRegionConfigs">
-            	<list>
-            		<!-- Default region will never timeout -->
-            		<bean name="OptimisticTestEJB3EntityDefaultEvictionRegionConfig" class="org.jboss.cache.config.EvictionRegionConfig">
-            			<property name="regionName">/_default_</property>
-            			<property name="evictionPolicyConfig">
-            				<bean name="OptimisticTestEJB3EntityDefaultLRUConfig" class="org.jboss.cache.eviction.LRUConfiguration">
-               					<property name="maxNodes">5000</property>
-               					<property name="timeToLiveSeconds">1000</property>
-               				</bean>
-               			</property>
-            		</bean>
-            		<!-- EJB3 integration code will programatically create other
-            		     regions as beans are deployed -->
-            	</list>
-			</property>
-         </bean>
-      </property>
-      
-   </bean>
-    
-   <!-- Now we use the above configuration to construct the cache itself -->
-   <bean name="OptimisticTestEJB3EntityCache" class="org.jboss.cache.jmx.CacheJmxWrapper">
-      
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=OptimisticEJB3EntityTreeCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true)</annotation>
-      
-      <property name="configuration"><inject bean="OptimisticTestEJB3EntityCacheConfig"/></property>
-          
-   </bean>
-
-</deployment>
-

Deleted: projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-service.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-service.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/optimistic/optimistic-entity-cache-service.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
-
-   <!-- ============================================================ -->
-   <!-- Clustered entity cache config for use with JBoss Cache 1.4.x --> 
-   <!-- ============================================================ -->
-   <mbean code="org.jboss.cache.TreeCache" 
-         name="jboss.cache:service=OptimisticEJB3EntityTreeCache">
-         
-    <depends>jboss:service=Naming</depends>
-    <depends>jboss:service=TransactionManager</depends>
-    
-    <!-- Name of cluster. Needs to be the same on all nodes in the clusters, 
-         in order to find each other -->
-    <attribute name="ClusterName">${jboss.partition.name:DefaultPartition}-OptimisticEntityCache</attribute>
-        
-    <!-- Configure the TransactionManager -->
-    <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
-
-    <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
-    
-    <!--
-            Node locking level : SERIALIZABLE
-                                 REPEATABLE_READ (default)
-                                 READ_COMMITTED
-                                 READ_UNCOMMITTED
-                                 NONE
-    -->
-    <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
-
-    <!--     Valid modes are LOCAL
-                             REPL_ASYNC
-                             REPL_SYNC
-    -->
-    <attribute name="CacheMode">REPL_SYNC</attribute>
-      
-      <!-- Must be true if any entity deployment uses a scoped classloader -->
-      <attribute name="UseRegionBasedMarshalling">true</attribute>
-      <!-- Must match the value of "useRegionBasedMarshalling" -->
-      <attribute name="InactiveOnStartup">true</attribute>
-
-	  <!-- 
-	        JGroups protocol stack config in XML format.
-		    
-		    On Windows machines, because of the media sense feature
-            being broken with multicast (even after disabling media sense)
-            set the UDP.loopback attribute to true
-      -->     
-      <attribute name="ClusterConfig">
-         <config>
-            <UDP mcast_addr="${jgroups.udp.mcast_addr:228.1.2.3}" 
-                 mcast_port="53333"
-                 tos="8"
-                 ucast_recv_buf_size="20000000"
-                 ucast_send_buf_size="640000"
-                 mcast_recv_buf_size="25000000"
-                 mcast_send_buf_size="640000"
-                 loopback="false"
-                 discard_incompatible_packets="true"
-                 max_bundle_size="64000"
-                 max_bundle_timeout="30"
-                 use_incoming_packet_handler="true"
-                 use_outgoing_packet_handler="false"
-                 ip_ttl="${jgroups.udp.ip_ttl:2}"
-                 down_thread="false" up_thread="false"
-                 enable_bundling="false"/>
-            <PING timeout="2000"
-                  down_thread="false" up_thread="false" num_initial_members="3"/>
-            <MERGE2 max_interval="100000"
-                    down_thread="false" up_thread="false" min_interval="20000"/>
-            <FD_SOCK down_thread="false" up_thread="false"/>
-            <FD timeout="10000" max_tries="5" down_thread="false" up_thread="false" shun="true"/>
-            <VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false"/>
-            <pbcast.NAKACK max_xmit_size="60000"
-                    use_mcast_xmit="false" gc_lag="0"
-                    retransmit_timeout="300,600,1200,2400,4800"
-                    down_thread="false" up_thread="false"
-                    discard_delivered_msgs="true"/>
-            <UNICAST timeout="300,600,1200,2400,3600"
-                    down_thread="false" up_thread="false"/>
-            <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
-                    down_thread="false" up_thread="false"
-                    max_bytes="400000"/>
-            <pbcast.GMS print_local_addr="true" join_timeout="3000"
-                    down_thread="false" up_thread="false"
-                    join_retry_timeout="2000" shun="true"
-                    view_bundling="true"/>
-            <FRAG2 frag_size="60000" down_thread="false" up_thread="false"/>
-            <pbcast.STATE_TRANSFER down_thread="false" up_thread="false" use_flush="false"/>
-        </config>
-      </attribute>
-
-    <!--    The max amount of time (in milliseconds) we wait until the
-            initial state (ie. the contents of the cache) are retrieved from
-            existing members.
-    -->
-    <attribute name="InitialStateRetrievalTimeout">17500</attribute>
-
-    <!--    Number of milliseconds to wait until all responses for a
-            synchronous call have been received.
-    -->
-    <attribute name="SyncReplTimeout">17500</attribute>
-
-    <!--  Max number of milliseconds to wait for a lock acquisition -->
-    <attribute name="LockAcquisitionTimeout">15000</attribute>
-
-    <!--  Name of the eviction policy class. -->
-    <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
-
-    <!--  Specific eviction policy configurations. This is LRU -->
-    <attribute name="EvictionPolicyConfig">
-      <config>
-        <attribute name="wakeUpIntervalSeconds">5</attribute>
-        <!--  Cache wide default -->
-        <region name="/_default_">
-         <attribute name="maxNodes">5000</attribute>
-         <attribute name="timeToLiveSeconds">1000</attribute>
-       </region>
-      </config>
-    </attribute>
-
-  </mbean>
-
-</server>
-

Modified: projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/providedprefix/META-INF/persistence.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/providedprefix/META-INF/persistence.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredentity/providedprefix/META-INF/persistence.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -4,7 +4,7 @@
       <jta-data-source>java:/ClusteredEntityTestDS</jta-data-source>
       <properties>
          <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
-         <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>
+         <property name="hibernate.cache.jbc2.config.name" value="pessimistic-shared"/>
          <!-- Must use "update" here as we do a test of redeployment and don't want to drop the db -->
          <property name="hibernate.hbm2ddl.auto" value="update"/>
          <property name="hibernate.cache.use_query_cache" value="true"/>

Modified: projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/ejb-jar.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/ejb-jar.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -20,12 +20,5 @@
          <session-type>Stateful</session-type>
          <transaction-type>Container</transaction-type>
       </session>
-      <session>
-         <ejb-name>NonClusteredStateful</ejb-name>
-         <remote>org.jboss.ejb3.test.clusteredsession.OverrideStatefulRemote</remote>
-         <ejb-class>org.jboss.ejb3.test.clusteredsession.OverrideStatefulBean</ejb-class>
-         <session-type>Stateful</session-type>
-         <transaction-type>Container</transaction-type>
-      </session>
    </enterprise-beans>
 </ejb-jar>

Modified: projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/jboss.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/jboss.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/META-INF/jboss.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -39,14 +39,5 @@
                <load-balance-policy>org.jboss.ha.framework.interfaces.FirstAvailableIdenticalAllProxies</load-balance-policy>
             </cluster-config>
          </session>
-         <session>
-            <ejb-name>NonClusteredStateful</ejb-name>
-            <jndi-name>NonClusteredStatefulRemote</jndi-name>
-            <clustered>false</clustered>
-            <cache-config>
-               <cache-max-size>1000</cache-max-size>
-               <idle-timeout-seconds>100</idle-timeout-seconds>
-            </cache-config>
-         </session>
       </enterprise-beans>
    </jboss>
\ No newline at end of file

Modified: projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/islocal/foreign/testlocal-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/islocal/foreign/testlocal-beans.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/clusteredsession/islocal/foreign/testlocal-beans.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -5,41 +5,26 @@
    <bean name="Ejb3IsLocalTestPartition"
    		 class="org.jboss.ha.framework.server.ClusterPartition">
    		 
-    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=Ejb3IsLocalTestPartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=Ejb3IsLocalTestPartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
       
-   	<constructor>
-   	   <parameter>
-            <bean name="Ejb3IsLocalTestPartition-ClusterPartitionConfig" 
-                  class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
-               
-               <!-- ClusterPartition requires a Cache for state management -->
-               <property name="clusteredCache">
-                  <inject bean="DefaultPartition-HAPartitionCache" property="cache"/>
-               </property>
-               
-               <!--property name="distributedState"><inject bean="DistributedState"/></property-->
+   	<!-- ClusterPartition requires a Cache for state management -->
+      <property name="cacheManager"><inject bean="CacheManager"/></property>
+      <property name="cacheConfigName">ha-partition</property>               
                 
-               <!-- Name of the partition being built -->
-               <property name="partitionName">Ejb3IsLocalTestPartition</property>
+      <!-- Name of the partition being built -->
+      <property name="partitionName">Ejb3IsLocalTestPartition</property>
          
-               <!-- The address used to determine the node name -->
-               <property name="nodeAddress">${jboss.bind.address}</property>
-         
-               <!-- Inject the naming service port as an aid in creating a nodeUniqueId.  Not needed if nodeUniqueId is set -->
-               <property name="namingServicePort"><inject bean="jboss:service=Naming" property="Port"/></property>
+      <!-- The address used to determine the node name -->
+      <property name="nodeAddress">${jboss.bind.address}</property>
                
-               <!-- Determine if deadlock detection is enabled -->
-               <property name="deadlockDetection">false</property>
+      <!-- Determine if deadlock detection is enabled -->
+      <property name="deadlockDetection">false</property>
               
-               <!-- Max time (in ms) to wait for state transfer to complete. Increase for large states -->
-               <property name="stateTransferTimeout">30000</property>
+      <!-- Max time (in ms) to wait for state transfer to complete. Increase for large states -->
+      <property name="stateTransferTimeout">30000</property>
               
-               <!-- Max time (in ms) to wait for RPC calls to complete. -->
-               <property name="methodCallTimeout">60000</property>            
-               
-            </bean>
-         </parameter>
-      </constructor>
+      <!-- Max time (in ms) to wait for RPC calls to complete. -->
+      <property name="methodCallTimeout">60000</property> 
       
       <property name="distributedReplicantManagerImpl">
          <bean name="Ejb3IsLocalTestDistributedReplicantManager"

Modified: projects/ejb3/trunk/core/src/test/resources/test/ejbthree1136/jboss-service.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/test/ejbthree1136/jboss-service.xml	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/core/src/test/resources/test/ejbthree1136/jboss-service.xml	2008-05-12 22:01:40 UTC (rev 73316)
@@ -5,7 +5,9 @@
    <mbean code="org.jboss.ejb3.test.ejbthree1136.SFSBCacheManipulator"
       name="jboss.test:service=Ejb3SFSBCacheManipulator">
 
-      <depends optional-attribute-name="ClusteredBeanCache" proxy-type="attribute"><inject bean="EJB3SFSBClusteredCache" property="cache"/></depends>
+      <attribute name="CacheManager"><inject bean="CacheManager"/></attribute>
+      
+      <attribute name="CacheConfigName">sfsb-cache</attribute>
 
       <attribute name="RegionRoot">/jboss:j2ee:jar=ejbthree1136.jar,name=DoNothingBean,service=EJB3</attribute>
    </mbean>

Modified: projects/ejb3/trunk/installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-deploy-clustered.txt
===================================================================
--- projects/ejb3/trunk/installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-deploy-clustered.txt	2008-05-12 21:50:34 UTC (rev 73315)
+++ projects/ejb3/trunk/installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-deploy-clustered.txt	2008-05-12 22:01:40 UTC (rev 73316)
@@ -1,2 +1 @@
-ejb3-clustered-sfsbcache-beans.xml
-ejb3-entity-cache-beans.xml
\ No newline at end of file
+nonexistent-but-satisfies-ant.txt




More information about the jboss-cvs-commits mailing list