Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
joram
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
joram
joram
Commits
5ee64ebf
Commit
5ee64ebf
authored
Dec 15, 2020
by
Andre Freyssinet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes an error in the calculation of the delay between 2 connection attempts.
parent
40b638d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
joram/a3/rt/src/main/java/fr/dyade/aaa/util/DBTransaction.java
.../a3/rt/src/main/java/fr/dyade/aaa/util/DBTransaction.java
+20
-15
No files found.
joram/a3/rt/src/main/java/fr/dyade/aaa/util/DBTransaction.java
View file @
5ee64ebf
...
...
@@ -482,35 +482,40 @@ public abstract class DBTransaction extends AbstractTransaction implements DBTra
lastexc
=
null
;
completed
=
true
;
}
catch
(
SQLException
sqle
)
{
if
(
logmon
.
isLoggable
(
BasicLevel
.
DEBUG
))
logmon
.
log
(
BasicLevel
.
WARN
,
"DBTransaction, commit: try to reconnect"
,
sqle
);
else
logmon
.
log
(
BasicLevel
.
WARN
,
"DBTransaction, commit: try to reconnect - "
+
sqle
.
getMessage
());
lastexc
=
sqle
;
retry
+=
1
;
long
time
=
System
.
currentTimeMillis
();
if
(
startRetry
==
0L
)
startRetry
=
time
;
if
((
connectRetryCount
>
0
)
&&
(
retry
>
connectRetryCount
))
{
logmon
.
log
(
BasicLevel
.
WARN
,
"DBTransaction, commit: maximum number of reconnection attempts reached: "
+
connectRetryCount
);
break
;
}
if
((
connectRetryMaxPeriod
>
0L
)
&&
((
time
-
startRetry
)
>
connectRetryMaxPeriod
))
{
logmon
.
log
(
BasicLevel
.
WARN
,
"DBTransaction, commit: reconnection period exceeded: "
+
connectRetryMaxPeriod
);
break
;
}
if
((
connectRetryCount
>
0
)
&&
(
retry
>
connectRetryCount
))
break
;
if
((
connectRetryMaxPeriod
>
0L
)
&&
((
time
-
startRetry
)
>
connectRetryMaxPeriod
))
break
;
if
(
logmon
.
isLoggable
(
BasicLevel
.
DEBUG
))
logmon
.
log
(
BasicLevel
.
WARN
,
"DBTransaction, commit: try to reconnect"
,
sqle
);
else
logmon
.
log
(
BasicLevel
.
WARN
,
"DBTransaction, commit: try to reconnect - "
+
sqle
.
getMessage
());
try
{
if
(
lastTry
==
0L
)
{
// It's the first retry do not wait.
lastTry
=
time
;
}
else
{
// Wait for at least configured delay
// Do not wait the 1st time.
if
(
lastTry
!=
0L
)
{
// Wait for at least configured delay since last attempt to connect
long
delay
=
connectRetryMinDelay
-
(
time
-
lastTry
);
lastTry
=
time
;
try
{
if
(
delay
>
0
)
Thread
.
sleep
(
delay
);
}
catch
(
InterruptedException
exc
)
{}
}
lastTry
=
System
.
currentTimeMillis
();
connectDB
();
createPreparedStatement
();
}
catch
(
IOException
exc
)
{}
}
catch
(
IOException
exc
)
{
logmon
.
log
(
BasicLevel
.
INFO
,
"DBTransaction, commit: cannot reconnect"
+
exc
.
getMessage
());
}
}
}
while
(!
completed
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment