ObjectGrid 構成 XML ファイルを使用して、クライアント・サイドの設定を変更できます。
WebSphere® eXtreme Scale クライアントの設定を 変更するには、コンテナー・サーバーに使用したファイルと似た構造の ObjectGrid XML ファイルを作成する必要があります。
以下の XML ファイルがデプロイメント・ポリシー XML ファイルと対になっており、これらのファイルを使用してコンテナー・サーバーが開始されたものと想定します。
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>
コンテナー・サーバーでは、CompanyGrid という名前の ObjectGrid インスタンスが companyGridServerSide.xml ファイルによる 定義に従って動作します。デフォルトでは CompanyGrid クライアントの設定は、サーバーで実行している CompanyGrid インスタンスの設定と同じです。
以下の ObjectGrid XML ファイルを使用すると、CompanyGrid クライアントの属性およびプラグインのいくつかを指定できます。
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>
companyGridClientSide.xml ファイルを使用して CompanyGrid クライアントを 作成するには、ObjectGrid XML ファイルを URL として、ObjectGridManager インターフェースの いずれかの connect メソッドに渡します。
ObjectGridManager ogManager =
ObjectGridManagerFactory.ObjectGridManager();
ClientClusterContext clientClusterContext =
ogManager.connect("MyServer1.company.com:2809", null, new URL(
"file:xml/companyGridClientSide.xml"));