Skip to content

Commit

Permalink
jlewallen#62 - Added a 10 second hardcoded connection and transfer ti…
Browse files Browse the repository at this point in the history
…meout to the HTTP Client connection so that it doesn't stall builds in the event of a network issue.
  • Loading branch information
Toby Jackson committed Aug 14, 2014
1 parent 3964def commit c8c1715
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

public class StandardHipChatService implements HipChatService {

/**
* HTTP Connection timeout when making calls to HipChat
*/
public static final Integer CONNECTION_TIMEOUT = 10000;
private static final Logger logger = Logger.getLogger(StandardHipChatService.class.getName());

private String host = "api.hipchat.com";
Expand Down Expand Up @@ -59,6 +63,9 @@ public void publish(String message, String color) {

private HttpClient getHttpClient() {
HttpClient client = new HttpClient();
client.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECTION_TIMEOUT);
client.getHttpConnectionManager().getParams().setSoTimeout(CONNECTION_TIMEOUT);

if (Jenkins.getInstance() != null) {
ProxyConfiguration proxy = Jenkins.getInstance().proxy;
if (proxy != null) {
Expand Down

0 comments on commit c8c1715

Please sign in to comment.