[
https://issues.apache.org/jira/browse/TAJO-1877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14970415#comment-14970415
]
ASF GitHub Bot commented on TAJO-1877:
--------------------------------------
Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/835#discussion_r42832337
--- Diff:
tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
---
@@ -2813,22 +2647,19 @@ public static String
getDatabaseNameOfTable(Connection conn, int tid) throws SQL
public IndexDescProto getIndexByName(String databaseName, final String
indexName)
throws UndefinedDatabaseException, UndefinedIndexException {
- Connection conn = null;
ResultSet res = null;
- PreparedStatement pstmt = null;
IndexDescProto proto = null;
- try {
- int databaseId = getDatabaseId(databaseName);
+ String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=? AND
INDEX_NAME=?";
- String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=?
AND INDEX_NAME=?";
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(sql);
+ }
- if (LOG.isDebugEnabled()) {
- LOG.debug(sql);
- }
+ try (Connection conn = getConnection();
--- End diff --
Why do you close the connection here?
> Adopt try-resource statement to AbstractDBStore
> -----------------------------------------------
>
> Key: TAJO-1877
> URL: https://issues.apache.org/jira/browse/TAJO-1877
> Project: Tajo
> Issue Type: Sub-task
> Components: Catalog
> Reporter: Hyunsik Choi
> Assignee: Dongkyu Hwangbo
> Labels: newbie
>
> See
> https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html.
> JDK 7 introduced try-resource statement for better resource allocation and
> deallocation. We can also adopt this feature to AbstractDBStore.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)