Class ApacheConnectorProperties.ApacheConnectorPropertiesBuilder

    • Method Detail

      • keepAliveStrategy

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder keepAliveStrategy​(org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy)
        ConnectionKeepAliveStrategy for the Apache HttpClient.

        The value MUST be an instance of ConnectionKeepAliveStrategy.

        If the property is absent the default keepalive strategy of the Apache HTTP library will be used

        Returns:
        this.
      • connectionManagerShared

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder connectionManagerShared​(boolean connectionManagerShared)
        A value of true indicates that configured connection manager should be shared among multiple Jersey ClientRuntime instances.

        It means that closing a particular ClientRuntime instance does not shut down the underlying connection manager automatically. In such case, the connection manager life-cycle should be fully managed by the application code. To release all allocated resources, caller code should especially ensure HttpClientConnectionManager.shutdown() gets invoked eventually. This property may only be set prior to constructing Apache connector using ApacheConnectorProvider.

        The value MUST be boolean

        Returns:
        this.
      • connectionManager

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder connectionManager​(org.apache.http.conn.HttpClientConnectionManager connectionManager)
        Connection Manager which will be used to create the Apache HttpClient.

        This takes precedence over the default pooling configuration The value MUST be an instance of HttpClientConnectionManager.

        If the property is absent a default Connection Manager will be used (PoolingHttpClientConnectionManager)

        Returns:
        this.
      • connectionReuseStrategy

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder connectionReuseStrategy​(org.apache.http.ConnectionReuseStrategy connectionReuseStrategy)
        ConnectionReuseStrategy for the Apache HttpClient.

        The value MUST be an instance of org.apache.http.impl.ConnectionReuseStrategy.

        If the property is absent the default reuse strategy of the Apache HTTP library will be used

        Returns:
        this.
      • connectionPooling

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder connectionPooling​(boolean connectionPooling)
        A value that indicates whether connection pooling will be enabled.

        The value MUST be boolean

        If the property is absent then default option of pooling will be used If the property is false, then the thread-safe BasicHttpClientConnectionManager is used for the Apache HttpClient A connection manager for a single connection. This connection manager maintains only one active connection. Even though this class is fully thread-safe it ought to be used by one execution thread only, as only one thread a time can lease the connection at a time. This connection manager implementation should be used inside an EJB container

        Returns:
        this.
      • expectContinue

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder expectContinue​(boolean expectContinue)
        A value that indicates whether to support expect 100 continue behavior for the Apache HttpClient.

        If this value is true, and the Apache HttpClient is used, and operation supports expect 100 continue, then this request header will be emitted.

        The value MUST be boolean.

        If the property is absent then default option of true will be used.

        Returns:
        this.
      • connectionClosingStrategy

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder connectionClosingStrategy​(ApacheConnectionClosingStrategy connectionClosingStrategy)
        Strategy that closes the Apache Connection.

        Accepts an instance of ApacheConnectionClosingStrategy. The value MUST be an instance of ApacheConnectionClosingStrategy.

        If the property is absent then default option of ApacheConnectionClosingStrategy.ImmediateClosingStrategy will be used

        Note: When using ApacheConnectionClosingStrategy.GracefulClosingStrategy, streams returned from response are read till the end of the stream when closing the stream. This can introduce additional time when closing the stream with partial read, depending on how large the remaining stream is. Use ApacheConnectionClosingStrategy.ImmediateClosingStrategy for large files with partial reads instead for faster close. ApacheConnectionClosingStrategy.ImmediateClosingStrategy on the other hand takes longer when using partial read for smaller stream size (< 1MB). Please consider your use-case and change accordingly. Please use ApacheConnectorPropertiesExample for reference

        Returns:
        this.
      • requestRetryHandler

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder requestRetryHandler​(org.apache.http.client.HttpRequestRetryHandler requestRetryHandler)
        Request RetryHandler to be used for the Apache Connection.

        Accepts an instance of HttpRequestRetryHandler

        Returns:
        this.
      • idleConnectionMonitorThreadEnabled

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder idleConnectionMonitorThreadEnabled​(boolean idleConnectionMonitorThreadEnabled)
        Idle monitor thread polls the connection manager to monitor for expired and idle connections and closes any such connections

        If the property is absent then default value of false will be used

      • idleConnectionMonitorThreadWaitTimeInSeconds

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder idleConnectionMonitorThreadWaitTimeInSeconds​(int idleConnectionMonitorThreadWaitTimeInSeconds)
        The time interval after which the check and closing of expired/idle connections is performed by the idleMonitorThread.

        This is applicable only if idleConnectionMonitorThead is enabled/true

        If the property is absent then default value of 5 seconds will be used

      • idleConnectionMonitorThreadIdleTimeoutInSeconds

        public ApacheConnectorProperties.ApacheConnectorPropertiesBuilder idleConnectionMonitorThreadIdleTimeoutInSeconds​(int idleConnectionMonitorThreadIdleTimeoutInSeconds)
        The idle timeout - close connections that have been idle longer than idleConnectionMonitorThreadIdleTimeoutInSeconds seconds by idleMonitorThread.

        This is applicable only if idleConnectionMonitorThead is enabled/true

        If the property is absent then default value of 20 seconds will be used