Dashboard > GridGain User Guide > Table Of Contents > Migration To GridGain 2.0 From Previous Version
Migration To GridGain 2.0 From Previous Version
Added by architect, last edited by architect on Feb 25, 2008  (view change)
Labels: 
(None)


Public API Changes

GridGain 2.0 introduced some public API changes that mostly have to do with Generics.

GridTask Changes

GridTask Javadoc declaration changed from GridTask<T> in 1.6 to GridTask<T, R> in 2.0. The additional R parameter signifies the type of task return value. Such a change allows stronger type definition of grid tasks and generally makes the code more readable.

As a consequence of this change, GridTaskFuture Javadoc has a generics return value and should be declared as GridTaskFuture<R>.

In order to migrate your 1.6 code to 2.0 version, simply add correct return value to your task declarations or add Object instead if your task returns a different type of value every time.

Service Provider Interfaces (SPIs) Changes

The following changes affected SPI implementations. If you don't have any custom SPI implemented, you should ignore this section.

GridSpi Changes

Methods onContextInitialized(GridSpiContext) and onContextDestroyed() were added to GridSpi {javadoc:spi/GridSpi.html}} interface. GridSpiContext Javadoc allows SPI's to reuse common functionality provided by other SPI's, such as, node discovery, communication, and event notification.

GridDiscoverySpi Changes

The following interfaces from Discovery SPI are affected:

GridNode Changes

GridNode Javadoc has a new method getMetrics() which returns frequently updated GridNodeMetrics Javadoc containing a lot of useful dynamically changing information about node performance and physical characteristics.

New setMetricsProvider(..) Method

Method setMetricsProvider(..) was added to GridDiscoverySpi Javadoc in order to enable the underlying implementations to exchange runtime metrics information between nodes.

New getNode(UUID) Method

Method getNode(UUID) Javadoc was added to discovery SPI in order to make sure that single nodes are retrieved from discovered topology in the most efficient way. In all discovery SPI implementations shipped with GridGain, the complexity of this operation is O(1).

GridCollisionSpi Changes

GridCollisionSpi Javadoc was enhanced with method setExternalCollisionListener(..). This is a listener to be set for notification of external collision events (e.g. job stealing). Once grid receives such notification, it will immediately invoke collision SPI.

GridGain uses this listener to enable job stealing from overloaded to underloaded nodes. However, you can also utilize it, for instance, to provide time based collision resolution. To achieve this, you most likely would mark some job by setting a certain attribute in job context (see GridJobContext Javadoc ) for a job that requires time-based scheduling and set some timer in your SPI implementation that would wake up after a certain period of time. Once this period is reached, you would notify this listener that a collision resolution should take place. Then inside of your collision resolution logic, you would find the marked waiting job and activate it.

Note that most collision SPI's may not have external collisions. In that case, they should simply ignore this method and do nothing when listener is set.

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