Package io.hekate.cluster.seed.zookeeper
Class ZooKeeperSeedNodeProviderConfig
- java.lang.Object
-
- io.hekate.cluster.seed.zookeeper.ZooKeeperSeedNodeProviderConfig
-
public class ZooKeeperSeedNodeProviderConfig extends Object
Configuration forZooKeeperSeedNodeProvider
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_BASE_PATH
Default value (="/hekate/cluster") forsetBasePath(String)
.static int
DEFAULT_CLEANUP_INTERVAL
Default value (=60000) forsetCleanupInterval(int)
.static int
DEFAULT_CONNECT_TIMEOUT
Default value (=5000) forsetConnectTimeout(int)
.static int
DEFAULT_SESSION_TIMEOUT
Default value (=10000) forsetSessionTimeout(int)
.
-
Constructor Summary
Constructors Constructor Description ZooKeeperSeedNodeProviderConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBasePath()
Returns the base path to store seed nodes information in ZooKeeper (seesetBasePath(String)
).int
getCleanupInterval()
Returns the time interval in milliseconds between stale node cleanup runs (seesetCleanupInterval(int)
).String
getConnectionString()
Returns the list of ZooKeeper servers to connect to (seesetConnectionString(String)
).int
getConnectTimeout()
Returns the ZooKeeper connection timeout in milliseconds (seesetConnectTimeout(int)
).int
getSessionTimeout()
Returns the ZooKeeper session timeout in milliseconds (seesetSessionTimeout(int)
).void
setBasePath(String basePath)
Sets the base path to store seed nodes information in ZooKeeper.void
setCleanupInterval(int cleanupInterval)
Sets the time interval in milliseconds between stale node cleanup runs.void
setConnectionString(String connectionString)
Set the list of ZooKeeper servers to connect to.void
setConnectTimeout(int connectTimeout)
Sets the ZooKeeper connection timeout in milliseconds.void
setSessionTimeout(int sessionTimeout)
Sets the ZooKeeper session timeout in milliseconds.String
toString()
ZooKeeperSeedNodeProviderConfig
withBasePath(String basePath)
Fluent-style version ofsetBasePath(String)
.ZooKeeperSeedNodeProviderConfig
withCleanupInterval(int cleanupInterval)
Fluent-style version ofsetCleanupInterval(int)
.ZooKeeperSeedNodeProviderConfig
withConnectionString(String connectionString)
Fluent-style version ofsetConnectionString(String)
.ZooKeeperSeedNodeProviderConfig
withConnectTimeout(int connectTimeout)
Fluent-style version ofsetConnectTimeout(int)
.ZooKeeperSeedNodeProviderConfig
withSessionTimeout(int sessionTimeout)
Fluent-style version ofsetSessionTimeout(int)
.
-
-
-
Field Detail
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUT
Default value (=5000) forsetConnectTimeout(int)
.- See Also:
- Constant Field Values
-
DEFAULT_SESSION_TIMEOUT
public static final int DEFAULT_SESSION_TIMEOUT
Default value (=10000) forsetSessionTimeout(int)
.- See Also:
- Constant Field Values
-
DEFAULT_CLEANUP_INTERVAL
public static final int DEFAULT_CLEANUP_INTERVAL
Default value (=60000) forsetCleanupInterval(int)
.- See Also:
- Constant Field Values
-
DEFAULT_BASE_PATH
public static final String DEFAULT_BASE_PATH
Default value (="/hekate/cluster") forsetBasePath(String)
.- See Also:
- Constant Field Values
-
-
Method Detail
-
getConnectionString
public String getConnectionString()
Returns the list of ZooKeeper servers to connect to (seesetConnectionString(String)
).- Returns:
- ZooKeeper connection string.
-
setConnectionString
public void setConnectionString(String connectionString)
Set the list of ZooKeeper servers to connect to.Connection string can be specified as a comma-separated list of host:port addresses (f.e.
127.0.1:2181,127.0.01:2182
)- Parameters:
connectionString
- Comma-separated list of addresses.
-
withConnectionString
public ZooKeeperSeedNodeProviderConfig withConnectionString(String connectionString)
Fluent-style version ofsetConnectionString(String)
.- Parameters:
connectionString
- Comma-separated list of addresses.- Returns:
- This instance.
-
getConnectTimeout
public int getConnectTimeout()
Returns the ZooKeeper connection timeout in milliseconds (seesetConnectTimeout(int)
).- Returns:
- Timeout in milliseconds.
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
Sets the ZooKeeper connection timeout in milliseconds.Default value of this parameter is 5000.
- Parameters:
connectTimeout
- Timeout in milliseconds.
-
withConnectTimeout
public ZooKeeperSeedNodeProviderConfig withConnectTimeout(int connectTimeout)
Fluent-style version ofsetConnectTimeout(int)
.- Parameters:
connectTimeout
- Timeout in milliseconds.- Returns:
- This instance.
-
getSessionTimeout
public int getSessionTimeout()
Returns the ZooKeeper session timeout in milliseconds (seesetSessionTimeout(int)
).- Returns:
- Timeout in milliseconds.
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
Sets the ZooKeeper session timeout in milliseconds.Note that
ZooKeeperSeedNodeProvider
uses short-lived connection when interacting with ZooKeeper server (i.e. it creates a new connection for each operation and then closes it once operation is complete). Thus, it is not necessary to set this parameter to a large value.Default value of this parameter is 10000.
- Parameters:
sessionTimeout
- Timeout in milliseconds.
-
withSessionTimeout
public ZooKeeperSeedNodeProviderConfig withSessionTimeout(int sessionTimeout)
Fluent-style version ofsetSessionTimeout(int)
.- Parameters:
sessionTimeout
- Timeout in milliseconds.- Returns:
- This instance.
-
getBasePath
public String getBasePath()
Returns the base path to store seed nodes information in ZooKeeper (seesetBasePath(String)
).- Returns:
- Base path to store seed nodes.
-
setBasePath
public void setBasePath(String basePath)
Sets the base path to store seed nodes information in ZooKeeper.Default value of this parameter is "/hekate/cluster".
- Parameters:
basePath
- Base path to store seed nodes.
-
withBasePath
public ZooKeeperSeedNodeProviderConfig withBasePath(String basePath)
Fluent-style version ofsetBasePath(String)
.- Parameters:
basePath
- Base path to store seed nodes.- Returns:
- This instance.
-
getCleanupInterval
public int getCleanupInterval()
Returns the time interval in milliseconds between stale node cleanup runs (seesetCleanupInterval(int)
).- Returns:
- Time interval in milliseconds.
-
setCleanupInterval
public void setCleanupInterval(int cleanupInterval)
Sets the time interval in milliseconds between stale node cleanup runs.Default value of this parameter is 60000.
For more details please see the documentation of
SeedNodeProvider
.- Parameters:
cleanupInterval
- Time interval in milliseconds.- See Also:
SeedNodeProvider.cleanupInterval()
-
withCleanupInterval
public ZooKeeperSeedNodeProviderConfig withCleanupInterval(int cleanupInterval)
Fluent-style version ofsetCleanupInterval(int)
.- Parameters:
cleanupInterval
- Time interval in milliseconds.- Returns:
- This instance.
-
-