WebSphere eXtreme Scale Programming Guide > Access data in WebSphere eXtreme Scale > Interacting with an ObjectGrid using the ObjectGridManager



Connect to a distributed ObjectGrid


You can connect to a distributed ObjectGrid with a connection end point for the catalog service.  You must have the host name and endpoint port of the catalog server to which to connect.

In order to connect to a distributed grid, have configured the server-side environment with a catalog service and container servers.

The getObjectGrid(ClientClusterContext ccc, String objectGridName) method connects to the specified catalog service and returns a client ObjectGrid instance corresponding to a server-side ObjectGrid instance.

The following code snippet is an example of how to connect to a distributed grid.

                // Create an ObjectGridManager instance.

                ObjectGridManager ogm = ObjectGridManagerFactory.getObjectGridManager();

                // Obtain a ClientClusterContext by connecting to a catalog 
                // server based distributed ObjectGrid.  You have to provide
                // a connection end point for the catalog server in the format
                // of hostName:endPointPort.  The hostName is the machine
                // where the catalog server resides, and the endPointPort is
                // the catalog server's listening port, whose default is 2809.

                ClientClusterContext ccc = ogm.connect("localhost:2809", null, null);

                // Obtain a distributed ObjectGrid using ObjectGridManager and providing
                // the ClientClusterContext.

                ObjectGrid og = ogm.getObjectGrid(ccc, "objectgridName");



Parent topic

Interacting with an ObjectGrid using the ObjectGridManager


+

Search Tips   |   Advanced Search