public synchronized boolean switchConnection(Connection newCon) throws InterruptedException {
    Connection oldCon = null;
    synchronized (this) {
      if (shouldDestroy()) {
        return false;
      }

      if (active && !shouldDestroy()) {
        waitingToSwitch = true;
        try {
          while (active && !shouldDestroy()) {
            wait();
          }
        } finally {
          waitingToSwitch = false;
          notifyAll();
        }
      }
      if (shouldDestroy()) {
        return false;
      }
      assert !active;
      final long now = System.nanoTime();
      oldCon = connection;
      connection = newCon;
      endpoint = newCon.getEndpoint();
      birthDate = now;
    }
    if (oldCon != null) {
      try {
        // do this outside of sync
        oldCon.close(false);
      } catch (Exception e) {
        // ignore
      }
    }
    return true;
  }
Set the destroy bit if it is not already set.

@return true if we were able to set to bit; false if someone else already did
geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java