docs: public MCWrapper reserve(
                               ManagedConnectionFactory managedConnectionFactory,
                               Subject subject,
                               ConnectionRequestInfo requestInfo,
                               Object affinity,
                               boolean connectionSharing,
                               boolean enforceSerialReuse,
                               int commitPriority,
                               int branchCoupling) throws javax.resource.ResourceException, ResourceAllocationException {
  
          final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
  
          //boolean normalSharing = true;
          // This is to be a parm past in when j2c code is ready
          //  If this is false we don't check the for an existing shared
          //  Connection, we hand out a new shared connection.
  
          if (isTracingEnabled && tc.isEntryEnabled())
              Tr.entry(this, tc, "reserve");
  
          if (isTracingEnabled && tc.isDebugEnabled()) {
  
              StringBuffer sbuff = new StringBuffer(250);
              sbuff.append("input parms... ");
              sbuff.append(nl);
              sbuff.append(" subject = ");
              if (subject == null) {
                  sbuff.append("null");
              } else {
                  // synchronized(this) {
                  SubjectToString subjectToString = new SubjectToString();
                  subjectToString.setSubject(subject);
                  sbuff.append(AccessController.doPrivileged(subjectToString));
                  // }
              }
              sbuff.append(" affinity = ");
              sbuff.append(affinity);
              sbuff.append(nl);
              sbuff.append(" Shared connection = ");
              sbuff.append(connectionSharing);
              sbuff.append(nl);
              sbuff.append(" Force new MC = ");
              sbuff.append(enforceSerialReuse);
              sbuff.append(nl);
              sbuff.append(" commitPriority = ");
              sbuff.append(commitPriority);
              sbuff.append(nl);
              sbuff.append(" branchCoupling = ");
              sbuff.append(branchCoupling);
              sbuff.append(nl);
              sbuff.append(" Connection Request Information = ");
              sbuff.append(requestInfo);
              Tr.debug(this, tc, sbuff.toString());
              Tr.debug(this, tc, "reserve(), Pool contents ==> " + this.toString2(1));
  
          }
  
          /*
           * Added for holding out connection request while
           * a free or shared pool is being updated
           */
          requestingAccessToPool();
  
          // Count the number of managed connection on this thread.
          //  If we find matching thread,
          //  add to a counter and check if we exceeded the max number
          //  allowed set by customer using custom properties maxNumberOfMCsAllowableInThread.  Throw
          //  an exception if we exceed the number.  :-)
          if (maxNumberOfMCsAllowableInThread == 0) {
              // don't check the number of connections when using a lightweight server
              // and maxNumberOfMCsAllowableInThread is 0 (in the lighweight server 0 means no limit)
          } else if (maxNumberOfMCsAllowableInThread > 0) {
              // if the custom property is set, lets use it.
              checkForMCsOnThread(maxNumberOfMCsAllowableInThread);
          }
  
          if ((isTracingEnabled && tc.isDebugEnabled())) {
              ++totalPoolConnectionRequests;
          }
  
          com.ibm.ws.j2c.MCWrapper mcWrapper = null;
  
          int sharedbucket = 0;
  
          /*
           * Check affinity and connectionSharing. We need to check for a shared connection
           * first. If a matching one exists, reuse it.
           */
          if (affinity != null && connectionSharing) {
              // Start -  - thread local fast path...
              if (localConnection_ != null) {
                  ArrayList<MCWrapper> mh = localConnection_.get();
                  if (mh != null) {
                      requestingAccessToTLSPool();
                      int arraySize = mh.size();
                      if (arraySize > 0) {
                          MCWrapper freeLocalConnection = null;
                          if (arraySize == 1) {
                              // fast path, we only have one.
                              MCWrapper localConnection = mh.get(0);
                              if (localConnection.getPoolState() == MCWrapper.ConnectionState_freeTLSPool) {
                                  // We have a free connection, save it and use it if we do not have a matching affinity.
                                  freeLocalConnection = getMCWrapperFromMatch(subject, requestInfo, managedConnectionFactory, localConnection); // Need to add code for handling resource exception.
                              } else if (localConnection.getPoolState() == MCWrapper.ConnectionState_sharedTLSPool) {
                                  if (localConnection.getSharedPoolCoordinator() != null &&
                                      localConnection.getSharedPoolCoordinator().equals(affinity) &&
                                      isBranchCouplingCompatible(commitPriority, branchCoupling, localConnection)) {
                                      /*
                                       * No call to matchManagedConnection is occurring to check for matching connection.
                                       * When this feature is enabled, its assumed user of the feature know what they are doing.
                                       *
                                       * I am tempted to add the matching code here, but, not sure of the performance hit.
                                       */
                                      //MCWrapper mcwtemp = getMCWrapperFromMatch(subject, requestInfo, managedConnectionFactory, localConnection); // Need to add code for handling resource exception.
                                      if (isCRIsMatching(requestInfo, localConnection) &&
                                          isSubjectsMatching(subject, localConnection)) { // we have a matching connection.
  
                                          if (enforceSerialReuse && (localConnection.getHandleCount() >= 1)) {
                                              logLTCSerialReuseInfo(affinity, gConfigProps.cfName,
                                                                    localConnection, this);
                                          } // end enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)
                                          else {
                                              endingAccessToTLSPool();
                                              activeRequest.decrementAndGet();
                                              if (isTracingEnabled && tc.isEntryEnabled())
                                                  Tr.exit(this, tc, "reserve", new Object[] { localConnection, localConnection.getManagedConnection() });
                                              return localConnection;
                                          }
                                      }
                                  }
                              }
  
                          } else {
                              for (int i = 0; i < arraySize; ++i) {
                                  MCWrapper localConnection = mh.get(i);
                                  // check for affinity.  check pool state to see if its active.
                                  // if the checks are matching, then life is good.
                                  if (localConnection.getPoolState() == MCWrapper.ConnectionState_freeTLSPool) {
                                      // We have a free connection, save it and use it if we do not have a matching affinity.
                                      if (freeLocalConnection == null) {
                                          freeLocalConnection = getMCWrapperFromMatch(subject, requestInfo, managedConnectionFactory, localConnection); // Need to add code for handling resource exception.
                                      }
                                  } else if (localConnection.getPoolState() == MCWrapper.ConnectionState_sharedTLSPool) {
                                      if (localConnection.getSharedPoolCoordinator() != null &&
                                          localConnection.getSharedPoolCoordinator().equals(affinity) &&
                                          isBranchCouplingCompatible(commitPriority, branchCoupling, localConnection)) {
                                          /*
                                           * No call to matchManagedConnection is occurring to check for matching connection.
                                           * When this feature is enabled, its assumed user of the feature know what they are doing.
                                           *
                                           * I am tempted to add the matching code here, but, not sure of the performance hit.
                                           */
                                          //MCWrapper mcwtemp = getMCWrapperFromMatch(subject, requestInfo, managedConnectionFactory, localConnection); // Need to add code for handling resource exception.
                                          if (isCRIsMatching(requestInfo, localConnection) &&
                                              isSubjectsMatching(subject, localConnection)) { // we have a matching connection.
  
                                              if (enforceSerialReuse && (localConnection.getHandleCount() >= 1)) {
                                                  logLTCSerialReuseInfo(affinity, gConfigProps.cfName,
                                                                        localConnection, this);
                                              } // end enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)
                                              else {
                                                  endingAccessToTLSPool();
                                                  activeRequest.decrementAndGet();
                                                  if (isTracingEnabled && tc.isEntryEnabled())
                                                      Tr.exit(this, tc, "reserve", new Object[] { localConnection, localConnection.getManagedConnection() });
                                                  return localConnection;
                                              }
                                          }
                                      }
                                  }
                              }
                          }
                          if (freeLocalConnection != null) {
                              freeLocalConnection.setPoolState(MCWrapper.ConnectionState_sharedTLSPool);
                              freeLocalConnection.setSharedPoolCoordinator(affinity);
                              freeLocalConnection.markInUse();
                              endingAccessToTLSPool();
                              activeRequest.decrementAndGet();
                              if (isTracingEnabled && tc.isEntryEnabled())
                                  Tr.exit(this, tc, "reserve", new Object[] { freeLocalConnection, freeLocalConnection.getManagedConnection() });
                              return freeLocalConnection;
                          }
                          //}
                      }
                      endingAccessToTLSPool();
                  }
              }
              // End -  - thread local fast path...
              /*
               * Looking in the shared pool for an existing connection with an affinity
               */
              sharedbucket = Math.abs(affinity.hashCode() % maxSharedBuckets); // Calculate the buck values for the shared bucket
  
              if (isTracingEnabled && tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Searching for shared connection in partition " + sharedbucket);
              }
  
              mcWrapper = sharedPool[sharedbucket].getSharedConnection(affinity,
                                                                       subject,
                                                                       requestInfo,
                                                                       enforceSerialReuse,
                                                                       gConfigProps.getXpathId(),
                                                                       commitPriority,
                                                                       branchCoupling);
              // Start -  - thread local fast path...
          } else {
              // The connection is not shared.  This is a once only use thread pool.  We will look for free
              // TLS connections, if we find one and move it to inuse, it can not be used again until
              // returned to the TLS
              if (localConnection_ != null) {
                  ArrayList<MCWrapper> mh = localConnection_.get();
                  if (mh != null) {
                      requestingAccessToTLSPool();
                      int arraySize = mh.size();
                      if (arraySize > 0) {
                          for (int i = 0; i < arraySize; ++i) {
                              MCWrapper localConnection = mh.get(i);
                              // check for affinity.  check pool state to see if its active.
                              // if the checks are matching, then life is good.
                              if (localConnection.getPoolState() == MCWrapper.ConnectionState_freeTLSPool) {
                                  // We have a free connection, save it and use it if we do not have a matching affinity.
                                  MCWrapper mcwtemp = getMCWrapperFromMatch(subject, requestInfo, managedConnectionFactory, localConnection); // Need to add code for handling resource exception.
                                  if (mcwtemp != null) { // we have a matching connection.
                                      localConnection.setPoolState(MCWrapper.ConnectionState_unsharedTLSPool);
                                      localConnection.markInUse();
                                      endingAccessToTLSPool();
                                      activeRequest.decrementAndGet();
                                      if (isTracingEnabled && tc.isEntryEnabled())
                                          Tr.exit(this, tc, "reserve", new Object[] { localConnection, localConnection.getManagedConnection() });
                                      return localConnection;
                                  }
  
                              }
                          }
                      }
                      endingAccessToTLSPool();
                  }
              }
              // End -  - thread local fast path...
          }
  
          /*
           * If mcWrapper is null, we did not find a shared connection. We need to look for an existing
           * connection in the free pool.
           */
          if (mcWrapper == null) {
  
              /*
               * Test connection code added
               */
              if (!allowConnectionRequests) {
  
                  /*
                   * Need to throw an exception. It is OK to do an un-synchronized read of
                   * the allowConnectionRequests.
                   */
                  ResourceAllocationException throwMe = null;
                  if (connectionPoolShutDown) {
                      Object[] parms = new Object[] { "reserve",
                                                      "Pool requests blocked, connection pool is being shut down.",
                                                      "ResourceAllocationException", gConfigProps.cfName };
                      Tr.error(tc, "POOL_MANAGER_EXCP_CCF2_0002_J2CA0046", parms);
                      throwMe = new ResourceAllocationException("Pool requests blocked for " + gConfigProps.getXpathId()
                                                                + ", connection pool is being shut down.");
                  } else {
                      Object[] parms = new Object[] { "reserve",
                                                      "Failed preTestConnection. Pool requests blocked until the test connection thread is successful.",
                                                      "ResourceAllocationException", gConfigProps.cfName };
                      Tr.error(tc, "POOL_MANAGER_EXCP_CCF2_0002_J2CA0046", parms);
                      throwMe = new ResourceAllocationException("Failed preTestConnection. Pool requests blocked for " + gConfigProps.getXpathId()
                                                                + " until the test connection thread is successful.");
                  }
  
                  activeRequest.decrementAndGet();
  
                  if (isTracingEnabled && tc.isEntryEnabled()) {
                      Tr.exit(this, tc, "reserve", throwMe);
                  }
                  throw (throwMe);
  
              }
  
              int hashCode = computeHashCode(subject, requestInfo);
              int hashMapBucket = hashCode % maxFreePoolHashSize;
              /*
               * If we have waiters, we don't have any free connection, move to the
               * create or wait code. If we don't have any waiters, we need to look for
               * a free connection.
               *
               * If connectionPooling is disabled, there is no reason to check the free
               * pool, go directly to create or wait code.
               */
              if (waiterCount < 1 && gConfigProps.connectionPoolingEnabled) {
                  /*
                   * Looking in the free pool for an existing free connection. If one
                   * exist and it matches the Subject and CRI information, we will use it.
                   */
  
                  if (freePool[hashMapBucket].mcWrapperList.size() > 0) {
                      mcWrapper = freePool[hashMapBucket].getFreeConnection(managedConnectionFactory, subject, requestInfo, hashCode);
                  } else {
                      if (isTracingEnabled && tc.isDebugEnabled()) {
                          ++freePool[hashMapBucket].fop_get_notfound;
                      }
                  }
                  /*
                   * If mcWrapper is null, we need to check the free pool for non-matching
                   * connection. If we find a free connection that does not match and the
                   * free pool has reached its maxConnections, we need to remove the free
                   * connection and create a new connection for this request.
                   */
                  if (mcWrapper == null) {
                      /*
                       * If one user id option is used there will be no victim to claim or
                       * if maxConnections is zero, move on to the create or wait code
                       */
                      if (maxConnections != 0) {
                          boolean tryToClaimVictim = false;
                          if (totalConnectionCount.get() >= maxConnections) {
                              // remove synchronized block and second totalConnectionCount check
                              /*
                               * We only need to try and claim a victim if we have reached
                               * our connection max.
                               */
                              tryToClaimVictim = true;
                          }
                          if (tryToClaimVictim) {
                              // We need to look for a victim
                              /*
                               * searchHashMapBucket is the first hashMapBucket being
                               * searched. We only need to search through the hash map bucket
                               * since there is only one free pool bucket.
                               */
                              int searchHashMapBucket = hashMapBucket;
                              int tempLocalHashMapBucket = hashMapBucket;
                              for (int i = 0; i < maxFreePoolHashSize; ++i) {
                                  /*
                                   *
                                   * This is not double-checked locking. The following code dirty
                                   * reads the size of the mcWrapperList that may be change at
                                   * any time by another thread. If it is greater than zero, we
                                   * need to synchronize and check the value again. If it is
                                   * still greater than zero, we have one or more mcWrappers to
                                   * work with. In order to work with the mcWrapperList, we need
                                   * to be synchronized.
                                   */
                                  if (freePool[searchHashMapBucket].mcWrapperList.size() > 0) {
                                      try {
  
                                          synchronized (freePool[searchHashMapBucket].freeConnectionLockObject) {
  
                                              if (freePool[searchHashMapBucket].mcWrapperList.size() > 0) {
  
                                                  /*
                                                   * claimVictim will return a true if in has claimed a
                                                   * victim, Since we have locked this free pool, we
                                                   * know a victim will be claimed.
                                                   */
                                                  mcWrapper = claimVictim(managedConnectionFactory, searchHashMapBucket, subject,
                                                                          requestInfo);
                                              }
                                          } // end sync, only need the sync for claimVictim.
                                          if (mcWrapper == null) {
                                              mcWrapper = freePool[hashMapBucket].createOrWaitForConnection(managedConnectionFactory,
                                                                                                            subject,
                                                                                                            requestInfo,
                                                                                                            hashMapBucket, maxFreePoolHashSize, true,
                                                                                                            connectionSharing,
                                                                                                            hashCode);
                                          }
                                          break;
  
                                          //}
  
                                          //} // end sync - moved sync up, since we do not need it for the createorwaitforConnections and some resource adapters have not been returning from createManagedConnection
  
                                      } catch (ConnectionWaitTimeoutException e) {
                                          /*
                                           * All we need to do is throw the
                                           * ConnectionWaitTimeoutException exception.
                                           */
                                          throw e;
                                      } catch (ResourceAllocationException e) {
                                          /*
                                           * Start of new code for defect The following
                                           * notify code was moved from the create or wait code due
                                           * to the free pool lock required at the time.
                                           *
                                           * We need to reduce the totalConnectionCount and notify a
                                           * waiter if one exists. This will allow the wait a chance
                                           * at creating a connection to return to the requester.
                                           */
                                          if (e.getCause() instanceof InterruptedException) {
                                              if (isTracingEnabled && tc.isDebugEnabled()) {
                                                  Tr.debug(tc, "Thread was interrupted, skipping decrement of total connection count");
                                              }
                                              synchronized (waiterFreePoolLock) {
                                                  if (waiterCount > 0) {
                                                      waiterFreePoolLock.notify();
                                                  }
                                              }
                                          } else {
                                              synchronized (waiterFreePoolLock) {
                                                  int totalCount = this.totalConnectionCount.decrementAndGet();
                                                  if (isTracingEnabled && tc.isDebugEnabled()) {
                                                      Tr.debug(tc, "Decrement of total connection count " + totalCount);
                                                  }
                                                  if (waiterCount > 0) {
                                                      waiterFreePoolLock.notify();
                                                  }
  
                                              }
                                          }
                                          throw e;
                                      }
  
                                  }
  
                                  /*
                                   * move to the next hash bucket to be searched
                                   */
                                  searchHashMapBucket = (++tempLocalHashMapBucket) % maxFreePoolHashSize;
  
                              }
  
                          }
  
                      }
                      /*
                       * If mcWrapper is null, will create a new connection or wait for a
                       * connection to become available.
                       */
                      if (mcWrapper == null) {
  
                          try {
                              mcWrapper = freePool[hashMapBucket].createOrWaitForConnection(managedConnectionFactory,
                                                                                            subject,
                                                                                            requestInfo,
                                                                                            hashMapBucket, maxFreePoolHashSize,
                                                                                            false, connectionSharing,
                                                                                            hashCode);
                          } catch (ConnectionWaitTimeoutException e) {
                              /*
                               * All we need to do is throw the ConnectionWaitTimeoutException
                               * exception.
                               */
                              throw e;
                          } catch (ResourceAllocationException e) {
                              /*
                               * Start of new code for defect The following notify code
                               * was moved from the create or wait code due to the free pool
                               * lock required at the time.
                               *
                               * We need to reduce the totalConnectionCount and notify a waiter
                               * if one exists. This will allow the wait a chance at creating a
                               * connection to return to the requester.
                               */
                              if (e.getCause() instanceof InterruptedException) {
                                  if (isTracingEnabled && tc.isDebugEnabled()) {
                                      Tr.debug(tc, "Thread was interrupted, skipping decrement of total connection count");
                                  }
                                  synchronized (waiterFreePoolLock) {
                                      if (waiterCount > 0) {
                                          waiterFreePoolLock.notify();
                                      }
                                  }
                              } else {
                                  synchronized (waiterFreePoolLock) {
                                      int totalCount = this.totalConnectionCount.decrementAndGet();
                                      if (isTracingEnabled && tc.isDebugEnabled()) {
                                          Tr.debug(tc, "Decrement of total connection count " + totalCount);
                                      }
                                      if (waiterCount > 0) {
                                          waiterFreePoolLock.notify();
                                      }
  
                                  }
                              }
                              throw e;
                          }
                      }
                  }
              } // end if waiterCount > 0
              else {
                  if ((isTracingEnabled && tc.isDebugEnabled())) {
                      ++waitSkip;
                  }
  
                  /*
                   * if waiterCount is one or greater there are no connection available,
                   * Call the createOrWaitForConnection code
                   */
  
                  try {
  
                      mcWrapper = freePool[hashMapBucket].createOrWaitForConnection(managedConnectionFactory,
                                                                                    subject,
                                                                                    requestInfo,
                                                                                    hashMapBucket, maxFreePoolHashSize, false,
                                                                                    connectionSharing,
                                                                                    hashCode);
  
                  } catch (ConnectionWaitTimeoutException e) {
                      /*
                       * All we need to do is throw the ConnectionWaitTimeoutException
                       * exception.
                       */
                      throw e;
                  } catch (ResourceAllocationException e) {
                      /*
                       * Start of new code for defect The following notify code was
                       * moved from the create or wait code due to the free pool lock
                       * required at the time.
                       *
                       * We need to reduce the totalConnectionCount and notify a waiter if
                       * one exists. This will allow the wait a chance at creating a
                       * connection to return to the requester.
                       */
                      if (e.getCause() instanceof InterruptedException) {
                          if (isTracingEnabled && tc.isDebugEnabled()) {
                              Tr.debug(tc, "Thread was interrupted, skipping decrement of total connection count");
                          }
                          synchronized (waiterFreePoolLock) {
                              if (waiterCount > 0) {
                                  waiterFreePoolLock.notify();
                              }
                          }
                      } else {
                          synchronized (waiterFreePoolLock) {
                              int totalCount = this.totalConnectionCount.decrementAndGet();
                              if (isTracingEnabled && tc.isDebugEnabled()) {
                                  Tr.debug(tc, "Decrement of total connection count " + totalCount);
                              }
                              if (waiterCount > 0) {
                                  waiterFreePoolLock.notify();
                              }
  
                          }
                      }
                      throw e;
                  }
  
              }
  
              // if the mcWrapper is null, the following code will not be executed.
              ManagedConnection mc = mcWrapper.getManagedConnection();
              if (((managedConnectionFactory instanceof WSManagedConnectionFactory &&
                    ((WSManagedConnectionFactory) managedConnectionFactory).isPooledConnectionValidationEnabled())
                   || ((com.ibm.ejs.j2c.MCWrapper) mcWrapper).isPretestThisConnection())
                  && gConfigProps.validatingMCFSupported) {
                  /*
                   * Reset pretest value
                   */
                  ((com.ibm.ejs.j2c.MCWrapper) mcWrapper).setPretestThisConnection(false);
                  /*
                   * We need to test the connection before we return the mcWrapper from
                   * the free pool. Note: We do not need to test shared connections
                   * because the connection is already being used. If there is a
                   * connection problem, it should fail in the application using the
                   * shared connection.
                   */
                  int poolState = mcWrapper.getPoolState();
                  mcWrapper.setPoolState(50);
                  ValidatingManagedConnectionFactory validatingMCF = ((ValidatingManagedConnectionFactory) managedConnectionFactory);
                  Set<?> invalid = validatingMCF.getInvalidConnections(Collections.singleton(mc));
                  if (invalid.isEmpty())
                      mcWrapper.setPoolState(poolState);
                  else {
                      /*
                       * Before we try to create a new connection, we need to destroy the
                       * connection that failed the preTestConnection
                       */
                      freePool[0].cleanupAndDestroyMCWrapper(mcWrapper);
  
                      /*
                       * We are going to try calling the test connection again.
                       */
                      try {
                          /*
                           * Try to create a new connection.
                           */
                          mcWrapper = freePool[0].createManagedConnectionWithMCWrapper(managedConnectionFactory, subject,
                                                                                       requestInfo,
                                                                                       connectionSharing,
                                                                                       hashCode);
                          mcWrapper.setHashMapBucket(hashMapBucket);
                      } catch (ResourceException re) {
                          preTestFailed(managedConnectionFactory, subject, requestInfo, hashMapBucket, re);
                      }
                      mc = mcWrapper.getManagedConnection();
                      invalid = validatingMCF.getInvalidConnections(Collections.singleton(mc));
                      if (invalid.isEmpty())
                          allowConnectionRequests = true;
                      else
                          preTestFailed(managedConnectionFactory, subject, requestInfo, hashMapBucket, new ResourceAllocationException());
                  }
              }
  
              mcWrapper.markInUse();
              if (gConfigProps.raSupportsReauthentication) {
                  mcWrapper.setHashMapBucketReAuth(hashMapBucket);
              }
  
              /*
               *
               * While the connection is inuse we need continued support of WAS pooling
               * functions except for pooling connections in the free pool. By
               * commenting out the following check, we will store inuse connection in
               * the shared or unshared pools. When the connection is close and the
               * transaction committed, the connection will not be pooled in the free
               * pool.
               */
              // if (gConfigProps.connectionPoolingEnabled) {
              if (affinity != null && connectionSharing && !((com.ibm.ejs.j2c.MCWrapper) mcWrapper).isEnlistmentDisabled()) { // add to shared pool, 723884
                  if (gConfigProps.isConnectionSynchronizationProvider()) {
                      /*
                       * If we are a SynchronizationProvider and shareable, log a message
                       * and put this connection in the unshareable pool. Connection sharing
                       * is not allowed.
                       */
                      if (isTracingEnabled && tc.isDebugEnabled()) {
                          Tr.debug(this, tc, "Shareable connections are not allowed with connections that are a SynchronizationProvider.  This connection will not be shareable.");
                      }
                      mcWrapper.setPoolState(3);
                      mcWrapper.setInSharedPool(false);
                  } else {
                      //  save on thread local?
                      if (isThreadLocalConnectionEnabled && localConnection_ != null) {
                          ArrayList<MCWrapper> mh = localConnection_.get();
                          requestingAccessToTLSPool();
                          if (mh.size() < maxCapacity) {
                              mcWrapper.setPoolState(MCWrapper.ConnectionState_sharedTLSPool);
                              mcWrapper.setSharedPoolCoordinator(affinity);
                              mh.add(mcWrapper);
                              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                  ((com.ibm.ejs.j2c.MCWrapper) mcWrapper).setThreadID(((com.ibm.ejs.j2c.MCWrapper) mcWrapper).getThreadID() + "-reserve-added");
                                  Tr.debug(this, tc, "Added mcWrapper from thread local " + mcWrapper);
                              }
                              tlsArrayLists.put(mcWrapper, mh);
                          } else {
                              sharedPool[sharedbucket].setSharedConnection(affinity, mcWrapper);
                              mcWrapper.setInSharedPool(true);
                          }
                          endingAccessToTLSPool();
                          //localConnection_.set(mh);
                      } else {
                          sharedPool[sharedbucket].setSharedConnection(affinity, mcWrapper);
                          mcWrapper.setInSharedPool(true);
                      }
                      // Not creating the parked connection ConnectionManager.parkHandle is not used.
                  }
              } else { // add it to the used pool.
                  if (isThreadLocalConnectionEnabled && localConnection_ != null) {
                      ArrayList<MCWrapper> mh = localConnection_.get();
                      requestingAccessToTLSPool();
                      if (mh.size() < maxCapacity) {
                          mcWrapper.setPoolState(MCWrapper.ConnectionState_unsharedTLSPool);
                          //mcWrapper.setSharedPoolCoordinator(affinity);
                          mh.add(mcWrapper);
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              ((com.ibm.ejs.j2c.MCWrapper) mcWrapper).setThreadID(((com.ibm.ejs.j2c.MCWrapper) mcWrapper).getThreadID() + "-reserve-added");
                              Tr.debug(this, tc, "Added mcWrapper from thread local " + mcWrapper);
                          }
                          tlsArrayLists.put(mcWrapper, mh);
                      } else {
                          mcWrapper.setPoolState(3);
                          mcWrapper.setInSharedPool(false);
                      }
                      endingAccessToTLSPool();
                      //localConnection_.set(mh);
                  } else {
                      mcWrapper.setPoolState(MCWrapper.ConnectionState_unsharedPool);
                      mcWrapper.setInSharedPool(false);
                  }
              }
              // }
          }
  
          /*
           * Check to see if trace has been turned on for the managed connection.
           */
          if (traceWriter.isTraceEnabled()) {
              /*
               * If trace has been turned on, check to see if we already set the log
               * writer.
               */
              if (!mcWrapper.isLogWriterSet()) {
                  /*
                   * Set the log writer on all mc's
                   */
                  turnOnLogWriter();
              }
          } else {
              /*
               * If trace has been turned off, check to see if we already set the log
               * writer to null.
               */
              if (mcWrapper.isLogWriterSet()) {
                  /*
                   * Set a null log writer on the mc
                   */
                  turnOffLogWriter();
              }
          }
          activeRequest.decrementAndGet();
  
          if (isTracingEnabled && tc.isDebugEnabled()) {
              if (mcWrapper.getPoolState() == 3) {
                  // unshared connections may or may not be in a transaction, but they can be in a scope of a transaction
                  // Save the transaction scope for easier debugging of problems
                  ((com.ibm.ejs.j2c.MCWrapper) mcWrapper).setUnSharedPoolCoordinator(affinity);
              }
          }
  
          if (isTracingEnabled && tc.isEntryEnabled())
              Tr.exit(this, tc, "reserve", new Object[] { mcWrapper, mcWrapper.getManagedConnection() });
          return mcWrapper;
  
      }