Author: manik.surtani(a)jboss.com
Date: 2008-10-13 10:46:17 -0400 (Mon, 13 Oct 2008)
New Revision: 6910
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
Log:
Applied Krzysztof Sobolewski's patch for JBCACHE-1424 (JDBCCacheLoader does not close
ConnectionFactory)
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-13
14:02:29 UTC (rev 6909)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-13
14:46:17 UTC (rev 6910)
@@ -286,33 +286,39 @@
@Override
public void stop()
{
- if (config.getDropTable())
+ try
{
- Connection con = null;
- Statement st = null;
- try
+ if (config.getDropTable())
{
- if (log.isDebugEnabled())
+ Connection con = null;
+ Statement st = null;
+ try
{
- log.debug("executing ddl: " + config.getDropTableDDL());
+ if (log.isDebugEnabled())
+ {
+ log.debug("executing ddl: " + config.getDropTableDDL());
+ }
+
+ con = cf.getConnection();
+ st = con.createStatement();
+ st.executeUpdate(config.getDropTableDDL());
+ safeClose(st);
}
-
- con = cf.getConnection();
- st = con.createStatement();
- st.executeUpdate(config.getDropTableDDL());
- safeClose(st);
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table: " + e.getMessage(), e);
+ }
+ finally
+ {
+ safeClose(st);
+ cf.close(con);
+ }
}
- catch (SQLException e)
- {
- log.error("Failed to drop table: " + e.getMessage(), e);
- }
- finally
- {
- safeClose(st);
- cf.close(con);
- cf.stop();
- }
}
+ finally
+ {
+ cf.stop();
+ }
}
/**
Show replies by date