Package com.clickhouse.client
Class ClickHouseLoadBalancingPolicy
java.lang.Object
com.clickhouse.client.ClickHouseLoadBalancingPolicy
- All Implemented Interfaces:
Serializable
@Deprecated
public abstract class ClickHouseLoadBalancingPolicy
extends Object
implements Serializable
Deprecated.
Load balancing policy. In general, a policy is responsible for 3 things: 1)
get node from a managed list; 2) managing node's status; and 3) optionally
schedule background tasks like node discovery and health check.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.Similar as the default policy, which always picks the first healthy node.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.Policy to pick a healthy node randomly from the list.static final StringDeprecated.Policy to pick healthy node one after another based their order in the list. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final ClickHouseNodeget(ClickHouseNodes manager) Deprecated.Gets next node available in the list.protected ClickHouseNodeget(ClickHouseNodes manager, ClickHouseNodeSelector t) Deprecated.Gets next node available in the list according to the given node selector.protected StringDeprecated.Gets a SQL query for finding all local nodes regardless which cluster it belongs to.protected StringDeprecated.Gets a parameterized SQL query for finding all local nodes of a specific cluster.protected StringDeprecated.Gets a parameterized SQL query for finding all non-local nodes in one or many clusters.protected ScheduledExecutorServiceDeprecated.Gets scheduled executor service for auto discovery and health check.Deprecated.Gets or creates singleton load balancing policy.protected ScheduledFuture<?>schedule(ScheduledFuture<?> current, Runnable task, long interval) Deprecated.Schedules thetaskto run only whencurrentrun has been completed/cancelled or does not exist.protected ClickHouseNodesuggest(ClickHouseNodes manager, ClickHouseNode server, Throwable failure) Deprecated.Sugguests a new node as replacement of the given one in order to recover from the failure, which is usually a connection error.toString()Deprecated.protected voidupdate(ClickHouseNodes manager, ClickHouseNode node, ClickHouseNode.Status status) Deprecated.Updates node status to one ofClickHouseNode.Status.
-
Field Details
-
QUERY_GET_ALL_NODES
Deprecated.- See Also:
-
QUERY_GET_CLUSTER_NODES
Deprecated.- See Also:
-
QUERY_GET_OTHER_NODES
Deprecated.- See Also:
-
FIRST_ALIVE
Deprecated.Similar as the default policy, which always picks the first healthy node. Besides, it provides scheduler for node discovery and health check.- See Also:
-
RANDOM
Deprecated.Policy to pick a healthy node randomly from the list.- See Also:
-
ROUND_ROBIN
Deprecated.Policy to pick healthy node one after another based their order in the list.- See Also:
-
-
Constructor Details
-
ClickHouseLoadBalancingPolicy
public ClickHouseLoadBalancingPolicy()Deprecated.
-
-
Method Details
-
of
Deprecated.Gets or creates singleton load balancing policy.- Parameters:
name- policy name, one ofFIRST_ALIVE,RANDOMandROUND_ROBIN, or a fully qualified class name- Returns:
- non-null load balancing policy
-
getQueryForAllLocalNodes
Deprecated.Gets a SQL query for finding all local nodes regardless which cluster it belongs to. Defaults toQUERY_GET_ALL_NODES.- Returns:
- non-null SQL query
-
getQueryForClusterLocalNodes
Deprecated.Gets a parameterized SQL query for finding all local nodes of a specific cluster. Defaults toQUERY_GET_CLUSTER_NODES.- Returns:
- non-null SQL query
-
getQueryForNonLocalNodes
Deprecated.Gets a parameterized SQL query for finding all non-local nodes in one or many clusters. Defaults toQUERY_GET_OTHER_NODES.- Returns:
- non-null SQL query
-
get
Deprecated.Gets next node available in the list.- Parameters:
manager- managed nodes- Returns:
- next node
-
get
Deprecated.Gets next node available in the list according to the given node selector.- Parameters:
manager- managed nodest- node selector- Returns:
- next node
- Throws:
IllegalArgumentException- when no node available to use
-
suggest
Deprecated.Sugguests a new node as replacement of the given one in order to recover from the failure, which is usually a connection error.- Parameters:
manager- non-null manager for finding suitable nodeserver- non-null server to replacefailure- non-null recoverable exception- Returns:
- new server, or the exact same server from input when running out of options
-
update
Deprecated.Updates node status to one ofClickHouseNode.Status.- Parameters:
manager- non-null node managernode- non-null node to updatestatus- non-null status of the node
-
getScheduler
Deprecated.Gets scheduled executor service for auto discovery and health check.- Returns:
- scheduled executor service, null will turn off auto discovery and health check
-
schedule
Deprecated.Schedules thetaskto run only whencurrentrun has been completed/cancelled or does not exist.- Parameters:
current- current task, which could be null or in running statustask- scheduled task to runinterval- interval between each run- Returns:
- future object representing the scheduled task, could be null when no
scheduler available(
getScheduler()returns null)
-
toString
Deprecated.
-