this.properties.put(PASSWORD, password);
}
public DbFuture<Connection> connect() throws DbException {
if (isClosed()) {
throw new DbException("This connection manager is closed");
}
final DbFutureConcurrentProxy<Connection> future = new DbFutureConcurrentProxy<Connection>();
Future<Connection> executorFuture = executorService.submit(new Callable<Connection>() {
public Connection call() throws Exception {
try {
java.sql.Connection jdbcConnection = DriverManager.getConnection(jdbcUrl, properties);
JdbcConnection connection = new JdbcConnection(JdbcConnectionManager.this, jdbcConnection);
synchronized (lock) {
if (isClosed()) {
connection.close(true);
future.setException(new DbException("Connection manager closed"));
} else {
connections.add(connection);
future.setValue(connection);
}
}
return connection;
} catch (SQLException e) {
future.setException(new DbException(e));
e.printStackTrace();
throw e;
} finally {
future.setDone();
}