You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2010/06/02 09:31:09 UTC
svn commit: r950396 - in /openejb/branches/openejb-3.1.x: ./
container/openejb-core/src/main/java/org/apache/openejb/core/stateless/
container/openejb-core/src/main/java/org/apache/openejb/util/
container/openejb-core/src/test/java/org/apache/openejb/c...
Author: dblevins
Date: Wed Jun 2 07:31:08 2010
New Revision: 950396
URL: http://svn.apache.org/viewvc?rev=950396&view=rev
Log:
svn merge -r 950390:950391 https://svn.apache.org/repos/asf/openejb/trunk/openejb3
http://svn.apache.org/viewvc?rev=950391&view=rev
------------------------------------------------------------------------
r950391 | dblevins | 2010-06-02 00:01:41 -0700 (Wed, 02 Jun 2010) | 3 lines
Set the default units for all Duration pooling options
OPENEJB-1235
------------------------------------------------------------------------
Modified:
openejb/branches/openejb-3.1.x/ (props changed)
openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java (props changed)
openejb/branches/openejb-3.1.x/examples/alternate-descriptors/src/main/resources/META-INF/test.ejb-jar.xml (props changed)
Propchange: openejb/branches/openejb-3.1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 2 07:31:08 2010
@@ -1,2 +1,2 @@
/openejb/branches/openejb-3.1.1:779593
-/openejb/trunk/openejb3:943472,943862,943965,944757,945989,946399,946485,946489,946705,946792,946814,946861,946863-946864,947010,947017,947042,948022,948241,948243,948548,949014,949233
+/openejb/trunk/openejb3:943472,943862,943965,944757,945989,946399,946485,946489,946705,946792,946814,946861,946863-946864,947010,947017,947042,948022,948241,948243,948548,949014,949233,950391
Modified: openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java?rev=950396&r1=950395&r2=950396&view=diff
==============================================================================
--- openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java (original)
+++ openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java Wed Jun 2 07:31:08 2010
@@ -392,18 +392,18 @@ public class StatelessInstanceManager {
final Pool.Builder builder = new Pool.Builder(poolBuilder);
- String timeString = options.get("Timeout", this.accessTimeout.toString());
- timeString = options.get("AccessTimeout", timeString);
- Duration accessTimeout = new Duration(timeString);
- if (accessTimeout.getUnit() == null) accessTimeout.setUnit(TimeUnit.MILLISECONDS);
-
- String s = options.get("CloseTimeout", this.closeTimeout.toString());
- Duration closeTimeout = new Duration(s);
- if (closeTimeout.getUnit() == null) closeTimeout.setUnit(TimeUnit.MILLISECONDS);
+ Duration accessTimeout = getDuration(options, "Timeout", this.accessTimeout, TimeUnit.MILLISECONDS);
+ accessTimeout = getDuration(options, "AccessTimeout", accessTimeout, TimeUnit.MILLISECONDS);
+
+ Duration closeTimeout = getDuration(options, "CloseTimeout", this.closeTimeout, TimeUnit.MINUTES);
final ObjectRecipe recipe = PassthroughFactory.recipe(builder);
recipe.setAllProperties(deploymentInfo.getProperties());
+ setDefault(builder.getMaxAge(), TimeUnit.HOURS);
+ setDefault(builder.getIdleTimeout(), TimeUnit.MINUTES);
+ setDefault(builder.getInterval(), TimeUnit.MINUTES);
+
builder.setSupplier(new StatelessSupplier(deploymentInfo));
builder.setExecutor(executor);
@@ -460,6 +460,17 @@ public class StatelessInstanceManager {
data.getPool().start();
}
+ private void setDefault(Duration duration, TimeUnit unit) {
+ if (duration.getUnit() == null) duration.setUnit(unit);
+ }
+
+ private Duration getDuration(Options options, String property, Duration defaultValue, TimeUnit defaultUnit) {
+ String s = options.get(property, defaultValue.toString());
+ Duration duration = new Duration(s);
+ if (duration.getUnit() == null) duration.setUnit(defaultUnit);
+ return duration;
+ }
+
private Instance createInstance(CoreDeploymentInfo deploymentInfo) {
ThreadContext ctx = new ThreadContext(deploymentInfo, null);
ThreadContext oldCallContext = ThreadContext.enter(ctx);
Modified: openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java?rev=950396&r1=950395&r2=950396&view=diff
==============================================================================
--- openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java (original)
+++ openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java Wed Jun 2 07:31:08 2010
@@ -943,6 +943,22 @@ public class Pool<T> {
return maxAge;
}
+ public boolean isStrict() {
+ return strict;
+ }
+
+ public Duration getIdleTimeout() {
+ return idleTimeout;
+ }
+
+ public Duration getInterval() {
+ return interval;
+ }
+
+ public boolean isReplaceAged() {
+ return replaceAged;
+ }
+
public void setMaxAgeOffset(double maxAgeOffset) {
this.maxAgeOffset = maxAgeOffset;
}
Propchange: openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 2 07:31:08 2010
@@ -1,2 +1,2 @@
/openejb/branches/openejb-3.1.1/container/openejb-core/src/test/java/org/apache/openejb/config/UberInterfaceTest.java:779593
-/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java:943472,943862,943965,944757,945989,946399,946485,946489,946705,946792,946814,946861,946863-946864,947010,947017,947042,948022,948241,948243,948548,949014,949233
+/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java:943472,943862,943965,944757,945989,946399,946485,946489,946705,946792,946814,946861,946863-946864,947010,947017,947042,948022,948241,948243,948548,949014,949233,950391
Propchange: openejb/branches/openejb-3.1.x/examples/alternate-descriptors/src/main/resources/META-INF/test.ejb-jar.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 2 07:31:08 2010
@@ -1,2 +1,2 @@
/openejb/branches/openejb-3.1.1/examples/alternate-descriptors/src/main/resources/META-INF/ejb-jar.xml:779593
-/openejb/trunk/openejb3/examples/alternate-descriptors/src/main/resources/META-INF/test.ejb-jar.xml:943472,943862,943965,944757,945989,946399,946485,946489,946705,946792,946814,946861,946863-946864,947010,947017,947042,948022,948241,948243,948548,949014,949233
+/openejb/trunk/openejb3/examples/alternate-descriptors/src/main/resources/META-INF/test.ejb-jar.xml:943472,943862,943965,944757,945989,946399,946485,946489,946705,946792,946814,946861,946863-946864,947010,947017,947042,948022,948241,948243,948548,949014,949233,950391