public abstract class AbstractClient
extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AbstractClient.LibraryVersion
A version of a software library.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserAgent(AbstractClient.LibraryVersion userAgent)
Add a software library to the list of user agents.
|
String |
getApplicationID() |
int |
getConnectTimeout()
Get the connection timeout.
|
String |
getHeader(String name)
Get an HTTP header.
|
int |
getHostDownDelay()
Get the timeout for retrying connection to a down host.
|
String[] |
getReadHosts() |
int |
getReadTimeout()
Get the default read timeout.
|
int |
getSearchTimeout()
Get the read timeout for search requests.
|
AbstractClient.LibraryVersion[] |
getUserAgents()
Retrieve the list of declared user agents.
|
String[] |
getWriteHosts() |
boolean |
hasUserAgent(AbstractClient.LibraryVersion userAgent)
Test whether a user agent is declared.
|
void |
removeUserAgent(AbstractClient.LibraryVersion userAgent)
Remove a software library from the list of user agents.
|
void |
setCompletionExecutor(java.util.concurrent.Executor completionExecutor)
Change the executor on which completion handlers are executed.
|
void |
setConnectTimeout(int connectTimeout)
Set the connection timeout.
|
void |
setHeader(String name,
String value)
Set an HTTP header that will be sent with every request.
|
void |
setHostDownDelay(int hostDownDelay)
Set the timeout for retrying connection to a down host.
|
void |
setHosts(String... hosts)
Set read and write hosts to the same value (convenience method).
|
void |
setReadHosts(String... hosts) |
void |
setReadTimeout(int readTimeout)
Set the default read timeout.
|
void |
setSearchTimeout(int searchTimeout)
Set the read timeout for search requests.
|
void |
setWriteHosts(String... hosts) |
public String getApplicationID()
public void setHeader(@NonNull String name, @Nullable String value)
name
- Header name.value
- Value for the header. If null, the header will be removed.public String getHeader(@NonNull String name)
name
- Header name.public String[] getReadHosts()
public void setReadHosts(@NonNull String... hosts)
public String[] getWriteHosts()
public void setWriteHosts(@NonNull String... hosts)
public void setHosts(@NonNull String... hosts)
hosts
- New hosts. Must not be empty.public int getConnectTimeout()
public void setConnectTimeout(int connectTimeout)
connectTimeout
- The new connection timeout (ms).public int getReadTimeout()
public void setReadTimeout(int readTimeout)
readTimeout
- The default read timeout (ms).public int getSearchTimeout()
public void setSearchTimeout(int searchTimeout)
searchTimeout
- The read timeout for search requests (ms).public int getHostDownDelay()
public void setHostDownDelay(int hostDownDelay)
hostDownDelay
- The delay before connecting again to a down host (ms).public void addUserAgent(@NonNull AbstractClient.LibraryVersion userAgent)
userAgent
- The library to add.public void removeUserAgent(@NonNull AbstractClient.LibraryVersion userAgent)
userAgent
- The library to remove.@NonNull public AbstractClient.LibraryVersion[] getUserAgents()
public boolean hasUserAgent(@NonNull AbstractClient.LibraryVersion userAgent)
userAgent
- The user agent to look for.public void setCompletionExecutor(@NonNull java.util.concurrent.Executor completionExecutor)
completionExecutor
- The new completion executor to use.