Fixes #275 make global lock non-static

pull/284/head
Brett Wooldridge 10 years ago
parent e9e7f05c42
commit f7df7cd0b0

@ -13,6 +13,6 @@
<parent>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-parent</artifactId>
<version>2.3.3-SNAPSHOT</version>
<version>2.3.4-SNAPSHOT</version>
</parent>
</project>

@ -139,7 +139,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
this.isReadOnly = configuration.isReadOnly();
this.isAutoCommit = configuration.isAutoCommit();
this.suspendResumeLock = configuration.isAllowPoolSuspension() ? GlobalPoolLock.SUSPEND_RESUME_LOCK : GlobalPoolLock.FAUX_LOCK;
this.suspendResumeLock = configuration.isAllowPoolSuspension() ? new GlobalPoolLock(true) : GlobalPoolLock.FAUX_LOCK;
this.catalog = configuration.getCatalog();
this.connectionCustomizer = initializeCustomizer();

@ -25,9 +25,9 @@ import java.util.concurrent.Semaphore;
*
* @author Brett Wooldridge
*/
public class GlobalPoolLock
class GlobalPoolLock
{
public static final GlobalPoolLock FAUX_LOCK = new GlobalPoolLock(false) {
static final GlobalPoolLock FAUX_LOCK = new GlobalPoolLock(false) {
@Override
public void acquire() {}
@ -41,15 +41,13 @@ public class GlobalPoolLock
public void resume() {}
};
public static final GlobalPoolLock SUSPEND_RESUME_LOCK = new GlobalPoolLock(true);
private static final int MAX_PERMITS = 10000;
private final Semaphore acquisitionSemaphore;
/**
* Default constructor
*/
private GlobalPoolLock(final boolean createSemaphore) {
GlobalPoolLock(final boolean createSemaphore) {
acquisitionSemaphore = (createSemaphore ? new Semaphore(MAX_PERMITS, true) : null);
}

Loading…
Cancel
Save