IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
    
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerworks > My developerWorks >  Dashboard > WebSphere eXtreme Scale V6.1 User Guide > ... > Programming the ObjectGrid > Embedded server API
developerWorks
Log In   View a printable version of the current page.
Overview Connect Spaces Forums Wikis
Embedded server API
Added by dcberg, last edited by saif.patel@us.ibm.com on Jan 26, 2009  (view change)
Labels: 
(None)

Getting Started Examples Reference API documentation

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.

Issue the ServerFactory.getInstance method so that any JVM can host the ObjectGrid server run time. This method returns the server singleton and starts the server run time. You must set the server properties before you issue the getInstance method. Otherwise, any modifications that you make after you issue the method do not affect the run time.

Instantiating the ObjectGrid Server
Server server = ServerFactory.getInstance();

You can use several properties to configure the ObjectGrid server instance, which you can retrieve from the ServerFactory.getServerProperties method. The ServerProperties object is a singleton, therefore, each call to the getServerProperties method retrieves the same instance. All properties set at the first invocation of getInstance are used to initialize the server.

Setting Server Properties

You can set the server properties until the ServerFactory.getInstance is called for the first time. The first call of the getInstance method instantiates the ObjectGrid server, and reads all the configured properties. Setting the properties after creation has no effect.

Setting Properties for Embedded ObjectGrid Server
// Get the server properties associated with this process.
ServerProperties serverProperties = ServerFactory.getServerProperties();

// Set the server name for this process.
serverProperties.setServerName("EmbeddedServerA");

// Set the name of the zone this process is contained in.
serverProperties.setZoneName("EmbeddedZone1");

// Set the end point information required to bootstrap to the catalog service.
serverProperties.setCatalogServiceBootstrap("localhost:2809");

// Set the ORB listener host name to use to bind to.
serverProperties.setListenerHost("host.local.domain");

// Set the ORB listener port to use to bind to.
serverProperties.setListenerPort(9010);

// Turn off all MBeans for this process.
serverProperties.setMBeansEnabled(false);

Server server = ServerFactory.getInstance();

Embedding the catalog service

Any JVM setting that is flagged by the CatalogServerProperties.setCatalogServer method can host the catalog service for ObjectGrid. This method indicates to the ObjectGrid server run time to instantiate the catalog service when the server is started.

Instantiating the ObjectGrid Catalog Server
CatalogServerProperties catalogServerProperties = ServerFactory.getCatalogProperties();
catalogServerProperties.setCatalogServer(true);

Server server = ServerFactory.getInstance();

Embedding the ObjectGrid container

Issue the Server.createContainer method for any JVM to host multiple ObjectGrid containers.

Instantiating an ObjectGrid Container
Server server = ServerFactory.getInstance();
DeploymentPolicy policy = DeploymentPolicyFactory.createDeploymentPolicy(
    new File("META-INF/embeddedDeploymentPolicy.xml").toURL(),
    new File("META-INF/embeddedObjectGrid.xml").toURL());
Container container = server.createContainer(policy);

Self-contained server process

You can start all the services together, which is useful for development and practical in production. By starting the services together, a single process starts the catalog service, and some set of containers and run client connection logic, to sort out programming issues prior to deploying in a distributed environment.

Instantiating a Self Contained ObjectGrid Server
CatalogServerProperties catalogServerProperties = ServerFactory.getCatalogProperties();
catalogServerProperties.setCatalogServer(true);

Server server = ServerFactory.getInstance();
DeploymentPolicy policy = DeploymentPolicyFactory.createDeploymentPolicy(
    new File("META-INF/embeddedDeploymentPolicy.xml").toURL(),
    new File("META-INF/embeddedObjectGrid.xml").toURL());
Container container = server.createContainer(policy);

Embedding ObjectGrid in WebSphere Application Server

The configuration for ObjectGrid is set up automatically when you install WebSphere Extended Deployment DataGrid in a WebSphere Application Server environment. You are not required to set any properties before you access the server to create a container.

Instantiating an ObjectGrid Server in WebSphere Application Server
Server server = ServerFactory.getInstance();
DeploymentPolicy policy = DeploymentPolicyFactory.createDeploymentPolicy(
    new File("META-INF/embeddedDeploymentPolicy.xml").toURL(),
    new File("META-INF/embeddedObjectGrid.xml").toURL());
Container container = server.createContainer(policy);
Wiki Disclaimer and License
© Copyright IBM Corporation 2007,2009. All Rights Reserved.


 
    About IBM Privacy Contact