@Override
   public void increaseCapacity()
   {
      //Only the prefill credential MCP should be affected by the incrementer
      if (!credential.equals(pool.getPrefillCredential()))
         return;

      // We have already created one connection when this method is scheduled
      int created = 1;
      boolean create = true;

      while (create && !pool.isFull())
      {
         try
         {
            long startWait = 0L;
            if (pool.getRequestSemaphore()
                  .tryAcquire(pool.getConfiguration().getBlockingTimeout(), TimeUnit.MILLISECONDS))
            {

               try
               {
                  if (pool.isShutdown())
                  {
                     return;
                  }

                  int currentSize = listeners.size();

                  create = pool.getCapacity().getIncrementer()
                        .shouldCreate(currentSize, pool.getConfiguration().getMaxSize(), created);

                  if (create)
                  {
                     try
                     {
                        ConnectionListener cl = pool.createConnectionListener(credential, this);

                        if (Tracer.isEnabled())
                           Tracer.createConnectionListener(pool.getConfiguration().getId(), this, cl,
                                 cl.getManagedConnection(), false, false, true,
                                 Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null);

                        boolean added = false;

                        if (listeners.size() < pool.getConfiguration().getMaxSize())
                        {
                           //if (trace)
                           // log.trace("Capacity fill: cl=" + cl);

                           listeners.add(cl);
                           created++;
                           added = true;
                        }

                        if (!added)
                        {
                           if (Tracer.isEnabled())
                              Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false,
                                    true, false, false, false, true,
                                    Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null);

                           pool.destroyConnectionListener(cl);
                           return;
                        }
                     }
                     catch (ResourceException re)
                     {
                        //log.unableFillPool(re);
                        return;
                     }
                  }
               }
               finally
               {
                  pool.getRequestSemaphore().release();
               }
            }
         }
         catch (InterruptedException ignored)
         {
            Thread.interrupted();

            //if (trace)
            // log.trace("Interrupted while requesting permit in increaseCapacity");
         }
      }
   }
@ Override public void increaseCapacity ( ) { if ( ! credential . equals ( pool . getPrefillCredential ( ) ) ) return ; int created = 1 ; boolean create = true ; while ( create && ! pool . isFull ( ) ) { try { long startWait = 0L ; if ( pool . getRequestSemaphore ( ) . tryAcquire ( pool . getConfiguration ( ) . getBlockingTimeout ( ) , TimeUnit . MILLISECONDS ) ) { try { if ( pool . isShutdown ( ) ) { return ; } int currentSize = listeners . size ( ) ; create = pool . getCapacity ( ) . getIncrementer ( ) . shouldCreate ( currentSize , pool . getConfiguration ( ) . getMaxSize ( ) , created ) ; if ( create ) { try { ConnectionListener cl = pool . createConnectionListener ( credential , this ) ; if ( Tracer . isEnabled ( ) ) Tracer . createConnectionListener ( pool . getConfiguration ( ) . getId ( ) , this , cl , cl . getManagedConnection ( ) , false , false , true , Tracer . isRecordCallstacks ( ) ? new Throwable ( "CALLSTACK" ) : null ) ; boolean added = false ; if ( listeners . size ( ) < pool . getConfiguration ( ) . getMaxSize ( ) ) { listeners . add ( cl ) ; created ++ ; added = true ; } if ( ! added ) { if ( Tracer . isEnabled ( ) ) Tracer . destroyConnectionListener ( pool . getConfiguration ( ) . getId ( ) , this , cl , false , false , true , false , false , false , true , Tracer . isRecordCallstacks ( ) ? new Throwable ( "CALLSTACK" ) : null ) ; pool . destroyConnectionListener ( cl ) ; return ; } } catch ( ResourceException re ) { return ; } } } finally { pool . getRequestSemaphore ( ) . release ( ) ; } } } catch ( InterruptedException ignored ) { Thread . interrupted ( ) ; } } }
{@inheritDoc}