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

Tilmann Zäschke commented on JDO-735:
-------------------------------------

In theory, I could imagine that a database server process could benefit from a 
{{close()}} method. While {{closeAll()}} releases all resources associated with 
a specific query, {{close()}} could serve as a hint to the server that no 
similar query is expected to be executed in the near future. This may allow the 
server to drop resources such as index pages that were only used for that 
query. 

This would not necessarily require support for {{isClosed()}} (unusable state), 
because a user could still be allowed to use the query later on.

The most resources are probably associated with query results, not queries. 
Therefore, an alternative may be to make query results AutoCloseable. This 
would require queries (such as the new JDOQLTypedQuery) to return something 
like a {{CloseableList}} when executed.

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

Reply via email to