See the WebSphere eXtreme Scale Wiki for links to eXtreme Scale Version 7.0 documentation.
If you log in
with your developerWorks ID, you can leave comments and feedback for the development team.
ObjectGrid allows Java virtual machines (JVM) that are not servers to attach to the grid, and then work against the data that is stored in the grid or invoke DataGrid APIs. ObjectGrid has two kinds of clusters:
- Static (Version 6.0.2 mode for backwards compatibility)
- Dynamic (native Version 6.1 mode)
Java archive (JAR) files that are required for client
Clients need either the ogstreamquery.jar file and either the objectgrid.jar file or the ogclient.jar file on the classpath. Clients that are attaching to a dynamic grid need an IBM Software Development Kit (SDK) at Version 1.4.2 or a Java Development Kit (JDK) that is supplied by a vendor with the IBM object request broker (ORB) installed. Client that attach to static or existing grids work with any JDK at Version 1.4.2 or later.
Connecting to a dynamic grid
You should always use dynamic mode. A dynamic grid is a grid that uses a catalog service, which uses the new deployment.xml file instead of a cluster.xml file from Version 6.0.2. Clients bootstrap into a dynamic grid using the catalog service. The clients need to be configured with a subset of the end points of the catalog server instances. Suppose that you started a dynamic grid on a single machine. You started a single catalog server and two containers. The test application uses a grid called CompanyGrid. The code for a client to connect to this grid follows:
ObjectGridManager ogmgr = ObjectGridManagerFactory.getObjectGridManager();
URL objectgridxml = Thread.currentThread().getContextClassLoader().getResource("CONFIG/objectgrid.xml");
ClientClusterContext ccc = ogmgr.connect("localhost:2809", null, objectgridxml);
ObjectGrid grid = ogmgr.getObjectGrid(ccc, "CompanyGrid");
This code locates the objectgrid.xml file for the client, which is stored in the CONFIG folder on the classpath. The code then connects to the catalog server instance using the localhost:2809 host name. For fault tolerance, use two catalog server instances and both end points specified on the client, for example host1:port,host2:port.
Connecting to a static grid (legacy mode)
If you need to use static grids, then the following example shows how to connect to a static grid:
URL objectgridxml = Thread.currentThread().getContextClassLoader().getResource("reports/myobjectgrid.xml");
ClientClusterContext ccc = ObjectGridManagerFactory.getObjectGridManager().connect("ClusterName", host, port, null, objectgridxml);
ObjectGrid og = ObjectGridManagerFactory.getObjectGridManager().getObjectGrid(ccc, "MyGrid");
The variables host and port are an end point, usually port 6601, for any cluster member. The cluster name is the name that is specified in the cluster.xml file that is used to start the static grid.
Turning on trace on a client
If trace is required on a client, then add the following lines to the client before connecting to the grid:
ObjectGridManagerFactory.getObjectGridManager().setTraceSpecification("ObjectGrid*=all=enabled");
ObjectGridManagerFactory.getObjectGridManager().setTraceEnabled(true);
This code turns on all trace. Trace slows down the client dramatically.
© Copyright IBM Corporation 2007,2009. All Rights Reserved.