I'm assuming that from your other post you are using jboss 3, although it would be nice if you said. I would be reluctant to spend a lot of time improving XADatasource stuff in 2.4 since it is removed from 3.0.
XADataSourceImpl will not work as a xa driver in the jca-xa wrapper, if that is what you are proposing.
I think the solution (in jboss 3) is to
1. extend the jca-xa wrapper to wrap the Connection as well as the XAConnection.
2. Catch and filter SQLExceptions. I think this needs to be in a db specific manner, since as far as I can tell there is no standardization in the codes returned. Anyway, if the SQLException can be determined to mean the connection is dead, a ConnectionError event should be broadcast which will remove the ManagedConnection from the pool.
My other (http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ post was for 3.0. This thread refer to JBoss 2.4.3
Do you think your proposal will make it into 3.0?
I don't think it is necesary to filter SQLExceptions for dead connections. Being conservative and broadcast all SQLException occurances will sufice. One must just be able to turn connection removal on or off, because it could result in some performance issues (especially if your business processes generate lots off FK constraints errors and stuff).
Post http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ was the result of my attempt to test just this what we are discussing. I wanted to see what happen with dead connections in the jca-xa wrapper.
I don't think broadcasting all sql exceptions will go over very well. Killing connections for fk constraints violations....no thanks. Having dead connections remain in the pool... also no thanks.
We could do driver specific wrapper versions also, although I think a configuration element with some kind of list of fatal exceptions might be easier.
I don't know if this is likely to get into 3.0. I have a lot to do right now... I am very tempted to start from the lgpl version of the code before jca/external minerva/x license and rewrite most of this stuff (into lgpl), including making a simpler and better working pool.