deniskuzZ commented on code in PR #5474:
URL: https://github.com/apache/hive/pull/5474#discussion_r1825671219
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PersistenceManagerProvider.java:
##########
@@ -319,9 +327,17 @@ private static PersistenceManagerFactory
initPMF(Configuration conf, boolean for
LOG.warn("Could not create PersistenceManagerFactory using "
+ "connection pool properties, will fall back", e);
pmf = JDOHelper.getPersistenceManagerFactory(prop);
+ } finally {
+ if (pmf == null && ds instanceof AutoCloseable) {
+ try (AutoCloseable close1 = (AutoCloseable) ds;
+ AutoCloseable close2 = (AutoCloseable) ds2 ) {
+ } catch (Exception e) {
+ LOG.warn("Failed to close the DataSource", e);
+ }
+ }
}
}
- DataStoreCache dsc = pmf.getDataStoreCache();
+ DataStoreCache dsc = pmf != null ? pmf.getDataStoreCache() : null;
Review Comment:
agree, but I don't see that you re-throw an original exception in finally
when `pmf` is null
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]