ARM API Support

David Schlosnagle schlosna at gmail.com
Wed Jul 28 09:19:34 PDT 2010


On Wed, Jul 28, 2010 at 12:10 PM, Joe Darcy <joe.darcy at oracle.com> wrote:
> Lance Andersen, JDBC spec lead, left the following comment on my blog
> regarding JDBC support for ARM/try-with-resources:
>
> "The changes to add support for ARM would be part of JDBC 4.1 which we hope
> to include in Java SE 7.  If JDBC 4.1 makes it into Java SE 7 we should be
> able to include this feature.  We have been discussing this in the JDBC EG
> and at this time we do not see any potential gotchas for the interfaces
> which support a close() method."
>
> http://blogs.sun.com/darcy/entry/project_coin_arm_api#comment-1280332609000
>
> -Joe

Joe,

Thanks! I'd love for ARM support to be included in the JDBC spec and
Java SE 7. There is one JDBC specific interaction with AutoCloseable
that developers would need to be cautious of -- the
java.sql.Connection needs to be committed or rolled back prior to the
invocation of close() (whether explicit or implicit via the ARM
construct) [1]. This isn't really any different than if someone was
already explicitly closing the Connection, but I could see some cases
where developers naively assume that using the ARM construct with a
Connection would automatically handle this for them, and unfortunately
this could be considered a violation of the "do no harm" principle.

Adapting any other APIs to AutoCloseable seems reasonable through
library support, at least until JDK7 support becomes prevalent enough
for developers to adopt AutoCloseable.

[1]: http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#close%28%29
    It is strongly recommended that an application explicitly commits or rolls
    back an active transaction prior to calling the close method. If the close
    method is called and there is an active transaction, the results are
    implementation-defined.

- Dave



More information about the coin-dev mailing list