Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxxoo committed Aug 17, 2022
1 parent 664c614 commit 048e782
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class RoleElectionStateMachineImpl implements RoleElectionStateMachine {
public RoleElectionStateMachineImpl(Config config, RoleTypeDataAdapter adapter) {
this.config = config;
this.roleTypeDataAdapter = adapter;
this.state = new UnKnownState(null);
this.state = new UnknownState(null);
this.shutdown = false;
}

Expand Down Expand Up @@ -94,11 +94,11 @@ private interface Callback {
void call(StateMachineContext context);
}

private static class UnKnownState implements RoleState {
private static class UnknownState implements RoleState {

final Integer epoch;

public UnKnownState(Integer epoch) {
public UnknownState(Integer epoch) {
this.epoch = epoch;
}

Expand Down Expand Up @@ -146,7 +146,7 @@ public AbdicationState(Integer epoch) {
@Override
public RoleState transform(StateMachineContext context) {
RoleState.heartBeatPark(context);
return new UnKnownState(this.epoch).transform(context);
return new UnknownState(this.epoch).transform(context);
}

@Override
Expand All @@ -172,7 +172,7 @@ public RoleState transform(StateMachineContext context) {
}
context.reset();
context.epoch(this.roleTypeData.epoch());
return new UnKnownState(this.roleTypeData.epoch()).transform(context);
return new UnknownState(this.roleTypeData.epoch()).transform(context);
}

@Override
Expand All @@ -194,7 +194,7 @@ public WorkerState(RoleTypeData roleTypeData) {
@Override
public RoleState transform(StateMachineContext context) {
RoleState.heartBeatPark(context);
RoleState nextState = new UnKnownState(this.roleTypeData.epoch()).transform(context);
RoleState nextState = new UnknownState(this.roleTypeData.epoch()).transform(context);
if (nextState instanceof WorkerState) {
this.merge((WorkerState) nextState);
if (this.clock > context.config().exceedsWorkerCount()) {
Expand Down Expand Up @@ -249,7 +249,7 @@ public RoleState transform(StateMachineContext context) {
if (context.adapter().updateIfNodePresent(roleTypeData)) {
return new MasterState(roleTypeData);
} else {
return new UnKnownState(epoch).transform(context);
return new UnknownState(epoch).transform(context);
}
}

Expand Down

0 comments on commit 048e782

Please sign in to comment.