Package com.hazelcast.config
Class AdvancedNetworkConfig
java.lang.Object
com.hazelcast.config.AdvancedNetworkConfig
Similar to
NetworkConfig with the additional ability to define multiple
endpoints, each with its own separate protocol/security and/or socket properties.
When enabled, this configuration takes precedence over NetworkConfig.
Advanced networking is disabled by default.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMember endpoint decorated as aNetworkConfigFacade used during bootstrap to hide if-logic between the two networking configuration approaches -
Constructor Summary
ConstructorsConstructorDescriptionCreates a disabled advanced network configuration with a defaultMEMBERserver socket endpoint. -
Method Summary
Modifier and TypeMethodDescriptionaddWanEndpointConfig(EndpointConfig endpointConfig) Adds the given WANEndpointConfigto the endpoints configuration.booleanMap<com.hazelcast.instance.EndpointQualifier,EndpointConfig> Returns the endpoint configurations keyed by theirEndpointQualifier.Returns the currentIcmpFailureDetectorConfig.getJoin()Returns theJoinConfig.Returns the configuration for the provider of the member's bind and public addresses.Returns the server socket endpoint configuration for theRESTprotocol.inthashCode()booleanReturns whether advanced networking is enabled.setClientEndpointConfig(ServerSocketEndpointConfig serverSocketEndpointConfig) Sets the server socket endpoint config forCLIENTprotocol.setEnabled(boolean enabled) Enables or disables advanced networking.setEndpointConfigs(Map<com.hazelcast.instance.EndpointQualifier, EndpointConfig> endpointConfigs) Replaces all endpoint configurations with the entries in the given map.setIcmpFailureDetectorConfig(IcmpFailureDetectorConfig icmpFailureDetectorConfig) Sets theIcmpFailureDetectorConfig.setJoin(JoinConfig join) Sets the configuration that defines how this member discovers and joins the cluster.setMemberAddressProviderConfig(MemberAddressProviderConfig memberAddressProviderConfig) Sets the configuration for the provider of the member's bind and public addresses.setMemberEndpointConfig(ServerSocketEndpointConfig serverSocketEndpointConfig) Sets the server socket endpoint config forMEMBERprotocol.setMemcacheEndpointConfig(ServerSocketEndpointConfig memcacheEndpointConfig) Sets the server socket endpoint config formemcacheprotocol.setRestEndpointConfig(RestServerEndpointConfig restServerEndpointConfig) Deprecated, for removal: This API element is subject to removal in a future version.use RestConfig instead.toString()
-
Constructor Details
-
AdvancedNetworkConfig
public AdvancedNetworkConfig()Creates a disabled advanced network configuration with a defaultMEMBERserver socket endpoint.
-
-
Method Details
-
getMemberAddressProviderConfig
Returns the configuration for the provider of the member's bind and public addresses.- Returns:
- the member address provider configuration
-
setMemberAddressProviderConfig
public AdvancedNetworkConfig setMemberAddressProviderConfig(MemberAddressProviderConfig memberAddressProviderConfig) Sets the configuration for the provider of the member's bind and public addresses.- Parameters:
memberAddressProviderConfig- the member address provider configuration- Returns:
- this object for fluent chaining
-
addWanEndpointConfig
Adds the given WANEndpointConfigto the endpoints configuration. When the argument is anEndpointConfig, then it configures network settings for the client side of outgoing network connections opened from that member. When the providedendpointconfigis aServerSocketEndpointConfig, then theHazelcastInstancewill additionally listen on the configured port for incoming WAN connections.Example of how to configure Hazelcast instances for active-passive WAN replication:
-
On the passive side, configure the Hazelcast instance to listen on port 8765 with SSL enabled:
Config config = new Config(); ServerSocketEndpointConfig wanServerSocketConfig = new ServerSocketEndpointConfig().setPort(8765); // setup SSL config etc wanServerSocketConfig.getSSLConfig() .setEnabled(true) .setFactoryImplementation(new OpenSSLEngineFactory()); config.getAdvancedNetworkConfig() .setEnabled(true) .addWanEndpointConfig(wanServerSocketConfig); HazelcastInstance passive = Hazelcast.newHazelcastInstance(config); -
On the active side, configure the client-side of outgoing connections with SSL:
Config config = new Config(); EndpointConfig wanEndpointConfig = new EndpointConfig().setName("wan-tokyo"); wanEndpointConfig.getSSLConfig() .setEnabled(true) .setFactoryImplementation(new OpenSSLEngineFactory()); config.getAdvancedNetworkConfig() .setEnabled(true) .addWanEndpointConfig(wanEndpointConfig); // setup WAN replication WanReplicationConfig wanReplicationConfig = new WanReplicationConfig(); // WAN publisher config references endpoint config by name WanBatchReplicationPublisherConfig publisherConfig = new WanBatchReplicationPublisherConfig() .setEndpoint("wan-tokyo") .setTargetEndpoints("tokyo.hazelcast.com:8765"); wanReplicationConfig.addWanBatchReplicationPublisherConfig(publisherConfig); config.addWanReplicationConfig(wanReplicationConfig); HazelcastInstance active = Hazelcast.newHazelcastInstance(config);
- Parameters:
endpointConfig- the endpoint configuration to add- Returns:
- this object for fluent chaining
-
On the passive side, configure the Hazelcast instance to listen on port 8765 with SSL enabled:
-
setMemberEndpointConfig
public AdvancedNetworkConfig setMemberEndpointConfig(ServerSocketEndpointConfig serverSocketEndpointConfig) Sets the server socket endpoint config forMEMBERprotocol. If anotherServerSocketEndpointConfigwas previously set, it will be replaced. When starting a Hazelcast instance withAdvancedNetworkConfigenabled, its configuration must include oneServerSocketEndpointConfigfor protocol typeMEMBER.- Parameters:
serverSocketEndpointConfig- the server socket endpoint configuration- Returns:
- this object for fluent chaining
-
setClientEndpointConfig
public AdvancedNetworkConfig setClientEndpointConfig(ServerSocketEndpointConfig serverSocketEndpointConfig) Sets the server socket endpoint config forCLIENTprotocol. If anotherServerSocketEndpointConfigwas previously set, it will be replaced. When starting a Hazelcast instance withAdvancedNetworkConfigenabled, its configuration may include at most oneServerSocketEndpointConfigfor protocol typeCLIENT.- Parameters:
serverSocketEndpointConfig- the server socket endpoint configuration- Returns:
- this object for fluent chaining
-
setRestEndpointConfig
@Deprecated(since="5.5", forRemoval=true) public AdvancedNetworkConfig setRestEndpointConfig(RestServerEndpointConfig restServerEndpointConfig) Deprecated, for removal: This API element is subject to removal in a future version.use RestConfig instead. Will be removed at 6.0.Sets the server socket endpoint config forRESTprotocol. If anotherServerSocketEndpointConfigwas previously set, it will be replaced. When starting a Hazelcast instance withAdvancedNetworkConfigenabled, its configuration may include at most oneServerSocketEndpointConfigfor protocol typeREST.- Parameters:
restServerEndpointConfig- the server socket endpoint configuration- Returns:
- this object for fluent chaining
- See Also:
-
setMemcacheEndpointConfig
public AdvancedNetworkConfig setMemcacheEndpointConfig(ServerSocketEndpointConfig memcacheEndpointConfig) Sets the server socket endpoint config formemcacheprotocol. If anotherServerSocketEndpointConfigwas previously set, it will be replaced.- Parameters:
memcacheEndpointConfig- the server socket endpoint configuration- Returns:
- this object for fluent chaining
-
getEndpointConfigs
Returns the endpoint configurations keyed by theirEndpointQualifier.- Returns:
- the endpoint configurations
-
setEndpointConfigs
public AdvancedNetworkConfig setEndpointConfigs(Map<com.hazelcast.instance.EndpointQualifier, EndpointConfig> endpointConfigs) Replaces all endpoint configurations with the entries in the given map. Each endpoint's protocol type is set to the type of its correspondingEndpointQualifier. The endpoint configurations themselves are not copied.- Parameters:
endpointConfigs- the endpoint configurations keyed by their qualifiers- Returns:
- this object for fluent chaining
- Throws:
InvalidConfigurationException- if the number of endpoints for a protocol exceeds its allowed server socket count
-
isEnabled
public boolean isEnabled()Returns whether advanced networking is enabled.- Returns:
trueif advanced networking is enabled,falseotherwise
-
setEnabled
Enables or disables advanced networking. When enabled, this configuration takes precedence overConfig.getNetworkConfig().- Parameters:
enabled-trueto enable advanced networking,falseto disable it- Returns:
- this object for fluent chaining
-
getJoin
Returns theJoinConfig.- Returns:
- the join
-
setJoin
Sets the configuration that defines how this member discovers and joins the cluster.- Parameters:
join- the join configuration- Returns:
- this object for fluent chaining
-
setIcmpFailureDetectorConfig
public AdvancedNetworkConfig setIcmpFailureDetectorConfig(IcmpFailureDetectorConfig icmpFailureDetectorConfig) Sets theIcmpFailureDetectorConfig. The value can benullif this detector isn't needed.- Parameters:
icmpFailureDetectorConfig- the IcmpFailureDetectorConfig to set- Returns:
- this object for fluent chaining
- See Also:
-
getIcmpFailureDetectorConfig
Returns the currentIcmpFailureDetectorConfig. It is possible that null is returned if no IcmpFailureDetectorConfig has been set.- Returns:
- the IcmpFailureDetectorConfig
- See Also:
-
getRestEndpointConfig
Returns the server socket endpoint configuration for theRESTprotocol.- Returns:
- the REST endpoint configuration, or
nullif none has been configured - See Also:
-
toString
-
equals
-
hashCode
public int hashCode()
-