docs: protected void removeSharedConnection(MCWrapper mcWrapper) throws ResourceException {
  
          final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
  
          boolean removedSharedConnection = false;
  
          if (isTracingEnabled && tc.isEntryEnabled()) {
              Tr.entry(this, tc, "removeSharedConnection");
          }
  
          //MCWrapper mcw = null;
          synchronized (sharedLockObject) {
  
              if (mcWrapperListSize == 1) {
                  /*
                   * If there is only one mcWrapper in the list, the odds of it
                   * being the right one are good. So, optimistically
                   * remove it from the mcWrapper list and compare mcWrappers.
                   * If we are right, we are happy and we exit the method.
                   * If we are wrong (This should not happen), we are sad
                   * and need to add back into the list
                   */
                  if (mcWrapper == mcWrapperList[0]) {
                      removedSharedConnection = true;
                      mcWrapperListSize = 0;
                      mcWrapperList[mcWrapperListSize] = null;
                  }
              } else { // Too many mcWrappers to feel optimistic
                  /*
                   * If there is more than one mcWrapper in the list, the odds of it
                   * being the right are not as good. So, we
                   * get it from the mcWrapper list and compare mcWrappers.
                   * If the compare is equal, we remove the mcWrapper from the list.
                   * If the compare is not equal, we continue to look through the list
                   * hoping to match mcWrappers. In the normal case we will find a
                   * match and remove the mcWrapper from the list and exit.
                   */
                  for (int i = 0; i < mcWrapperListSize; ++i) {
                      // Look for mcWrapper and remove
                      if (removedSharedConnection) {
                          mcWrapperList[i - 1] = mcWrapperList[--mcWrapperListSize]; // shift all remain wrappers up to fill any open location.
                          // mcWrapperList[i - 1] = mcWrapperList[i];
                          mcWrapperList[mcWrapperListSize] = null; // - For safety, setting the last one to null is good.
                          break;
                      } else {
                          if (mcWrapper == mcWrapperList[i]) {
                              removedSharedConnection = true;
                              if (i == mcWrapperListSize) {
                                  // last one in list, remove it.
                                  mcWrapperList[--mcWrapperListSize] = null; // - For safety, setting the last one to null is good.
                              }
                          }
                      }
                  }
  //                if (removedSharedConnection) {
  //                    --mcWrapperListSize;
  //                }
              }
  
          }
  
          if (!removedSharedConnection) {
              /*
               * We should never throw this exception unless a resource adapter
               * replace the Subject or CRI references. They are not allow to
               * replace the Subject or CRI references when the connection is
               * being used.
               */
              Tr.error(tc, "SHAREDPOOL_REMOVESHAREDCONNECTION_ERROR_J2CA1003", mcWrapper);
              ResourceException re = new ResourceException("removeSharedConnection: failed to remove MCWrapper " + mcWrapper.toString());
              com.ibm.ws.ffdc.FFDCFilter.processException(
                                                          re,
                                                          "com.ibm.ejs.j2c.poolmanager.SharedPool.removeSharedConnection",
                                                          "184",
                                                          this);
              _pm.activeRequest.decrementAndGet();
              throw re;
  
          } else {
              mcWrapper.setPoolState(0);
          }
  
          if (isTracingEnabled && tc.isEntryEnabled()) {
              if (tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Removed connection");
              }
              Tr.exit(this, tc, "removeSharedConnection");
          }
  
      }