This content has been marked as final.
Show 2 replies
-
1. Re: JBAS-5229 - Feature request - Atomic redeploy of connect
dsmiley Feb 12, 2008 8:18 AM (in response to adrian.brock)Perhaps you could suspend new transactions from being acquired until the existing transactions complete, then switch the datasource, then resume the transactions?
And when I mentioned closing down the datasource, then obviously that will entail closing any connections pooled therein.
~ David -
2. Re: JBAS-5229 - Feature request - Atomic redeploy of connect
adrian.brock Feb 12, 2008 8:45 AM (in response to adrian.brock)"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. ;-)
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.