public static class ResourceClient.Builder extends Object implements Builder<ResourceClient>
ResourceClient.
The client builder configures a ResourceClient to connect to a cluster of ResourceServers.
To create a client builder, use the ResourceClient.builder() method.
ResourceClient client = ResourceClient.builder(servers)
.withTransport(new NettyTransport())
.build();
| Modifier and Type | Method and Description |
|---|---|
ResourceClient.Builder |
addResourceType(Class<? extends io.atomix.resource.Resource<?>> type)
Adds a resource type to the server.
|
ResourceClient.Builder |
addResourceType(io.atomix.resource.ResourceType type)
Adds a resource type to the server.
|
ResourceClient |
build() |
ResourceClient.Builder |
withConnectionStrategy(ConnectionStrategy connectionStrategy)
Sets the Atomix connection strategy.
|
ResourceClient.Builder |
withResourceTypes(Class<? extends io.atomix.resource.Resource<?>>... types)
Sets the available resource types.
|
ResourceClient.Builder |
withResourceTypes(Collection<io.atomix.resource.ResourceType> types)
Sets the available resource types.
|
ResourceClient.Builder |
withResourceTypes(io.atomix.resource.ResourceType... types)
Sets the available resource types.
|
ResourceClient.Builder |
withSerializer(Serializer serializer)
Sets the Atomix serializer.
|
ResourceClient.Builder |
withSessionTimeout(Duration sessionTimeout)
Sets the client session timeout.
|
ResourceClient.Builder |
withTransport(Transport transport)
Sets the Atomix transport.
|
public ResourceClient.Builder withTransport(Transport transport)
The configured transport should be the same transport as all other nodes in the cluster.
If no transport is explicitly provided, the instance will default to the NettyTransport
if available on the classpath.
transport - The Atomix transport.NullPointerException - if transport is nullpublic ResourceClient.Builder withConnectionStrategy(ConnectionStrategy connectionStrategy)
connectionStrategy - The client connection strategy.NullPointerException - If the connection strategy is nullpublic ResourceClient.Builder withSerializer(Serializer serializer)
The serializer will be used to serialize and deserialize operations that are sent over the wire.
serializer - The Atomix serializer.public ResourceClient.Builder withSessionTimeout(Duration sessionTimeout)
sessionTimeout - The client session timeout.public ResourceClient.Builder withResourceTypes(Class<? extends io.atomix.resource.Resource<?>>... types)
types - The available resource types.public ResourceClient.Builder withResourceTypes(io.atomix.resource.ResourceType... types)
types - The available resource types.public ResourceClient.Builder withResourceTypes(Collection<io.atomix.resource.ResourceType> types)
types - The available resource types.public ResourceClient.Builder addResourceType(Class<? extends io.atomix.resource.Resource<?>> type)
type - The resource type.public ResourceClient.Builder addResourceType(io.atomix.resource.ResourceType type)
type - The resource type.public ResourceClient build()
build in interface Builder<ResourceClient>Copyright © 2013–2017. All rights reserved.