[jboss-dev-forums] [Design of JCA on JBoss] - Re: JBAS-5229 - Feature request - Atomic redeploy of connect

adrian@jboss.org do-not-reply at jboss.com
Tue Feb 12 08:45:55 EST 2008


"dsmiley" wrote : Perhaps you could suspend new transactions from being acquired until the existing transactions complete, then switch the datasource, then resume the transactions?
  | 

Transactions can last a long time. e.g. the default timeout is 5 minutes.
We aren't going to suspend all database activity on all threads for 5 minutes because
of one long running transaction using the old datasource. ;-)

anonymous wrote : 
  | And when I mentioned closing down the datasource, then obviously that will entail closing any connections pooled therein.
  | 

We already do that. In fact, we do better. Although the previous datasource
is shutdown, transactions can continue with the connections until they finish with them
and then we close the real connection when the transaction commits.
See the flushing part here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=HowDoIChangeThePoolingParameters
What is not allowed is to make new getConection() requests from the shutdown
datasource.

In general, this "feature" would be best handled by the application retrying the request
from the beginning of the transaciton.
If you closed the connection and want to re-aquire one in the same jdbc transaction
after the datasource is "gone", then your transaction is broken.
The connection manager can't really satisfy your request (unless we add
extra code to hand-off to the new connection manager described above).

The solution is to rollback the transaction and restart with a new transaction and a
new connection from the new datasource.
In general only the application knows where the transaction starts,
although the container can know for CMT if you tell it what
exceptions are "retryable":
http://wiki.jboss.org/wiki/Wiki.jsp?page=RetryingTransactions

Of course, if the datasource is not transactional then this feature would make sense.
There is no need for a correlation between two different getConnection() requests,
there is not global transaction.

But then again you don't really see the problem if you don't cache the datasource between
the two getConnection() requests.

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

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



More information about the jboss-dev-forums mailing list