Skip to content

Commit

Permalink
Make changes as non-breaked
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessar committed Mar 20, 2019
1 parent 4ca5a1d commit f4121fa
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class HttpClientManager {
// put differently, a maximum period inactivity between two consecutive data packets.
private static int socketTimeout = -1;

public static CloseableHttpAsyncClient initializeHttpAsyncClient() {
private static void initializeHttpAsyncClient() {
synchronized (HttpClientManager.class) {
if (httpAsyncClient == null) {
RequestConfig config = RequestConfig.custom()
Expand All @@ -35,14 +35,14 @@ public static CloseableHttpAsyncClient initializeHttpAsyncClient() {
.build();
client.start();
httpAsyncClient = client;
} else {
throw new RuntimeException("initializeHttpAsyncClient cannot be called twice or after setHttpAsyncClient.");
}
}
return httpAsyncClient;
}

public static CloseableHttpAsyncClient getHttpAsyncClient() {
if (httpAsyncClient == null) {
initializeHttpAsyncClient();
}
return httpAsyncClient;
}

Expand All @@ -51,7 +51,7 @@ public static void setHttpAsyncClient(CloseableHttpAsyncClient httpAsyncClient)
if (HttpClientManager.httpAsyncClient == null) {
HttpClientManager.httpAsyncClient = httpAsyncClient;
} else {
throw new RuntimeException("Cannot setHttpAsyncClient after having previously set, or after default already initialized.");
throw new RuntimeException("Cannot setHttpAsyncClient after having previously set, or after default already initialized from earlier call to getHttpAsyncClient.");
}
}
}
Expand All @@ -61,7 +61,7 @@ public static void setConnectionRequestTimeout(int timeout) {
if (HttpClientManager.httpAsyncClient == null) {
connectionRequestTimeout = timeout;
} else {
throw new RuntimeException("Set timeout preference only before initializeHttpAsyncClient.");
throw new RuntimeException("Cannot setConnectionRequestTimeout after previously setting httpAsyncClient, or after default already initialized from earlier call to getHttpAsyncClient.");
}
}

Expand All @@ -70,7 +70,7 @@ public static void setConnectTimeout(int timeout) {
if (HttpClientManager.httpAsyncClient == null) {
connectionTimeout = timeout;
} else {
throw new RuntimeException("Set timeout preference only before initializeHttpAsyncClient.");
throw new RuntimeException("Cannot setConnectTimeout after previously setting httpAsyncClient, or after default already initialized from earlier call to getHttpAsyncClient.");
}
}

Expand All @@ -80,7 +80,7 @@ public static void setSocketTimeout(int timeout) {
if (HttpClientManager.httpAsyncClient == null) {
socketTimeout = timeout;
} else {
throw new RuntimeException("Set timeout preference only before initializeHttpAsyncClient.");
throw new RuntimeException("Cannot setSocketTimeout after previously setting httpAsyncClient, or after default already initialized from earlier call to getHttpAsyncClient.");
}
}
}

0 comments on commit f4121fa

Please sign in to comment.