3 * Copyright (C) 2010 Guillaume Cottenceau and MNC S.A.
5 * This file is part of sdbl4j, and is licensed under the Apache 2.0 license.
11 import java.sql.Connection;
13 public class ConnectionParameters {
15 private int preOpenedConnections;
16 private int alertLevel;
17 private int maxConnections;
18 private ConnectionCreator connectionCreator;
20 public interface ConnectionCreator {
21 public Connection createConnection();
24 public ConnectionParameters( int preOpenedConnections, int alertLevel, int maxConnections,
25 ConnectionCreator connectionCreator ) {
26 this.preOpenedConnections = preOpenedConnections;
27 this.alertLevel = alertLevel;
28 this.maxConnections = maxConnections;
29 this.connectionCreator = connectionCreator;
32 public int getPreOpenedConnections() {
33 return preOpenedConnections;
36 public int getAlertLevel() {
40 public int getMaxConnections() {
41 return maxConnections;
44 public Connection createConnection() {
45 return connectionCreator.createConnection();
48 public String toString() {
49 return "connectionParameters{preOpenedConnections=" + preOpenedConnections + ",alertLevel=" + alertLevel
50 + ",maxConnections=" + maxConnections + ",connectionCreator=" + connectionCreator + "}";