resizeLock.writeLock().acquire();
try {
ResizeInfo resizeInfo = new ResizeInfo(this.minSize, (int)permits.permits(), connectionCount, newMaxSize);
this.shrinkLater = resizeInfo.getShrinkLater();
permits = new FIFOSemaphore(newMaxSize);
//pre-acquire permits for the existing checked out connections that will not be closed when they are returned.
for (int i = 0; i < resizeInfo.getTransferCheckedOut(); i++) {
permits.acquire();
}
//transfer connections we are going to keep