Bug #13775 Extraneous sleep on autoReconnect
| Submitted: | 5 Oct 2005 16:35 | Modified: | 22 Nov 2005 5:08 |
|---|---|---|---|
| Reporter: | DAN MACDONALD | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S4 (Feature request) |
| Version: | 3.1.10 | OS: | |
| Assigned to: | Mark Matthews | CPU Architecture: | Any |
[22 Nov 2005 5:08]
Mark Matthews
Fixed for 3.1.12 and 5.0.0, see nightly snapshots from http://downloads.mysql.com/snapshots.php#connector-j for fix to test after 00:00 GMT Nov 23rd, when the next build occurs. Thanks for the bug report.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.066 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: There is an additional sleep before hard failure which delays the application notification by timeout past the last attempt. Really it adds no value as the connection won't be attempted again. for (int attemptCount = 0; (attemptCount < getMaxReconnects()) && !connectionGood; attemptCount++) { // ... attempt connection retrieval // On failure - at this point if we are going to break out of the // loop on the next evaluation, why the frivolous sleep? try { Thread.sleep((long) timeout * 1000); // line 2724 timeout = timeout * 2; } catch (InterruptedException IE) { ; } } How to repeat: Read the code. Suggested fix: for (int attemptCount = 0; (attemptCount < getMaxReconnects()) && !connectionGood; attemptCount++) { // Only sleep if it's not the first attempt if ( attemptCount > 0 ) { try { Thread.sleep((long) timeout * 1000); timeout = timeout * 2; } catch (InterruptedException IE) { ; } } // ... attempt connection retrieval }