tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r917339 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
Date Mon, 01 Mar 2010 01:11:03 GMT
Author: dblevins
Date: Mon Mar  1 01:11:03 2010
New Revision: 917339

URL: http://svn.apache.org/viewvc?rev=917339&view=rev
Log:
Set Timeout (aka. AccessTimeout) on a per bean level 

Modified:
    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/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=917339&r1=917338&r2=917339&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 Mar  1 01:11:03 2010
@@ -102,11 +102,9 @@
         CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
         Data data = (Data) deploymentInfo.getContainerData();
 
-        final Pool<Instance> pool = data.getPool();
-
         Instance instance = null;
         try {
-            final Pool.Entry<Instance> entry = pool.pop(timeout.getTime(), timeout.getUnit());
+            final Pool.Entry<Instance> entry = data.poolPop();
 
             if (entry != null){
                 instance = entry.get();
@@ -349,7 +347,11 @@
         boolean strict = options.get("StrictPooling", this.strictPooling);
         int min = options.get("PoolMin", poolMin);
 
-        Data data = new Data(max, strict, min);
+        String timeString = options.get("Timeout", this.timeout.toString());
+        timeString = options.get("AccessTimeout", timeString);
+        Duration accessTimeout = new Duration(timeString);
+
+        Data data = new Data(max, strict, min, accessTimeout);
         deploymentInfo.setContainerData(data);      
     }
 
@@ -363,11 +365,21 @@
 
     private static final class Data {
         private final Pool<Instance> pool;
+        private Duration accessTimeout;
 
-        public Data(int poolLimit, boolean strictPooling, int min) {
+        public Data(int poolLimit, boolean strictPooling, int min, Duration accessTimeout)
{
+            this.accessTimeout = accessTimeout;
             pool = new Pool<Instance>(poolLimit, min, strictPooling);
         }
 
+        public Duration getAccessTimeout() {
+            return accessTimeout;
+        }
+
+        public Pool.Entry<Instance> poolPop() throws InterruptedException, TimeoutException
{
+            return pool.pop(accessTimeout.getTime(), accessTimeout.getUnit());
+        }
+
         public Pool<Instance> getPool() {
             return pool;
         }



Mime
View raw message