|
| 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