Navigation Menu

Skip to content

Commit

Permalink
Configurable isAlive path
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément Stenac committed Mar 2, 2010
1 parent 5b914ef commit e9b57bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/com/exalead/io/failover/FailoverHttpClient.java
Expand Up @@ -41,6 +41,14 @@ public void setConnectionAcquireFailTimeout(long timeout) {
manager.failTimeout = timeout;
}

/**
* Set the path on which the "isAlive" service is mounted.
* isAlive must reply < 400 if host is alive, > 500 if host is down
*/
public void setIsAlivePath(String isAlivePath) {
manager.isAlivePath = isAlivePath;
}

// /** Maximum time to wait for a connection to become available
// * (if all hosts are not down and max number of connections
// * is exceeded)
Expand Down
Expand Up @@ -170,6 +170,7 @@ public HostConfiguration getHostToUse() throws IOException {
int applicativeTimeout = 5000;
int failMaxTries = 2;
long failTimeout = 200;
String isAlivePath = "isAlive";

/* *************************** isAlive monitoring ************************* */

Expand Down Expand Up @@ -206,8 +207,8 @@ public void setParams(HttpConnectionManagerParams params) {
boolean checkConnection(MonitoredConnection connection) throws IOException {
/* TODO: HANDLE really state (for the case where isAlive is password-protected) */
HttpState hs = new HttpState();
GetMethod gm = new GetMethod(connection.host.getURI() + "/isAlive");

GetMethod gm = new GetMethod(connection.host.getURI() + "/" + isAlivePath);
gm.getParams().setDefaults(new HttpClientParams());

connection.conn.setSocketTimeout(isAliveTimeout);
Expand Down

0 comments on commit e9b57bf

Please sign in to comment.