/* * * Copyright (C) 2010 Guillaume Cottenceau and MNC S.A. * * This file is part of sdbl4j, and is licensed under the Apache 2.0 license. * */ package org.gc.sdbl4j; import java.sql.Connection; public class ConnectionParameters { private int preOpenedConnections; private int alertLevel; private int maxConnections; private ConnectionCreator connectionCreator; public interface ConnectionCreator { public Connection createConnection(); } public ConnectionParameters( int preOpenedConnections, int alertLevel, int maxConnections, ConnectionCreator connectionCreator ) { this.preOpenedConnections = preOpenedConnections; this.alertLevel = alertLevel; this.maxConnections = maxConnections; this.connectionCreator = connectionCreator; } public int getPreOpenedConnections() { return preOpenedConnections; } public int getAlertLevel() { return alertLevel; } public int getMaxConnections() { return maxConnections; } public Connection createConnection() { return connectionCreator.createConnection(); } public String toString() { return "connectionParameters{preOpenedConnections=" + preOpenedConnections + ",alertLevel=" + alertLevel + ",maxConnections=" + maxConnections + ",connectionCreator=" + connectionCreator + "}"; } }