Repository navigation
Expand file tree
/
Copy pathGossipSettings.java
More file actions
executable file
·288 lines (226 loc) · 7.31 KB
/
Copy pathGossipSettings.java
File metadata and controls
executable file
·288 lines (226 loc) · 7.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.tron.gossip;
import java.util.HashMap;
import java.util.Map;
import org.tron.gossip.lock.LockManagerSettings;
/**
* In this object the settings used by the GossipService are held.
*/
public class GossipSettings {
/**
* Time between gossip'ing in ms. Default is 1 second.
*/
private int gossipInterval = 10;
/**
* Time between cleanups in ms. Default is 10 seconds.
*/
private int cleanupInterval = 5000;
/**
* the minimum samples needed before reporting a result
*/
private int minimumSamples = 5;
/**
* the number of samples to keep per host
*/
private int windowSize = 5000;
/**
* the threshold for the detector
*/
private double convictThreshold = 10;
private String distribution = "normal";
private String activeGossipClass = "org.tron.gossip.manager.SimpleActiveGossiper";
private String transportManagerClass = "org.tron.gossip.transport.udp.UdpTransportManager";
private String protocolManagerClass = "org.tron.gossip.protocol.json.JacksonProtocolManager";
private Map<String, String> activeGossipProperties = new HashMap<>();
private String pathToRingState = "./";
private boolean persistRingState = true;
private String pathToDataState = "./";
private boolean persistDataState = true;
private String pathToKeyStore = "./keys";
private boolean signMessages = false;
// Settings related to lock manager
private LockManagerSettings lockManagerSettings = LockManagerSettings
.getLockManagerDefaultSettings();
private boolean bulkTransfer = false;
private int bulkTransferSize = StartupSettings.DEFAULT_BULK_TRANSFER_SIZE;
/**
* Construct GossipSettings with default settings.
*/
public GossipSettings() {
}
/**
* Construct GossipSettings with given settings.
*
* @param gossipInterval The gossip interval in ms.
* @param cleanupInterval The cleanup interval in ms.
*/
public GossipSettings(int gossipInterval, int cleanupInterval, int windowSize, int minimumSamples,
double convictThreshold, String distribution, boolean bulkTransfer) {
this.gossipInterval = gossipInterval;
this.cleanupInterval = cleanupInterval;
this.windowSize = windowSize;
this.minimumSamples = minimumSamples;
this.convictThreshold = convictThreshold;
this.distribution = distribution;
this.bulkTransfer = bulkTransfer;
}
/**
* Set the gossip interval. This is the time between a gossip message is send.
*
* @param gossipInterval The gossip interval in ms.
*/
public void setGossipTimeout(int gossipInterval) {
this.gossipInterval = gossipInterval;
}
/**
* Get the gossip interval.
*
* @return The gossip interval in ms.
*/
public int getGossipInterval() {
return gossipInterval;
}
public void setGossipInterval(int gossipInterval) {
this.gossipInterval = gossipInterval;
}
/**
* Get the clean interval.
*
* @return The cleanup interval.
*/
public int getCleanupInterval() {
return cleanupInterval;
}
/**
* Set the cleanup interval. This is the time between the last heartbeat received from a member
* and when it will be marked as dead.
*
* @param cleanupInterval The cleanup interval in ms.
*/
public void setCleanupInterval(int cleanupInterval) {
this.cleanupInterval = cleanupInterval;
}
public int getMinimumSamples() {
return minimumSamples;
}
public void setMinimumSamples(int minimumSamples) {
this.minimumSamples = minimumSamples;
}
public int getWindowSize() {
return windowSize;
}
public void setWindowSize(int windowSize) {
this.windowSize = windowSize;
}
public double getConvictThreshold() {
return convictThreshold;
}
public void setConvictThreshold(double convictThreshold) {
this.convictThreshold = convictThreshold;
}
public String getDistribution() {
return distribution;
}
public void setDistribution(String distribution) {
this.distribution = distribution;
}
public String getActiveGossipClass() {
return activeGossipClass;
}
public void setActiveGossipClass(String activeGossipClass) {
this.activeGossipClass = activeGossipClass;
}
public Map<String, String> getActiveGossipProperties() {
return activeGossipProperties;
}
public void setActiveGossipProperties(Map<String, String> activeGossipProperties) {
this.activeGossipProperties = activeGossipProperties;
}
public String getPathToRingState() {
return pathToRingState;
}
public void setPathToRingState(String pathToRingState) {
this.pathToRingState = pathToRingState;
}
public boolean isPersistRingState() {
return persistRingState;
}
public void setPersistRingState(boolean persistRingState) {
this.persistRingState = persistRingState;
}
public String getPathToDataState() {
return pathToDataState;
}
public void setPathToDataState(String pathToDataState) {
this.pathToDataState = pathToDataState;
}
public boolean isPersistDataState() {
return persistDataState;
}
public void setPersistDataState(boolean persistDataState) {
this.persistDataState = persistDataState;
}
public String getPathToKeyStore() {
return pathToKeyStore;
}
public void setPathToKeyStore(String pathToKeyStore) {
this.pathToKeyStore = pathToKeyStore;
}
public boolean isSignMessages() {
return signMessages;
}
public void setSignMessages(boolean signMessages) {
this.signMessages = signMessages;
}
public String getTransportManagerClass() {
return transportManagerClass;
}
public void setTransportManagerClass(String transportManagerClass) {
this.transportManagerClass = transportManagerClass;
}
public String getProtocolManagerClass() {
return protocolManagerClass;
}
public void setProtocolManagerClass(String protocolManagerClass) {
this.protocolManagerClass = protocolManagerClass;
}
public LockManagerSettings getLockManagerSettings() {
return lockManagerSettings;
}
/**
* Set the lock settings use by the lock manager
*
* @param lockManagerSettings lock settings. This object cannot be null.
*/
public void setLockManagerSettings(LockManagerSettings lockManagerSettings) {
this.lockManagerSettings = lockManagerSettings;
}
public boolean isBulkTransfer() {
return bulkTransfer;
}
public void setBulkTransfer(boolean bulkTransfer) {
this.bulkTransfer = bulkTransfer;
}
public int getBulkTransferSize() {
return bulkTransferSize;
}
public void setBulkTransferSize(int bulkTransferSize) {
this.bulkTransferSize = bulkTransferSize;
}
}