code: protected void requestingAccessToPool() {
          /*
           * Added for holding out connection request while
           * a free or shared pool is being updated
           */
          if (updateToPoolInProgress) {
              synchronized (updateToPoolInProgressLockObject) {
                  while (updateToPoolInProgress) {
                      try {
                          /*
                           * Wait for 250 milliseconds and check if update to pool is
                           * finished. The update is complete when updateToPoolInProgress is
                           * changed to false and a updateToPoolInProgressLockObject.notifyAll()
                           * is called.
                           */
                          updateToPoolInProgressLockObject.wait(updateToPoolInProgressSleepTime);
                      } catch (InterruptedException e1) {
                          // We don't need to do anything here.
                          // e1.printStackTrace();
                      }
                  }
              }
          }
          activeRequest.incrementAndGet();
          if (updateToPoolInProgress) {
              activeRequest.decrementAndGet();
              synchronized (updateToPoolInProgressLockObject) {
                  while (updateToPoolInProgress) {
                      try {
                          /*
                           * Wait for 250 milliseconds and check if update to pool is
                           * finished. The update is complete when updateToPoolInProgress is
                           * changed to false and a updateToPoolInProgressLockObject.notifyAll()
                           * is called.
                           */
                          updateToPoolInProgressLockObject.wait(updateToPoolInProgressSleepTime);
                      } catch (InterruptedException e1) {
                          // We don't need to do anything here.
                          // e1.printStackTrace();
                      }
                  }
              }
              activeRequest.incrementAndGet();
          }
      }
docs: The caller of the method must call endingAccessToPool()