code: public ConnectionListener getConnectionListener(Credential credential) throws ResourceException
     {
        log.tracef("getConnectionListener(%s)", credential);
  
        ConnectionListener cl = null;
        ManagedConnectionPool mcp = getManagedConnectionPool(credential);
  
        if (isShutdown())
           throw new ResourceException();
        
        if (cm.getTransactionSupport() == TransactionSupportLevel.LocalTransaction
              || cm.getTransactionSupport() == TransactionSupportLevel.XATransaction)
        {
           try
           {
              TransactionalConnectionManager txCM = (TransactionalConnectionManager) cm;
              Transaction tx = txCM.getTransactionIntegration().getTransactionManager().getTransaction();
  
              if (TxUtils.isUncommitted(tx))
              {
                 Object id = txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().getTransactionKey();
  
                 Map<ManagedConnectionPool, ConnectionListener> currentMap = transactionMap.get(id);
  
                 if (currentMap == null)
                 {
                    Map<ManagedConnectionPool, ConnectionListener> map = new HashMap<>();
  
                    currentMap = transactionMap.putIfAbsent(id, map);
                    if (currentMap == null)
                    {
                       currentMap = map;
                    }
                 }
  
                 cl = currentMap.get(mcp);
  
                 if (cl == null)
                 {
                    if (TxUtils.isActive(tx))
                    {
                       cl = mcp.getConnectionListener();
  
                       currentMap.put(mcp, cl);
  
                       txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().
                          registerInterposedSynchronization(new TransactionMapCleanup(id, transactionMap));
                    }
                    else
                    {
                       throw new ResourceException();
                    }
                 }
              }
           }
           catch (ResourceException re)
           {
              throw re;
           }
           catch (Exception e)
           {
              throw new ResourceException(e);
           }
        }
  
        if (cl == null)
           cl = mcp.getConnectionListener();
  
        return cl;
     }
docs: {@inheritDoc}