com.atlassian.httpclient.api.factory
Class HttpClientOptions

java.lang.Object
  extended by com.atlassian.httpclient.api.factory.HttpClientOptions

public final class HttpClientOptions
extends Object

Configuration options for the http client instance and its caching system


Constructor Summary
HttpClientOptions()
           
 
Method Summary
 ExecutorService getCallbackExecutor()
           
 long getConnectionPoolTimeToLive()
           
 long getConnectionTimeout()
           
 long getIoSelectInterval()
          Determines time interval in milliseconds at which the I/O reactor wakes up to check for timed out sessions and session requests.
 int getIoThreadCount()
          Determines the number of I/O dispatch threads to be used by the I/O reactor.
 long getLeaseTimeout()
           
 int getMaxCacheEntries()
           
 long getMaxCacheObjectSize()
           
 int getMaxCallbackThreadPoolSize()
           
 int getMaxConnectionsPerHost()
           
 long getMaxEntitySize()
           
 ProxyOptions getProxyOptions()
           
 com.atlassian.util.concurrent.Effect<Request> getRequestPreparer()
           
 long getRequestTimeout()
           
 long getSocketTimeout()
           
 String getThreadPrefix()
           
 String getUserAgent()
           
 void setCallbackExecutor(ExecutorService callbackExecutor)
           
 void setConnectionPoolTimeToLive(int connectionPoolTimeToLive, TimeUnit timeUnit)
           
 void setConnectionTimeout(int connectionTimeout, TimeUnit timeUnit)
          Sets how long, in milliseconds, to wait for a TCP connection
 void setIoSelectInterval(int ioSelectInterval, TimeUnit timeUnit)
          Defines time interval in milliseconds at which the I/O reactor wakes up to check for timed out sessions and session requests.
 void setIoThreadCount(int ioThreadCount)
           
 void setLeaseTimeout(long leaseTimeout)
           
 void setMaxCacheEntries(int maxCacheEntries)
           
 void setMaxCacheObjectSize(long maxCacheObjectSize)
           
 void setMaxCallbackThreadPoolSize(int maxCallbackThreadPoolSize)
           
 void setMaxConnectionsPerHost(int maxConnectionsPerHost)
           
 void setMaxEntitySize(long maxEntitySize)
          param maxEntitySize The maximum entity size in bytes
 void setProxyOptions(ProxyOptions proxyOptions)
          Set proxy options for the client
 void setRequestPreparer(com.atlassian.util.concurrent.Effect<Request> requestPreparer)
           
 void setRequestTimeout(int requestTimeout, TimeUnit timeUnit)
           
 void setSocketTimeout(int socketTimeout, TimeUnit timeUnit)
           
 void setThreadPrefix(String threadPrefix)
           
 void setTrustSelfSignedCertificates(boolean trustSelfSignedCertificates)
           
 void setUserAgent(String userAgent)
           
 boolean trustSelfSignedCertificates()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientOptions

public HttpClientOptions()
Method Detail

getIoThreadCount

public int getIoThreadCount()
Determines the number of I/O dispatch threads to be used by the I/O reactor.

Default: 10


setIoThreadCount

public void setIoThreadCount(int ioThreadCount)
Parameters:
ioThreadCount - The number of I/O dispatch threads to be used by the I/O reactor. May not be negative or zero.

getIoSelectInterval

public long getIoSelectInterval()
Determines time interval in milliseconds at which the I/O reactor wakes up to check for timed out sessions and session requests.

Default: 1000 milliseconds.


setIoSelectInterval

public void setIoSelectInterval(int ioSelectInterval,
                                TimeUnit timeUnit)
Defines time interval in milliseconds at which the I/O reactor wakes up to check for timed out sessions and session requests. May not be negative or zero.


getConnectionTimeout

public long getConnectionTimeout()
Returns:
How long, in milliseconds, to wait for a TCP connection

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout,
                                 TimeUnit timeUnit)
Sets how long, in milliseconds, to wait for a TCP connection

Parameters:
connectionTimeout - Timeout value, defaults to 5000 milliseconds
timeUnit - The time unit

getSocketTimeout

public long getSocketTimeout()
Returns:
How long, in milliseconds, to wait for data over the socket

setSocketTimeout

public void setSocketTimeout(int socketTimeout,
                             TimeUnit timeUnit)
Parameters:
socketTimeout - How long to wait for data, defaults to 20 seconds
timeUnit - The time unit

getRequestTimeout

public long getRequestTimeout()
Returns:
How long to wait for the entire request

setRequestTimeout

public void setRequestTimeout(int requestTimeout,
                              TimeUnit timeUnit)
Parameters:
requestTimeout - How long to wait for the entire request. Defaults to 30 seconds.
timeUnit - The time unit

getUserAgent

public String getUserAgent()
Returns:
The user agent string

setUserAgent

public void setUserAgent(String userAgent)
Parameters:
userAgent - The user agent string

getThreadPrefix

public String getThreadPrefix()
Returns:
Name prefix to use for spawned threads

setThreadPrefix

public void setThreadPrefix(String threadPrefix)
Parameters:
threadPrefix - Name prefix to use for spawned threads

getConnectionPoolTimeToLive

public long getConnectionPoolTimeToLive()
Returns:
How long, in milliseconds, to allow connections to live in the pool. Defaults to 30 seconds.

setConnectionPoolTimeToLive

public void setConnectionPoolTimeToLive(int connectionPoolTimeToLive,
                                        TimeUnit timeUnit)
Parameters:
connectionPoolTimeToLive - How long to allow connections to live in the pool
timeUnit - The time unit

getMaxConnectionsPerHost

public int getMaxConnectionsPerHost()
Returns:
How many simultaneous connections are allowed per host. Defaults to 20

setMaxConnectionsPerHost

public void setMaxConnectionsPerHost(int maxConnectionsPerHost)
Parameters:
maxConnectionsPerHost - How many connections are allowed per host

getMaxCacheObjectSize

public long getMaxCacheObjectSize()
Returns:
The max object size, in bytes, allowed in the HTTP cache. Defaults to 100k

setMaxCacheObjectSize

public void setMaxCacheObjectSize(long maxCacheObjectSize)
Parameters:
maxCacheObjectSize - The max cache object size in bytes

getMaxCacheEntries

public int getMaxCacheEntries()
Returns:
The max cache entries. Defaults to 1000.

setMaxCacheEntries

public void setMaxCacheEntries(int maxCacheEntries)
Parameters:
maxCacheEntries - The max cache entries

getRequestPreparer

public com.atlassian.util.concurrent.Effect<Request> getRequestPreparer()
Returns:
The effect to apply before the request is executed

setRequestPreparer

public void setRequestPreparer(com.atlassian.util.concurrent.Effect<Request> requestPreparer)
Parameters:
requestPreparer - The effect to apply before the request is executed

getMaxEntitySize

public long getMaxEntitySize()
Returns:
The maximum entity size in bytes. Default is 100MB

getLeaseTimeout

public long getLeaseTimeout()
Returns:
The maximum time request to be kept in queue before execution, after timeout - request will be removed

setLeaseTimeout

public void setLeaseTimeout(long leaseTimeout)
Parameters:
leaseTimeout - The maximum time request to be kept in queue before execution, after timeout - request will be removed

setMaxEntitySize

public void setMaxEntitySize(long maxEntitySize)
param maxEntitySize The maximum entity size in bytes


getMaxCallbackThreadPoolSize

public int getMaxCallbackThreadPoolSize()
Returns:
The maximum number of threads that can be used for executing callbacks

setMaxCallbackThreadPoolSize

public void setMaxCallbackThreadPoolSize(int maxCallbackThreadPoolSize)
Parameters:
maxCallbackThreadPoolSize - The maximum number of threads that can be used for executing callbacks

setCallbackExecutor

public void setCallbackExecutor(ExecutorService callbackExecutor)

getCallbackExecutor

public ExecutorService getCallbackExecutor()

setTrustSelfSignedCertificates

public void setTrustSelfSignedCertificates(boolean trustSelfSignedCertificates)

trustSelfSignedCertificates

public boolean trustSelfSignedCertificates()
Returns:
whether self signed certificates are trusted.

setProxyOptions

public void setProxyOptions(@Nonnull
                            ProxyOptions proxyOptions)
Set proxy options for the client

Parameters:
proxyOptions - Proxy options created using ProxyOptions.ProxyOptionsBuilder.

getProxyOptions

public ProxyOptions getProxyOptions()
Returns:
The proxy options to use for the client.


Copyright © 2012–2015 Atlassian. All rights reserved.