You can use an ObjectGrid configuration XML file to override settings on the client side.
To change the settings on a WebSphere® eXtreme Scale client, create an ObjectGrid XML file that is similar in structure to the file that was used for the container server.
For a list of the plug-ins and attributes that you can override on the client, see Java client overrides.
companyGridServerSide.xml
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="CompanyGrid">
<bean id="TransactionCallback"
className="com.company.MyTxCallback" />
<bean id="ObjectGridEventListener"
className="com.company.MyOgEventListener" />
<backingMap name="Customer"
pluginCollectionRef="customerPlugins" />
<backingMap name="Item" />
<backingMap name="OrderLine" numberOfBuckets="1049"
timeToLive="1600" ttlEvictorType="LAST_ACCESS_TIME" />
<backingMap name="Order" lockStrategy="PESSIMISTIC"
pluginCollectionRef="orderPlugins" />
</objectGrid>
</objectGrids>
<backingMapPluginCollections>
<backingMapPluginCollection id="customerPlugins">
<bean id="Evictor"
className="com.ibm.websphere.objectGrid.plugins.builtins.LRUEvictor" />
<bean id="MapEventListener"
className="com.company.MyMapEventListener" />
</backingMapPluginCollection>
<backingMapPluginCollection id="orderPlugins">
<bean id="MapIndexPlugin"
className="com.company.MyMapIndexPlugin" />
</backingMapPluginCollection>
</backingMapPluginCollections>
</objectGridConfig>
On a container server, the ObjectGrid
instance named CompanyGrid behaves as defined by the companyGridServerSide.xml file. By default, the CompanyGrid client has the same settings
as the CompanyGrid instance that is running on the server. The following
ObjectGrid XML file can be used to specify some of the attributes
and plug-ins on the CompanyGrid client:companyGridClientSide.xml
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="CompanyGrid">
<bean id="TransactionCallback"
className="com.company.MyClientTxCallback" />
<bean id="ObjectGridEventListener" className="" />
<backingMap name="Customer" numberOfBuckets="1429"
pluginCollectionRef="customerPlugins" />
<backingMap name="Item" />
<backingMap name="OrderLine" numberOfBuckets="701"
timeToLive="800" ttlEvictorType="LAST_ACCESS_TIME" />
<backingMap name="Order" lockStrategy="PESSIMISTIC"
pluginCollectionRef="orderPlugins" />
</objectGrid>
</objectGrids>
<backingMapPluginCollections>
<backingMapPluginCollection id="customerPlugins">
<bean id="Evictor"
className="com.ibm.websphere.objectGrid.plugins.builtins.LRUEvictor" />
<bean id="MapEventListener" className="" />
</backingMapPluginCollection>
<backingMapPluginCollection id="orderPlugins">
<bean id="MapIndexPlugin"
className="com.company.MyMapIndexPlugin" />
</backingMapPluginCollection>
</backingMapPluginCollections>
</objectGridConfig>
To create the CompanyGrid client with the companyGridClientSide.xml file, pass the ObjectGrid XML file as a URL to one of the connect methods on the ObjectGridManager interface:
ObjectGridManager ogManager =
ObjectGridManagerFactory.ObjectGridManager();
ClientClusterContext clientClusterContext =
ogManager.connect("MyServer1.company.com:2809", null, new URL(
"file:xml/companyGridClientSide.xml"));