close() {
- return client.close();
- }
-
- @Override
- public boolean isOpen() {
- return client.isOpen();
- }
-
- @Override
- public boolean isClosed() {
- return client.isClosed();
- }
-
- @Override
- public String toString() {
- return client.toString();
- }
-
-}
diff --git a/manager/src/main/java/io/atomix/manager/ResourceClient.java b/manager/src/main/java/io/atomix/manager/ResourceClient.java
index b1bb01c805..60dc476cc2 100644
--- a/manager/src/main/java/io/atomix/manager/ResourceClient.java
+++ b/manager/src/main/java/io/atomix/manager/ResourceClient.java
@@ -65,7 +65,7 @@
*
* Client lifecycle
*
- * When a client is {@link #open() started}, the client will attempt to contact random servers in the provided
+ * When a client is {@link #connect() connected}, the client will attempt to contact random servers in the provided
* {@link Address} list to open a new session. Opening a client session requires only that the client be able to
* communicate with at least one server which can communicate with the leader. Once a session has been opened,
* the client will periodically send keep-alive requests to the cluster to maintain its session. In the event
@@ -263,17 +263,29 @@ private synchronized void close(ResourceInstance instance) {
futures.remove(instance.key());
}
- @Override
- public CompletableFuture open() {
- return client.open().thenApply(v -> this);
+ /**
+ * Returns the resource client state.
+ *
+ * @return The resource client state.
+ */
+ public CopycatClient.State state() {
+ return client.state();
}
- @Override
- public boolean isOpen() {
- return client.isOpen();
+ /**
+ * Connects the client to the cluster.
+ *
+ * @return A completable future to be completed once the client is connected.
+ */
+ public CompletableFuture connect() {
+ return client.connect().thenApply(v -> this);
}
- @Override
+ /**
+ * Closes the client.
+ *
+ * @return A completable future to be completed once the client has been closed.
+ */
public CompletableFuture close() {
CompletableFuture>[] futures = new CompletableFuture[instances.size()];
int i = 0;
@@ -283,11 +295,6 @@ public CompletableFuture close() {
return CompletableFuture.allOf(futures).thenCompose(v -> client.close());
}
- @Override
- public boolean isClosed() {
- return client.isClosed();
- }
-
@Override
public String toString() {
return String.format("%s[session=%s]", getClass().getSimpleName(), client.session());
diff --git a/manager/src/main/java/io/atomix/manager/ResourceManager.java b/manager/src/main/java/io/atomix/manager/ResourceManager.java
index 3af2e45b5c..94f3742afe 100644
--- a/manager/src/main/java/io/atomix/manager/ResourceManager.java
+++ b/manager/src/main/java/io/atomix/manager/ResourceManager.java
@@ -16,7 +16,6 @@
package io.atomix.manager;
import io.atomix.catalyst.serializer.Serializer;
-import io.atomix.catalyst.util.Managed;
import io.atomix.catalyst.util.concurrent.ThreadContext;
import io.atomix.resource.Resource;
import io.atomix.resource.ResourceType;
@@ -30,7 +29,7 @@
* @param resource type
* @author Jordan Halterman
*/
-public interface ResourceManager> extends Managed {
+public interface ResourceManager> {
/**
* Returns the Atomix thread context.
diff --git a/manager/src/main/java/io/atomix/manager/ResourceServer.java b/manager/src/main/java/io/atomix/manager/ResourceServer.java
index 41bec60f32..ded0388fa3 100644
--- a/manager/src/main/java/io/atomix/manager/ResourceServer.java
+++ b/manager/src/main/java/io/atomix/manager/ResourceServer.java
@@ -20,7 +20,6 @@
import io.atomix.catalyst.transport.Transport;
import io.atomix.catalyst.util.Assert;
import io.atomix.catalyst.util.ConfigurationException;
-import io.atomix.catalyst.util.Managed;
import io.atomix.catalyst.util.concurrent.ThreadContext;
import io.atomix.copycat.server.CopycatServer;
import io.atomix.copycat.server.storage.Storage;
@@ -66,7 +65,7 @@
*
* Server lifecycle
*
- * When the server is {@link #open() started}, the server will attempt to contact members in the configured
+ * When the server is {@link #start() started}, the server will attempt to contact members in the configured
* startup {@link Address} list. If any of the members are already in an active state, the server will request
* to join the cluster. During the process of joining the cluster, the server will notify the current cluster
* leader of its existence. If the leader already knows about the joining server, the server will immediately
@@ -78,7 +77,7 @@
*
* @author recover() {
if (state != State.SUSPENDED)
@@ -245,11 +240,6 @@ public synchronized CompletableFuture close() {
return closeFuture;
}
- @Override
- public boolean isClosed() {
- return client.isClosed();
- }
-
@Override
public String toString() {
return String.format("%s[resource=%d]", getClass().getSimpleName(), resource);
diff --git a/resource/src/main/java/io/atomix/resource/AbstractResource.java b/resource/src/main/java/io/atomix/resource/AbstractResource.java
index d00baf13f8..6fc516b17d 100644
--- a/resource/src/main/java/io/atomix/resource/AbstractResource.java
+++ b/resource/src/main/java/io/atomix/resource/AbstractResource.java
@@ -285,7 +285,7 @@ protected CompletableFuture submit(Query query, ReadConsistency consis
@Override
@SuppressWarnings("unchecked")
public CompletableFuture open() {
- return client.open()
+ return client.connect()
.thenCompose(v -> client.submit(new ResourceCommand.Config()))
.thenApply(config -> {
this.config = new Config(config);
diff --git a/testing/src/main/java/io/atomix/testing/AbstractCopycatTest.java b/testing/src/main/java/io/atomix/testing/AbstractCopycatTest.java
index bf0f287169..4c13b9b704 100644
--- a/testing/src/main/java/io/atomix/testing/AbstractCopycatTest.java
+++ b/testing/src/main/java/io/atomix/testing/AbstractCopycatTest.java
@@ -71,7 +71,7 @@ protected void cleanup() {
});
servers.stream().forEach(s -> {
try {
- s.close().join();
+ s.stop().join();
} catch (Exception ignore) {
}
});
@@ -182,7 +182,7 @@ protected List createServers(int live, int total, Resource.Config
List servers = new ArrayList<>();
for (int i = 0; i < live; i++) {
CopycatServer server = createServer(members.get(i), config);
- server.open().thenRun(this::resume);
+ server.start().thenRun(this::resume);
servers.add(server);
}