|
19 | 19 |
|
20 | 20 | package quickfix; |
21 | 21 |
|
| 22 | +import javax.sql.DataSource; |
| 23 | + |
22 | 24 | /** |
23 | 25 | * Class for storing JDBC setting constants shared by both the log and message |
24 | 26 | * store classes. |
@@ -103,40 +105,62 @@ public class JdbcSetting { |
103 | 105 | public static final String SETTING_JDBC_SESSION_ID_DEFAULT_PROPERTY_VALUE = "JdbcSessionIdDefaultPropertyValue"; |
104 | 106 |
|
105 | 107 | /** |
106 | | - * Specifies the maximum number of connections to the database |
107 | | - * |
108 | | - * @see <a href="http://proxool.sourceforge.net/properties.html">http://proxool.sourceforge.net/properties.html</a> |
| 108 | + * Controls the maximum size that the pool is allowed to reach, including both idle and in-use connections. |
| 109 | + * Basically this value will determine the maximum number of actual connections to the database backend. |
| 110 | + * A reasonable value for this is best determined by your execution environment. When the pool reaches this size, |
| 111 | + * and no idle connections are available, calls to {@link DataSource#getConnection()} will block for up to |
| 112 | + * {@link JdbcSetting#SETTING_JDBC_CONNECTION_TIMEOUT} milliseconds before timing out. |
109 | 113 | */ |
110 | 114 | public static final String SETTING_JDBC_MAX_ACTIVE_CONNECTION = "JdbcMaxActiveConnection"; |
111 | 115 |
|
112 | 116 | /** |
113 | | - * Specifies if the housekeeper comes across a thread that has been active for longer than |
114 | | - * this then it will kill it. So make sure you set this to a number bigger than your |
115 | | - * slowest expected response! |
116 | | - * |
117 | | - * @see <a href="http://proxool.sourceforge.net/properties.html">http://proxool.sourceforge.net/properties.html</a> |
| 117 | + * Controls the minimum number of idle connections that HikariCP tries to maintain in the pool. |
| 118 | + * If the idle connections dip below this value and total connections in the pool are less than |
| 119 | + * {@link JdbcSetting#SETTING_JDBC_MAX_ACTIVE_CONNECTION}, HikariCP will make the best effort to add |
| 120 | + * additional connections quickly and efficiently. However, for maximum performance and responsiveness |
| 121 | + * to spike demands, we recommend not setting this value and instead allowing HikariCP to act as a fixed |
| 122 | + * size connection pool. |
118 | 123 | */ |
119 | | - public static final String SETTING_JDBC_MAX_ACTIVE_TIME = "JdbcMaxActiveTime"; |
| 124 | + public static final String SETTING_JDBC_MIN_IDLE_CONNECTION = "JdbcMinIdleConnection"; |
120 | 125 |
|
121 | 126 | /** |
122 | | - * Specifies the maximum amount of time that a connection exists for before |
123 | | - * it is killed (milliseconds). |
124 | | - * |
125 | | - * @see <a href="http://proxool.sourceforge.net/properties.html">http://proxool.sourceforge.net/properties.html</a> |
| 127 | + * Controls the maximum lifetime of a connection in the pool. An in-use connection will never be retired, only when |
| 128 | + * it is closed will it then be removed. On a connection-by-connection basis, minor negative attenuation is applied to |
| 129 | + * avoid mass-extinction in the pool. We strongly recommend setting this value, and it should be several seconds shorter |
| 130 | + * than any database or infrastructure imposed connection time limit. A value of 0 indicates no maximum lifetime (infinite |
| 131 | + * lifetime), subject of course to the {@link JdbcSetting#SETTING_JDBC_CONNECTION_IDLE_TIMEOUT} setting. |
126 | 132 | */ |
127 | 133 | public static final String SETTING_JDBC_MAX_CONNECTION_LIFETIME = "JdbcMaxConnectionLifeTime"; |
128 | 134 |
|
129 | 135 | /** |
130 | | - * Specifies the maximum number of connections we can be building at any one time. |
131 | | - * That is, the number of new connections that have been requested but aren't yet |
132 | | - * available for use. Because connections can be built using more than one thread |
133 | | - * (for instance, when they are built on demand) and it takes a finite time between |
134 | | - * deciding to build the connection and it becoming available we need some way of |
135 | | - * ensuring that a lot of threads don't all decide to build a connection at once. |
136 | | - * (We could solve this in a smarter way - and indeed we will one day) |
137 | | - * |
138 | | - * @see <a href="http://proxool.sourceforge.net/properties.html">http://proxool.sourceforge.net/properties.html</a> |
| 136 | + * Controls the maximum number of milliseconds that a client (that's you) will wait for a connection from the pool. If this time |
| 137 | + * is exceeded without a connection becoming available, an SQLException will be thrown. Lowest acceptable connection timeout is 250 ms. |
139 | 138 | */ |
140 | | - public static final String SETTING_JDBC_SIMULTANEOUS_BUILD_THROTTLE = "JdbcSimultaneousBuildThrottle"; |
| 139 | + public static final String SETTING_JDBC_CONNECTION_TIMEOUT = "JdbcConnectionTimeout"; |
141 | 140 |
|
| 141 | + /** |
| 142 | + * Controls the maximum amount of time that a connection is allowed to sit idle in the pool. |
| 143 | + * This setting only applies when {@link JdbcSetting#SETTING_JDBC_MIN_IDLE_CONNECTION} is defined to be less than |
| 144 | + * {@link JdbcSetting#SETTING_JDBC_MAX_ACTIVE_CONNECTION}. Idle connections will not be retired once the pool |
| 145 | + * reaches {@link JdbcSetting#SETTING_JDBC_MIN_IDLE_CONNECTION} connections. |
| 146 | + */ |
| 147 | + public static final String SETTING_JDBC_CONNECTION_IDLE_TIMEOUT = "JdbcConnectionIdleTimeout"; |
| 148 | + |
| 149 | + /** |
| 150 | + * Controls how frequently HikariCP will attempt to keep a connection alive, in order to prevent it from being timed out by the |
| 151 | + * database or network infrastructure. This value must be less than the {@link JdbcSetting#SETTING_JDBC_MAX_CONNECTION_LIFETIME} value. |
| 152 | + * A "keepalive" will only occur on an idle connection. When the time arrives for a "keepalive" against a given connection, that connection |
| 153 | + * will be removed from the pool, "pinged", and then returned to the pool. The 'ping' is one of either: invocation of the JDBC4 |
| 154 | + * {@link java.sql.Connection#isValid(int)} method, or execution of the {@link JdbcSetting#SETTING_JDBC_CONNECTION_TEST_QUERY}. Typically, the duration |
| 155 | + * out-of-the-pool should be measured in single digit milliseconds or even sub-millisecond, and therefore should have little or no noticeable |
| 156 | + * performance impact. The minimum allowed value is 30000ms (30 seconds), but a value in the range of minutes is most desirable. |
| 157 | + */ |
| 158 | + public static final String SETTING_JDBC_CONNECTION_KEEPALIVE_TIME = "JdbcConnectionKeepaliveTime"; |
| 159 | + |
| 160 | + /** |
| 161 | + * If your driver supports JDBC4 we strongly recommend not setting this property. This is for "legacy" drivers that do not support the |
| 162 | + * JDBC4 {@link java.sql.Connection#isValid(int)} API. This is the query that will be executed just before a connection is given to you |
| 163 | + * from the pool to validate that the connection to the database is still alive. |
| 164 | + */ |
| 165 | + public static final String SETTING_JDBC_CONNECTION_TEST_QUERY = "JdbcConnectionTestQuery"; |
142 | 166 | } |
0 commit comments