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 givent 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() |
int |
getHttpPort(java.lang.String serviceName)
Returns a configured http port for a specified service.
|
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.
|
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 ClusterConfigServicepublic 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 ClusterConfigServicepublic 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 ClusterConfigServicepublic long getZkGcInterval()
If no value is specified, the default value of 60 is returned.
getZkGcInterval in interface ClusterConfigServicepublic long getFailSafetyLevel()
getFailSafetyLevel in interface ClusterConfigServicepublic boolean isConfigured()
isConfigured in interface ClusterConfigServicepublic long getMaxScaleUp()
If no limit is configured, -1 is returned.
getMaxScaleUp in interface ClusterConfigServicepublic boolean isResumeJobs()
isResumeJobs in interface ClusterConfigServicepublic long getWorkerScaleUp(java.lang.String worker)
getWorkerScaleUp in interface ClusterConfigServicepublic java.util.Collection<java.lang.String> getWorkersWithScaleUp()
getWorkersWithScaleUp in interface ClusterConfigServicepublic int getHttpPort(java.lang.String serviceName)
getHttpPort in interface ClusterConfigServicepublic long getMaxRetries()
getMaxRetries in interface ClusterConfigServicepublic long getTimeToLive()
getTimeToLive in interface ClusterConfigServiceprotected 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 void readConfiguration()
throws java.io.IOException
java.io.IOException - error during loading of configuration file.