+ * Serializable types registered on the returned serializer are reflected throughout the system. Types
+ * registered on a client must also be registered on a server to be transported across the wire.
*
* @return The Atomix serializer.
*/
@@ -79,6 +87,46 @@ public
- * The client builder configures a {@link ResourceClient} to connect to a cluster of {@link ResourceServer}s
- * or {@link ResourceReplica}. To create a client builder, use the {@link #builder(Address...)} method.
+ * The client builder configures a {@link ResourceClient} to connect to a cluster of {@link ResourceServer}s.
+ * To create a client builder, use the {@link #builder(Address...)} method.
*
+ * If a resource at the given key already exists, the resource will be validated to verify that its type
+ * matches the given type. If no resource yet exists, a new resource will be created in the cluster. Once
+ * the session for the resource has been opened, a resource instance will be returned.
+ *
+ * The returned {@link Resource} instance will be a singleton reference to an global instance for this node.
+ * That is, multiple calls to this method for the same resource will result in the same {@link Resource}
+ * instance being returned.
+ *
+ * This method returns a {@link CompletableFuture} which can be used to block until the operation completes
+ * or to be notified in a separate thread once the operation completes. To block until the operation completes,
+ * use the {@link CompletableFuture#get()} method:
+ *
+ * If a resource at the given key already exists, the resource will be validated to verify that its type
+ * matches the given type. If no resource yet exists, a new resource will be created in the cluster. Once
+ * the session for the resource has been opened, a resource instance will be returned.
+ *
+ * The returned {@link Resource} instance will be a singleton reference to an global instance for this node.
+ * That is, multiple calls to this method for the same resource will result in the same {@link Resource}
+ * instance being returned.
+ *
+ * This method returns a {@link CompletableFuture} which can be used to block until the operation completes
+ * or to be notified in a separate thread once the operation completes. To block until the operation completes,
+ * use the {@link CompletableFuture#get()} method:
+ *
+ * If a resource at the given key already exists, the resource will be validated to verify that its type
+ * matches the given type. If no resource yet exists, a new resource will be created in the cluster. Once
+ * the session for the resource has been opened, a resource instance will be returned.
+ *
+ * The returned {@link Resource} instance will be a singleton reference to an global instance for this node.
+ * That is, multiple calls to this method for the same resource will result in the same {@link Resource}
+ * instance being returned.
+ *
+ * This method returns a {@link CompletableFuture} which can be used to block until the operation completes
+ * or to be notified in a separate thread once the operation completes. To block until the operation completes,
+ * use the {@link CompletableFuture#get()} method:
+ *
+ * If a resource at the given key already exists, the resource will be validated to verify that its type
+ * matches the given type. If no resource yet exists, a new resource will be created in the cluster. Once
+ * the session for the resource has been opened, a resource instance will be returned.
+ *
+ * The returned {@link Resource} instance will be a singleton reference to an global instance for this node.
+ * That is, multiple calls to this method for the same resource will result in the same {@link Resource}
+ * instance being returned.
+ *
+ * This method returns a {@link CompletableFuture} which can be used to block until the operation completes
+ * or to be notified in a separate thread once the operation completes. To block until the operation completes,
+ * use the {@link CompletableFuture#get()} method:
+ *
+ * The server serializer handles serialization for all operations within the resource server. Serializable
+ * types registered on the server serializer will be reflected in the {@link Storage} and {@link Transport}
+ * layers.
+ *
+ * @return The server serializer.
+ */
+ public Serializer serializer() {
+ return server.serializer();
+ }
+
/**
* Returns the underlying Copycat server.
*
diff --git a/messaging/src/main/java/io/atomix/messaging/DistributedMessageBus.java b/messaging/src/main/java/io/atomix/messaging/DistributedMessageBus.java
index 51e1010445..82cea9334c 100644
--- a/messaging/src/main/java/io/atomix/messaging/DistributedMessageBus.java
+++ b/messaging/src/main/java/io/atomix/messaging/DistributedMessageBus.java
@@ -19,6 +19,7 @@
import io.atomix.catalyst.transport.Client;
import io.atomix.catalyst.transport.Connection;
import io.atomix.catalyst.transport.Server;
+import io.atomix.catalyst.util.ConfigurationException;
import io.atomix.catalyst.util.concurrent.Futures;
import io.atomix.copycat.client.CopycatClient;
import io.atomix.messaging.state.MessageBusCommands;
@@ -46,11 +47,6 @@
* });
* }
*
* Messages are produced and consumed by {@link MessageProducer producers} and {@link MessageConsumer consumers} respectively.
* Each producer and consumer is associated with a string message bus topic.
*
diff --git a/resource/src/main/java/io/atomix/resource/ResourceFactory.java b/resource/src/main/java/io/atomix/resource/ResourceFactory.java
index 18cf312b87..8b95e1a56d 100644
--- a/resource/src/main/java/io/atomix/resource/ResourceFactory.java
+++ b/resource/src/main/java/io/atomix/resource/ResourceFactory.java
@@ -23,7 +23,7 @@
* @author ) type());
- T resource = (T) type.factory().create(client, null);
+ T resource = (T) type.factory().create(client, options);
resource.open().thenRun(this::resume);
resources.add(resource);
await(10000);
diff --git a/variables/src/main/java/io/atomix/variables/AbstractDistributedValue.java b/variables/src/main/java/io/atomix/variables/AbstractDistributedValue.java
index c0f92c4f51..9f6b0e85db 100644
--- a/variables/src/main/java/io/atomix/variables/AbstractDistributedValue.java
+++ b/variables/src/main/java/io/atomix/variables/AbstractDistributedValue.java
@@ -28,9 +28,9 @@
* @author , U extends Resource.Options, V> extends Resource
* {@code
* ResourceClient client = ResourceClient.builder(servers)
diff --git a/manager/src/main/java/io/atomix/manager/ResourceManager.java b/manager/src/main/java/io/atomix/manager/ResourceManager.java
index a3af444411..ba09f28a26 100644
--- a/manager/src/main/java/io/atomix/manager/ResourceManager.java
+++ b/manager/src/main/java/io/atomix/manager/ResourceManager.java
@@ -44,6 +44,17 @@ public interface ResourceManager
- * Once a message bus instance has been created, it's not immediately opened. The message bus instance must be explicitly
- * opened by calling {@link #open(Address)}, providing an {@link Address} to which to bind the message bus server. Because
- * each message bus instance runs on a separate server, it's recommended that nodes use a singleton instance of this
- * resource by using {@code get(...)} rather than {@code create(...)} to get a reference to the resource.
- *
+ * {@code
+ * DistributedLock lock = atomix.get("lock", DistributedLock.class).get();
+ * }
+ *
+ * Alternatively, to execute the operation asynchronous and be notified once the result is received in a different
+ * thread, use one of the many completable future callbacks:
+ *
+ * {@code
+ * atomix.
+ *
+ * @param key The key at which to get the resource.
+ * @param type The expected resource type.
+ * @param options The local resource options.
+ * @param
+ * {@code
+ * DistributedLock lock = atomix.get("lock", DistributedLock.class).get();
+ * }
+ *
+ * Alternatively, to execute the operation asynchronous and be notified once the result is received in a different
+ * thread, use one of the many completable future callbacks:
+ *
+ * {@code
+ * atomix.
+ *
+ * @param key The key at which to get the resource.
+ * @param type The expected resource type.
+ * @param config The cluster-wide resource configuration.
+ * @param options The local resource options.
+ * @param
+ * {@code
+ * DistributedLock lock = atomix.get("lock", DistributedLock.class).get();
+ * }
+ *
+ * Alternatively, to execute the operation asynchronous and be notified once the result is received in a different
+ * thread, use one of the many completable future callbacks:
+ *
+ * {@code
+ * atomix.
+ *
+ * @param key The key at which to get the resource.
+ * @param type The expected resource type.
+ * @param options The local resource options.
+ * @param
+ * {@code
+ * DistributedLock lock = atomix.get("lock", DistributedLock.class).get();
+ * }
+ *
+ * Alternatively, to execute the operation asynchronous and be notified once the result is received in a different
+ * thread, use one of the many completable future callbacks:
+ *
+ * {@code
+ * atomix.
+ *
+ * @param key The key at which to get the resource.
+ * @param type The expected resource type.
+ * @param config The cluster-wide resource configuration.
+ * @param options The local resource options.
* @param
@@ -69,9 +65,29 @@
* @author
- * Alternatively, to execute the operation asynchronous and be notified once the lock is acquired in a different
- * thread, use one of the many completable future callbacks:
- *
- * {@code
- * bus.open(new Address("123.456.789.0", 5000)).thenRun(() -> System.out.println("Message bus open!"));
- * }
- *
- *
- * @param address The address on which to listen.
- * @return A completable future to be completed once the message bus is started.
+ * Starts listening on the server.
*/
- public synchronized CompletableFuture