Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery.common.java
/
microservice
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ea1a3f21
authored
May 23, 2019
by
Amir Aharon
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add params to init http client
parent
a1e71715
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
src/main/java/microservice/utils/RestHttpClient.java
src/main/java/microservice/utils/RestHttpClient.java
View file @
ea1a3f21
...
@@ -49,6 +49,7 @@ import java.util.Locale;
...
@@ -49,6 +49,7 @@ import java.util.Locale;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.function.Consumer
;
import
java.util.function.Consumer
;
import
java.util.function.Supplier
;
import
java.util.function.Supplier
;
import
java.util.concurrent.TimeUnit
;
import
static
common
.
microservice
.
io
.
iface
.
IRestClient
.
COMMAND_ERROR
;
import
static
common
.
microservice
.
io
.
iface
.
IRestClient
.
COMMAND_ERROR
;
...
@@ -58,7 +59,8 @@ import static common.microservice.io.iface.IRestClient.COMMAND_ERROR;
...
@@ -58,7 +59,8 @@ import static common.microservice.io.iface.IRestClient.COMMAND_ERROR;
*/
*/
public
class
RestHttpClient
extends
SimpleRestClient
implements
Closeable
{
public
class
RestHttpClient
extends
SimpleRestClient
implements
Closeable
{
private
final
int
HTTP_SOCKET_READ_TIMEOUT
=
Integer
.
valueOf
(
System
.
getProperty
(
"microservice.http.client.read.timeout.seconds"
,
"30"
));
private
final
int
HTTP_SOCKET_CONNECT_TIMEOUT
=
Integer
.
valueOf
(
System
.
getProperty
(
"microservice.http.client.connect.timeout.seconds"
,
"10"
));
List
<
String
>
brrFieldNames
=
null
;
List
<
String
>
brrFieldNames
=
null
;
// CloseableHttpAsyncClient httpAsyncClient = null;
// CloseableHttpAsyncClient httpAsyncClient = null;
...
@@ -85,7 +87,12 @@ public class RestHttpClient extends SimpleRestClient implements Closeable {
...
@@ -85,7 +87,12 @@ public class RestHttpClient extends SimpleRestClient implements Closeable {
}
}
private
void
initClient
()
{
private
void
initClient
()
{
client
=
new
OkHttpClient
();
client
=
new
OkHttpClient
.
Builder
()
.
connectTimeout
(
HTTP_SOCKET_CONNECT_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
10
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
HTTP_SOCKET_READ_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
build
();
// httpAsyncClient = createHttpClient();
// httpAsyncClient = createHttpClient();
// httpAsyncClient.start();
// httpAsyncClient.start();
initBaseRestValidation
();
initBaseRestValidation
();
...
...
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