Skip to content

Commit e665228

Browse files
authored
fix server time inconsistency problem
1 parent 016345b commit e665228

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright (c) 2017 The jgossip Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package net.lvsq.jgossip.model;
16+
17+
import java.util.concurrent.atomic.AtomicInteger;
18+
19+
/**
20+
* Created by lvsq on 8/19/2017.
21+
*/
22+
public class CandidateMemberState {
23+
private long heartbeatTime;
24+
private AtomicInteger downingCount;
25+
26+
public CandidateMemberState(long heartbeatTime) {
27+
this.heartbeatTime = heartbeatTime;
28+
this.downingCount = new AtomicInteger(0);
29+
}
30+
31+
public void updateCount() {
32+
this.downingCount.incrementAndGet();
33+
}
34+
35+
public long getHeartbeatTime() {
36+
return heartbeatTime;
37+
}
38+
39+
public void setHeartbeatTime(long heartbeatTime) {
40+
this.heartbeatTime = heartbeatTime;
41+
}
42+
43+
public AtomicInteger getDowningCount() {
44+
return downingCount;
45+
}
46+
47+
public void setDowningCount(AtomicInteger downingCount) {
48+
this.downingCount = downingCount;
49+
}
50+
51+
@Override
52+
public String toString() {
53+
return "CandidateMemberState{" +
54+
"heartbeatTime=" + heartbeatTime +
55+
", downingCount=" + downingCount.get() +
56+
'}';
57+
}
58+
}

0 commit comments

Comments
 (0)