Moving to Atomix version 1.0.0-rc3
Change-Id: I75572a52b530741f482455d59922327121a03999
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java
index 89e1e82..b40e39d 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java
@@ -47,21 +47,20 @@
public class StoragePartition implements Managed<StoragePartition> {
private final AtomicBoolean isOpened = new AtomicBoolean(false);
- private final AtomicBoolean isClosed = new AtomicBoolean(false);
private final Serializer serializer;
private final MessagingService messagingService;
private final ClusterService clusterService;
private final File logFolder;
private Partition partition;
- private static final Collection<ResourceType> RESOURCE_TYPES = ImmutableSet.of(
- new ResourceType(DistributedLong.class),
- new ResourceType(AtomixLeaderElector.class),
- new ResourceType(AtomixConsistentMap.class));
-
private NodeId localNodeId;
private StoragePartitionServer server;
private StoragePartitionClient client;
+ public static final Collection<ResourceType> RESOURCE_TYPES = ImmutableSet.of(
+ new ResourceType(DistributedLong.class),
+ new ResourceType(AtomixLeaderElector.class),
+ new ResourceType(AtomixConsistentMap.class));
+
public StoragePartition(Partition partition,
MessagingService messagingService,
ClusterService clusterService,
@@ -96,8 +95,7 @@
public CompletableFuture<Void> close() {
// We do not explicitly close the server and instead let the cluster
// deal with this as an unclean exit.
- return closeClient().thenAccept(v -> isClosed.set(true))
- .thenApply(v -> null);
+ return closeClient();
}
/**
@@ -138,7 +136,6 @@
() -> new CopycatTransport(CopycatTransport.Mode.SERVER,
partition.getId(),
messagingService),
- RESOURCE_TYPES,
logFolder);
return server.open().thenRun(() -> this.server = server);
}
@@ -158,7 +155,6 @@
() -> new CopycatTransport(CopycatTransport.Mode.SERVER,
partition.getId(),
messagingService),
- RESOURCE_TYPES,
logFolder);
return server.join(Collections2.transform(otherMembers, this::toAddress)).thenRun(() -> this.server = server);
}
@@ -168,8 +164,7 @@
serializer,
new CopycatTransport(CopycatTransport.Mode.CLIENT,
partition.getId(),
- messagingService),
- RESOURCE_TYPES);
+ messagingService));
return client.open().thenApply(v -> client);
}
@@ -183,12 +178,7 @@
@Override
public boolean isOpen() {
- return isOpened.get() && !isClosed.get();
- }
-
- @Override
- public boolean isClosed() {
- return isClosed.get();
+ return isOpened.get();
}
private CompletableFuture<Void> closeClient() {
@@ -209,7 +199,7 @@
* @return partition info
*/
public Optional<PartitionInfo> info() {
- return server != null && !server.isClosed() ? Optional.of(server.info()) : Optional.empty();
+ return server != null && server.isOpen() ? Optional.of(server.info()) : Optional.empty();
}
public void onUpdate(Partition newValue) {