Skip to content

Commit 29eb0aa

Browse files
author
Kenneth Xu
committed
Added a missed file.
1 parent 8aeb488 commit 29eb0aa

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.sharneng</groupId>
66
<artifactId>gm4java</artifactId>
7-
<version>1.0.1</version>
7+
<version>1.0.2-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<parent>
@@ -36,9 +36,9 @@
3636
</license>
3737
</licenses>
3838
<scm>
39-
<url>http://kennethxublogsource.googlecode.com/svn/tags/gm4java-1.0.1</url>
40-
<connection>scm:svn:http://kennethxublogsource.googlecode.com/svn/tags/gm4java-1.0.1</connection>
41-
<developerConnection>scm:svn:https://kennethxublogsource.googlecode.com/svn/tags/gm4java-1.0.1</developerConnection>
39+
<url>http://kennethxublogsource.googlecode.com/svn/trunk/gm4java</url>
40+
<connection>scm:svn:http://kennethxublogsource.googlecode.com/svn/trunk/gm4java</connection>
41+
<developerConnection>scm:svn:https://kennethxublogsource.googlecode.com/svn/trunk/gm4java</developerConnection>
4242
</scm>
4343
<developers>
4444
<developer>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package org.gm4java.engine.support;
2+
3+
import org.apache.commons.pool.impl.GenericObjectPool;
4+
5+
/**
6+
* Defines the behavior of the {@link PooledGMService#getConnection()} method when the pool is exhausted.
7+
*
8+
* @see GMConnectionPoolConfig#getWhenExhaustedAction()
9+
*/
10+
public enum WhenExhaustedAction {
11+
/**
12+
* Throw a {@link NoSuchElementException}.
13+
*/
14+
FAIL(GenericObjectPool.WHEN_EXHAUSTED_FAIL),
15+
16+
/**
17+
* Blocks until a new or idle connection is available. Or fail if maxWait is positive and passed.
18+
*/
19+
BLOCK(GenericObjectPool.WHEN_EXHAUSTED_BLOCK),
20+
21+
/**
22+
* Create a new connection and return it (essentially making maxActive meaningless).
23+
*/
24+
GROW(GenericObjectPool.WHEN_EXHAUSTED_GROW);
25+
26+
private WhenExhaustedAction(byte whenExhaustedAction) {
27+
this.whenExhaustedAction = whenExhaustedAction;
28+
}
29+
30+
private final byte whenExhaustedAction;
31+
32+
byte toValue() {
33+
return whenExhaustedAction;
34+
}
35+
36+
static WhenExhaustedAction fromValue(byte whenExhaustedAction) {
37+
switch (whenExhaustedAction) {
38+
case GenericObjectPool.WHEN_EXHAUSTED_BLOCK:
39+
return WhenExhaustedAction.BLOCK;
40+
case GenericObjectPool.WHEN_EXHAUSTED_FAIL:
41+
return WhenExhaustedAction.FAIL;
42+
case GenericObjectPool.WHEN_EXHAUSTED_GROW:
43+
return WhenExhaustedAction.GROW;
44+
default:
45+
throw new IllegalArgumentException("whenExhaustedAction " + whenExhaustedAction + " not recognized.");
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)