My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 678 attachment: maxidletime.patch (1.1 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Index: PooledDataSource.java
===================================================================
--- PooledDataSource.java (revision 5440)
+++ PooledDataSource.java (working copy)
@@ -49,9 +49,18 @@
protected String poolPingQuery = "NO PING QUERY SET";
protected boolean poolPingEnabled = false;
protected int poolPingConnectionsNotUsedFor = 0;
+ protected int poolMaxIdleTime = 600000;

- private int expectedConnectionTypeCode;
+ public int getPoolMaxIdleTime() {
+ return poolMaxIdleTime;
+}

+public void setPoolMaxIdleTime(int poolMaxIdleTime) {
+ this.poolMaxIdleTime = poolMaxIdleTime;
+}
+
+private int expectedConnectionTypeCode;
+
public PooledDataSource() {
dataSource = new UnpooledDataSource();
}
@@ -462,7 +471,7 @@
boolean result = true;

try {
- result = !conn.getRealConnection().isClosed();
+ result = conn.getTimeElapsedSinceLastUse() < getPoolMaxIdleTime() && !conn.getRealConnection().isClosed();
} catch (SQLException e) {
if (log.isDebugEnabled()) {
log.debug("Connection " + conn.getRealHashCode() + " is BAD: " + e.getMessage());
Powered by Google Project Hosting