Class HttpClientPool

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

public class HttpClientPool extends java.lang.Object
Class HttpClientPool implements a pool for http client connections
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ctor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Add the connection to the pool, but does NOT add it as available connection.
    void
    Closes the pool.
    protected void
     
    Returns the configuration context of this pool
    int
    Returns the number of connections in this pool that are available/free for (re-)use.
    int
    Returns the number of all connections in this pool.
    int
    Returns poolSize
    javax.net.ssl.SSLContext
    Returns the SSL context for the clients in this pool.
    java.lang.String[]
    getUpdatedCipherSuites(java.lang.String[] pCurrentCipherSuites, java.lang.String pDisableCipherSuites)
    Returns updated array of cipher suites which is current cipher suites less any cipher suites listed to be disabled NOTE: The updated array is generated only upon first invocation and then saved, effectively making this a lazy initialization of the cipher suites on a HttpClientPool basis - it has to be done here and not in WBEMClient where it belongs because socket characteristics are not known to WBEMClient
    boolean
    Removes a connection completely from the pool.
    Returns the available connections of this pool for a given URI&AuthorizationHandler
    boolean
    Add the connection to the pool.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpClientPool

      public HttpClientPool(WBEMConfiguration pConfiguration)
      Ctor.
      Parameters:
      pConfiguration - The configuration for this session. Must be non-null.
  • Method Details

    • 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 javax.net.ssl.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(java.net.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() throws java.lang.Throwable
      Overrides:
      finalize in class java.lang.Object
      Throws:
      java.lang.Throwable
    • getPoolSize

      public int getPoolSize()
      Returns poolSize
      Returns:
      The value of poolSize.
    • getUpdatedCipherSuites

      public java.lang.String[] getUpdatedCipherSuites(java.lang.String[] pCurrentCipherSuites, java.lang.String pDisableCipherSuites)
      Returns updated array of cipher suites which is current cipher suites less any cipher suites listed to be disabled NOTE: The updated array is generated only upon first invocation and then saved, effectively making this a lazy initialization of the cipher suites on a HttpClientPool basis - it has to be done here and not in WBEMClient where it belongs because socket characteristics are not known to WBEMClient
      Parameters:
      pCurrentCipherSuites - The currently enabled cipher suites
      pDisableCipherSuites - The list of cipher suites to be disabled
      Returns:
      The updated enabled cipher suites