Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Commit 88a81e4

Browse files
committed
Created ReconnectionParams class for holding reconnection values
1 parent 6cb48ec commit 88a81e4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.clusterws;
2+
3+
public class ReconnectionParams {
4+
private Boolean mAutoReconnect;
5+
private Integer mReconnectionIntervalMin;
6+
private Integer mReconnectionIntervalMax;
7+
private Integer mReconnectionAttempts;
8+
private Integer mReconnectionsAttempted;
9+
10+
public ReconnectionParams(Boolean autoReconnect,
11+
Integer reconnectionIntervalMin,
12+
Integer reconnectionIntervalMax,
13+
Integer reconnectionAttempts) {
14+
mAutoReconnect = autoReconnect != null ? autoReconnect : false;
15+
mReconnectionIntervalMin = reconnectionIntervalMin != null ? reconnectionIntervalMin : 1000;
16+
mReconnectionIntervalMax = reconnectionIntervalMax != null ? reconnectionIntervalMax : 5000;
17+
mReconnectionAttempts = reconnectionAttempts != null ? reconnectionAttempts : 0;
18+
mReconnectionsAttempted = 0;
19+
}
20+
21+
public boolean isAutoReconnect() {
22+
return mAutoReconnect;
23+
}
24+
25+
public Integer getReconnectionIntervalMin() {
26+
return mReconnectionIntervalMin;
27+
}
28+
29+
public Integer getReconnectionIntervalMax() {
30+
return mReconnectionIntervalMax;
31+
}
32+
33+
public Integer getReconnectionAttempts() {
34+
return mReconnectionAttempts;
35+
}
36+
37+
public void incrementReconnectionsAttempted() {
38+
mReconnectionsAttempted++;
39+
}
40+
41+
public void resetReconnectionsAttempted() {
42+
mReconnectionsAttempted = 0;
43+
}
44+
45+
public Integer getReconnectionsAttempted() {
46+
return mReconnectionsAttempted;
47+
}
48+
}

0 commit comments

Comments
 (0)