You can override client-side settings programmatically. Create an object.
For a list of the plug-ins and attributes that you can override on the client, see Java client overrides.
You must specify either the default map name that corresponds to your data grid name or one of the template map names. For more information about the template map names, see Dynamic map configuration options.
ObjectGridConfiguration companyGridConfig = ObjectGridConfigFactory
.createObjectGridConfiguration("CompanyGrid");
Plugin txCallbackPlugin = ObjectGridConfigFactory.createPlugin(
PluginType.TRANSACTION_CALLBACK, "com.company.MyClientTxCallback");
companyGridConfig.addPlugin(txCallbackPlugin);
Plugin ogEventListenerPlugin = ObjectGridConfigFactory.createPlugin(
PluginType.OBJECTGRID_EVENT_LISTENER, "");
companyGridConfig.addPlugin(ogEventListenerPlugin);
BackingMapConfiguration customerMapConfig = ObjectGridConfigFactory
.createBackingMapConfiguration("Customer");
customerMapConfig.setNumberOfBuckets(1429);
Plugin evictorPlugin = ObjectGridConfigFactory.createPlugin(PluginType.EVICTOR,
"com.ibm.websphere.objectgrid.plugins.builtins.LRUEvictor");
customerMapConfig.addPlugin(evictorPlugin);
companyGridConfig.addBackingMapConfiguration(customerMapConfig);
BackingMapConfiguration orderLineMapConfig = ObjectGridConfigFactory
.createBackingMapConfiguration("OrderLine");
orderLineMapConfig.setNumberOfBuckets(701);
orderLineMapConfig.setTimeToLive(800);
orderLineMapConfig.setTtlEvictorType(TTLType.LAST_ACCESS_TIME);
companyGridConfig.addBackingMapConfiguration(orderLineMapConfig);
ClientClusterContext client = ogManager.connect(catalogServerEndpoints, null, null);
ObjectGrid companyGrid = ogManager.getObjectGrid(client, objectGridName, companyGridConfig);
The ogManager instance of the ObjectGridManager interface checks for overrides only in the ObjectGridConfiguration and BackingMapConfiguration objects that you include in the overrideMap Map. For instance, the previous code overrides the number of buckets on the OrderLine Map. However, the Order map remains unchanged on the client side because no configuration for that map is included.