code: protected org.ironjacamar.core.connectionmanager.listener.ConnectionListener getConnectionListener(
           Credential credential) throws ResourceException
     {
        org.ironjacamar.core.connectionmanager.listener.ConnectionListener result = null;
        Exception failure = null;
  
        // First attempt
        boolean isInterrupted = Thread.interrupted();
        boolean innerIsInterrupted = false;
        try
        {
           result = pool.getConnectionListener(credential);
  
           if (supportsLazyAssociation == null)
           {
              supportsLazyAssociation =
                 (result.getManagedConnection() instanceof DissociatableManagedConnection) ? Boolean.TRUE : Boolean.FALSE;
           }
  
           return result;
        }
        catch (ResourceException e)
        {
           failure = e;
  
           // Retry?
           if (cmConfiguration.getAllocationRetry() != 0 || e instanceof RetryableException)
           {
              int to = cmConfiguration.getAllocationRetry();
              long sleep = cmConfiguration.getAllocationRetryWaitMillis();
  
              if (to == 0 && e instanceof RetryableException)
                 to = 1;
  
              for (int i = 0; i < to; i++)
              {
                 if (shutdown.get())
                 {
                    throw new ResourceException();
                 }
  
                 if (Thread.currentThread().isInterrupted())
                 {
                    Thread.interrupted();
                    innerIsInterrupted = true;
                 }
  
                 try
                 {
                    if (sleep > 0)
                       Thread.sleep(sleep);
  
                    return pool.getConnectionListener(credential);
                 }
                 catch (ResourceException re)
                 {
                    failure = re;
                 }
                 catch (InterruptedException ie)
                 {
                    failure = ie;
                    innerIsInterrupted = true;
                 }
              }
           }
        }
        catch (Exception e)
        {
           failure = e;
        }
        finally
        {
           if (isInterrupted || innerIsInterrupted)
           {
              Thread.currentThread().interrupt();
        
              if (innerIsInterrupted)
                 throw new ResourceException(failure);
           }
        }
  
        if (cmConfiguration.isSharable() && Boolean.TRUE.equals(supportsLazyAssociation))
           return associateConnectionListener(credential, null);
  
        // If we get here all retries failed, throw the lastest failure
        throw new ResourceException(failure);
     }
docs: Get a connection listener
  
  @param credential The credential
  @return The listener
  @throws ResourceException Thrown in case of an error