public class SimpleClusterConfigService extends java.lang.Object implements ClusterConfigService
ClusterConfigService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_ID
bundle id.
|
static long |
DEFAULT_FAILSAFETY_LEVEL
default number of nodes that may fail until zookeeper stops to work.
|
static long |
DEFAULT_MAX_RETRIES
default max retries for a task.
|
static long |
DEFAULT_MAX_SCALE_UP
default max scale up is -1 which means: unlimited.
|
static boolean |
DEFAULT_RESUME_JOBS
default resumeJobs.
|
static long |
DEFAULT_TIME_TO_LIVE
default time to live for a task.
|
static long |
DEFAULT_ZK_GC_INTERVAL
default zookeeper garbage collection interval.
|
Constructor and Description |
---|
SimpleClusterConfigService()
Default Constructor for OSGi DS.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activate(ComponentContext context)
OSGi Declarative Services service activation method.
|
protected void |
deactivate(ComponentContext context)
OSGi Declarative Services service deactivation method.
|
AnyMap |
getAllProperties() |
protected boolean |
getBooleanPropertyOrSetDefault(AnyMap properties,
java.lang.String key,
boolean defaultValueToSet)
Looks up the long value with the given key in the given properties map, if this value is not set, the given
defaultvalue will be set.
|
protected boolean |
getBooleanPropertyOrSetDefault(java.lang.String key,
boolean defaultValueToSet)
Looks up the long value with the given key, if this value is not set, the given defaultvalue will be set.
|
java.util.List<java.lang.String> |
getClusterNodes()
If no cluster nodes are specified, the returned cluster consists of the local host only (as returned by
getLocalHost() . |
long |
getFailSafetyLevel() |
java.lang.String |
getHttpAuthPasswordHash() |
java.lang.String |
getHttpAuthUser() |
int |
getHttpPort(java.lang.String serviceName) |
protected int |
getIntegerServiceProperty(java.lang.String serviceName,
java.lang.String property)
Gets integer property from a service section. return -1 if not set.
|
java.lang.String |
getLocalHost()
If no name is specified in the configuration, the host name determined by the local
InetAddress is
returned. |
protected long |
getLongPropertyOrSetDefault(AnyMap properties,
java.lang.String key,
long defaultValueToSet)
Looks up the long value with the given key in the givent properties map, if this value is not set, the given
defaultvalue will be set.
|
protected long |
getLongPropertyOrSetDefault(java.lang.String key,
long defaultValueToSet)
Looks up the long value with the given key, if this value is not set, the given defaultvalue will be set.
|
long |
getMaxRetries() |
long |
getMaxScaleUp()
If no limit is configured, -1 is returned.
|
int |
getSecureHttpPort(java.lang.String serviceName) |
long |
getTimeToLive() |
long |
getWorkerScaleUp(java.lang.String worker) |
java.util.Collection<java.lang.String> |
getWorkersWithScaleUp() |
long |
getZkGcInterval()
If no value is specified, the default value of 60 is returned.
|
boolean |
isConfigured() |
boolean |
isResumeJobs() |
protected void |
readConfiguration()
Read the configuration from the configuration file.
|
public static final java.lang.String BUNDLE_ID
public static final long DEFAULT_ZK_GC_INTERVAL
public static final long DEFAULT_FAILSAFETY_LEVEL
public static final long DEFAULT_MAX_SCALE_UP
public static final long DEFAULT_MAX_RETRIES
public static final long DEFAULT_TIME_TO_LIVE
public static final boolean DEFAULT_RESUME_JOBS
public SimpleClusterConfigService()
protected void activate(ComponentContext context)
context
- OSGi service component context.protected void deactivate(ComponentContext context)
context
- OSGi service component context.public AnyMap getAllProperties()
getAllProperties
in interface ClusterConfigService
public java.util.List<java.lang.String> getClusterNodes()
If no cluster nodes are specified, the returned cluster consists of the local host only (as returned by
getLocalHost()
.
getClusterNodes
in interface ClusterConfigService
public java.lang.String getLocalHost()
If no name is specified in the configuration, the host name determined by the local InetAddress
is
returned.
getLocalHost
in interface ClusterConfigService
public long getZkGcInterval()
If no value is specified, the default value of 60 is returned.
getZkGcInterval
in interface ClusterConfigService
public long getFailSafetyLevel()
getFailSafetyLevel
in interface ClusterConfigService
public boolean isConfigured()
isConfigured
in interface ClusterConfigService
public long getMaxScaleUp()
If no limit is configured, -1 is returned.
getMaxScaleUp
in interface ClusterConfigService
public boolean isResumeJobs()
isResumeJobs
in interface ClusterConfigService
public long getWorkerScaleUp(java.lang.String worker)
getWorkerScaleUp
in interface ClusterConfigService
public java.util.Collection<java.lang.String> getWorkersWithScaleUp()
getWorkersWithScaleUp
in interface ClusterConfigService
public int getHttpPort(java.lang.String serviceName)
getHttpPort
in interface ClusterConfigService
public int getSecureHttpPort(java.lang.String serviceName)
getSecureHttpPort
in interface ClusterConfigService
public java.lang.String getHttpAuthUser()
getHttpAuthUser
in interface ClusterConfigService
public java.lang.String getHttpAuthPasswordHash()
getHttpAuthPasswordHash
in interface ClusterConfigService
public long getMaxRetries()
getMaxRetries
in interface ClusterConfigService
public long getTimeToLive()
getTimeToLive
in interface ClusterConfigService
protected long getLongPropertyOrSetDefault(java.lang.String key, long defaultValueToSet)
key
- the key of the propertydefaultValueToSet
- the default valueprotected long getLongPropertyOrSetDefault(AnyMap properties, java.lang.String key, long defaultValueToSet)
key
- the key of the propertydefaultValueToSet
- the default valueprotected boolean getBooleanPropertyOrSetDefault(java.lang.String key, boolean defaultValueToSet)
key
- the key of the propertydefaultValueToSet
- the default valueprotected boolean getBooleanPropertyOrSetDefault(AnyMap properties, java.lang.String key, boolean defaultValueToSet)
key
- the key of the propertydefaultValueToSet
- the default valueprotected int getIntegerServiceProperty(java.lang.String serviceName, java.lang.String property)
serviceName
- name of service sectionproperty
- property nameprotected void readConfiguration() throws java.io.IOException
java.io.IOException
- error during loading of configuration file.