[
https://issues.apache.org/jira/browse/PHOENIX-1372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14947512#comment-14947512
]
Samarth Jain commented on PHOENIX-1372:
---------------------------------------
It would also be cleaner, IMHO, to use the try-with-resources construct to
close the resources.
I am not too sure if this change is really needed in QueryOptimizer. Can you
tell us more about why you had to make it?
{code}
SelectStatement select = (SelectStatement)dataPlan.getStatement();
// Exit early if we have a point lookup as we can't get better than
that
- if (!useIndexes
+ if (!useIndexes || select == null
{code}
> Fix resource leaks in various classes
> -------------------------------------
>
> Key: PHOENIX-1372
> URL: https://issues.apache.org/jira/browse/PHOENIX-1372
> Project: Phoenix
> Issue Type: Bug
> Reporter: Ted Yu
> Assignee: Ted Yu
> Labels: resources
> Attachments: 1372-v1.txt
>
>
> Statement / PreparedStatement should be closed after query completes.
> Below is an example of resource leak from
> MetaDataUtil#deleteViewIndexSequences():
> {code}
> public static void deleteViewIndexSequences(PhoenixConnection
> connection, PName name) throws SQLException {
> SequenceKey key = getViewIndexSequenceKey(null, name);
> connection.createStatement().executeUpdate("DELETE FROM " +
> PhoenixDatabaseMetaData.SEQUENCE_TABLE_NAME +
> {code}
> The Statement created by connection.createStatement() should be closed upon
> return.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)