Class ClientConfig
- Direct Known Subclasses:
ClientClasspathXmlConfig
,ClientClasspathYamlConfig
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a flake ID generator configuration.Adds a label for this clientClient
availableaddListenerConfig
(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 newProxyFactoryConfig
addQueryCacheConfig
(String mapName, QueryCacheConfig queryCacheConfig) addReliableTopicConfig
(ClientReliableTopicConfig reliableTopicConfig) Adds a ClientReliableTopicConfig.boolean
Returns aClientFlakeIdGeneratorConfig
configuration 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 theClientFlakeIdGeneratorConfig
for the given name, creating one if necessary and adding it to the collection of known configurations.Returns the map ofFlakeIdGenerator
configurations, mapped by config name.Returns the configuration for tracking use of this Hazelcast instance.Gets list of all configuredListenerConfig
'sGets LoadBalancerGets load balancer class nameGetsManagedContext
Returns the metrics collection config.getNearCacheConfig
(String name) Gets theNearCacheConfig
configured for the map / cache with nameMap of all configured NearCacheConfig's with the name key and configuration as the valueGetsClientNetworkConfig
getOrCreateQueryCacheConfig
(String mapName, String cacheName) getOrNullQueryCacheConfig
(String mapName, String cacheName) GetsProperties
objectgetProperty
(String name) Gets a named property already set or from system properties if not exists.Gets list ofProxyFactoryConfig
getReliableTopicConfig
(String name) Gets the ClientReliableTopicConfig for a given reliable topic name.Returns the map of reliable topic configurations, mapped by config name.GetsClientSecurityConfig
object which allows client credentials configuration.GetsSerializationConfig
Returns the configuration for the SQL feature.Returns the ClientTpcConfigGet current configuration of User Code Deployment.int
hashCode()
boolean
Note that backup acks to client can be enabled only for smart client.static ClientConfig
load()
Populates HazelcastClientConfig
object from an external configuration file.setBackupAckToClientEnabled
(boolean backupAckToClientEnabled) This feature reduces number of hops and increase performance for smart 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) setCredentials
(Credentials credentials) Shortcut forgetSecurityConfig().setCredentials()
Sets the map ofFlakeIdGenerator
configurations, 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) SetsManagedContext
setMetricsConfig
(ClientMetricsConfig metricsConfig) Sets the metrics collection config.setNativeMemoryConfig
(NativeMemoryConfig nativeMemoryConfig) setNearCacheConfigMap
(Map<String, NearCacheConfig> nearCacheConfigMap) Sets allNearCacheConfig
's with the provided mapsetNetworkConfig
(ClientNetworkConfig networkConfig) SetsClientNetworkConfig
setProperties
(Properties properties) sets all propertiessetProperty
(String name, String value) Sets the value of a named property.setProxyFactoryConfigs
(List<ProxyFactoryConfig> proxyFactoryConfigs) Sets theProxyFactoryConfig
setQueryCacheConfigs
(Map<String, Map<String, QueryCacheConfig>> queryCacheConfigs) Sets the map ofClientReliableTopicConfig
, mapped by config name.setSecurityConfig
(ClientSecurityConfig securityConfig) SetsClientSecurityConfig
objectsetSerializationConfig
(SerializationConfig serializationConfig) SetsSerializationConfig
setSqlConfig
(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 HazelcastClientConfig
object 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 theMatchingPointConfigPatternMatcher
is 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 theMatchingPointConfigPatternMatcher
is 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
ClientConfig
for chaining
-
getProperties
GetsProperties
object- Returns:
Properties
object
-
setProperties
sets all properties- Parameters:
properties
-Properties
object- Returns:
- configured
ClientConfig
for chaining
-
getSecurityConfig
GetsClientSecurityConfig
object which allows client credentials configuration.- Returns:
ClientSecurityConfig
instance
-
setSecurityConfig
SetsClientSecurityConfig
object- Parameters:
securityConfig
-ClientSecurityConfig
to be set- Returns:
- configured
ClientConfig
for chaining - See Also:
-
setCredentials
Shortcut forgetSecurityConfig().setCredentials()
- Parameters:
credentials
- Credentials instance to be set- Returns:
- configured
ClientConfig
for chaining
-
getNetworkConfig
GetsClientNetworkConfig
- Returns:
ClientNetworkConfig
- See Also:
-
setNetworkConfig
SetsClientNetworkConfig
- Parameters:
networkConfig
-ClientNetworkConfig
to be set- Returns:
- configured
ClientConfig
for chaining - See Also:
-
addReliableTopicConfig
Adds a ClientReliableTopicConfig.- Parameters:
reliableTopicConfig
- the ClientReliableTopicConfig to add- Returns:
- configured
ClientConfig
for 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
ClientConfig
for chaining - See Also:
-
addListenerConfig
Helper method to add a new ListenerConfig- Parameters:
listenerConfig
- ListenerConfig- Returns:
- configured
ClientConfig
for chaining - See Also:
-
addProxyFactoryConfig
Helper method to add a newProxyFactoryConfig
- Parameters:
proxyFactoryConfig
-ProxyFactoryConfig
- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getNearCacheConfig
Gets theNearCacheConfig
configured 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
ClientConfig
for chaining
-
getFlakeIdGeneratorConfigMap
Returns the map ofFlakeIdGenerator
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
-
findFlakeIdGeneratorConfig
Returns aClientFlakeIdGeneratorConfig
configuration 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 theClientFlakeIdGeneratorConfig
for the given name, creating one if necessary and adding it to the collection of known configurations.The configuration is found by matching the the configuration name pattern to the provided
name
without 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 ofFlakeIdGenerator
configurations, 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
ClientConfig
for 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
ClientConfig
for 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
ClientConfig
for 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
ClientConfig
for chaining
-
getManagedContext
GetsManagedContext
- Returns:
ManagedContext
- See Also:
-
setManagedContext
SetsManagedContext
- Parameters:
managedContext
-ManagedContext
- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getProxyFactoryConfigs
Gets list ofProxyFactoryConfig
- Returns:
- list of
ProxyFactoryConfig
- See Also:
-
setProxyFactoryConfigs
Sets theProxyFactoryConfig
- Parameters:
proxyFactoryConfigs
- list to assign- Returns:
- configured
ClientConfig
for chaining
-
getSerializationConfig
GetsSerializationConfig
- Returns:
- SerializationConfig
- See Also:
-
setSerializationConfig
SetsSerializationConfig
- Parameters:
serializationConfig
- SerializationConfig- Returns:
- configured
ClientConfig
for 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
ClientConfig
for 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 clientClient
available- Parameters:
label
- The label to be added.- Returns:
- configured
ClientConfig
for 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
ClientConfig
for chaining
-
setUserContext
-
getUserContext
-
setBackupAckToClientEnabled
This feature reduces number of hops and increase performance for smart clients. It is enabled by default for smart clients. This config has no effect for unisocket clients.- Parameters:
backupAckToClientEnabled
- enables client to get backup acknowledgements directly from the member that backups are applied- Returns:
- configured
ClientConfig
for chaining
-
isBackupAckToClientEnabled
public boolean isBackupAckToClientEnabled()Note that backup acks to client can be enabled only for smart client. This config has no effect for unisocket clients.- Returns:
- true if backup acknowledgements comes to client
-
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
ClientConfig
for chaining - Throws:
IllegalArgumentException
- if thetpcConfig
isnull
- Since:
- 5.3
-
hashCode
public int hashCode() -
equals
-
toString
-