Class ClientConfig
- Direct Known Subclasses:
ClientClasspathXmlConfig,ClientClasspathYamlConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a flake ID generator configuration.Adds a label for this clientClientavailableaddListenerConfig(ListenerConfig listenerConfig) Helper method to add a new ListenerConfigaddNearCacheConfig(NearCacheConfig nearCacheConfig) Helper method to add a new NearCacheConfigaddProxyFactoryConfig(ProxyFactoryConfig proxyFactoryConfig) Helper method to add a newProxyFactoryConfigaddQueryCacheConfig(String mapName, QueryCacheConfig queryCacheConfig) addReliableTopicConfig(ClientReliableTopicConfig reliableTopicConfig) Adds a ClientReliableTopicConfig.booleanReturns aClientFlakeIdGeneratorConfigconfiguration for the given flake ID generator name.Gets the classLoaderReturns the configured cluster name.Returns the pattern matcher which is used to match item names to configuration objects.Returns theClientFlakeIdGeneratorConfigfor the given name, creating one if necessary and adding it to the collection of known configurations.Returns the map ofFlakeIdGeneratorconfigurations, mapped by config name.Returns the configuration for tracking use of this Hazelcast instance.Gets list of all configuredListenerConfig'sGets LoadBalancerGets load balancer class nameGetsManagedContextReturns the metrics collection config.getNearCacheConfig(String name) Gets theNearCacheConfigconfigured for the map / cache with nameMap of all configured NearCacheConfig's with the name key and configuration as the valueGetsClientNetworkConfiggetOrCreateQueryCacheConfig(String mapName, String cacheName) getOrNullQueryCacheConfig(String mapName, String cacheName) GetsPropertiesobjectgetProperty(String name) Gets a named property already set or from system properties if not exists.Gets list ofProxyFactoryConfiggetReliableTopicConfig(String name) Gets the ClientReliableTopicConfig for a given reliable topic name.Returns the map of reliable topic configurations, mapped by config name.GetsClientSecurityConfigobject which allows client credentials configuration.GetsSerializationConfigReturns the configuration for the SQL feature.Returns the ClientTpcConfigGet current configuration of User Code Deployment.inthashCode()booleanNote that backup acks to client can be enabled only for all members routing client.booleanReturns whether CP direct-to-leader operation sending is enabled for this client.static ClientConfigload()Populates HazelcastClientConfigobject from an external configuration file.setBackupAckToClientEnabled(boolean backupAckToClientEnabled) This feature reduces number of hops and increases performance forRoutingMode.ALL_MEMBERSrouting clients.setClassLoader(ClassLoader classLoader) Sets the classLoader which is used by serialization and listener configurationsetClusterName(String clusterName) setConfigPatternMatcher(ConfigPatternMatcher configPatternMatcher) Sets the pattern matcher which is used to match item names to configuration objects.setConnectionStrategyConfig(ClientConnectionStrategyConfig connectionStrategyConfig) setCPDirectToLeaderRoutingEnabled(boolean cpDirectToLeaderRoutingEnabled) Sets whether CP direct-to-leader operation sending is enabled.setCredentials(Credentials credentials) Shortcut forgetSecurityConfig().setCredentials()Sets the map ofFlakeIdGeneratorconfigurations, mapped by config name.setInstanceName(String instanceName) setInstanceTrackingConfig(InstanceTrackingConfig instanceTrackingConfig) Returns the configuration for tracking use of this Hazelcast instance.Set labels for the client.setListenerConfigs(List<ListenerConfig> listenerConfigs) Sets allListenerConfig'ssetLoadBalancer(LoadBalancer loadBalancer) Sets theLoadBalancer.setLoadBalancerClassName(String loadBalancerClassName) Sets load balancer class name.setManagedContext(ManagedContext managedContext) SetsManagedContextsetMetricsConfig(ClientMetricsConfig metricsConfig) Sets the metrics collection config.setNativeMemoryConfig(NativeMemoryConfig nativeMemoryConfig) setNearCacheConfigMap(Map<String, NearCacheConfig> nearCacheConfigMap) Sets allNearCacheConfig's with the provided mapsetNetworkConfig(ClientNetworkConfig networkConfig) SetsClientNetworkConfigsetProperties(Properties properties) sets all propertiessetProperty(String name, String value) Sets the value of a named property.setProxyFactoryConfigs(List<ProxyFactoryConfig> proxyFactoryConfigs) Sets theProxyFactoryConfigsetQueryCacheConfigs(Map<String, Map<String, QueryCacheConfig>> queryCacheConfigs) Sets the map ofClientReliableTopicConfig, mapped by config name.setSecurityConfig(ClientSecurityConfig securityConfig) SetsClientSecurityConfigobjectsetSerializationConfig(SerializationConfig serializationConfig) SetsSerializationConfigsetSqlConfig(ClientSqlConfig sqlConfig) Sets the configuration for the SQL feature.setTpcConfig(ClientTpcConfig tpcConfig) Sets the TpcConfigsetUserCodeDeploymentConfig(ClientUserCodeDeploymentConfig userCodeDeploymentConfig) Set User Code Deployment configurationsetUserContext(ConcurrentMap<String, Object> userContext) toString()
-
Constructor Details
-
ClientConfig
public ClientConfig() -
ClientConfig
-
-
Method Details
-
load
Populates HazelcastClientConfigobject from an external configuration file.It tries to load Hazelcast Client configuration from a list of well-known locations, and then applies overrides found in environment variables/system properties
When no location contains Hazelcast Client configuration then it returns default.
Note that the same mechanism is used when calling
HazelcastClient.newHazelcastClient().- Returns:
- ClientConfig created from a file when exists, otherwise default.
-
setConfigPatternMatcher
Sets the pattern matcher which is used to match item names to configuration objects. By default, theMatchingPointConfigPatternMatcheris used.- Parameters:
configPatternMatcher- the pattern matcher- Returns:
- this configuration
- Throws:
IllegalArgumentException- if the pattern matcher isnull
-
getConfigPatternMatcher
Returns the pattern matcher which is used to match item names to configuration objects. By default, theMatchingPointConfigPatternMatcheris used.- Returns:
- the pattern matcher
-
getProperty
Gets a named property already set or from system properties if not exists.- Parameters:
name- property name- Returns:
- value of the property
-
setProperty
Sets the value of a named property.- Parameters:
name- property namevalue- value of the property- Returns:
- configured
ClientConfigfor chaining
-
getProperties
GetsPropertiesobject- Returns:
Propertiesobject
-
setProperties
sets all properties- Parameters:
properties-Propertiesobject- Returns:
- configured
ClientConfigfor chaining
-
getSecurityConfig
GetsClientSecurityConfigobject which allows client credentials configuration.- Returns:
ClientSecurityConfiginstance
-
setSecurityConfig
SetsClientSecurityConfigobject- Parameters:
securityConfig-ClientSecurityConfigto be set- Returns:
- configured
ClientConfigfor chaining - See Also:
-
setCredentials
Shortcut forgetSecurityConfig().setCredentials()- Parameters:
credentials- Credentials instance to be set- Returns:
- configured
ClientConfigfor chaining
-
getNetworkConfig
GetsClientNetworkConfig- Returns:
ClientNetworkConfig- See Also:
-
setNetworkConfig
SetsClientNetworkConfig- Parameters:
networkConfig-ClientNetworkConfigto be set- Returns:
- configured
ClientConfigfor chaining - See Also:
-
addReliableTopicConfig
Adds a ClientReliableTopicConfig.- Parameters:
reliableTopicConfig- the ClientReliableTopicConfig to add- Returns:
- configured
ClientConfigfor chaining
-
getReliableTopicConfig
Gets the ClientReliableTopicConfig for a given reliable topic name.- Parameters:
name- the name of the reliable topic- Returns:
- the found config. If none is found, a default configured one is returned.
-
addNearCacheConfig
Helper method to add a new NearCacheConfig- Parameters:
nearCacheConfig-NearCacheConfig- Returns:
- configured
ClientConfigfor chaining - See Also:
-
addListenerConfig
Helper method to add a new ListenerConfig- Parameters:
listenerConfig- ListenerConfig- Returns:
- configured
ClientConfigfor chaining - See Also:
-
addProxyFactoryConfig
Helper method to add a newProxyFactoryConfig- Parameters:
proxyFactoryConfig-ProxyFactoryConfig- Returns:
- configured
ClientConfigfor chaining - See Also:
-
getNearCacheConfig
Gets theNearCacheConfigconfigured for the map / cache with name- Parameters:
name- name of the map / cache- Returns:
- Configured
NearCacheConfig - See Also:
-
getNearCacheConfigMap
Map of all configured NearCacheConfig's with the name key and configuration as the value- Returns:
- map of NearCacheConfig
- See Also:
-
setNearCacheConfigMap
Sets allNearCacheConfig's with the provided map- Parameters:
nearCacheConfigMap- map of (name,NearCacheConfig)- Returns:
- configured
ClientConfigfor chaining
-
getFlakeIdGeneratorConfigMap
Returns the map ofFlakeIdGeneratorconfigurations, mapped by config name. The config name may be a pattern with which the configuration was initially obtained.- Returns:
- the map configurations mapped by config name
-
findFlakeIdGeneratorConfig
Returns aClientFlakeIdGeneratorConfigconfiguration for the given flake ID generator name.The name is matched by pattern to the configuration and by stripping the partition ID qualifier from the given
name. If there is no config found by the name, it will return the configuration with the name"default".- Parameters:
name- name of the flake ID generator config- Returns:
- the flake ID generator configuration
- Throws:
InvalidConfigurationException- if ambiguous configurations are found- See Also:
-
getFlakeIdGeneratorConfig
Returns theClientFlakeIdGeneratorConfigfor the given name, creating one if necessary and adding it to the collection of known configurations.The configuration is found by matching the configuration name pattern to the provided
namewithout the partition qualifier (the part of the name after'@'). If no configuration matches, it will create one by cloning the"default"configuration and add it to the configuration collection.This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking
addFlakeIdGeneratorConfig(ClientFlakeIdGeneratorConfig).Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored.
- Parameters:
name- name of the flake ID generator config- Returns:
- the cache configuration
- Throws:
InvalidConfigurationException- if ambiguous configurations are found- See Also:
-
addFlakeIdGeneratorConfig
Adds a flake ID generator configuration. The configuration is saved under the config name, which may be a pattern with which the configuration will be obtained in the future.- Parameters:
config- the flake ID configuration- Returns:
- this config instance
-
setFlakeIdGeneratorConfigMap
Sets the map ofFlakeIdGeneratorconfigurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future.- Parameters:
map- the FlakeIdGenerator configuration map to set- Returns:
- this config instance
-
setReliableTopicConfigMap
Sets the map ofClientReliableTopicConfig, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future.- Parameters:
map- the FlakeIdGenerator configuration map to set- Returns:
- this config instance
-
getReliableTopicConfigMap
Returns the map of reliable topic configurations, mapped by config name. The config name may be a pattern with which the configuration was initially obtained.- Returns:
- the map configurations mapped by config name
-
getListenerConfigs
Gets list of all configuredListenerConfig's- Returns:
ListenerConfig- See Also:
-
setListenerConfigs
Sets allListenerConfig's- Parameters:
listenerConfigs- list ofListenerConfig- Returns:
- configured
ClientConfigfor chaining - See Also:
-
getLoadBalancer
Gets LoadBalancer- Returns:
- LoadBalancer
- See Also:
-
setLoadBalancer
Sets theLoadBalancer.If a load balancer class name was set, it will be removed.
- Parameters:
loadBalancer-LoadBalancer- Returns:
- configured
ClientConfigfor chaining - See Also:
-
getLoadBalancerClassName
Gets load balancer class name- Returns:
- load balancer class name
- See Also:
-
setLoadBalancerClassName
Sets load balancer class name.If a load balancer implementation was set, it will be removed.
- Parameters:
loadBalancerClassName-LoadBalancer- Returns:
- configured
ClientConfigfor chaining - See Also:
-
getClassLoader
Gets the classLoader- Returns:
- configured classLoader, null if not yet configured
-
setClassLoader
Sets the classLoader which is used by serialization and listener configuration- Parameters:
classLoader- the classLoader- Returns:
- configured
ClientConfigfor chaining
-
getManagedContext
GetsManagedContext- Returns:
ManagedContext- See Also:
-
setManagedContext
SetsManagedContext- Parameters:
managedContext-ManagedContext- Returns:
- configured
ClientConfigfor chaining - See Also:
-
getProxyFactoryConfigs
Gets list ofProxyFactoryConfig- Returns:
- list of
ProxyFactoryConfig - See Also:
-
setProxyFactoryConfigs
Sets theProxyFactoryConfig- Parameters:
proxyFactoryConfigs- list to assign- Returns:
- configured
ClientConfigfor chaining
-
getSerializationConfig
GetsSerializationConfig- Returns:
- SerializationConfig
- See Also:
-
setSerializationConfig
SetsSerializationConfig- Parameters:
serializationConfig- SerializationConfig- Returns:
- configured
ClientConfigfor chaining - See Also:
-
getNativeMemoryConfig
-
setNativeMemoryConfig
-
addQueryCacheConfig
-
getQueryCacheConfigs
-
setQueryCacheConfigs
public ClientConfig setQueryCacheConfigs(Map<String, Map<String, QueryCacheConfig>> queryCacheConfigs) -
getInstanceName
-
setInstanceName
-
getClusterName
Returns the configured cluster name. The name is sent as part of client authentication message and may be verified on the member.- Returns:
- the configured cluster name
-
setClusterName
-
getConnectionStrategyConfig
-
setConnectionStrategyConfig
public ClientConfig setConnectionStrategyConfig(ClientConnectionStrategyConfig connectionStrategyConfig) -
getUserCodeDeploymentConfig
Get current configuration of User Code Deployment.- Returns:
- User Code Deployment configuration
- Since:
- 3.9
-
setUserCodeDeploymentConfig
public ClientConfig setUserCodeDeploymentConfig(ClientUserCodeDeploymentConfig userCodeDeploymentConfig) Set User Code Deployment configuration- Parameters:
userCodeDeploymentConfig- the configuration of User Code Deployment- Returns:
- configured
ClientConfigfor chaining - Since:
- 3.9
-
getOrCreateQueryCacheConfig
- Parameters:
mapName- The name of the map for which the query cache config is to be returned.cacheName- The name of the query cache.- Returns:
- The query cache config. If the config does not exist, it is created.
-
getOrNullQueryCacheConfig
- Parameters:
mapName- The name of the map for which the query cache config is to be returned.cacheName- The name of the query cache.- Returns:
- The query cache config. If no such config exist null is returned.
-
addLabel
Adds a label for this clientClientavailable- Parameters:
label- The label to be added.- Returns:
- configured
ClientConfigfor chaining
-
getLabels
- Returns:
- all the labels assigned to this client
-
setLabels
Set labels for the client. Deletes old labels if added earlier.- Parameters:
labels- The labels to be set- Returns:
- configured
ClientConfigfor chaining
-
setUserContext
-
getUserContext
-
setBackupAckToClientEnabled
This feature reduces number of hops and increases performance forRoutingMode.ALL_MEMBERSrouting clients. It is enabled by default forRoutingMode.ALL_MEMBERSrouting clients. This config has no effect forRoutingMode.MULTI_MEMBERorRoutingMode.SINGLE_MEMBERrouting clients.- Parameters:
backupAckToClientEnabled- enables client to get backup acknowledgements directly from the member that backups are applied- Returns:
- configured
ClientConfigfor chaining
-
isBackupAckToClientEnabled
public boolean isBackupAckToClientEnabled()Note that backup acks to client can be enabled only for all members routing client. This config has no effect for single member or multi member clients.- Returns:
truemeans backup acknowledgements come to client, otherwisefalseindicates that acknowledgements go to members
-
getMetricsConfig
Returns the metrics collection config. -
setMetricsConfig
Sets the metrics collection config. -
getInstanceTrackingConfig
Returns the configuration for tracking use of this Hazelcast instance. -
setInstanceTrackingConfig
@Nonnull public ClientConfig setInstanceTrackingConfig(@Nonnull InstanceTrackingConfig instanceTrackingConfig) Returns the configuration for tracking use of this Hazelcast instance. -
getSqlConfig
Returns the configuration for the SQL feature.- Since:
- 5.2
-
setSqlConfig
Sets the configuration for the SQL feature.- Since:
- 5.2
-
getTpcConfig
Returns the ClientTpcConfig- Returns:
- the ClientTpcConfig
- Since:
- 5.3
-
setTpcConfig
Sets the TpcConfig- Parameters:
tpcConfig- TpcConfig to set- Returns:
- configured
ClientConfigfor chaining - Throws:
IllegalArgumentException- if thetpcConfigisnull- Since:
- 5.3
-
isCPDirectToLeaderRoutingEnabled
public boolean isCPDirectToLeaderRoutingEnabled()Returns whether CP direct-to-leader operation sending is enabled for this client. This functionality requires Hazelcast Enterprise license components. The default setting isfalse.- Returns:
trueif CP direct-to-leader operation sending is enabled, otherwisefalse- Since:
- 5.5
-
setCPDirectToLeaderRoutingEnabled
Sets whether CP direct-to-leader operation sending is enabled. SeeisCPDirectToLeaderRoutingEnabled().- Parameters:
cpDirectToLeaderRoutingEnabled- the boolean value to set- Returns:
- configured
ClientConfigfor chaining - Since:
- 5.5
-
hashCode
public int hashCode() -
equals
-
toString
-