public class ConsulMastershipElector extends Object implements MastershipElector
| Modifier and Type | Field and Description |
|---|---|
static String |
ACTIVE_DATACENTER |
protected String |
activeVersionKey |
protected com.jayway.jsonpath.Configuration |
conf |
protected com.cisco.oss.foundation.http.HttpClient |
consulClient |
protected String |
jobName |
protected String |
mastershipKey |
protected com.jayway.jsonpath.Configuration |
nullableConf |
protected String |
sessionId |
protected Thread |
sessionTTlThread |
protected int |
ttlPeriod |
protected int |
ttlUpdateTime |
| Constructor and Description |
|---|
ConsulMastershipElector() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupMaster() |
void |
close() |
String |
getActiveVersion() |
protected String |
getActiveVersionKey() |
void |
init(String id,
String jobName) |
boolean |
isActiveDataCenter(String currentDataCenter) |
boolean |
isActiveKeyValue(String key,
String currentValue) |
boolean |
isActiveVersion(String currentVersion) |
boolean |
isMaster() |
boolean |
isReady() |
public static final String ACTIVE_DATACENTER
protected com.cisco.oss.foundation.http.HttpClient consulClient
protected String activeVersionKey
protected String sessionId
protected String mastershipKey
protected String jobName
protected Thread sessionTTlThread
protected int ttlUpdateTime
protected int ttlPeriod
protected com.jayway.jsonpath.Configuration conf
protected com.jayway.jsonpath.Configuration nullableConf
public void init(String id, String jobName)
init in interface MastershipElectorpublic boolean isReady()
isReady in interface MastershipElectorpublic boolean isActiveVersion(String currentVersion)
isActiveVersion in interface MastershipElectorpublic boolean isActiveDataCenter(String currentDataCenter)
isActiveDataCenter in interface MastershipElectorpublic boolean isMaster()
isMaster in interface MastershipElectorpublic void close()
close in interface MastershipElectorprotected String getActiveVersionKey()
public String getActiveVersion()
getActiveVersion in interface MastershipElectorpublic void cleanupMaster()
cleanupMaster in interface MastershipElectorCopyright © 2016 Cisco. All rights reserved.