Author: manik.surtani(a)jboss.com
Date: 2008-10-13 10:50:19 -0400 (Mon, 13 Oct 2008)
New Revision: 6912
Modified:
core/branches/flat/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/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-13
14:46:48 UTC (rev 6911)
+++
core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-13
14:50:19 UTC (rev 6912)
@@ -311,33 +311,39 @@
@Override
public void stop()
{
- if (config.getDropTable())
+ try
{
- Connection con = null;
- Statement st = null;
- try
+ if (config.getDropTable())
{
- if (getLogger().isDebugEnabled())
+ Connection con = null;
+ Statement st = null;
+ try
{
- getLogger().debug("executing ddl: " +
config.getDropTableDDL());
+ if (getLogger().isDebugEnabled())
+ {
+ getLogger().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)
+ {
+ getLogger().error("Failed to drop table: " + e.getMessage(),
e);
+ }
+ finally
+ {
+ safeClose(st);
+ cf.close(con);
+ }
}
- catch (SQLException e)
- {
- getLogger().error("Failed to drop table: " + e.getMessage(), e);
- }
- finally
- {
- safeClose(st);
- cf.close(con);
- cf.stop();
- }
}
+ finally
+ {
+ cf.stop();
+ }
}
/**
Show replies by date