This commit is contained in:
parent
47849b61ec
commit
eb5911ac7d
4 changed files with 23 additions and 6 deletions
|
|
@ -21,6 +21,7 @@
|
|||
******************************************************************************/
|
||||
package zutil.db;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
|
|
@ -37,7 +38,7 @@ import javax.sql.DataSource;
|
|||
import zutil.db.handler.SimpleSQLHandler;
|
||||
import zutil.log.LogUtil;
|
||||
|
||||
public class DBConnection{
|
||||
public class DBConnection implements Closeable{
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
|
||||
public enum DBMS{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
******************************************************************************/
|
||||
package zutil.db;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.io.Closeable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
|
@ -33,7 +33,7 @@ import zutil.db.DBConnection.DBMS;
|
|||
*
|
||||
* @author Ziver
|
||||
*/
|
||||
public class DBConnectionPool extends TimerTask {
|
||||
public class DBConnectionPool extends TimerTask implements Closeable{
|
||||
public static final long DEFAULT_TIMEOUT = 10*60*60*1000; // 10 minutes;
|
||||
public static final int DEFAULT_MAX_SIZE = 5;
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ public class DBConnectionPool extends TimerTask {
|
|||
/**
|
||||
* Closes all the connections
|
||||
*/
|
||||
public synchronized void close() throws SQLException{
|
||||
public synchronized void close(){
|
||||
for( PoolItem item : inusePool ){
|
||||
item.conn.forceClose();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue