org.apache.sling.discovery.impl

## Class Config

- java.lang.Object
- - org.apache.sling.discovery.impl.Config

All Implemented Interfaces:
  org.apache.sling.discovery.base.connectors.BaseConfig, org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig

    @Service(value={Config.class,org.apache.sling.discovery.base.connectors.BaseConfig.class,org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig.class})
    public class Config
    extends Object
    implements org.apache.sling.discovery.base.connectors.BaseConfig, org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig

Configuration object used as a central config point for the discovery service implementation

The properties are described below under.

### Field Summary

Fields
`static String` `CONNECTION_TIMEOUT_KEY`
`static int` `DEFAULT_CONNECTION_TIMEOUT` Configure the socket connect timeout for topology connectors.
`static long` `DEFAULT_HEARTBEAT_INTERVAL` Configure the interval (in seconds) according to which the heartbeats are exchanged in the topology.
`static long` `DEFAULT_HEARTBEAT_TIMEOUT` Configure the timeout (in seconds) after which an instance is considered dead/crashed.
`static int` `DEFAULT_MIN_EVENT_DELAY` Configure the time (in seconds) which must be passed at minimum between sending TOPOLOGY_CHANGING/_CHANGED (avoid flooding).
`static int` `DEFAULT_SO_TIMEOUT` Configure the socket read timeout (SO_TIMEOUT) for topology connectors.
`static String` `DISCOVERY_RESOURCE_PATH_KEY`
`static String` `HEARTBEAT_INTERVAL_KEY`
`static String` `HEARTBEAT_TIMEOUT_KEY`
`protected long` `heartbeatInterval`
`protected long` `heartbeatTimeout`
`static String` `INVERT_REPOSITORY_DESCRIPTOR_NAME_KEY` Whether or not (default false) the leaderElectionRepositoryDescriptor should be inverted (if that one is configured at all).
`static String` `LEADER_ELECTION_REPOSITORY_DESCRIPTOR_NAME_KEY` Name of the repository descriptor to be taken into account for leader election: those instances have preference to become leader which have the corresponding descriptor value of 'false'
`static String` `MIN_EVENT_DELAY_KEY`
`protected int` `minEventDelay`
`static String` `SO_TIMEOUT_KEY`
`static String` `TOPOLOGY_CONNECTOR_URLS_KEY` URLs where to join a topology, eg http://localhost:4502/libs/sling/topology/connector
`static String` `TOPOLOGY_CONNECTOR_WHITELIST_KEY`

### Constructor Summary

Constructors
Constructor and Description
`Config()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `activate(Map<String,Object> properties)`
`protected void` `configure(Map<String,Object> properties)`
`int` `getBackoffStableFactor()` Returns the (maximum) backoff factor to be used for stable connectors
`int` `getBackoffStandbyFactor()` Returns the backoff factor to be used for standby (loop) connectors
`long` `getBackoffStandbyInterval()` Returns the backoff interval for standby (loop) connectors in seconds
`String` `getClusterInstancesPath()` Returns the resource path where cluster instance informations are stored.
`long` `getClusterSyncServiceIntervalMillis()`
`long` `getClusterSyncServiceTimeoutMillis()`
`long` `getConnectorPingInterval()`
`long` `getConnectorPingTimeout()`
`String` `getDiscoveryResourcePath()`
`String` `getEstablishedViewPath()` Returns the resource path where the established view is stored.
`long` `getHeartbeatInterval()` Returns the interval (in seconds) in which heartbeats are sent
`long` `getHeartbeatTimeout()` Returns the timeout (in seconds) after which an instance or voting is considered invalid/timed out
`long` `getHeartbeatTimeoutMillis()` Returns the timeout (in milliseconds) after which an instance or voting is considered invalid/timed out
`String` `getIdMapPath()`
`long` `getKeyInterval()`
`String` `getLeaderElectionRepositoryDescriptor()` Returns the repository descriptor key which is to be included in the cluster leader election - or null.
`int` `getMinEventDelay()` Returns the minimum time (in seconds) between sending TOPOLOGY_CHANGING/_CHANGED events - to avoid flooding
`String` `getOngoingVotingsPath()` Returns the resource path where ongoing votings are stored.
`String` `getPreviousViewPath()` Returns the resource path where the previous view is stored.
`String` `getSharedKey()`
`int` `getSocketConnectTimeout()` Returns the socket connect() timeout used by the topology connector, 0 disables the timeout
`int` `getSoTimeout()` Returns the socket read timeout (SO_TIMEOUT) used by the topology connector, 0 disables the timeout
`String` `getSyncTokenPath()`
`URL[]` `getTopologyConnectorURLs()` Returns the URLs to which to open a topology connector - or null/empty if no topology connector is configured (default is null)
`String[]` `getTopologyConnectorWhitelist()` Returns a comma separated list of hostnames and/or ip addresses which are allowed as remote hosts to open connections to the topology connector servlet
`boolean` `isAutoStopLocalLoopEnabled()`
`boolean` `isEncryptionEnabled()`
`boolean` `isGzipConnectorRequestsEnabled()`
`boolean` `isHmacEnabled()`
`boolean` `shouldInvertRepositoryDescriptor()` Returns true when the value of the repository descriptor identified via the property 'leaderElectionRepositoryDescriptor' should be inverted - only applies when 'leaderElectionRepositoryDescriptor' is configured of course.
`boolean` `useSyncTokenService()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_HEARTBEAT_TIMEOUT

    public static final long DEFAULT_HEARTBEAT_TIMEOUT

Configure the timeout (in seconds) after which an instance is considered dead/crashed.

See Also:
  Constant Field Values

#### HEARTBEAT_TIMEOUT_KEY

    @Property(longValue=120L)
    public static final String HEARTBEAT_TIMEOUT_KEY

See Also:
  Constant Field Values

#### heartbeatTimeout

    protected long heartbeatTimeout

#### DEFAULT_HEARTBEAT_INTERVAL

    public static final long DEFAULT_HEARTBEAT_INTERVAL

Configure the interval (in seconds) according to which the heartbeats are exchanged in the topology.

See Also:
  Constant Field Values

#### HEARTBEAT_INTERVAL_KEY

    @Property(longValue=30L)
    public static final String HEARTBEAT_INTERVAL_KEY

See Also:
  Constant Field Values

#### heartbeatInterval

    protected long heartbeatInterval

#### DEFAULT_MIN_EVENT_DELAY

    public static final int DEFAULT_MIN_EVENT_DELAY

Configure the time (in seconds) which must be passed at minimum between sending TOPOLOGY_CHANGING/_CHANGED (avoid flooding).

See Also:
  Constant Field Values

#### MIN_EVENT_DELAY_KEY

    @Property(intValue=3)
    public static final String MIN_EVENT_DELAY_KEY

See Also:
  Constant Field Values

#### minEventDelay

    protected int minEventDelay

#### DEFAULT_CONNECTION_TIMEOUT

    public static final int DEFAULT_CONNECTION_TIMEOUT

Configure the socket connect timeout for topology connectors.

See Also:
  Constant Field Values

#### CONNECTION_TIMEOUT_KEY

    @Property(intValue=10)
    public static final String CONNECTION_TIMEOUT_KEY

See Also:
  Constant Field Values

#### DEFAULT_SO_TIMEOUT

    public static final int DEFAULT_SO_TIMEOUT

Configure the socket read timeout (SO_TIMEOUT) for topology connectors.

See Also:
  Constant Field Values

#### SO_TIMEOUT_KEY

    @Property(intValue=10)
    public static final String SO_TIMEOUT_KEY

See Also:
  Constant Field Values

#### LEADER_ELECTION_REPOSITORY_DESCRIPTOR_NAME_KEY

    @Property
    public static final String LEADER_ELECTION_REPOSITORY_DESCRIPTOR_NAME_KEY

Name of the repository descriptor to be taken into account for leader election: those instances have preference to become leader which have the corresponding descriptor value of 'false'

See Also:
  Constant Field Values

#### INVERT_REPOSITORY_DESCRIPTOR_NAME_KEY

    @Property(boolValue=false)
    public static final String INVERT_REPOSITORY_DESCRIPTOR_NAME_KEY

Whether or not (default false) the leaderElectionRepositoryDescriptor should be inverted (if that one is configured at all).

See Also:
  Constant Field Values

#### TOPOLOGY_CONNECTOR_URLS_KEY

    @Property(cardinality=1024)
    public static final String TOPOLOGY_CONNECTOR_URLS_KEY

URLs where to join a topology, eg http://localhost:4502/libs/sling/topology/connector

See Also:
  Constant Field Values

#### TOPOLOGY_CONNECTOR_WHITELIST_KEY

    @Property(value={"localhost","127.0.0.1"})
    public static final String TOPOLOGY_CONNECTOR_WHITELIST_KEY

See Also:
  Constant Field Values

#### DISCOVERY_RESOURCE_PATH_KEY

    @Property(value="/var/discovery/impl/",
              propertyPrivate=true)
    public static final String DISCOVERY_RESOURCE_PATH_KEY

See Also:
  Constant Field Values

### Constructor Detail

#### Config

    public Config()

### Method Detail

#### activate

    @Activate
    protected void activate(Map<String,Object> properties)

#### configure

    protected void configure(Map<String,Object> properties)

#### getHeartbeatTimeout

    public long getHeartbeatTimeout()

Returns the timeout (in seconds) after which an instance or voting is considered invalid/timed out

Returns:
  the timeout (in seconds) after which an instance or voting is considered invalid/timed out

#### getHeartbeatTimeoutMillis

    public long getHeartbeatTimeoutMillis()

Returns the timeout (in milliseconds) after which an instance or voting is considered invalid/timed out

Returns:
  the timeout (in milliseconds) after which an instance or voting is considered invalid/timed out

#### getSocketConnectTimeout

    public int getSocketConnectTimeout()

Returns the socket connect() timeout used by the topology connector, 0 disables the timeout

Specified by:
  `getSocketConnectTimeout` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the socket connect() timeout used by the topology connector, 0 disables the timeout

#### getSoTimeout

    public int getSoTimeout()

Returns the socket read timeout (SO_TIMEOUT) used by the topology connector, 0 disables the timeout

Specified by:
  `getSoTimeout` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the socket read timeout (SO_TIMEOUT) used by the topology connector, 0 disables the timeout

#### getHeartbeatInterval

    public long getHeartbeatInterval()

Returns the interval (in seconds) in which heartbeats are sent

Returns:
  the interval (in seconds) in which heartbeats are sent

#### getMinEventDelay

    public int getMinEventDelay()

Returns the minimum time (in seconds) between sending TOPOLOGY_CHANGING/_CHANGED events - to avoid flooding

Specified by:
  `getMinEventDelay` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the minimum time (in seconds) between sending TOPOLOGY_CHANGING/_CHANGED events - to avoid flooding

#### getTopologyConnectorURLs

    public URL[] getTopologyConnectorURLs()

Returns the URLs to which to open a topology connector - or null/empty if no topology connector is configured (default is null)

Specified by:
  `getTopologyConnectorURLs` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the URLs to which to open a topology connector - or null/empty if no topology connector is configured

#### getTopologyConnectorWhitelist

    public String[] getTopologyConnectorWhitelist()

Returns a comma separated list of hostnames and/or ip addresses which are allowed as remote hosts to open connections to the topology connector servlet

Specified by:
  `getTopologyConnectorWhitelist` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  a comma separated list of hostnames and/or ip addresses which are allowed as remote hosts to open connections to the topology connector servlet

#### getDiscoveryResourcePath

    public String getDiscoveryResourcePath()

#### getClusterInstancesPath

    public String getClusterInstancesPath()

Returns the resource path where cluster instance informations are stored.

Specified by:
  `getClusterInstancesPath` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the resource path where cluster instance informations are stored

#### getEstablishedViewPath

    public String getEstablishedViewPath()

Returns the resource path where the established view is stored.

Returns:
  the resource path where the established view is stored

#### getOngoingVotingsPath

    public String getOngoingVotingsPath()

Returns the resource path where ongoing votings are stored.

Returns:
  the resource path where ongoing votings are stored

#### getPreviousViewPath

    public String getPreviousViewPath()

Returns the resource path where the previous view is stored.

Returns:
  the resource path where the previous view is stored

#### getLeaderElectionRepositoryDescriptor

    public String getLeaderElectionRepositoryDescriptor()

Returns the repository descriptor key which is to be included in the cluster leader election - or null.

When set, the value (treated as a boolean) of the repository descriptor is prepended to the leader election id.

Returns:
  the repository descriptor key which is to be included in the cluster leader election - or null

#### shouldInvertRepositoryDescriptor

    public boolean shouldInvertRepositoryDescriptor()

Returns true when the value of the repository descriptor identified via the property 'leaderElectionRepositoryDescriptor' should be inverted - only applies when 'leaderElectionRepositoryDescriptor' is configured of course.

Returns:
  true when property resulting from 'leaderElectionRepositoryDescriptor' should be inverted, false if it should remain unchanged.

#### isHmacEnabled

    public boolean isHmacEnabled()

Specified by:
  `isHmacEnabled` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  true if hmac is enabled.

#### getSharedKey

    public String getSharedKey()

Specified by:
  `getSharedKey` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the shared key

#### getKeyInterval

    public long getKeyInterval()

Specified by:
  `getKeyInterval` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the interval of the shared key for hmac.

#### isEncryptionEnabled

    public boolean isEncryptionEnabled()

Specified by:
  `isEncryptionEnabled` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  true if encryption is enabled.

#### isGzipConnectorRequestsEnabled

    public boolean isGzipConnectorRequestsEnabled()

Specified by:
  `isGzipConnectorRequestsEnabled` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  true if requests on the topology connector should be gzipped (which only works if the server accepts that.. ie discovery.impl 1.0.4+)

#### isAutoStopLocalLoopEnabled

    public boolean isAutoStopLocalLoopEnabled()

Specified by:
  `isAutoStopLocalLoopEnabled` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  true if the auto-stopping of local-loop topology connectors is enabled.

#### getBackoffStandbyFactor

    public int getBackoffStandbyFactor()

Returns the backoff factor to be used for standby (loop) connectors

Specified by:
  `getBackoffStandbyFactor` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the backoff factor to be used for standby (loop) connectors

#### getBackoffStableFactor

    public int getBackoffStableFactor()

Returns the (maximum) backoff factor to be used for stable connectors

Specified by:
  `getBackoffStableFactor` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the (maximum) backoff factor to be used for stable connectors

#### getBackoffStandbyInterval

    public long getBackoffStandbyInterval()

Returns the backoff interval for standby (loop) connectors in seconds

Specified by:
  `getBackoffStandbyInterval` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`
Returns:
  the backoff interval for standby (loop) connectors in seconds

#### getConnectorPingInterval

    public long getConnectorPingInterval()

Specified by:
  `getConnectorPingInterval` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`

#### getConnectorPingTimeout

    public long getConnectorPingTimeout()

Specified by:
  `getConnectorPingTimeout` in interface `org.apache.sling.discovery.base.connectors.BaseConfig`

#### getSyncTokenPath

    public String getSyncTokenPath()

Specified by:
  `getSyncTokenPath` in interface `org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig`

#### getIdMapPath

    public String getIdMapPath()

Specified by:
  `getIdMapPath` in interface `org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig`

#### getClusterSyncServiceTimeoutMillis

    public long getClusterSyncServiceTimeoutMillis()

Specified by:
  `getClusterSyncServiceTimeoutMillis` in interface `org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig`

#### getClusterSyncServiceIntervalMillis

    public long getClusterSyncServiceIntervalMillis()

Specified by:
  `getClusterSyncServiceIntervalMillis` in interface `org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig`

#### useSyncTokenService

    public boolean useSyncTokenService()