class RJack::HTTPClient3::ManagerFacade

Facade over http client and connection manager, setup, start, shutdown

Example Settings

See: hc.apache.org/httpclient-3.x/preference-api.html

manager_params.max_total_connections = 200
manager_params.connection_timeout = 1500 #ms
manager_params.default_max_connections_per_host = 20
manager_params.stale_checking_enabled = false
client_params.connection_manager_timeout = 3000 #ms
client_params.so_timeout = 3000 #ms
client_params.set_parameter( HttpMethodParams::RETRY_HANDLER,
                             DefaultHttpMethodRetryHandler.new( 2, false ) )
client_params.cookie_policy = CookiePolicy::IGNORE_COOKIES

Expect incompatible changes to these setting upon upgrade to 4.0

Attributes

client[R]

The HttpClient instance available after start

client_params[R]

Client parameters

manager_params[R]

Manager parameters

Public Class Methods

new() click to toggle source
# File lib/rjack-httpclient-3.rb, line 64
def initialize
  @manager_params = HttpConnectionManagerParams.new

  @client_params = HttpClientParams.new

  @client = nil
  @connection_manager = nil
end

Public Instance Methods

shutdown() click to toggle source

Shutdown and close the connection manager and client.

# File lib/rjack-httpclient-3.rb, line 83
def shutdown
  @connection_manager.shutdown if @connection_manager
  @client = nil
  @connection_manager = nil
end
start() click to toggle source

Given previously set parameters, construct connection manager and client.

# File lib/rjack-httpclient-3.rb, line 75
def start
  @connection_manager = MultiThreadedHttpConnectionManager.new()
  @connection_manager.params = @manager_params

  @client = HttpClient.new( @client_params, @connection_manager );
end