Author: dblevins
Date: Mon Jan 7 14:16:36 2008
New Revision: 609793
URL: http://svn.apache.org/viewvc?rev=609793&view=rev
Log:
Added comments on the lifecycle management of the stateless bean instances
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java?rev=609793&r1=609792&r2=609793&view=diff
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
(original)
+++
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
Mon Jan 7 14:16:36 2008
@@ -214,6 +214,13 @@
if (type == ExceptionType.SYSTEM) {
/* System Exception ****************************/
+ /**
+ * The bean instance is not put into the pool via
instanceManager.poolInstance
+ * and therefore the instance will be garbage collected and
destroyed.
+ * For this reason the discardInstance method of the
StatelessInstanceManager
+ * does nothing.
+ */
+
txPolicy.handleSystemException(re, instance, txContext);
} else {
/* Application Exception ***********************/
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java?rev=609793&r1=609792&r2=609793&view=diff
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
(original)
+++
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
Mon Jan 7 14:16:36 2008
@@ -78,6 +78,21 @@
}
}
+ /**
+ * Removes an instance from the pool and returns it for use
+ * by the container in business methods.
+ *
+ * If the pool is at it's limit the StrictPooling flag will
+ * cause this thread to wait.
+ *
+ * If StrictPooling is not enabled this method will create a
+ * new stateless bean instance performing all required injection
+ * and callbacks before returning it in a method ready state.
+ *
+ * @param callContext
+ * @return
+ * @throws OpenEJBException
+ */
public Object getInstance(ThreadContext callContext)
throws OpenEJBException {
CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
@@ -238,6 +253,20 @@
return new StatelessContext(transactionManager, securityService);
}
+ /**
+ * All instances are removed from the pool in getInstance(...). They are
only
+ * returned by the StatelessContainer via this method under two
circumstances.
+ *
+ * 1. The business method returns normally
+ * 2. The business method throws an application exception
+ *
+ * Instances are not returned to the pool if the business method threw a
system
+ * exception.
+ *
+ * @param callContext
+ * @param bean
+ * @throws OpenEJBException
+ */
public void poolInstance(ThreadContext callContext, Object bean) throws
OpenEJBException {
if (bean == null) {
throw new SystemException("Invalid arguments");
@@ -277,6 +306,14 @@
}
+ /**
+ * This method has no work to do as all instances are removed from
+ * the pool on getInstance(...) and not returned via poolInstance(...)
+ * if they threw a system exception.
+ *
+ * @param callContext
+ * @param bean
+ */
public void discardInstance(ThreadContext callContext, Object bean) {
}