hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ankur Shah" <ankurdots...@gmail.com>
Subject Apache HttpClient - Using custom socket factory for failover support
Date Fri, 21 Mar 2008 05:05:53 GMT
I am using httpclient to connect to a remote server. Now for each primary
server there's also a backup failover server that i must talk to if
connection attempts with the primary server fails. To achieve
this what i'd ideally like to do is have HttpClient use a custom factory
that tries to create a socket connection with the primary server and if that
fails (or times out), it'll go about  talking to backup server (and retry a
few times before giving up altogether).

Now, searching on the web, i did find references to a
MultiHomeProtocolSocketFactory (that extends DefaultSocketFactory) that is
presumably in apache contrib package. But what that does is that in the
overriden
createSocket method, it takes host as a param (among other thing) and then
simply does a InetAddress.getAllByName which is not what i want. From what i
understand this caters to a DNS based failover which is not the case here.

What i'd ideally like to do is create a factory and have a createSocket
method that takes primary and secondary host and port as args and then tries
both. I am not sure though how can i make HttpConnection class
invoke my method.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message