001package io.ebean.datasource; 002 003import javax.sql.DataSource; 004import java.sql.SQLException; 005 006/** 007 * DataSource pool API. 008 */ 009public interface DataSourcePool extends DataSource { 010 011 /** 012 * Return the dataSource name. 013 */ 014 String getName(); 015 016 /** 017 * Return true if the pool defaults to using autocommit. 018 */ 019 boolean isAutoCommit(); 020 021 /** 022 * Shutdown the pool with the option to deregister the driver. 023 */ 024 void shutdown(boolean deregisterDriver); 025 026 /** 027 * Return the current status of the connection pool. 028 * <p> 029 * This is cheaper than getStatistics() in that it just the counts of free, busy, 030 * wait etc and does not included times (total connection time etc). 031 * </p> 032 * <p> 033 * If you pass reset = true then the counters are reset. 034 * </p> 035 */ 036 PoolStatus getStatus(boolean reset); 037 038 /** 039 * Return the aggregated execution statistics collected on all the connections in the pool. 040 * <p> 041 * If reset is set to true the counters are reset once the statistics have been collected. 042 * </p> 043 */ 044 PoolStatistics getStatistics(boolean reset); 045 046 /** 047 * Returns false when the dataSource is down. 048 */ 049 boolean isDataSourceUp(); 050 051 /** 052 * Returns the reason, why the dataSource is down. 053 */ 054 SQLException getDataSourceDownReason(); 055 056 /** 057 * Set a new maximum size. The pool should respect this new maximum 058 * immediately and not require a restart. You may want to increase the 059 * maxConnections if the pool gets large and hits the warning level. 060 */ 061 void setMaxSize(int max); 062 063 /** 064 * Set a new maximum size. The pool should respect this new maximum immediately 065 * and not require a restart. You may want to increase the maxConnections if the 066 * pool gets large and hits the warning and or alert levels. 067 */ 068 void setWarningSize(int warningSize); 069 070 /** 071 * Return the warning size. When the pool hits this size it can send a 072 * notify message to an administrator. 073 */ 074 public int getWarningSize(); 075 076}