com.atlassian.httpclient.api.factory
Class HttpClientOptions

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

public final class HttpClientOptions
extends java.lang.Object

Configuration options for the http client instance and its caching system


Constructor Summary
HttpClientOptions()
           
 
Method Summary
 java.util.concurrent.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.
 int getMaxCacheEntries()
           
 long getMaxCacheObjectSize()
           
 int getMaxConnectionsPerHost()
           
 long getMaxEntitySize()
           
 com.atlassian.util.concurrent.Effect<Request> getRequestPreparer()
           
 long getRequestTimeout()
           
 long getSocketTimeout()
           
 java.lang.String getThreadPrefix()
           
 java.lang.String getUserAgent()
           
 void setCallbackExecutor(java.util.concurrent.ExecutorService callbackExecutor)
           
 void setConnectionPoolTimeToLive(int connectionPoolTimeToLive, java.util.concurrent.TimeUnit timeUnit)
           
 void setConnectionTimeout(int connectionTimeout, java.util.concurrent.TimeUnit timeUnit)
          Sets how long, in milliseconds, to wait for a TCP connection
 void setIoSelectInterval(int ioSelectInterval, java.util.concurrent.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 setMaxCacheEntries(int maxCacheEntries)
           
 void setMaxCacheObjectSize(long maxCacheObjectSize)
           
 void setMaxConnectionsPerHost(int maxConnectionsPerHost)
           
 void setMaxEntitySize(long maxEntitySize)
          param maxEntitySize The maximum entity size in bytes
 void setRequestPreparer(com.atlassian.util.concurrent.Effect<Request> requestPreparer)
           
 void setRequestTimeout(int requestTimeout, java.util.concurrent.TimeUnit timeUnit)
           
 void setSocketTimeout(int socketTimeout, java.util.concurrent.TimeUnit timeUnit)
           
 void setThreadPrefix(java.lang.String threadPrefix)
           
 void setUserAgent(java.lang.String userAgent)
           
 
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,
                                java.util.concurrent.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,
                                 java.util.concurrent.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,
                             java.util.concurrent.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,
                              java.util.concurrent.TimeUnit timeUnit)
Parameters:
requestTimeout - How long to wait for the entire request. Defaults to 30 seconds.
timeUnit - The time unit

getUserAgent

public java.lang.String getUserAgent()
Returns:
The user agent string

setUserAgent

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

getThreadPrefix

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

setThreadPrefix

public void setThreadPrefix(java.lang.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,
                                        java.util.concurrent.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

setMaxEntitySize

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


setCallbackExecutor

public void setCallbackExecutor(java.util.concurrent.ExecutorService callbackExecutor)

getCallbackExecutor

public java.util.concurrent.ExecutorService getCallbackExecutor()


Copyright © 2012-2013 Atlassian. All Rights Reserved.