dengzhhu653 commented on a change in pull request #1071: URL: https://github.com/apache/hive/pull/1071#discussion_r439108243
########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java ########## @@ -12872,15 +12879,16 @@ public int deleteRuntimeStats(int maxRetainSecs) throws MetaException { return 0; } boolean committed = false; - try { + try (Query q = pm.newQuery(MRuntimeStat.class)) { openTransaction(); int maxCreateTime = (int) (System.currentTimeMillis() / 1000) - maxRetainSecs; - Query q = pm.newQuery(MRuntimeStat.class); q.setFilter("createTime <= maxCreateTime"); q.declareParameters("int maxCreateTime"); long deleted = q.deletePersistentAll(maxCreateTime); committed = commitTransaction(); return (int) deleted; + } catch (Exception e) { + throw new MetaException(e.getMessage()); Review comment: A checked exception should be handled by try-with-resources ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org