org.sblim.cimclient.internal.http
Class HttpClientPool

java.lang.Object
  extended by org.sblim.cimclient.internal.http.HttpClientPool

public class HttpClientPool
extends Object

Class HttpClientPool implements a pool for http client connections


Constructor Summary
HttpClientPool(WBEMConfiguration pConfiguration)
          Ctor.
 
Method Summary
 boolean addConnectionToPool(HttpClient httpClient)
          Add the connection to the pool, but does NOT add it as available connection.
 void closePool()
          Closes the pool.
protected  void finalize()
           
 WBEMConfiguration getConfigurationContext()
          Returns the configuration context of this pool
 int getNumberOfAllConnections()
          Returns the number of connections in this pool that are available/free for (re-)use.
 int getNumberOfAvailableConnections()
          Returns the number of all connections in this pool.
 int getPoolSize()
          Returns poolSize
 SSLContext getSslContext()
          Returns the SSL context for the clients in this pool.
 boolean removeConnectionFromPool(HttpClient httpClient)
          Removes a connection completely from the pool.
 HttpClient retrieveAvailableConnectionFromPool(URI pUri, AuthorizationHandler pHandler)
          Returns the available connections of this pool for a given URI&AuthorizationHandler
 boolean returnAvailableConnectionToPool(HttpClient httpClient)
          Add the connection to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientPool

public HttpClientPool(WBEMConfiguration pConfiguration)
Ctor.

Parameters:
pConfiguration - The configuration for this session. Must be non-null.
Method Detail

getNumberOfAllConnections

public int getNumberOfAllConnections()
Returns the number of connections in this pool that are available/free for (re-)use.

Returns:
number of available/free connections in pool

getNumberOfAvailableConnections

public int getNumberOfAvailableConnections()
Returns the number of all connections in this pool.

Returns:
number of all connections in pool

getConfigurationContext

public WBEMConfiguration getConfigurationContext()
Returns the configuration context of this pool

Returns:
The configuration

getSslContext

public SSLContext getSslContext()
Returns the SSL context for the clients in this pool. The context is initialized on the first call of this method (lazy initialization).

Returns:
The SSL context

retrieveAvailableConnectionFromPool

public HttpClient retrieveAvailableConnectionFromPool(URI pUri,
                                                      AuthorizationHandler pHandler)
Returns the available connections of this pool for a given URI&AuthorizationHandler

Parameters:
pUri - The uri
pHandler - The authorization handler
Returns:
A connection if one is available, null otherwise

returnAvailableConnectionToPool

public boolean returnAvailableConnectionToPool(HttpClient httpClient)
Add the connection to the pool. Connection is added as available connection. Use method addConnectionToPool(HttpClient) to add the connection without being available for reuse.

Parameters:
httpClient - connection that is to be added to the pool
Returns:
true if connection was added otherwise false

addConnectionToPool

public boolean addConnectionToPool(HttpClient httpClient)
Add the connection to the pool, but does NOT add it as available connection. Use method returnAvailableConnectionToPool(HttpClient) to also add the connection to the available connections.

Parameters:
httpClient - connection that is to be added to the pool
Returns:
true if connection was added otherwise false

removeConnectionFromPool

public boolean removeConnectionFromPool(HttpClient httpClient)
Removes a connection completely from the pool.

Parameters:
httpClient - connection that is to be removed from the pool
Returns:
true if connection was removed otherwise false

closePool

public void closePool()
Closes the pool. This will disconnect all clients in the pool.


finalize

protected void finalize()
Overrides:
finalize in class Object

getPoolSize

public int getPoolSize()
Returns poolSize

Returns:
The value of poolSize.


Copyright © 2005, 2009 IBM Corporation. All Rights Reserved.