You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Ivan <xh...@gmail.com> on 2010/06/10 10:52:13 UTC

Re: 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/ope

Do OpenEJB 3.1.* has the minium JRE version of 1.6 ? If not, I guess we
could not use TimeUnit.MINUTES, it only exists in JDK 1.6.
Thanks !


2010/6/2 <db...@apache.org>

> 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
>
>
>


-- 
Ivan

TimeUnits (Re: svn commit: r950396)

Posted by David Blevins <da...@visi.com>.
On Jun 10, 2010, at 2:39 AM, Jean-Louis MONTEIRO wrote:

> Ivan Xu wrote:
>> 
>> Do OpenEJB 3.1.* has the minium JRE version of 1.6 ? If not, I guess we
>> could not use TimeUnit.MINUTES, it only exists in JDK 1.6.
>> Thanks !
>> 
> 
> Absolutely!
> 3.1.x --> Java EE 5
> 3.2.x --> Java EE 6
> 
> Can you fill a JIRA and push a patch?

Good catch.  This was my mistake so just went ahead and fixed it.  I converted the 3.1.x version to use Duration.Unit, so we should be good.

On that note, the Duration.Unit enum was only there to work around the lack of MINUTES, HOURS, and DAYS in the Java 5 TimeUnit enum, so now that we are in Java 6 in trunk, I went ahead and finally cleaned up that class.


Thanks for the heads up, Ivan!


-David


Re: 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/ope

Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.

Ivan Xu wrote:
> 
> Do OpenEJB 3.1.* has the minium JRE version of 1.6 ? If not, I guess we
> could not use TimeUnit.MINUTES, it only exists in JDK 1.6.
> Thanks !
> 

Absolutely!
3.1.x --> Java EE 5
3.2.x --> Java EE 6

Can you fill a JIRA and push a patch?

Jean-Louis

-- 
View this message in context: http://openejb.979440.n4.nabble.com/Re-svn-commit-r950396-in-openejb-branches-openejb-3-1-x-container-openejb-core-src-main-java-org-apae-tp2250121p2250167.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.