com.go.trove.net
Class MultiPooledSocketFactory

java.lang.Object
  |
  +--com.go.trove.net.DistributedSocketFactory
        |
        +--com.go.trove.net.MultiPooledSocketFactory
All Implemented Interfaces:
SocketFactory

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.

Version:
7 , 00/12/12
Author:
Brian S O'Neill

Constructor Summary
MultiPooledSocketFactory(java.lang.String[] hosts, int[] ports, long timeout)
           
 
Method Summary
protected  SocketFactory createSocketFactory(java.net.InetAddress address, int port, long timeout)
          Create socket factories for newly resolved addresses.
 
Methods inherited from class com.go.trove.net.DistributedSocketFactory
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

MultiPooledSocketFactory

public MultiPooledSocketFactory(java.lang.String[] hosts,
                                int[] ports,
                                long timeout)
Parameters:
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

createSocketFactory

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