![JAR search and dependency download from the Maven repository](/logo.png)
org.kawanfw.sql.servlet.ConnectionCloser Maven / Gradle / Ivy
/*
* This file is part of AceQL.
* AceQL: Remote JDBC access over HTTP.
* Copyright (C) 2015, KawanSoft SAS
* (http://www.kawansoft.com). All rights reserved.
*
* AceQL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* AceQL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Any modifications to this file must keep this entire header
* intact.
*/
package org.kawanfw.sql.servlet;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.kawanfw.commons.server.util.ServerLogger;
import org.kawanfw.sql.api.server.SqlConfigurator;
/**
* @author Nicolas de Pomereu
*
*/
public class ConnectionCloser {
protected ConnectionCloser() {
}
/**
* Clean the connection so that it is released to the pool
*
* @param connection
* @param sqlConfigurator
* the user sql configuration that contains the close
* implementation
*/
public static void freeConnection(Connection connection,
SqlConfigurator sqlConfigurator) {
if (connection != null) {
// Release the Connection into the pool
try {
sqlConfigurator.close(connection);
} catch (SQLException e) {
ServerLogger.getLogger().log(Level.WARNING,
ExceptionUtils.getStackTrace(e));
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy