You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2003/11/01 23:49:33 UTC
cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache StatelessInstanceFactory.java
jboynes 2003/11/01 14:49:33
Modified: modules/core/src/java/org/apache/geronimo/cache
InstanceFactory.java
modules/core/src/test/org/apache/geronimo/cache
SimpleInstancePoolTest.java
modules/core/src/java/org/apache/geronimo/ejb/cache
StatelessInstanceFactory.java
Log:
Added destroyInstance method to InstanceFactory to allow clean shutdown
of objects the pool/cache does not want any more
Revision Changes Path
1.3 +16 -2 incubator-geronimo/modules/core/src/java/org/apache/geronimo/cache/InstanceFactory.java
Index: InstanceFactory.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/cache/InstanceFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InstanceFactory.java 11 Aug 2003 17:59:09 -0000 1.2
+++ InstanceFactory.java 1 Nov 2003 22:49:33 -0000 1.3
@@ -56,10 +56,24 @@
package org.apache.geronimo.cache;
/**
- *
+ * A factory for instances of Pooled or Cached objects
*
* @version $Revision$ $Date$
*/
public interface InstanceFactory {
+ /**
+ * Create an instance ready for insertion into the pool. This method
+ * should have performed any initialization needed by the object's
+ * lifecycle
+ * @return an instance ready to be used
+ * @throws Exception if there was a problem initializing the instance
+ */
Object createInstance() throws Exception;
+
+ /**
+ * Destroy an instance that the pool decided was not needed any longer.
+ * This method should perform any shutdown needed by the lifecycle
+ * @param instance the instance to destroy
+ */
+ void destroyInstance(Object instance);
}
1.3 +3 -0 incubator-geronimo/modules/core/src/test/org/apache/geronimo/cache/SimpleInstancePoolTest.java
Index: SimpleInstancePoolTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/cache/SimpleInstancePoolTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleInstancePoolTest.java 17 Aug 2003 10:32:10 -0000 1.2
+++ SimpleInstancePoolTest.java 1 Nov 2003 22:49:33 -0000 1.3
@@ -115,5 +115,8 @@
public Object createInstance() {
return new Object();
}
+
+ public void destroyInstance(Object instance) {
+ }
}
}
1.8 +5 -1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatelessInstanceFactory.java
Index: StatelessInstanceFactory.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatelessInstanceFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StatelessInstanceFactory.java 30 Oct 2003 07:47:04 -0000 1.7
+++ StatelessInstanceFactory.java 1 Nov 2003 22:49:33 -0000 1.8
@@ -119,4 +119,8 @@
enterpriseContext.setInstance(instance);
return enterpriseContext;
}
+
+ public void destroyInstance(Object instance) {
+ throw new UnsupportedOperationException();
+ }
}