Bug #8123

portal hazelcast client should load config directly from xml

Added by Dave Vieglais almost 5 years ago. Updated over 4 years ago.

Target version:
Start date:
Due date:
% Done:


Product Version:
Story Points:


The hazelcast client for the portal is selectively pulling config values from the configuration file after loading with FileSystemXmlConfig and adding them to a hand crafted ClientConfig instance. Instead, the client should be initiated with the config loaded directly form the XML file since FileSystemXmlConfig is a subclass of ClientConfig.

This will ensure that configuration properties of the hazelcast client can be easily set without changing the code.

In the current version, only address, user, and password are being set - all other configuration is being ignored.


#1 Updated by Rob Nahf almost 5 years ago

in Hz 2.4.1 (, FileSystemXmlConfig is not a subclass of ClientConfig, but Config. Using (the underdocumented) ClientConfigBuilder, however, may be the way to instantiate a ClientConfig object from an xml file.

In v3.0, ClientConfigBuilder goes away and XMLClientConfigBuilder appears, and there's a manual: (

If you want to specify your own configuration file to create a Config object, the Hazelcast client supports the following.

Config cfg = new XmlClientConfigBuilder(xmlFileName).build();

Config cfg = new XmlClientConfigBuilder(inputStream).build();

#2 Updated by Rob Nahf almost 5 years ago

the ClientConfigBuilder is not made for XML, but for reading .properties files. The newer hazelcast-client definition ( doesn't come into existence until v3.0, which would require a bigger refactor. (

#3 Updated by Rob Nahf almost 5 years ago

  • Status changed from New to In Progress
  • Assignee changed from Jing Tao to Rob Nahf
  • % Done changed from 0 to 30

#4 Updated by Rob Nahf almost 5 years ago

From dave, the issue was discovered while trying to deal with failed client reconnects. So the issue is making sure Hz 2.x has enough power to deal with these issues. Documentation about the client config properties is limited, but I found the 2.4 source code:

public class ClientConfigBuilder {

private static final ILogger logger = Logger.getLogger(ClientConfigBuilder.class.getName());

public final static String GROUP_NAME = "";
public final static String GROUP_PASS = "";
public final static String CONNECTION_TIMEOUT = "hazelcast.client.connection.timeout";
public final static String CONNECTION_ATTEMPT_LIMIT = "hazelcast.client.connection.attempts.limit";
public final static String RECONNECTION_TIMEOUT = "hazelcast.client.reconnection.timeout";
public final static String RECONNECTION_ATTEMPT_LIMIT = "hazelcast.client.reconnection.attempts.limit";
public final static String SHUFFLE_ADDRESSES = "hazelcast.client.shuffle.addresses";
public final static String UPDATE_AUTOMATIC = "hazelcast.client.update.automatic";
public final static String ADDRESSES = "hazelcast.client.addresses";

So this is what we have to work with - looks like enough.

The hazelcast-client.xml file is in cn-buildout/dataone-cn-portal, so we will need to change this file formal from XML to simple .properties file, and make it available for d1_portal_servlet.

Below are the defaults:

public class ClientConfig {

private GroupConfig groupConfig = new GroupConfig();
private final List<InetSocketAddress> addressList = new ArrayList<InetSocketAddress>(10);
private Credentials credentials;
private int connectionTimeout = 30000;
private int initialConnectionAttemptLimit = 1;
private int reconnectionAttemptLimit = 1;
private int reConnectionTimeOut = 5000;
private boolean shuffle = false;
private boolean updateAutomatic = true;
private SocketInterceptor socketInterceptor = null;

#5 Updated by Rob Nahf almost 5 years ago

  • Status changed from In Progress to Testing
  • % Done changed from 30 to 50

in 2.3 branch (portal-servlet and dataonc-cn-portal), changed the hazelcast-client.xml to, and set reconnection parameters of 10sec / 10x similar to

These reconnection values should be played with in sandbox...

#6 Updated by Jing Tao over 4 years ago

  • Target version changed from CCI-2.3.6 to CCI-2.3.7

#7 Updated by Dave Vieglais over 4 years ago

  • Sprint set to CCI-2.3.7

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)