docs: protected void validateConnections(ManagedConnectionFactory managedConnectionFactory, boolean prepopulateEnabled) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(this, tc, "validateConnections", gConfigProps.cfName);
          }
  
          /*
           * Get all of the managed connections wrappers.
           */
          Set<ManagedConnection> mcSet = new HashSet<ManagedConnection>();
          LinkedList<MCWrapper> failedMCWList = new LinkedList<MCWrapper>();
          mcToMCWMapWrite.lock();
          try {
              Collection<MCWrapper> mcWrappers = mcToMCWMap.values();
              Iterator<MCWrapper> mcWrapperIt = mcWrappers.iterator();
              while (mcWrapperIt.hasNext()) {
                  MCWrapper mcw = mcWrapperIt.next();
                  if (mcw.getPoolState() == 1 && !mcw.isStale()) {
                      /*
                       * Only add valid managed connections to this set.
                       */
                      mcSet.add(mcw.getManagedConnection());
                      mcw.setPoolState(50); // set the state to 50, which basically means we are interacting with the resource adapter
                      try {
                          Set<?> set = ((ValidatingManagedConnectionFactory) managedConnectionFactory).getInvalidConnections(mcSet);
                          Iterator<?> it = set.iterator();
  
                          while (it.hasNext()) {
                              it.next();
                              failedMCWList.add(mcw);
                          }
                          mcSet.clear();
                      } catch (ResourceException e) {
                          Object[] parms = new Object[] { "fatalErrorNotification", CommonFunction.exceptionList(e), "ResourceException", gConfigProps.cfName };
                          Tr.error(tc, "ATTEMPT_TO_VALIDATE_MC_CONNECTIONS_J2CA0285", parms);
                      } finally {
                          // we do a check above to ensure we are in the free pool (1), therefore we shouldn't have to worry
                          // about capturing the current state and setting it back here - it is expected to be the free pool.
                          mcw.setPoolState(MCWrapper.ConnectionState_freePool);
                      }
  
                      if (prepopulateEnabled) {
                          // We prepopulate is enabled, we need to reset
                          // the idle time out to keep the good connections
                          // in the pool.  All of the bad connection will be
                          // destored before we leave this method.  The idle
                          // time will not matter for them.  :-)
                          ((com.ibm.ejs.j2c.MCWrapper) mcw).resetIdleTimeOut();
                      }
                  }
              }
          } finally {
              mcToMCWMapWrite.unlock();
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(this, tc, "Calling getInvalidConnections on the managedConnectionFactory with " + mcSet.size()
                                 + " managed connections");
          }
          /*
           * Ask the mcf to validate the managed connections and return the
           * failing managed connections
           */
  
          if (!failedMCWList.isEmpty()) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Returned from getInvalidConnections. There are " + failedMCWList.size() + " failing connections.");
              }
              /*
               * Check for failing connections
               */
              /*
               * Transfer the failing connection to an iterator
               */
              Iterator<MCWrapper> it = failedMCWList.iterator();
              /*
               * Iterate through the failed managed connection marking the
               * associated mcw stale
               */
              while (it.hasNext()) {
                  MCWrapper mcWrapper = it.next();
                  if (mcWrapper != null) {
                      mcWrapper.markStale();
                      checkForConnectionInFreePool(mcWrapper);
                  } else {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(this, tc, "null mc in set returned from getInvalidConnections");
                      }
                  }
              }
          } else {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Returned from getInvalidConnections. The returned set is null");
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(this, tc, "validateConnections");
          }
      }