@Override public void releaseChannelLock(Object partitionKey) { getFreeConnectionsForHost(partitionKey).release(); }
@Override public void releaseChannelLock(Object partitionKey) { this.globalMaxConnectionSemaphore.releaseChannelLock(partitionKey); super.releaseChannelLock(partitionKey); } }
@Test(timeOut = 1000, dataProvider = "permitsAndRunnersCount") public void perHostCheckPermitCount(int permitCount, int runnerCount) { allSemaphoresCheckPermitCount(new PerHostConnectionSemaphore(permitCount, 0), permitCount, runnerCount); }
@Test(timeOut = 1000, invocationCount = NON_DETERMINISTIC__INVOCATION_COUNT, successPercentage = NON_DETERMINISTIC__SUCCESS_PERCENT) public void perHostCheckAcquireTime() { checkAcquireTime(new PerHostConnectionSemaphore(CHECK_ACQUIRE_TIME__PERMITS, CHECK_ACQUIRE_TIME__TIMEOUT)); }
@Test(timeOut = 1000) public void perHostCheckRelease() throws IOException { checkRelease(new PerHostConnectionSemaphore(1, 0)); }
@Override public void acquireChannelLock(Object partitionKey) throws IOException { try { if (!getFreeConnectionsForHost(partitionKey).tryAcquire(acquireTimeout, TimeUnit.MILLISECONDS)) { throw tooManyConnectionsPerHost; } } catch (InterruptedException e) { throw new RuntimeException(e); } }