Class MultiPooledSocketFactory

All Implemented Interfaces:

public class MultiPooledSocketFactory
extends DistributedSocketFactory

Pooled SocketFactory implementation that connects to multiple hosts that may resolve to multiple InetAddresses. If running under Java 2, version 1.3, changes in the address resolution are automatically detected using InetAddressResolver.

Consider wrapping with a LazySocketFactory for automatic checking against socket factories that may be dead.

7 , 00/12/12
Brian S O'Neill

Constructor Summary
MultiPooledSocketFactory(java.lang.String[] hosts, int[] ports, long timeout)
Method Summary
protected  SocketFactory createSocketFactory( address, int port, long timeout)
          Create socket factories for newly resolved addresses.
Methods inherited from class
addSocketFactory, clear, createSocket, createSocket, createSocket, createSocket, getAvailableCount, getDefaultTimeout, getInetAddressAndPort, getInetAddressAndPort, getSocket, getSocket, getSocket, getSocket, recycleSocket, removeSocketFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MultiPooledSocketFactory(java.lang.String[] hosts,
                                int[] ports,
                                long timeout)
hosts - hosts to connect to; length matches ports
ports - ports to connect to; length matches hosts
timeout - Maximum time to wait (in milliseconds) for new connections to be established before throwing an exception
Method Detail


protected SocketFactory createSocketFactory( address,
                                            int port,
                                            long timeout)
Create socket factories for newly resolved addresses. Default implementation returns a LazySocketFactory wrapping a PooledSocketFactory wrapping a PlainSocketFactory.