ice.net
Class ConnectionManager

java.lang.Object
  extended byice.net.ConnectionManager
Direct Known Subclasses:
NonBlockingConnectionManager

public class ConnectionManager
extends Object


Constructor Summary
ConnectionManager()
           
ConnectionManager(ConnectionManagerSettings connectionManagerSettings)
          Construct a ConnectionManager.
ConnectionManager(ice.net.HttpSession httpSession)
          Deprecated. As of 1.5, replaced by ConnectionManager(ConnectionManagerSettings).
 
Method Summary
 void addHttpURLConnectionListener(HttpURLConnectionListener httpUrlConnectionListener)
          Adds the specified httpUrlConnectionListener for connection events.
 boolean arePersistentConnectionsEnabled()
           
 CachedInputStream createInputStream(HttpURLConnection httpUrlConnection, CacheManager cacheManager, Connection connection, byte[] buffer, int offset, int length)
          Deprecated. As of 1.6.0, replaced by createInputStream(HttpURLConnection, CacheManager, Connection, byte[], int, int).
 CachedInputStream createInputStream(HttpURLConnection httpUrlConnection, CacheManager cacheManager, Connection connection, byte[] buffer, int offset, int length)
           
protected  Socket createSocket(InetAddress inetAddress, int port)
          Factory method for creating sockets.
protected  void fireHttpURLConnectionEvent(HttpURLConnection httpUrlConnection, int eventType, HttpRequest httpRequest)
           
protected  void fireHttpURLConnectionEvent(HttpURLConnection httpUrlConnection, int eventType, HttpRequest httpRequest, HttpResponse httpResponse)
           
protected  InetAddress getByName(String host)
          Gets the IP address of the specified host.
protected  InetAddress getByName(String host, boolean useIp)
          Gets the IP address of the specified host.
 Connection getConnection(HttpURLConnection httpUrlConnection, URL url, InetAddress inetAddress, int port)
          Get a connection.
 int getMaxPersistentConnections()
           
 boolean getPersistent()
          Deprecated. As of 1.5, replaced by arePersistentConnectionsEnabled().
 int getPersistentConnectionTimeout()
           
 int getReadBufferSize()
           
 int getSoTimeout()
           
 boolean isNagleEnabled()
           
 void removeHttpURLConnectionListener(HttpURLConnectionListener httpUrlConnectionListener)
          Removes the specified httpUrlConnectionListener for connection events.
static void setLimits(boolean limits)
          Deprecated. As of 1.5, replaced by setMaxPersistentConnections(int).
 void setMaxPersistentConnections(int maxPersistentConnections)
           
 void setNagleEnabled(boolean nagleEnabled)
           
 void setPersistent(boolean persistent)
          Deprecated. As of 1.5, replaced by setPersistentConnectionsEnabled(boolean).
 void setPersistentConnectionsEnabled(boolean persistentConnectionsEnabled)
           
 void setPersistentConnectionTimeout(int persistentConnectionTimeout)
           
 void setReadBufferSize(int readBufferSize)
           
 void setSoTimeout(int soTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionManager

public ConnectionManager()

ConnectionManager

public ConnectionManager(ConnectionManagerSettings connectionManagerSettings)
Construct a ConnectionManager.

Since:
1.5

ConnectionManager

public ConnectionManager(ice.net.HttpSession httpSession)
Deprecated. As of 1.5, replaced by ConnectionManager(ConnectionManagerSettings).

Method Detail

addHttpURLConnectionListener

public void addHttpURLConnectionListener(HttpURLConnectionListener httpUrlConnectionListener)

Adds the specified httpUrlConnectionListener for connection events.

Parameters:
httpUrlConnectionListener - the listener to be added.
Since:
1.5

arePersistentConnectionsEnabled

public boolean arePersistentConnectionsEnabled()

getMaxPersistentConnections

public int getMaxPersistentConnections()

getPersistent

public boolean getPersistent()
Deprecated. As of 1.5, replaced by arePersistentConnectionsEnabled().


getPersistentConnectionTimeout

public int getPersistentConnectionTimeout()

getReadBufferSize

public int getReadBufferSize()

getSoTimeout

public int getSoTimeout()

isNagleEnabled

public boolean isNagleEnabled()

removeHttpURLConnectionListener

public void removeHttpURLConnectionListener(HttpURLConnectionListener httpUrlConnectionListener)

Removes the specified httpUrlConnectionListener for connection events.

Parameters:
httpUrlConnectionListener - the listener to be removed.
Since:
1.5

setLimits

public static void setLimits(boolean limits)
                      throws UnsupportedOperationException
Deprecated. As of 1.5, replaced by setMaxPersistentConnections(int).

Throws:
UnsupportedOperationException

setMaxPersistentConnections

public void setMaxPersistentConnections(int maxPersistentConnections)
                                 throws IllegalArgumentException
Throws:
IllegalArgumentException

setNagleEnabled

public void setNagleEnabled(boolean nagleEnabled)

setPersistent

public void setPersistent(boolean persistent)
Deprecated. As of 1.5, replaced by setPersistentConnectionsEnabled(boolean).


setPersistentConnectionsEnabled

public void setPersistentConnectionsEnabled(boolean persistentConnectionsEnabled)

setPersistentConnectionTimeout

public void setPersistentConnectionTimeout(int persistentConnectionTimeout)
                                    throws IllegalArgumentException
Throws:
IllegalArgumentException

setReadBufferSize

public void setReadBufferSize(int readBufferSize)
                       throws IllegalArgumentException
Throws:
IllegalArgumentException

setSoTimeout

public void setSoTimeout(int soTimeout)
                  throws IllegalArgumentException
Throws:
IllegalArgumentException

createSocket

protected Socket createSocket(InetAddress inetAddress,
                              int port)
                       throws IOException
Factory method for creating sockets. To be overriden by customers needing custom socket creation.

Throws:
IOException

fireHttpURLConnectionEvent

protected void fireHttpURLConnectionEvent(HttpURLConnection httpUrlConnection,
                                          int eventType,
                                          HttpRequest httpRequest)
                                   throws IllegalArgumentException
Throws:
IllegalArgumentException

fireHttpURLConnectionEvent

protected void fireHttpURLConnectionEvent(HttpURLConnection httpUrlConnection,
                                          int eventType,
                                          HttpRequest httpRequest,
                                          HttpResponse httpResponse)
                                   throws IllegalArgumentException
Throws:
IllegalArgumentException

createInputStream

public CachedInputStream createInputStream(HttpURLConnection httpUrlConnection,
                                           CacheManager cacheManager,
                                           Connection connection,
                                           byte[] buffer,
                                           int offset,
                                           int length)
Deprecated. As of 1.6.0, replaced by createInputStream(HttpURLConnection, CacheManager, Connection, byte[], int, int).


createInputStream

public CachedInputStream createInputStream(HttpURLConnection httpUrlConnection,
                                           CacheManager cacheManager,
                                           Connection connection,
                                           byte[] buffer,
                                           int offset,
                                           int length)

getConnection

public Connection getConnection(HttpURLConnection httpUrlConnection,
                                URL url,
                                InetAddress inetAddress,
                                int port)
                         throws IOException
Get a connection.

Throws:
IOException

getByName

protected InetAddress getByName(String host)
                         throws SecurityException,
                                UnknownHostException

Gets the IP address of the specified host.

Parameters:
host - the host for which the IP address is needed.
Returns:
the IP address.
Throws:
SecurityException - if a security manager exists and its SecurityManager.checkConnect(String, int) method doesn't allow the operation
UnknownHostException - if no IP address for the specified host could be found.

getByName

protected InetAddress getByName(String host,
                                boolean useIp)
                         throws SecurityException,
                                UnknownHostException

Gets the IP address of the specified host. The specified useIp indicates if the IP (Internet Protocol) is allowed to be used in determining the IP address.

Parameters:
host - the host for which the IP address is needed.
useIp - indicates that the use of the IP is allowed.
Returns:
the IP address.
Throws:
SecurityException - if a security manager exists and its SecurityManager.checkConnect(String, int) method doesn't allow the operation
UnknownHostException - if no IP address for the specified host could be found.
Since:
1.5.2