[jboss-jira] [JBoss JIRA] Created: (JBAS-3997) getManagedConnection retries

Adrian Brock (JIRA) jira-events at jboss.com
Wed Jan 17 06:27:52 EST 2007


getManagedConnection retries
----------------------------

                 Key: JBAS-3997
                 URL: http://jira.jboss.com/jira/browse/JBAS-3997
             Project: JBoss Application Server
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
          Components: JCA service
            Reporter: Adrian Brock
         Assigned To: Weston Price


We should add the ability to retry getManagedConnection()
when there is a resource exception from the pool.

This will allow the ConnectionManagers to be more tolerant of transient failures.

I'd suggest two new attributes on the connection manager, with the suggested defaults:

<allocate-retry>1</allocate-retry>
<allocate-retry-wait-millis>5000</allocate-retry-wait-millis>

I also think the connection manager needs a "shutdown" boolean (maintained by start/stop)
i.e. so don't wait 5 seconds if we get a resource exception caused by the CM/Pool getting
undeployed, e.g. at JBoss shutdown.

This would turn into the following *untested* code in BaseConnectionManager2:

   protected ConnectionListener getManagedConnection(Transaction transaction, Subject subject, ConnectionRequestInfo cri)
         throws ResourceException
   {
      ResourceException failure = null;

      if (shutdown.get())
         throw new ResourceException("The connection manager is shutdown " + jndiName);
      
      // First attempt
      try
      {
         return poolingStrategy.getConnection(transaction, subject, cri);
      }
      catch (ResourceException e)
      {
         failure = e;
         
         // Retry?
         for (int i = 0; i < allocationRetries; ++i)
         {

            if (shutdown.get())
               throw new ResourceException("The connection manager is shutdown " + jndiName);

            try
            {
               if (allocationWait != 0)
                  wait(allocationWait);
               return poolingStrategy.getConnection(transaction, subject, cri);
            }
            catch (ResourceException e1)
            {
               failure = e1;
            }
            catch (InterruptedException e1)
            {
               JBossResourceException.rethrowAsResourceException("getManagedConnection retry wait was interrupted " + jndiName, e1);
            }
         }
      }

      // If we get here all retries failed, throw the lastest failure
      throw failure;
   }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list