docs: @Override
      public boolean requestPermissionToClose(long waitForPermission) {
          synchronized (this) {
              if ((currentState & CLOSE_NOT_ALLOWED_MASK) == 0) {
  
                  if ((currentState & READ_OUTSTANDING) != 0) {
                      readOutWithClosePending = true;
                  } else {
                      readOutWithClosePending = false;
                  }
                  if ((currentState & WRITE_OUTSTANDING) != 0) {
                      writeOutWithClosePending = true;
                  } else {
                      writeOutWithClosePending = false;
                  }
  
                  currentState = CLOSE_PENDING;
  
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, "requestPermissionToClose returning true");
                  }
                  return true;
              }
  
              if (waitForPermission <= 0) {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, "requestPermissionToClose returning false");
                  }
                  return false;
              }
  
              long waitTillTime = (System.nanoTime() / ONE_MILLISECOND_IN_NANOSECONDS) + waitForPermission; //Measured in ms
              long waitTime = waitForPermission;
              while (true) {
                  // wait for a state change that will allow closing
                  try {
                      closeWaiting = true;
                      this.wait(waitTime);
                      closeWaiting = false;
  
                      // See if Permission can be granted
                      if ((currentState & CLOSE_NOT_ALLOWED_MASK) == 0) {
  
                          if ((currentState & READ_OUTSTANDING) != 0) {
                              readOutWithClosePending = true;
                          } else {
                              readOutWithClosePending = false;
                          }
                          if ((currentState & WRITE_OUTSTANDING) != 0) {
                              writeOutWithClosePending = true;
                          } else {
                              writeOutWithClosePending = false;
                          }
                          currentState = CLOSE_PENDING;
  
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "requestPermissionToClose returning(2) true");
                          }
                          return true;
                      }
                      waitTime = (waitTillTime - (System.nanoTime() / ONE_MILLISECOND_IN_NANOSECONDS));
                      if (waitTime <= 0) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "requestPermissionToClose returning(2) false");
                          }
                          return false;
                      }
                      continue;
                  } catch (InterruptedException x) {
                      // See if Permission can be granted
                      if ((currentState & CLOSE_NOT_ALLOWED_MASK) == 0) {
  
                          if ((currentState & READ_OUTSTANDING) != 0) {
                              readOutWithClosePending = true;
                          } else {
                              readOutWithClosePending = false;
                          }
                          if ((currentState & WRITE_OUTSTANDING) != 0) {
                              writeOutWithClosePending = true;
                          } else {
                              writeOutWithClosePending = false;
                          }
                          currentState = CLOSE_PENDING;
  
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "requestPermissionToClose returning(3) true");
                          }
                          return true;
                      }
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(tc, "requestPermissionToClose returning(3) false");
                      }
                      return false;
                  }
              } // end-while
          } // end-sync
      }