[jboss-user] [JCA/JBoss] - Re: JBoss Connection Socket usage in error scenarios

dkilley do-not-reply at jboss.com
Tue May 6 20:18:33 EDT 2008


Hi Vickyk,

I've enabled said debugging and will provide the actual log entries below, unfortunatly it did not reveal any meaningful exception/data, imho.

What I did notice with the information you gave me, browsing the Web Source Code, that perhaps I noticed something based ony our suggestion...


> BaseWrapperManagedConnection.java

      if (mcf.getNewConnectionSQL() != null)
  |       {
  |          Statement s = con.createStatement();
  |          try
  |          {
  |             s.execute(mcf.getNewConnectionSQL());
  |          }
  |          finally
  |          {
  |             s.close();
  |          }
  |       }
In this case the statement is closed, but nothing is done to the connection object, up in HALocalManagedConnectionFactory we have the following

         try
  |          {
  |             Driver d = getDriver(url);
  |             Connection con = d.connect(url, copy);
  |             if(con == null)
  |             {
  |                log.warn("Wrong driver class for this connection URL: " + url);
  |                urlSelector.failedUrl(url);
  |             }
  |             else
  |             {
  |                return new LocalManagedConnection(this, con, props, transactionIsolation, preparedStatementCacheSize);
  |             }
  |          }
  |          catch(Exception e)
  |          {
  |             log.warn("Failed to create connection for " + url + ": " + e.getMessage());
  |             urlSelector.failedUrl(url);
  |          }
In this case, where new LocalManagedConnection throws an exception, no call to con.close() is called, and it would only be called on the destroy.

What I am suggesting is either a new try/finally around the New LocalManagedConnection which closes the connection if it fails, or perhaps a finally added to the existing try, which may try to con.close when connections were not successful, thus a new try inside is better?

I am not a coder so I am way out of my depth on the specific suggestions for fixing, I am just providing some suggestions ;)

Thoughts?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148981#4148981

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148981



More information about the jboss-user mailing list