code: public ConnectionListener createConnectionListener(Credential credential, ManagedConnectionPool mcp)
        throws ResourceException
     {
        try
        {
           if (semaphore.tryAcquire(poolConfiguration.getBlockingTimeout(), TimeUnit.MILLISECONDS))
           {
              long start = getInternalStatistics().isEnabled() ? System.currentTimeMillis() : 0L;
  
              ManagedConnection mc =
                 cm.getManagedConnectionFactory().createManagedConnection(credential.getSubject(),
                                                                          credential.getConnectionRequestInfo());
  
              if (getInternalStatistics().isEnabled())
              {
                 getInternalStatistics().deltaCreatedCount();
                 getInternalStatistics().deltaTotalCreationTime(System.currentTimeMillis() - start);
              }
  
              if (cm.getTransactionSupport() == TransactionSupportLevel.NoTransaction)
              {
                 return new NoTransactionConnectionListener(cm, mc, credential, mcp, cm.getPool().getFlushStrategy());
              }
              else if (cm.getTransactionSupport() == TransactionSupportLevel.LocalTransaction)
              {
                 return new LocalTransactionConnectionListener(cm, mc, credential, getLocalXAResource(mc), mcp,
                       cm.getPool().getFlushStrategy());
              }
              else
              {
                 return new XATransactionConnectionListener(cm, mc, credential, getXAResource(mc),
                       cm.getConnectionManagerConfiguration().getXAResourceTimeout(), mcp,
                       cm.getPool().getFlushStrategy());
              }
           }
        }
        catch (ResourceException re)
        {
           throw re;
        }
        catch (Exception e)
        {
           throw new ResourceException(e);
        }
  
        throw new ResourceException("No ConnectionListener");
     }
docs: {@inheritDoc}