You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Alexander Klimetschek <ak...@day.com> on 2008/02/25 14:09:28 UTC
Database auto-reconnection: 2 trials needed?
Hi Thomas,
while backporting the DB auto-reconnect issue I have lots of
conflicts, so I have to fully understand the code to resolve it ;-).
So here's my question:
In the ConnectionRecoveryManager there are various methods (eg.
executeStmt) that have a trial-loop which tries 2 times before giving
up. IIUC, this is for the case when a connection is broken and needs
to be reestablished. I assume the first call to the connection results
in an SQLException indicating the connection is broken and thus we
need a second loop in which the connection is re-established.
Is this correct?
Are there other subtle things I have to be careful about?
Thanks,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: Database auto-reconnection: 2 trials needed?
Posted by Alexander Klimetschek <ak...@day.com>.
Am 25.02.2008 um 14:23 schrieb Thomas Mueller:
> I don't think it is really required to try twice. It is more like: OK
> we have a loop already, why don't we add one iteration for security...
> There is also an option to repeat forever (this is good for testing; I
> don't think it makes sense in most situations).
Ok, so at least one iteration is vital for the re-connect to work. But
I will copy over the 2-trials code as exact as possible.
>
>
>> Are there other subtle things I have to be careful about?
>
> I don't think. However you need to test it. It is possible to write a
> unit test (using Derby server), unfortunately we don't have any so
> far.
That's exactly what I have done so far. It obviously fails with the
old code, I hope after fully merging the test will run through.
Thanks!
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: Database auto-reconnection: 2 trials needed?
Posted by Thomas Mueller <th...@gmail.com>.
Hi,
> In the ConnectionRecoveryManager there are various methods (eg.
> executeStmt) that have a trial-loop which tries 2 times before giving
> up. IIUC, this is for the case when a connection is broken and needs
> to be reestablished.
I don't think it is really required to try twice. It is more like: OK
we have a loop already, why don't we add one iteration for security...
There is also an option to repeat forever (this is good for testing; I
don't think it makes sense in most situations).
> Are there other subtle things I have to be careful about?
I don't think. However you need to test it. It is possible to write a
unit test (using Derby server), unfortunately we don't have any so
far.
Regards,
Thomas