Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Grid Interface
Grid Interface
Added by architect, last edited by morpheus on Feb 18, 2008  (view change)
Labels: 
(None)


Most of the functionality provided by GridGain is accessible through Grid Javadoc interface. Most of the time when using GridGain you will be interacting with Grid interface and various other helper interfaces and classes such as listeners and adapters.

Grid interface defines a grid instance. In GridGain, a notion of grid instance is synonymous to grid node as node and grid instance have one-to-one relationship. Grid node defines a logical location of the grid instance, and grid instance defines Java runtime operating on that logical node. GridGain support multiple grid instances (and thus nodes) on the same VM, on the same computer or on different computers over various types of networks.

Grid instance can be obtains from GridFactory Javadoc . GridFactory can provide default (unnamed) grid instance or named. Most of the time you will use default unnamed grid instance:

GridFactory.start();

try {
    Grid grid = GridFactory.getGrid();

    // Using grid instance.
}
finally {
    GridFactory.stop(true);
}

Grid interface provides several areas of functionality:

  • Grid task Management
  • Topology Management
  • Message Exchange
  • System Events Management

Grid Task Management

Grid interface main functional goal is to execute grid tasks. In GridGain you can execute grid task asynchronously and synchronously.

  • execute(String, Object) Javadoc
  • execute(String, Object, long) Javadoc
  • execute(String, Object, GridTaskListener) Javadoc
  • execute(String, Object, long, GridTaskListener) Javadoc
  • execute(Class<? extends GridTask<T,R>>, T) Javadoc
  • execute(Class<? extends GridTask<T,R>>, T, long) Javadoc
  • execute(Class<? extends GridTask<T,R>>, T, GridTaskListener) Javadoc
  • execute(Class<? extends GridTask<T,R>>, T, long, GridTaskListener) Javadoc
  • execute(GridTask<T,R>, T) Javadoc
  • execute(GridTask<T,R>, T, long) Javadoc
  • execute(GridTask<T,R>, T, GridTaskListener) Javadoc
  • execute(GridTask<T,R>, T, long, GridTaskListener) Javadoc

Grid interface also allows manual deployment and undeployment of grid tasks (apart from deployment managed by deployment SPI). Note that if Peer Class Loading is enabled (default behavior), then tasks will be deployed automatically. Also note that tasks are auto-deployed first time they get executed via any of the execute(..) methods listed above.

Topology Management

Topology management is one of the key functional areas provided by Grid interface. GridGain provides basic set of operations such as topology listeners and access to all grid nodes:

Message Exchange

Message exchange is not direct grid functionality but often required in real-life systems. Along with topology management, message exchange (implemented via communication SPI) provides developer with basic cluster operations. Using the following methods user can send message to one or multiple nodes and subscribe the listener for receiving messages:

  • sendMessage(GridNode, Serializable) Javadoc
  • sendMessage(Collection<GridNode>, Serializable) Javadoc
  • addMessageListener(GridMessageListener) Javadoc
  • removeMessageListener(GridMessageListener) Javadoc

System Events Management

Every significant action in GridGain generates event. All events are stored locally on the node where they were generated. User can use distributed query facility in GridGain to query events on the grid:

  • queryEvents(GridEventFilter, Collection<GridNode>, long) Javadoc
  • queryLocalEvents(GridEventFilter) Javadoc
  • addLocalEventListener(GridLocalEventListener) Javadoc
  • removeLocalEventListener(GridLocalEventListener) Javadoc

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006) - Bug/feature request - Contact Administrators