private void replenishPool() { synchronized (lock) { // If we have gone below min pool size, create that many sessions. for (int i = 0; i < options.getMinSessions() - (totalSessions() + numSessionsBeingCreated); i++) { createSession(); } } } }
private void initPool() { synchronized (lock) { poolMaintainer.init(); for (int i = 0; i < options.getMinSessions(); i++) { createSession(); } } }
Math.max(options.getMinSessions(), maxSessionsInUse + options.getMaxIdleSessions()); numSessionsToClose = totalSessions() - sessionsToKeep; sessionsToClosePerLoop = (int) Math.ceil((double) numSessionsToClose / numClosureCycles);
@Test public void setMinMaxSessions() { if (minSessions > maxSessions) { expectedException.expect(IllegalArgumentException.class); } SessionPoolOptions options = SessionPoolOptions.newBuilder() .setMinSessions(minSessions) .setMaxSessions(maxSessions) .build(); assertEquals(minSessions, options.getMinSessions()); assertEquals(maxSessions, options.getMaxSessions()); } }
private void replenishPool() { synchronized (lock) { // If we have gone below min pool size, create that many sessions. for (int i = 0; i < options.getMinSessions() - (totalSessions() + numSessionsBeingCreated); i++) { createSession(); } } } }
private void initPool() { synchronized (lock) { poolMaintainer.init(); for (int i = 0; i < options.getMinSessions(); i++) { createSession(); } } }
Math.max(options.getMinSessions(), maxSessionsInUse + options.getMaxIdleSessions()); numSessionsToClose = totalSessions() - sessionsToKeep; sessionsToClosePerLoop = (int) Math.ceil((double) numSessionsToClose / numClosureCycles);