Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clients
Cesium-grp
cesium-plus-pod
Commits
ffabd4ea
Commit
ffabd4ea
authored
Dec 31, 2018
by
Benoit Lavenier
Browse files
[fix] When adding a execution action, make sure the ppol accepted it. Avoid execution lost
parent
37917551
Pipeline
#4206
passed with stage
in 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cesium-plus-pod-core/src/main/java/org/duniter/elasticsearch/client/Duniter4jClientImpl.java
View file @
ffabd4ea
...
...
@@ -1074,25 +1074,26 @@ public class Duniter4jClientImpl implements Duniter4jClient {
public
void
safeExecuteRequest
(
ActionRequestBuilder
<?,
?,
?>
request
,
boolean
wait
)
{
// Execute in a pool
if
(!
wait
)
{
boolean
acceptedInPool
=
false
;
while
(!
acceptedInPool
)
ListenableActionFuture
<?>
actionFuture
=
null
;
boolean
acceptedInPool
=
false
;
while
(!
acceptedInPool
)
{
try
{
actionFuture
=
request
.
execute
();
acceptedInPool
=
true
;
}
catch
(
EsRejectedExecutionException
e
)
{
// not accepted, so wait
try
{
request
.
execute
();
acceptedInPool
=
true
;
Thread
.
sleep
(
1000
);
// 1s
}
catch
(
EsRejectedExecutionException
e
)
{
// not accepted, so wait
try
{
Thread
.
sleep
(
1000
);
// 1s
}
catch
(
InterruptedException
e2
)
{
// silent
}
catch
(
InterruptedException
e2
)
{
// silent
}
}
else
{
request
.
execute
().
actionGet
();
}
}
// Wait end of action, if need
if
(
wait
&&
actionFuture
!=
null
)
{
actionFuture
.
actionGet
();
}
}
}
Write
Preview
Supports
Markdown
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