Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
duniter4j
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
java
duniter4j
Commits
ea40fcfb
Commit
ea40fcfb
authored
6 years ago
by
Benoit Lavenier
Browse files
Options
Downloads
Patches
Plain Diff
optimize debug log
parent
51db3502
No related branches found
No related tags found
No related merge requests found
Pipeline
#4331
passed
6 years ago
Stage: github-sync
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
duniter4j-core-client/src/main/java/org/duniter/core/client/service/HttpServiceImpl.java
+5
-5
5 additions, 5 deletions
...java/org/duniter/core/client/service/HttpServiceImpl.java
with
5 additions
and
5 deletions
duniter4j-core-client/src/main/java/org/duniter/core/client/service/HttpServiceImpl.java
+
5
−
5
View file @
ea40fcfb
...
...
@@ -309,14 +309,14 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean
HttpClientContext
clientContext
=
HttpClientContext
.
adapt
(
context
);
HttpRequest
request
=
clientContext
.
getRequest
();
if
(!
retrying
)
{
log
.
debug
(
"Failed request to "
+
request
.
getRequestLine
()
+
": "
+
exception
.
getMessage
());
if
(
debug
)
log
.
debug
(
"Failed request to "
+
request
.
getRequestLine
()
+
": "
+
exception
.
getMessage
());
return
false
;
}
boolean
idempotent
=
!(
request
instanceof
HttpEntityEnclosingRequest
);
if
(
idempotent
)
{
// Retry if the request is considered idempotent
log
.
debug
(
"Failed (but will retry) request to "
+
request
.
getRequestLine
()
+
": "
+
exception
.
getMessage
());
if
(
debug
)
log
.
debug
(
"Failed (but will retry) request to "
+
request
.
getRequestLine
()
+
": "
+
exception
.
getMessage
());
return
true
;
}
return
false
;
...
...
@@ -429,7 +429,7 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean
// HTTP requests limit exceed, retry when possible
if
(
retry
)
{
if
(
retryCount
>
0
)
{
log
.
debug
(
String
.
format
(
"Service unavailable: waiting [%s ms] before retrying..."
,
Constants
.
Config
.
TOO_MANY_REQUEST_RETRY_TIME
));
if
(
debug
)
log
.
debug
(
String
.
format
(
"Service unavailable: waiting [%s ms] before retrying..."
,
Constants
.
Config
.
TOO_MANY_REQUEST_RETRY_TIME
));
try
{
Thread
.
sleep
(
Constants
.
Config
.
TOO_MANY_REQUEST_RETRY_TIME
);
}
catch
(
InterruptedException
e
)
{
...
...
@@ -464,7 +464,7 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean
try
{
String
stringContent
=
getContentAsString
(
content
);
// Add a debug before returning the result
if
(
log
.
isDebugEnabled
()
)
{
if
(
debug
)
{
log
.
debug
(
"Parsing response:\n"
+
stringContent
);
}
return
stringContent
;
...
...
@@ -529,7 +529,7 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean
protected
boolean
executeRequest
(
HttpClient
httpClient
,
HttpUriRequest
request
)
{
if
(
log
.
isDebugEnabled
()
)
{
if
(
debug
)
{
log
.
debug
(
"Executing request : "
+
request
.
getRequestLine
());
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment