[jboss-cvs] JBossAS SVN: r65285 - in projects/ejb3/trunk/ejb3-cache: src/main/java/org/jboss/ejb3/cache and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 11 08:55:27 EDT 2007


Author: wolfc
Date: 2007-09-11 08:55:27 -0400 (Tue, 11 Sep 2007)
New Revision: 65285

Added:
   projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivatingCache.java
   projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivationManager.java
   projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/EntryStateCache.java
   projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/FileObjectStore.java
   projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimplePassivatingCache.java
   projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/
   projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/
   projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContainer.java
   projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContext.java
   projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/PassivationUnitTestCase.java
   projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/xpc/
   projects/ejb3/trunk/ejb3-cache/src/test/resources/
   projects/ejb3/trunk/ejb3-cache/src/test/resources/log4j.xml
Modified:
   projects/ejb3/trunk/ejb3-cache/.classpath
   projects/ejb3/trunk/ejb3-cache/pom.xml
   projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/ObjectStore.java
Log:
EJBTHREE-1016: implemented passivating cache

Modified: projects/ejb3/trunk/ejb3-cache/.classpath
===================================================================
--- projects/ejb3/trunk/ejb3-cache/.classpath	2007-09-11 08:07:35 UTC (rev 65284)
+++ projects/ejb3/trunk/ejb3-cache/.classpath	2007-09-11 12:55:27 UTC (rev 65285)
@@ -1,10 +1,21 @@
 <classpath>
   <classpathentry kind="src" path="src/main/java"/>
   <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
   <classpathentry kind="output" path="target/classes"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/jboss-transaction-api/1.0.1-SNAPSHOT/jboss-transaction-api-1.0.1-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-serialization/1.0.3.GA/jboss-serialization-1.0.3.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/trove/trove/2.1.1/trove-2.1.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/jboss/jboss-ejb-api/3.0.0-SNAPSHOT/jboss-ejb-api-3.0.0-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-transaction-api/1.0.1-SNAPSHOT/jboss-transaction-api-1.0.1-SNAPSHOT.jar"/>
 </classpath>
\ No newline at end of file

Modified: projects/ejb3/trunk/ejb3-cache/pom.xml
===================================================================
--- projects/ejb3/trunk/ejb3-cache/pom.xml	2007-09-11 08:07:35 UTC (rev 65284)
+++ projects/ejb3/trunk/ejb3-cache/pom.xml	2007-09-11 12:55:27 UTC (rev 65285)
@@ -43,14 +43,38 @@
   <dependencies>
     <dependency>
 	  <groupId>jboss</groupId>
+	  <artifactId>jboss-common-logging-spi</artifactId>
+	  <version>2.0.4.GA</version>
+	</dependency>
+    <dependency>
+	  <groupId>jboss</groupId>
+	  <artifactId>jboss-common-logging-log4j</artifactId>
+	  <version>2.0.4.GA</version>
+	  <scope>test</scope>
+	</dependency>
+    <dependency>
+	  <groupId>jboss</groupId>
 	  <artifactId>jboss-ejb-api</artifactId>
 	  <version>3.0.0-SNAPSHOT</version>
 	</dependency>
     <dependency>
+	  <groupId>jboss</groupId>
+	  <artifactId>jboss-serialization</artifactId>
+	  <version>1.0.3.GA</version>
+	</dependency>
+    <dependency>
 	  <groupId>junit</groupId>
 	  <artifactId>junit</artifactId>
 	  <version>3.8.1</version>
-	  <scope>testing</scope>
+	  <scope>test</scope>
 	</dependency>
+	
+	<!-- For jboss serialization -->
+    <dependency>
+	  <groupId>trove</groupId>
+	  <artifactId>trove</artifactId>
+	  <version>2.1.1</version>
+	  <scope>runtime</scope>
+	</dependency>
   </dependencies>
 </project>

Modified: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/ObjectStore.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/ObjectStore.java	2007-09-11 08:07:35 UTC (rev 65284)
+++ projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/ObjectStore.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -22,7 +22,7 @@
 package org.jboss.ejb3.cache;
 
 /**
- * Stores an indentifiable object on a persistence store. Note that the object
+ * Stores an indentifiable object on a persistence store. Note that the object store
  * does NOT call any callbacks.
  * 
  * It is assumed the key represents something meaning full to the object store.
@@ -32,7 +32,18 @@
  */
 public interface ObjectStore<T extends Identifiable>
 {
+   /**
+    * Load the object from storage.
+    * 
+    * @param key    the object identifier
+    * @return       the object or null if not found
+    */
    T load(Object key);
    
+   /**
+    * Store the object into storage.
+    * 
+    * @param obj    the object
+    */
    void store(T obj);
 }

Added: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivatingCache.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivatingCache.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivatingCache.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.cache;
+
+/**
+ * A cache which passivates unused objects.
+ * 
+ * A PassivatingCache is linked to an ObjectStore to store the
+ * passivated object and a PassivationManager to managed lifecycle
+ * callbacks on the object.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface PassivatingCache<T extends Identifiable> extends Cache<T>
+{
+
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivatingCache.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivationManager.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivationManager.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivationManager.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.cache;
+
+import java.io.Serializable;
+
+/**
+ * Manage passivation lifecycle callbacks on an object.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface PassivationManager<T extends Serializable>
+{
+   /**
+    * This method is called after an object has been retrieved
+    * from an ObjectStore.
+    * 
+    * @param obj    the object
+    */
+   void postActivate(T obj);
+   
+   /**
+    * This method is called before an object is serialized into an
+    * ObjectStore.
+    * 
+    * @param obj    the object
+    */
+   void prePassivate(T obj);
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/PassivationManager.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/EntryStateCache.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/EntryStateCache.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/EntryStateCache.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.cache.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ejb.NoSuchEJBException;
+
+import org.jboss.ejb3.cache.Identifiable;
+import org.jboss.ejb3.cache.PassivatingCache;
+import org.jboss.ejb3.cache.StatefulObjectFactory;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EntryStateCache<T extends Identifiable> implements PassivatingCache<T>
+{
+   private StatefulObjectFactory<T> factory;
+   private Map<Object, Entry> cache;
+   
+   private static enum State { READY, IN_USE };
+   
+   private class Entry
+   {
+      long lastUsed;
+      T obj;
+      State state;
+      
+      Entry(T obj)
+      {
+         assert obj != null : "obj is null";
+         
+         this.lastUsed = System.currentTimeMillis();
+         this.obj = obj;
+         this.state = State.IN_USE;
+      }
+   }
+   
+   public EntryStateCache(StatefulObjectFactory<T> factory)
+   {
+      assert factory != null : "factory is null";
+      
+      this.factory = factory;
+      this.cache = new HashMap<Object, Entry>();
+   }
+   
+   public T create(Class<?>[] initTypes, Object[] initValues)
+   {
+      T obj = factory.create(initTypes, initValues);
+      Entry entry = new Entry(obj);
+      synchronized (cache)
+      {
+         cache.put(obj.getId(), entry);
+      }
+      return obj;
+   }
+
+   public T get(Object key) throws NoSuchEJBException
+   {
+      synchronized (cache)
+      {
+         Entry entry = cache.get(key);
+         if(entry == null)
+            throw new NoSuchEJBException(String.valueOf(key));
+         if(entry.state != State.READY)
+            throw new IllegalStateException("entry " + entry + " is not ready");
+         entry.state = State.IN_USE;
+         entry.lastUsed = System.currentTimeMillis();
+         return entry.obj;
+      }
+   }
+
+   public T peek(Object key) throws NoSuchEJBException
+   {
+      synchronized (cache)
+      {
+         Entry entry = cache.get(key);
+         if(entry == null)
+            throw new NoSuchEJBException(String.valueOf(key));
+         return entry.obj;
+      }
+   }
+
+   public void release(T obj)
+   {
+      synchronized (cache)
+      {
+         Entry entry = cache.get(obj.getId());
+         if(entry.state != State.IN_USE)
+            throw new IllegalStateException("entry " + entry + " is not in use");
+         entry.state = State.READY;
+         entry.lastUsed = System.currentTimeMillis();
+      }
+   }
+
+   public void remove(Object key)
+   {
+      Entry entry;
+      synchronized (cache)
+      {
+         entry = cache.remove(key);
+         if(entry.state != State.READY)
+            throw new IllegalStateException("entry " + entry + " is not ready");
+      }
+      if(entry != null)
+         factory.destroy(entry.obj);
+   }
+
+   public void start()
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   public void stop()
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/EntryStateCache.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/FileObjectStore.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/FileObjectStore.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/FileObjectStore.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,243 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.cache.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import org.jboss.ejb3.cache.Identifiable;
+import org.jboss.ejb3.cache.ObjectStore;
+import org.jboss.logging.Logger;
+import org.jboss.serial.io.JBossObjectInputStream;
+import org.jboss.serial.io.JBossObjectOutputStream;
+
+/**
+ * Stores objects in a directory via serialization.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class FileObjectStore<T extends Identifiable> implements ObjectStore<T>
+{
+   private static final Logger log = Logger.getLogger(FileObjectStore.class);
+   
+   private File storageDirectory;
+   
+   private static class DeleteFileAction implements PrivilegedAction<Boolean>
+   {
+      File file;
+
+      DeleteFileAction(File file)
+      {
+         this.file = file;
+      }
+
+      public Boolean run()
+      {
+         return file.delete();
+      }
+
+      static boolean delete(File file)
+      {
+         DeleteFileAction action = new DeleteFileAction(file);
+         return AccessController.doPrivileged(action);
+      }
+   }
+
+   private static class FISAction implements PrivilegedExceptionAction<FileInputStream>
+   {
+      File file;
+
+      FISAction(File file)
+      {
+         this.file = file;
+      }
+
+      public FileInputStream run() throws FileNotFoundException
+      {
+         FileInputStream fis = new FileInputStream(file);
+         return fis;
+      }
+
+      static FileInputStream open(File file) throws FileNotFoundException
+      {
+         FISAction action = new FISAction(file);
+         FileInputStream fis = null;
+         try
+         {
+            fis = AccessController.doPrivileged(action);
+         }
+         catch (PrivilegedActionException e)
+         {
+            throw (FileNotFoundException) e.getException();
+         }
+         return fis;
+      }
+   }
+
+   private static class FOSAction implements PrivilegedExceptionAction<FileOutputStream>
+   {
+      File file;
+
+      FOSAction(File file)
+      {
+         this.file = file;
+      }
+
+      public FileOutputStream run() throws FileNotFoundException
+      {
+         FileOutputStream fis = new FileOutputStream(file);
+         return fis;
+      }
+
+      static FileOutputStream open(File file) throws FileNotFoundException
+      {
+         FOSAction action = new FOSAction(file);
+         FileOutputStream fos = null;
+         try
+         {
+            fos = AccessController.doPrivileged(action);
+         }
+         catch (PrivilegedActionException e)
+         {
+            throw (FileNotFoundException) e.getException();
+         }
+         return fos;
+      }
+   }
+
+   private static class MkdirsFileAction implements PrivilegedAction<Boolean>
+   {
+      File file;
+
+      MkdirsFileAction(File file)
+      {
+         this.file = file;
+      }
+
+      public Boolean run()
+      {
+         return file.mkdirs();
+      }
+
+      static boolean mkdirs(File file)
+      {
+         MkdirsFileAction action = new MkdirsFileAction(file);
+         return AccessController.doPrivileged(action);
+      }
+   }
+
+   protected File getFile(Object key)
+   {
+      return new File(storageDirectory, String.valueOf(key) + ".ser");
+   }
+   
+   @SuppressWarnings("unchecked")
+   public T load(Object key)
+   {
+      File file = getFile(key);
+      if(!file.exists())
+         return null;
+      
+      try
+      {
+         FileInputStream fis = FISAction.open(file);
+         ObjectInputStream in = new JBossObjectInputStream(fis);
+         try
+         {
+            return (T) in.readObject();
+         }
+         finally
+         {
+            in.close();
+            DeleteFileAction.delete(file);
+         }
+      }
+      catch(ClassNotFoundException e)
+      {
+         throw new RuntimeException("failed to load object " + key, e);
+      }
+      catch(IOException e)
+      {
+         throw new RuntimeException("failed to load object " + key, e);
+      }
+   }
+
+   public void setStorageDirectory(String dirName)
+   {
+      storageDirectory = new File(dirName);
+   }
+   
+   public void start()
+   {
+      assert storageDirectory != null : "storageDirectory is null";
+      
+      if(!storageDirectory.exists())
+      {
+         if(!MkdirsFileAction.mkdirs(storageDirectory))
+            throw new RuntimeException("Unable to create storage directory " + storageDirectory);
+         storageDirectory.deleteOnExit();
+      }
+      
+      if(!storageDirectory.isDirectory())
+         throw new RuntimeException("Storage directory " + storageDirectory + " is not a directory");
+   }
+   
+   public void stop()
+   {
+      // TODO: implement
+   }
+   
+   public void store(T obj)
+   {
+      File file = getFile(obj.getId());
+      file.deleteOnExit();
+      log.debug("saving state to " + file);
+      try
+      {
+         FileOutputStream fos = FOSAction.open(file);
+         ObjectOutputStream out = new JBossObjectOutputStream(fos);
+         try
+         {
+            out.writeObject(obj);
+            out.flush();
+         }
+         finally
+         {
+            out.close();
+         }
+      }
+      catch(IOException e)
+      {
+         throw new RuntimeException("failed to store object " + obj.getId(), e);
+      }
+   }
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/FileObjectStore.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimplePassivatingCache.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimplePassivatingCache.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimplePassivatingCache.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,263 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.cache.impl;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.ejb.NoSuchEJBException;
+
+import org.jboss.ejb3.cache.Identifiable;
+import org.jboss.ejb3.cache.ObjectStore;
+import org.jboss.ejb3.cache.PassivatingCache;
+import org.jboss.ejb3.cache.PassivationManager;
+import org.jboss.ejb3.cache.StatefulObjectFactory;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimplePassivatingCache<T extends Identifiable & Serializable> implements PassivatingCache<T>
+{
+   private static final Logger log = Logger.getLogger(SimplePassivatingCache.class);
+   
+   private StatefulObjectFactory<T> factory;
+   private PassivationManager<T> passivationManager;
+   private ObjectStore<T> store;
+   
+   private Map<Object, Entry> cache;
+   
+   private int sessionTimeout = -1;
+   private String name;
+   
+   private Thread sessionTimeoutTask;
+   
+   private static enum EntryState { READY, IN_USE };
+   
+   private class Entry
+   {
+      long lastUsed;
+      T obj;
+      EntryState state;
+      
+      Entry(T obj)
+      {
+         assert obj != null : "obj is null";
+         
+         this.lastUsed = System.currentTimeMillis();
+         this.obj = obj;
+         this.state = EntryState.IN_USE;
+      }
+   }
+   
+   private class SessionTimeoutThread extends Thread
+   {
+      public SessionTimeoutThread(String name)
+      {
+         super(name);
+         setDaemon(true);
+      }
+      
+      @Override
+      public void run()
+      {
+         try
+         {
+            while(!Thread.currentThread().isInterrupted())
+            {
+               Thread.sleep(1000);
+               
+               synchronized (cache)
+               {
+                  if(Thread.currentThread().isInterrupted())
+                     return;
+                  
+                  long then = System.currentTimeMillis() - sessionTimeout * 1000;
+                  Iterator<Entry> it = cache.values().iterator();
+                  while(it.hasNext())
+                  {
+                     Entry entry = it.next();
+                     if(then >= entry.lastUsed && entry.state != EntryState.IN_USE)
+                     {
+                        // TODO: can passivate?
+                        passivationManager.prePassivate(entry.obj);
+                        
+                        store.store(entry.obj);
+                        
+                        it.remove();
+                     }
+                  }
+               }
+            }
+         }
+         catch(InterruptedException e)
+         {
+            // do nothing
+         }
+      }
+   }
+   
+   public SimplePassivatingCache(StatefulObjectFactory<T> factory, PassivationManager<T> passivationManager, ObjectStore<T> store)
+   {
+      assert factory != null : "factory is null";
+      assert passivationManager != null : "passivationManager is null";
+      assert store != null : "store is null";
+      
+      this.factory = factory;
+      this.passivationManager = passivationManager;
+      this.store = store;
+      this.cache = new HashMap<Object, Entry>();
+   }
+   
+   public T create(Class<?>[] initTypes, Object[] initValues)
+   {
+      T obj = factory.create(initTypes, initValues);
+      Entry entry = new Entry(obj);
+      synchronized (cache)
+      {
+         cache.put(obj.getId(), entry);
+      }
+      return obj;
+   }
+
+   public T get(Object key) throws NoSuchEJBException
+   {
+      synchronized (cache)
+      {
+         Entry entry = cache.get(key);
+         if(entry == null)
+         {
+            T obj = store.load(key);
+            if(obj != null)
+            {
+               passivationManager.postActivate(obj);
+               
+               entry = new Entry(obj);
+               cache.put(key, entry);
+               return entry.obj;
+            }
+         }
+         if(entry == null)
+            throw new NoSuchEJBException(String.valueOf(key));
+         if(entry.state != EntryState.READY)
+            throw new IllegalStateException("entry " + entry + " is not ready");
+         entry.state = EntryState.IN_USE;
+         entry.lastUsed = System.currentTimeMillis();
+         return entry.obj;
+      }
+   }
+
+   public T peek(Object key) throws NoSuchEJBException
+   {
+      synchronized (cache)
+      {
+         Entry entry = cache.get(key);
+         if(entry == null)
+         {
+            T obj = store.load(key);
+            if(obj != null)
+            {
+               passivationManager.postActivate(obj);
+               
+               entry = new Entry(obj);
+               cache.put(key, entry);
+            }
+         }
+         entry.state = EntryState.READY;
+         if(entry == null)
+            throw new NoSuchEJBException(String.valueOf(key));
+         return entry.obj;
+      }
+   }
+
+   public void release(T obj)
+   {
+      synchronized (cache)
+      {
+         Entry entry = cache.get(obj.getId());
+         if(entry.state != EntryState.IN_USE)
+            throw new IllegalStateException("entry " + entry + " is not in use");
+         entry.state = EntryState.READY;
+         entry.lastUsed = System.currentTimeMillis();
+      }
+   }
+
+   public void remove(Object key)
+   {
+      Entry entry;
+      synchronized (cache)
+      {
+         entry = cache.remove(key);
+         if(entry.state != EntryState.READY)
+            throw new IllegalStateException("entry " + entry + " is not ready");
+      }
+      if(entry != null)
+         factory.destroy(entry.obj);
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   public void setSessionTimeout(int sessionTimeout)
+   {
+      assert sessionTimeout >= 0 : "sessionTimeout must be >= 0";
+      this.sessionTimeout = sessionTimeout;
+   }
+   
+   public void start()
+   {
+      assert name != null : "name has not been set";
+      assert sessionTimeout != -1 : "sessionTimeout has not been set";
+      
+      if(sessionTimeout > 0)
+      {
+         sessionTimeoutTask = new SessionTimeoutThread("Passivation Thread - " + name);
+         sessionTimeoutTask.start();
+      }
+   }
+
+   public void stop()
+   {
+      if(sessionTimeoutTask != null)
+      {
+         sessionTimeoutTask.interrupt();
+         try
+         {
+            sessionTimeoutTask.join(5000);
+         }
+         catch (InterruptedException e)
+         {
+            // ignore
+         }
+         if(sessionTimeoutTask.isAlive())
+            log.warn("Failed to stop " + sessionTimeoutTask);
+      }
+   }
+
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimplePassivatingCache.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContainer.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContainer.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContainer.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.passivation;
+
+import org.jboss.ejb3.cache.PassivationManager;
+import org.jboss.ejb3.cache.StatefulObjectFactory;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MockBeanContainer implements StatefulObjectFactory<MockBeanContext>, PassivationManager<MockBeanContext>
+{
+   private static final Logger log = Logger.getLogger(MockBeanContainer.class);
+   
+   protected int activations = 0;
+   protected int passivations = 0;
+   
+   public MockBeanContext create(Class<?>[] initTypes, Object[] initValues)
+   {
+      return new MockBeanContext();
+   }
+   
+   public void destroy(MockBeanContext obj)
+   {
+   }
+
+   public void postActivate(MockBeanContext obj)
+   {
+      log.info("postActivate " + obj);
+      activations++;
+      synchronized(this)
+      {
+         notifyAll();
+      }
+   }
+
+   public void prePassivate(MockBeanContext obj)
+   {
+      log.info("prePassivate " + obj);
+      passivations++;
+      synchronized(this)
+      {
+         notifyAll();
+      }
+   }
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContainer.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContext.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContext.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContext.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.passivation;
+
+import java.io.Serializable;
+
+import org.jboss.ejb3.cache.Identifiable;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MockBeanContext implements Identifiable, Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   private static volatile long currentId = 0;
+   
+   private long id;
+   
+   public MockBeanContext()
+   {
+      this.id = ++currentId;
+   }
+   
+   public Object getId()
+   {
+      return id;
+   }
+
+   @Override
+   public String toString()
+   {
+      return super.toString() + "{id=" + id + "}";
+   }
+
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/MockBeanContext.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/PassivationUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/PassivationUnitTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/PassivationUnitTestCase.java	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.passivation;
+
+import org.jboss.ejb3.cache.impl.FileObjectStore;
+import org.jboss.ejb3.cache.impl.SimplePassivatingCache;
+
+import junit.framework.TestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PassivationUnitTestCase extends TestCase
+{
+   private static void sleep(long micros)
+   {
+      try
+      {
+         Thread.sleep(micros);
+      }
+      catch (InterruptedException e)
+      {
+         // ignore
+      }
+   }
+   
+   public void test1() throws InterruptedException
+   {
+      MockBeanContainer container = new MockBeanContainer();
+      FileObjectStore<MockBeanContext> store = new FileObjectStore<MockBeanContext>();
+      store.setStorageDirectory("./target/tmp/passivation");
+      store.start();
+      SimplePassivatingCache<MockBeanContext> cache = new SimplePassivatingCache<MockBeanContext>(container, container, store);
+      cache.setName("MockBeanContainer");
+      cache.setSessionTimeout(1);
+      cache.start();
+      
+      MockBeanContext obj = cache.create(null, null);
+      Object key = obj.getId();
+      
+      cache.release(obj);
+      obj = null;
+      
+      wait(container);
+      
+      assertEquals("MockBeanContext should have been passivated", 1, container.passivations);
+      
+      obj = cache.get(key);
+      
+      assertEquals("MockBeanContext should have been activated", 1, container.activations);
+      
+      sleep(3000);
+      
+      assertEquals("MockBeanContext should not have been passivated", 1, container.passivations);
+      
+      cache.release(obj);
+      obj = null;
+      
+      wait(container);
+      
+      assertEquals("MockBeanContext should have been passivated", 2, container.passivations);
+   }
+   
+   private static void wait(Object obj) throws InterruptedException
+   {
+      synchronized (obj)
+      {
+         obj.wait(5000);
+      }
+   }
+}


Property changes on: projects/ejb3/trunk/ejb3-cache/src/test/java/org/jboss/ejb3/test/passivation/PassivationUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/ejb3-cache/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/ejb3-cache/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-cache/src/test/resources/log4j.xml	2007-09-11 12:55:27 UTC (rev 65285)
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id$ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <!-- A time/date based rolling appender -->
+  <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+    <param name="File" value="target/test.log"/>
+    <param name="Append" value="false"/>
+
+    <!-- Rollover at midnight each day -->
+    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+    <!-- Rollover at the top of each hour
+    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+    -->
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+      <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+      <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+       -->
+    </layout>	    
+  </appender>
+
+  <!-- A size based file rolling appender
+  <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+    <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+    <param name="Append" value="false"/>
+    <param name="MaxFileSize" value="500KB"/>
+    <param name="MaxBackupIndex" value="1"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>	    
+  </appender>
+  -->
+
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Threshold" value="FATAL"/>
+    <param name="Target" value="System.out"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+    </layout>
+  </appender>
+
+
+  <!-- ====================== -->
+  <!-- More Appender examples -->
+  <!-- ====================== -->
+
+  <!-- Buffer events and log them asynchronously
+  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+    <appender-ref ref="FILE"/>
+    <appender-ref ref="CONSOLE"/>
+  </appender>
+  -->
+
+  <!-- EMail events to an administrator
+  <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
+    <param name="Threshold" value="ERROR"/>
+    <param name="To" value="admin at myhost.domain.com"/>
+    <param name="From" value="nobody at myhost.domain.com"/>
+    <param name="Subject" value="JBoss Sever Errors"/>
+    <param name="SMTPHost" value="localhost"/>
+    <param name="BufferSize" value="10"/>
+  </appender>
+  -->
+
+  <!-- Syslog events
+  <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
+    <param name="Facility" value="LOCAL7"/>
+    <param name="FacilityPrinting" value="true"/>
+    <param name="SyslogHost" value="localhost"/>
+  </appender>
+  -->
+
+  <!-- Log events to JMS (requires a topic to be created)
+  <appender name="JMS" class="org.apache.log4j.net.JMSAppender">
+    <param name="Threshold" value="ERROR"/>
+    <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>
+    <param name="TopicBindingName" value="topic/MyErrorsTopic"/>
+  </appender>
+  -->
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Limit JBoss categories to INFO 
+  <category name="org.jboss">
+    <priority value="INFO" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <!-- Increase the priority threshold for the DefaultDS category
+  <category name="DefaultDS">
+    <priority value="FATAL"/>
+  </category>
+  -->
+
+  <!-- Decrease the priority threshold for the org.jboss.varia category
+  <category name="org.jboss.varia">
+    <priority value="DEBUG"/>
+  </category>
+  -->
+
+  <!--
+     | An example of enabling the custom TRACE level priority that is used
+     | by the JBoss internals to diagnose low level details. This example
+     | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+     | subpackages. This will produce A LOT of logging output.
+  <category name="org.jboss.system">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <category name="org.jboss.security">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+
+  <category name="org.jboss.tm">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  
+</log4j:configuration>


Property changes on: projects/ejb3/trunk/ejb3-cache/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list