Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT
The default connection timeout in milliseconds if not specified: 0
|
static HealthCheckFactory |
DEFAULT_HEALTHCHECK_FACTORY
The default HealthCheckFactory.
|
static int |
DEFAULT_IDLE_TIMEOUT
The default idle timeout in milliseconds for connections if not specified: 1000
|
static int |
DEFAULT_MAX_CONNECTIONS
The default maximum number of connections allowed if not specified: 0
|
static int |
DEFAULT_MIN_CONNECTIONS
The default minimum number of connections to maintain if not specified: 1
|
static String |
DEFAULT_REMOTE_ADDRESS
The default remote address to be used if not specified: "127.0.0.1"
|
static int |
DEFAULT_REMOTE_PORT
The default port number to be used if not specified: 8087
|
Constructor and Description |
---|
Builder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
RiakNode |
build()
Builds a RiakNode.
|
static List<RiakNode> |
buildNodes(Collection<HostAndPort> remoteHosts,
RiakNode.Builder builder)
Build a set of RiakNodes.
|
static List<RiakNode> |
buildNodes(RiakNode.Builder builder,
List<String> remoteAddresses)
Build a set of RiakNodes.
|
static List<RiakNode> |
buildNodes(RiakNode.Builder builder,
String... remoteAddresses)
Build a set of RiakNodes.
|
RiakNode.Builder |
withAuth(String username,
String password,
KeyStore trustStore)
Set the credentials for Riak security and authentication.
|
RiakNode.Builder |
withAuth(String username,
String password,
KeyStore trustStore,
KeyStore keyStore,
String keyPassword)
Set the credentials for Riak security and authentication.
|
RiakNode.Builder |
withBlockOnMaxConnections(boolean block)
Set whether to block if all connections are in use.
|
RiakNode.Builder |
withBootstrap(io.netty.bootstrap.Bootstrap bootstrap)
Provides a Netty Bootstrap for this node to use.
|
RiakNode.Builder |
withConnectionTimeout(int connectionTimeoutInMillis)
Set the connection timeout used when making new connections
|
RiakNode.Builder |
withExecutor(ScheduledExecutorService executor)
Provides an executor for this node to use for internal maintenance tasks.
|
RiakNode.Builder |
withHealthCheck(HealthCheckFactory factory)
Set the HealthCheckFactory used to determine if this RiakNode is healthy.
|
RiakNode.Builder |
withIdleTimeout(int idleTimeoutInMillis)
Set the idle timeout used to reap inactive connections.
|
RiakNode.Builder |
withMaxConnections(int maxConnections)
Set the maximum number of connections allowed.
|
RiakNode.Builder |
withMinConnections(int minConnections)
Set the minimum number of active connections to maintain.
|
RiakNode.Builder |
withRemoteAddress(HostAndPort hp)
Specifies the remote host and remote port for this RiakNode.
|
RiakNode.Builder |
withRemoteAddress(String remoteAddress)
Sets the remote address for this RiakNode.
|
RiakNode.Builder |
withRemoteHost(HostAndPort hostAndPOrt)
Sets the remote host and port for this RiakNode.
|
RiakNode.Builder |
withRemotePort(int port)
Specifies the remote port for this RiakNode.
|
public static final String DEFAULT_REMOTE_ADDRESS
public static final int DEFAULT_REMOTE_PORT
withRemotePort(int)
,
Constant Field Valuespublic static final int DEFAULT_MIN_CONNECTIONS
withMinConnections(int)
,
Constant Field Valuespublic static final int DEFAULT_MAX_CONNECTIONS
withMaxConnections(int)
,
Constant Field Valuespublic static final int DEFAULT_IDLE_TIMEOUT
withIdleTimeout(int)
,
Constant Field Valuespublic static final int DEFAULT_CONNECTION_TIMEOUT
withConnectionTimeout(int)
,
Constant Field Valuespublic static final HealthCheckFactory DEFAULT_HEALTHCHECK_FACTORY
By default this is the PingHealthCheck
HealthCheckFactory
,
HealthCheckDecoder
public Builder()
public RiakNode.Builder withRemoteHost(HostAndPort hostAndPOrt)
hostAndPOrt
- public RiakNode.Builder withRemoteAddress(String remoteAddress)
remoteAddress
- Can either be a FQDN or IP address. Since 2.0.3 it may contain port delimited by ':'.DEFAULT_REMOTE_ADDRESS
public RiakNode.Builder withRemotePort(int port)
port
- - the portDEFAULT_REMOTE_PORT
public RiakNode.Builder withRemoteAddress(HostAndPort hp)
hp
- - host and portDEFAULT_REMOTE_PORT
,
HostAndPort
public RiakNode.Builder withMinConnections(int minConnections)
minConnections
- - number of connections to maintain.DEFAULT_MIN_CONNECTIONS
public RiakNode.Builder withMaxConnections(int maxConnections)
maxConnections
- - maximum number of connections to allowDEFAULT_MAX_CONNECTIONS
public RiakNode.Builder withIdleTimeout(int idleTimeoutInMillis)
minConnections
has been set via withMinConnections(int)
idleTimeoutInMillis
- - idle timeout in millisecondsDEFAULT_IDLE_TIMEOUT
public RiakNode.Builder withConnectionTimeout(int connectionTimeoutInMillis)
connectionTimeoutInMillis
- DEFAULT_CONNECTION_TIMEOUT
public RiakNode.Builder withExecutor(ScheduledExecutorService executor)
Executors.newSingleThreadScheduledExecutor()
executor
- the ScheduledExecutorService to use.public RiakNode.Builder withBootstrap(io.netty.bootstrap.Bootstrap bootstrap)
NioEventLoopGroup
.bootstrap
- public RiakNode.Builder withBlockOnMaxConnections(boolean block)
If a maximum number of connections is specified and all those connections are in use, the default behavior when an operation is submitted to a node is to fail-fast and return. Setting this to true will cause the call to block (fair-scheduled, FIFO) until a connection becomes available.
block
- whether to block when an operation is submitted and
all connections are in use.public RiakNode.Builder withAuth(String username, String password, KeyStore trustStore)
Riak supports authentication and authorization features. These credentials will be used for all connections.
Note this requires Riak to have been configured with security enabled.
username
- the riak user name.password
- the password for this user.trustStore
- A Java KeyStore loaded with the CA certificate required for TLS/SSLpublic RiakNode.Builder withAuth(String username, String password, KeyStore trustStore, KeyStore keyStore, String keyPassword)
Riak supports authentication and authorization features. These credentials will be used for all connections.
Note this requires Riak to have been configured with security enabled.
username
- the riak user name.password
- the password for this user.trustStore
- A Java KeyStore loaded with the CA certificate required for TLS/SSLkeyStore
- A Java KeyStore loaded with User's Private certificate required for TLS/SSLkeyPassword
- the password for User's Private certificate.public RiakNode.Builder withHealthCheck(HealthCheckFactory factory)
If not set the PingHealthCheck
is used.
factory
- a HealthCheckFactory instance that produces HealthCheckDecodersHealthCheckDecoder
public RiakNode build()
Bootstrap
and/or a ScheduledExecutorService
has not been provided they
will be created.public static List<RiakNode> buildNodes(RiakNode.Builder builder, List<String> remoteAddresses)
builder
- a configured builder, used for common properties among the nodesremoteAddresses
- a list of IP addresses or FQDN.
Since 2.0.3 each of list item is treated as a comma separated list
of FQDN or IP addresses with the optional remote port delimited by ':'.public static List<RiakNode> buildNodes(Collection<HostAndPort> remoteHosts, RiakNode.Builder builder)
remoteHosts
- a list of hosts w/wo ports.builder
- a configured builder, used for common properties among the nodespublic static List<RiakNode> buildNodes(RiakNode.Builder builder, String... remoteAddresses) throws UnknownHostException
UnknownHostException
buildNodes(RiakNode.Builder, List)
Copyright © 2016. All rights reserved.