You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Craig L Russell (JIRA)" <ji...@apache.org> on 2016/10/07 22:00:22 UTC

[jira] [Comment Edited] (JDO-735) Make PersistenceManager and Query support AutoCloseable (JDK1.7+)

    [ https://issues.apache.org/jira/browse/JDO-735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15555583#comment-15555583 ] 

Craig L Russell edited comment on JDO-735 at 10/7/16 9:59 PM:
--------------------------------------------------------------

I think the isClosed method only makes sense if there are resources associated with the object. In the context of Extent and Query, the only resources are the iterators and result sets. And if close and closeAll are idempotent, there is no reason for the isClosed method. If you want to free resources, call close or closeAll. 

And I don't think that close should make the object unusable. What value do we add by making the Extent or Query unusable? Specifically, what resources are held by an "open" Query or Extent that has no open result sets?


was (Author: clr):
I think the isClosed method only makes sense if there are resources associated with the object. In the context of Extent and Query, the only resources are the iterators and result sets. And if close and closeAll are idempotent, there is no reason for the isClosed method. If you want to free resources, call close or closeAll. 

And I don't think that close should make the object unusable. What value do we add by making the Extent or Query unusable?

> Make PersistenceManager and Query support AutoCloseable (JDK1.7+)
> -----------------------------------------------------------------
>
>                 Key: JDO-735
>                 URL: https://issues.apache.org/jira/browse/JDO-735
>             Project: JDO
>          Issue Type: New Feature
>          Components: api, specification, tck
>            Reporter: Andy Jefferson
>            Assignee: Michael Bouschen
>             Fix For: JDO 3.2
>
>         Attachments: CloseWithActiveTxRollsBack.java
>
>
> So then it can be used with JDK1.7+ try-with-resources, as per http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)