Skip to content

Commit

Permalink
StashApiClient: Provide better descriptions for all timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
proski authored and jakub-bochenski committed Jun 3, 2019
1 parent 680a7b8 commit 6e0d3c4
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@
@SuppressFBWarnings("EQ_DOESNT_OVERRIDE_EQUALS")
public class StashApiClient {

// Request timeout: maximum time between sending an HTTP request and receiving
// a response to it from the server.
private static final int HTTP_REQUEST_TIMEOUT_SECONDS = 60;

// Connection timeout: maximum time for connecting to the HTTP server.
private static final int HTTP_CONNECTION_TIMEOUT_SECONDS = 15;

// Socket timeout: maximum period of inactivity between two data packets
// arriving to the client once the connection is established.
private static final int HTTP_SOCKET_TIMEOUT_SECONDS = 30;

private static final Logger logger =
Expand Down Expand Up @@ -190,12 +197,8 @@ public boolean mergePullRequest(String pullRequestId, String version) {
private HttpClient getHttpClient() {
HttpClient client = new HttpClient();
HttpParams httpParams = client.getParams();
// ConnectionTimeout : This denotes the time elapsed before the connection established or Server
// responded to connection request.
httpParams.setParameter(
CoreConnectionPNames.CONNECTION_TIMEOUT, HTTP_CONNECTION_TIMEOUT_SECONDS * 1000);
// SoTimeout : Maximum period inactivity between two consecutive data packets arriving at client
// side after connection is established.
httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, HTTP_SOCKET_TIMEOUT_SECONDS * 1000);

// if (Jenkins.getInstance() != null) {
Expand Down

0 comments on commit 6e0d3c4

Please sign in to comment.