This package contains the primary interfaces and classes for setting behaviors for ObjectGrid clients for this process.

Overview

The interfaces in this package should not be implemented directly but are used by the {@link com.ibm.websphere.objectgrid.ClientClusterContext} to set default behaviors for application clients for an ObjectGrid instance.

The properties available for use are defined in the {@link com.ibm.websphere.objectgrid.client.ClientProperties} interface.

There are two ways to configure client properties:

  1. Create a properties file named objectGridClient.properties and store it in the root of your classpath.
  2. Create a properties file on your file system in the directory where the client is started from named objectGridClient.properties.
  3. Create a properties file with any path and name and use the following system property to detect it: -Dcom.ibm.websphere.objectgrid.ClientProperties=<fileName>
  4. Create a properties file with any path and name and set load it programmatically and pass url to ClientClusterContext.getClientProperties(ogname, url).
  5. Programmatically define the properties the ClientProperties set methods.
In the following example we set the proximity routing defaults for all clients that use this ClientClusterContext:
    ObjectGridManager ogMgr = ObjectGridManagerFactory.getObjectGridManager();
    ClientClusterContext ccc = ogMgr.connect(...);
    ClientProperties props = ccc.getClientProperties("myOGName");
    props.setPreferLocalHost(true);
    props.setPreferLocalProcess(true);
    props.setPreferZones(new String[]{"New York", "Texas"});

    // The ClientProperites are now applied to the ObjectGrid client connection:
    ObjectGrid og=ogMgr.get(ccc, "myOGName");
The following example uses a custom client properties file:
    ClientClusterContext ccc = ogMgr.connect(...);
    URL clientPropsURL = Thread.currentThread().getContextClassLoader().getResource("etc/myObjectGridClient.properties");
    ClientProperties props = ccc.setClientProperties("myOGName", clientPropsURL);

    // The ClientProperites are now applied to the ObjectGrid client connection:
    ObjectGrid og=ogMgr.get(ccc, "myOGName");
The following file is an example of a properties file that matches the proceeding API:
    preferLocalProcess=true
    preferLocalhost=true
    preferZones=New York,Texas