code: public void waitUntilConnectionReleasedIfNecessary() throws InterruptedException {
          if (ConnectionStatus.RUNNING == status.get() || ConnectionStatus.TERMINATED == status.get()) {
              while (!status.compareAndSet(ConnectionStatus.RELEASE, ConnectionStatus.RUNNING)) {
                  resourceSynchronizer.doAwaitUntil();
              }
          }
      }
docs: Wait until connection is released if necessary.
  
  @throws InterruptedException interrupted exception