Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert staleJoinPreventionDuration to not static field #19623

Merged
merged 3 commits into from Sep 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -89,8 +89,6 @@ public class ClusterJoinManager {

public static final String STALE_JOIN_PREVENTION_DURATION_PROP = "hazelcast.stale.join.prevention.duration.seconds";
private static final int CLUSTER_OPERATION_RETRY_COUNT = 100;
private static final int STALE_JOIN_PREVENTION_DURATION_SECONDS
= Integer.getInteger(STALE_JOIN_PREVENTION_DURATION_PROP, 30);

private final ILogger logger;
private final Node node;
Expand All @@ -115,8 +113,8 @@ public class ClusterJoinManager {
private final ConcurrentMap<UUID, Long> leftMembersUuids = new ConcurrentHashMap<>();
private final long maxWaitMillisBeforeJoin;
private final long waitMillisBeforeJoin;
private final long staleJoinPreventionDuration;

private long staleJoinPreventionDurationInMillis;
ufukyilmaz marked this conversation as resolved.
Show resolved Hide resolved
private long firstJoinRequest;
private long timeToStartJoin;
private volatile boolean joinInProgress;
Expand All @@ -133,7 +131,7 @@ public class ClusterJoinManager {

maxWaitMillisBeforeJoin = node.getProperties().getMillis(ClusterProperty.MAX_WAIT_SECONDS_BEFORE_JOIN);
waitMillisBeforeJoin = node.getProperties().getMillis(ClusterProperty.WAIT_SECONDS_BEFORE_JOIN);
staleJoinPreventionDuration = TimeUnit.SECONDS.toMillis(STALE_JOIN_PREVENTION_DURATION_SECONDS);
staleJoinPreventionDurationInMillis = TimeUnit.SECONDS.toMillis(Integer.getInteger(STALE_JOIN_PREVENTION_DURATION_PROP, 30));
}

boolean isJoinInProgress() {
Expand Down Expand Up @@ -364,7 +362,7 @@ private boolean checkRecentlyJoinedMemberUuidBeforeJoin(Address target, UUID uui

private void cleanupRecentlyJoinedMemberUuids() {
long currentTime = Clock.currentTimeMillis();
recentlyJoinedMemberUuids.values().removeIf(joinTime -> (currentTime - joinTime) >= staleJoinPreventionDuration);
recentlyJoinedMemberUuids.values().removeIf(joinTime -> (currentTime - joinTime) >= staleJoinPreventionDurationInMillis);
}

private boolean authenticate(JoinRequest joinRequest, Connection connection) {
Expand Down