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 > ObjectGrid core programming API > Information > Page Comparison
developerWorks
Log In   View a printable version of the current page.
Overview Connect Spaces Forums Wikis
ObjectGrid core programming API
compared with
Current by Chris.D.Johnson
on Mar 02, 2009 15:51.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

 {include:pageTitle=OG_HEADER}
 {style}
 h3 {
 color: #0099cc;
 }
 h4 {
 color: #0099cc;
 }
 h5 {
 color: #0099cc;
 }
 {style}{excerpt}With the core API, the fundamental interaction with the ObjectGrid cache can occur, including obtaining an ObjectGrid instance, configuring the ObjectGrid and BackingMap, and so on. The core API is used for non-transactional operations, but might be essential to support transactional operations. {excerpt}
  
 h3. Getting Started
  
 * [Obtaining a reference to an ObjectGrid]
 * [Using Sessions to access data in the grid]
 {children:page=Using Sessions to access data in the grid|excerpt=true}
 * [Using indexing for non-key data access]
 * [Integrating ObjectGrid in a Java 2 Platform, Enterprise Edition (J2EE) environment]
 * [Introduction to ObjectGrid configuration]
  * [ObjectGrid client bootstrap]
  
 h3. Examples and Tutorials
  
 The following code snippet illustrates how to obtain and configure a local ObjectGrid:
 {code:title=Obtaining and Configuring local ObjectGrid example}
 // Obtain a local ObjectGrid reference
  // you can create a new ObjectGrid, or get configured ObjectGrid defined in ObjectGrid xml file
  ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
  ObjectGrid ivObjectGrid = objectGridManager.createObjectGrid("objectgridName");
  
  // Add a TransactionCallback into ObjectGrid
  HeapTransactionCallback tcb = new HeapTransactionCallback();
  ivObjectGrid.setTransactionCallback(tcb);
  
  // Define a BackingMap
  // if the BackingMap is configured in ObjectGrid xml file, you can just get it.
  BackingMap ivBackingMap = ivObjectGrid.defineMap("myMap");
  
  // Add a Loader into BackingMap
  Loader ivLoader = new HeapCacheLoader();
  ivBackingMap.setLoader(ivLoader);
  
  // initialize ObjectGrid
  ivObjectGrid.initialize();
  
  // Obtain a session to be used by the current thread.
  // Session can not be shared by multiple threads
  Session ivSession = ivObjectGrid.getSession();
  
  // Obtaining ObjectMap from ObjectGrid Session
  ObjectMap objectMap = ivSession.getMap("myMap");
 {code}
 The following code snippet illustrates how to obtain a catalog server-based distributed ObjectGrid:
 {code:title=Obtaining distributed ObjectGrid example}
 ObjectGridManager ogManager = ObjectGridManagerFactory.getObjectGridManager();
  
  // Obtain a ClientClusterContext by connecting to a catalog server based distributed ObjectGrid
  // You have to provide a connection end point in the format of hostName:endPointPort
  // The hostName is the machine where the catalog server reside.
  // The endPointPort is the catalog server listening port, the default is 2809.
  ClientClusterContext ivClientClusterContext = ogManager.connect("localhost:2809", null, null);
  
  // Obtain distributed ObjectGrid via ObjectGridManager by providing a ClientClusterContext
  ObjectGrid ivObjectGrid = ogManager.getObjectGrid(ivClientClusterContext, "objectgridName");
 {code}
  
 h3. Related Information
  
 * [ObjectGrid API documentation|http://www.ibm.com/developerworks/wikis/objectgridprog/docs/api/index.html?com/ibm/websphere/objectgrid/package-summary.html]
 * [ObjectGrid Configuration API documentation|http://www.ibm.com/developerworks/wikis/objectgridprog/docs/api/index.html?com/ibm/websphere/objectgrid/config/package-summary.html]
  
 {include:OG_FOOTER}

 
    About IBM Privacy Contact