Hi Oleg,

Thanks for the response. The server that i am running (acting as a client in
this particular case) is working with multiple servers (hosting different
webservices) with each having a primary and a failover pair. From this
perspective the thought was that rather than having different classes (all
having their own business logic around invoking the service) handle the
connection failed attempt, somehow have some central code that attempts to
connect to the primary and fails over to the backup. I also wanted to make
sure that in case of a connection failure with primary, a new pool is
established against the backup server.

>From this perspective, an after thought that I had was this. I was going to
extend the MultiThreadedHttpConnectionManager and have a failover capable
connection manager. In there, i was thinking about exposing a method (or a
new constructor) that allows backup host and ports to be added. This manager
will cache a map of primary and backup server. In the overriden
getConnectionWithTimeout method, i'd have super return me a connection that
i'll check and make sure that is valid and if not, i'll go to my cache, get
the backup host config and open up a connection to that.

Let me know if you think this would be a good idea or not.

Ankur

On Mon, Mar 24, 2008 at 12:47 PM, Oleg Kalnichevski <[EMAIL PROTECTED]>
wrote:

>
> On Thu, 2008-03-20 at 22:05 -0700, Ankur Shah wrote:
> > 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.
>
> Ankur,
>
> What's the point of trying to implement the failover support on the
> ProtocolSocketFactory level? What's wrong with just retrying failed
> requests against a secondary server in case the primary one is
> unavailable?
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to