Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public class LeaderElectionConfiguration {
private final LeaderCallbacks leaderCallbacks;
private final boolean exitOnStopLeading;

/**
* @deprecated Use {@link LeaderElectionConfigurationBuilder} instead
*/
@Deprecated(forRemoval = true)
public LeaderElectionConfiguration(String leaseName, String leaseNamespace, String identity) {
this(
leaseName,
Expand All @@ -49,30 +53,26 @@ public LeaderElectionConfiguration(String leaseName, String leaseNamespace, Stri
true);
}

/**
* @deprecated Use {@link LeaderElectionConfigurationBuilder} instead
*/
@Deprecated(forRemoval = true)
public LeaderElectionConfiguration(String leaseName, String leaseNamespace) {
this(
leaseName,
leaseNamespace,
LEASE_DURATION_DEFAULT_VALUE,
RENEW_DEADLINE_DEFAULT_VALUE,
RETRY_PERIOD_DEFAULT_VALUE,
null,
null,
true);
this(leaseName, leaseNamespace, null);
}

/**
* @deprecated Use {@link LeaderElectionConfigurationBuilder} instead
*/
@Deprecated(forRemoval = true)
public LeaderElectionConfiguration(String leaseName) {
this(
leaseName,
null,
LEASE_DURATION_DEFAULT_VALUE,
RENEW_DEADLINE_DEFAULT_VALUE,
RETRY_PERIOD_DEFAULT_VALUE,
null,
null,
true);
this(leaseName, null);
}

/**
* @deprecated Use {@link LeaderElectionConfigurationBuilder} instead
*/
@Deprecated(forRemoval = true)
public LeaderElectionConfiguration(
String leaseName,
String leaseNamespace,
Expand All @@ -82,6 +82,10 @@ public LeaderElectionConfiguration(
this(leaseName, leaseNamespace, leaseDuration, renewDeadline, retryPeriod, null, null, true);
}

/**
* @deprecated Use {@link LeaderElectionConfigurationBuilder} instead
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add proper annotation not just javadoc

@Deprecated // this will be made package-only
public LeaderElectionConfiguration(
String leaseName,
String leaseNamespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public final class LeaderElectionConfigurationBuilder {
private Duration renewDeadline = RENEW_DEADLINE_DEFAULT_VALUE;
private Duration retryPeriod = RETRY_PERIOD_DEFAULT_VALUE;
private LeaderCallbacks leaderCallbacks;
private boolean exitOnStopLeading = true;

private LeaderElectionConfigurationBuilder(String leaseName) {
this.leaseName = leaseName;
Expand Down Expand Up @@ -71,12 +70,22 @@ public LeaderElectionConfigurationBuilder withLeaderCallbacks(LeaderCallbacks le
return this;
}

/**
* @deprecated Use {@link #buildForTest(boolean)} instead as setting this to false should only be
* used for testing purposes
*/
@Deprecated(forRemoval = true)
public LeaderElectionConfigurationBuilder withExitOnStopLeading(boolean exitOnStopLeading) {
this.exitOnStopLeading = exitOnStopLeading;
return this;
throw new UnsupportedOperationException(
"Setting exitOnStopLeading should only be used for testing purposes, use buildForTest"
+ " instead");
}

public LeaderElectionConfiguration build() {
return buildForTest(false);
}

public LeaderElectionConfiguration buildForTest(boolean exitOnStopLeading) {
return new LeaderElectionConfiguration(
leaseName,
leaseNamespace,
Expand Down