Skip to content

Commit

Permalink
feat(flexible):modify code format
Browse files Browse the repository at this point in the history
  • Loading branch information
1294566108 committed Aug 18, 2023
1 parent 566f755 commit 4cb0e09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public Ballot() {
* @return true if init success
*/
public boolean init(Configuration conf, Configuration oldConf) {
peers.clear();
oldPeers.clear();
quorum = oldQuorum = 0;
this.peers.clear();
this.oldPeers.clear();
this.quorum = this.oldQuorum = 0;
int index = 0;

if (conf != null) {
Expand Down Expand Up @@ -143,6 +143,11 @@ public Ballot.PosHint grant(final PeerId peerId, final Ballot.PosHint hint) {
return hint;
}

/**
* Returns true when the ballot is granted.
*
* @return true if the ballot is granted
*/
public boolean isGranted() {
return quorum <= 0 && oldQuorum <= 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void testAppendPendingTask() {
assertFalse(this.box.appendPendingTask(
JRaftUtils.getConfiguration("localhost:8081,localhost:8082,localhost:8083"),
JRaftUtils.getConfiguration("localhost:8081"), new Closure() {

@Override
public void run(Status status) {

Expand All @@ -87,6 +88,7 @@ public void run(Status status) {
assertTrue(this.box.appendPendingTask(
JRaftUtils.getConfiguration("localhost:8081,localhost:8082,localhost:8083"),
JRaftUtils.getConfiguration("localhost:8081"), new Closure() {

@Override
public void run(Status status) {

Expand Down

0 comments on commit 4cb0e09

Please sign in to comment.