Skip to content

Commit

Permalink
- Use Cluster service to get Version
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarnett-hz committed Sep 15, 2023
1 parent 5043c94 commit dec631d
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.hazelcast.cp.internal;

import com.hazelcast.cluster.Cluster;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.core.HazelcastException;
import com.hazelcast.cp.CPGroup;
Expand All @@ -42,7 +43,6 @@
import com.hazelcast.internal.cluster.Versions;
import com.hazelcast.logging.ILogger;
import com.hazelcast.spi.impl.InternalCompletableFuture;
import com.hazelcast.version.Version;

import javax.annotation.Nonnull;
import java.util.Collection;
Expand Down Expand Up @@ -126,7 +126,7 @@ public CPSubsystemManagementService getCPSubsystemManagementService() {

RaftService raftService = getService(RaftService.SERVICE_NAME);
cpSubsystemManagementService =
new CPSubsystemManagementServiceImpl(raftService, instance.getCluster().getClusterVersion());
new CPSubsystemManagementServiceImpl(raftService, instance.getCluster());
return cpSubsystemManagementService;
}

Expand Down Expand Up @@ -173,12 +173,12 @@ public boolean removeGroupAvailabilityListener(UUID id) {

private static class CPSubsystemManagementServiceImpl implements CPSubsystemManagementService {
private final RaftService raftService;
// TODO RU_COMPAT_5_3, clusterVersion, added for Version 5.3 compatibility. Should be removed at Version 5.5
private final Version clusterVersion;
// TODO RU_COMPAT_5_3, cluster, added for Version 5.3 compatibility. Should be removed at Version 5.5
private final Cluster cluster;

CPSubsystemManagementServiceImpl(RaftService raftService, Version clusterVersion) {
CPSubsystemManagementServiceImpl(RaftService raftService, Cluster cluster) {
this.raftService = raftService;
this.clusterVersion = clusterVersion;
this.cluster = cluster;
}

@Override
Expand Down Expand Up @@ -233,7 +233,7 @@ public boolean awaitUntilDiscoveryCompleted(long timeout, TimeUnit timeUnit) thr

@Override
public CompletionStage<Void> wipeDestroyedObjects() {
if (clusterVersion.isUnknownOrLessThan(Versions.V5_4)) {
if (cluster.getClusterVersion().isUnknownOrLessThan(Versions.V5_4)) {
String message = "Wiping of previously destroyed CP objects is supported in cluster versions 5.4 and above";
throw new UnsupportedOperationException(message);
}
Expand Down

0 comments on commit dec631d

Please sign in to comment.