in flume-jdbc-channel/src/main/java/org/apache/flume/channel/jdbc/impl/JdbcChannelProviderImpl.java [238:283]
public void close() {
try {
connectionPool.close();
} catch (Exception ex) {
throw new JdbcChannelException("Unable to close connection pool", ex);
}
if (databaseType.equals(DatabaseType.DERBY)
&& driverClassName.equals(EMBEDDED_DERBY_DRIVER_CLASSNAME)) {
// Need to shut down the embedded Derby instance
if (connectUrl.startsWith("jdbc:derby:")) {
int index = connectUrl.indexOf(";");
String baseUrl = null;
if (index != -1) {
baseUrl = connectUrl.substring(0, index + 1);
} else {
baseUrl = connectUrl + ";";
}
String shutDownUrl = baseUrl + "shutdown=true";
LOGGER.debug("Attempting to shutdown embedded Derby using URL: "
+ shutDownUrl);
try {
DriverManager.getConnection(shutDownUrl);
} catch (SQLException ex) {
// Shutdown for one db instance is expected to raise SQL STATE 45000
if (ex.getErrorCode() != 45000) {
throw new JdbcChannelException(
"Unable to shutdown embedded Derby: " + shutDownUrl
+ " Error Code: " + ex.getErrorCode(), ex);
}
LOGGER.info("Embedded Derby shutdown raised SQL STATE "
+ "45000 as expected.");
}
} else {
LOGGER.warn("Even though embedded Derby drvier was loaded, the connect "
+ "URL is of an unexpected form: " + connectUrl + ". Therfore no "
+ "attempt will be made to shutdown embedded Derby instance.");
}
}
dataSource = null;
txFactory = null;
schemaHandler = null;
}