Skip to content

Commit

Permalink
Merge pull request jlewallen#22 from zikzik/master
Browse files Browse the repository at this point in the history
Add a 10 second timeout to HTTPClient
  • Loading branch information
aldaris committed Nov 14, 2014
2 parents f8dd829 + b59fd12 commit f481949
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

public class StandardHipChatService implements HipChatService {

/**
* HTTP Connection timeout when making calls to HipChat
*/
public static final Integer DEFAULT_TIMEOUT = 10000;
private static final Logger logger = Logger.getLogger(StandardHipChatService.class.getName());
private static final String[] DEFAULT_ROOMS = new String[0];

Expand Down Expand Up @@ -60,6 +64,8 @@ public void publish(String message, String color) {

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

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

0 comments on commit f481949

Please sign in to comment.