"Fossies" - the Fresh Open Source Software archive

Member "rabbit4.11/htdocs/javadoc/rabbit/io/ConnectionHandler.html" of archive rabbit4.11-bin.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. Alternatively you can here view or download the uninterpreted source code. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.



rabbit.io
Class ConnectionHandler

java.lang.Object
  extended by rabbit.io.ConnectionHandler

public class ConnectionHandler
extends Object

A class to handle the connections to the net. Tries to reuse connections whenever possible.

Author:
Robert Olofsson

Constructor Summary
ConnectionHandler(Counter counter, ProxyChain proxyChain, NioHandler nioHandler)
          Create a new ConnectionHandler.
 
Method Summary
 Map<Address,List<WebConnection>> getActiveConnections()
          Get a copy of the current connections.
 void getConnection(HttpHeader header, WebConnectionListener wcl)
          Get a WebConnection for the given header.
 long getKeepaliveTime()
          Get the current keep alive time.
 void markForPipelining(WebConnection wc)
          Mark a WebConnection ready for pipelining.
 void releaseConnection(WebConnection wc)
          Return a WebConnection to the pool so that it may be reused.
 void setKeepaliveTime(long milis)
          Set the keep alive time for this handler.
 void setup(SProperties config)
          Configure this ConnectionHandler using the given properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionHandler

public ConnectionHandler(Counter counter,
                         ProxyChain proxyChain,
                         NioHandler nioHandler)
Create a new ConnectionHandler.

Parameters:
counter - the Counter to update with statistics
proxyChain - the ProxyChain to use when doing dns lookups
nioHandler - the NioHandler to use for network and background tasks
Method Detail

setKeepaliveTime

public void setKeepaliveTime(long milis)
Set the keep alive time for this handler.

Parameters:
milis - the keep alive time in miliseconds.

getKeepaliveTime

public long getKeepaliveTime()
Get the current keep alive time.

Returns:
the keep alive time in miliseconds.

getActiveConnections

public Map<Address,List<WebConnection>> getActiveConnections()
Get a copy of the current connections.

Returns:
the current connections

getConnection

public void getConnection(HttpHeader header,
                          WebConnectionListener wcl)
Get a WebConnection for the given header.

Parameters:
header - the HttpHeader containing the URL to connect to.
wcl - the Listener that wants the connection.

releaseConnection

public void releaseConnection(WebConnection wc)
Return a WebConnection to the pool so that it may be reused.

Parameters:
wc - the WebConnection to return.

markForPipelining

public void markForPipelining(WebConnection wc)
Mark a WebConnection ready for pipelining.

Parameters:
wc - the WebConnection to mark ready for pipelining.

setup

public void setup(SProperties config)
Configure this ConnectionHandler using the given properties.

Parameters:
config - the properties to read the configuration from