import org.apache.commons.pool.impl.GenericObjectPool;
/**
- * Abstract database class providing the creation of the datasource,
- * preventing duplicate starts of the same database, and checking
- * for connection leaks when the database is stopped.
+ * Abstract database class providing the creation of the datasource, preventing
+ * duplicate starts of the same database, and checking for connection leaks when
+ * the database is stopped.
*
* @author Erik Brakkee
- *
+ *
*/
public abstract class AbstractDatabase implements Database {
private boolean started;
/**
- * Constructs the database.
+ * Constructs the database.
*/
protected AbstractDatabase() {
started = false;
}
/**
- * To be implemented by subclasses to start the database.
+ * To be implemented by subclasses to start the database.
*/
protected abstract void doStart();
/**
- * To be implemented by subclasses to stop the database.
+ * To be implemented by subclasses to stop the database.
*/
protected abstract void doStop();
// / BELOW THIS LINE IS NOT OF INTEREST TO SUBCLASSES.
/**
- * Starts the database.
+ * Starts the database.
*/
public final DataSource start() {
if (started) {
}
/**
- * Stops the database and tests for connection leaks.
- * In cast the system property with the name given by {@link #IGNORE_CONNECTION_LEAK_PROPERTY}
- * is set then the connection leaks are not checked.
+ * Stops the database and tests for connection leaks. In cast the system
+ * property with the name given by {@link #IGNORE_CONNECTION_LEAK_PROPERTY}
+ * is set then the connection leaks are not checked.
*/
public final void stop() {
if (!started) {
String msg = "JDBC connection pool still has " +
connectionPool.getNumActive() +
" active connection(s), this is a potential resource leak in the code\n";
- // backdoor to ignore connection leaks. Use this system property only if you
- // can safely ignore the connection leaks.
+ // backdoor to ignore connection leaks. Use this system property
+ // only if you
+ // can safely ignore the connection leaks.
if (System.getProperty(IGNORE_CONNECTION_LEAK_PROPERTY) == null) {
Assert.fail(msg);
}