Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxxoo committed Aug 16, 2022
1 parent ed3f3ca commit 54dac30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public MetaData(String node, int epoch) {
}

public void increaseCount() {
this.count ++;
this.count++;
}

public boolean isMaster(String node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Optional;

public interface MetaDataAdapter {

boolean postDelyIfPresent(MetaData metaData, long delySecond);

Optional<MetaData> queryDelay(long delySecond);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.baidu.hugegraph.util.E;

public class RoleElectionStateMachineImpl implements RoleElectionStateMachine{
public class RoleElectionStateMachineImpl implements RoleElectionStateMachine {

private volatile boolean shutdown = false;
private Config config;
Expand Down Expand Up @@ -189,9 +189,10 @@ public void merge(WorkerState state) {
throw new IllegalStateException("Meta count must increase");
} else if (state.metaData.epoch() == this.metaData.epoch() &&
state.metaData.count() > this.metaData.count()) {
this.count = 0;
this.metaData = state.metaData;
} else {
this.count ++;
this.count++;
}
}
}
Expand Down

0 comments on commit 54dac30

Please sign in to comment.