GridGain™ 2.0.3
Java API Specification

org.gridgain.grid.spi.deployment
Interface GridDeploymentSpi

All Superinterfaces:
GridSpi
All Known Implementing Classes:
GridLocalDeploymentSpi, GridUriDeploymentSpi

@Apache20LicenseCompatible
public interface GridDeploymentSpi
extends GridSpi

Grid deployment SPI is in charge of deploying tasks from different sources.

Task can be deployed directly by calling GridDeploymentSpi.deployTask(GridDeploymentTask)} method or by SPI itself, for example by asynchronously scanning some folder for new tasks. When method GridDeploymentSpi.findTask(String) is called by the system, SPI must return a deployed, but uninitialized task. 'Uninitialized' means that no grid resources were injected into resolvers yet and resolvers were not started. Every time a task gets redeployed or released via GridDeploymentSpi.undeployTask(String)} method, callback GridDeploymentListener.onTaskReleased(GridDeploymentTask)} must be called by SPI.

If peer class loading is enabled (which is default behavior, see GridConfiguration.isPeerClassLoadingEnabled()), then it is usually enough to deploy a task only on one grid node. Once a task starts executing on the grid, all other nodes will automatically load all task classes from the node that initiated the execution. Hot redeployment is also supported with peer class loading. Every time a task changes and gets redeployed on a node, all other nodes will detect it and will redeploy this task as well. Note that peer class loading comes into effect only if a task was not locally deployed, otherwise, preference will always be given to a locally deployed task.

Gridgain provides the following GridDeploymentSpi implementations:





See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.0.3

 

Method Summary
 void deployTask(GridDeploymentTask task)
          Explicitely deploys or re-deploys a given task.
 Map<String,GridDeploymentTask> findAllTasks()
          Finds all tasks that have been deployed keyed by task name.
 GridDeploymentTask findTask(String taskName)
          When underlying system needs a grid task it will attempt to deploy it on-demand by calling this method.
 void setListener(GridDeploymentListener listener)
          Sets deployment event listener.
 void undeployTask(String taskName)
          Un-deploys given task.
 
Methods inherited from interface org.gridgain.grid.spi.GridSpi
getNodeAttributes, onContextDestroyed, onContextInitialized, spiStart, spiStop
 

Method Detail

findTask

GridDeploymentTask findTask(String taskName)
When underlying system needs a grid task it will attempt to deploy it on-demand by calling this method. If deployer can't find the task it should return null.

Every time a task is executed on the grid, this method will be called and it is responsibility of the SPI implementation to efficiently return grid task and ensure that this task is the latest deployed instance.

Note also that many implementations would preemptively find to-be deployed tasks (if possible) and cache them so that they can return them immediately when this method is called.

Parameters:
taskName - Grid task name.
Returns:
Task that corresponds to given task identifier.

findAllTasks

Map<String,GridDeploymentTask> findAllTasks()
Finds all tasks that have been deployed keyed by task name. If no tasks were deployed, then empty map is returned.

Returns:
All locally deployed tasks or empty map if no tasks were deployed.

undeployTask

void undeployTask(String taskName)
Un-deploys given task. Upon this call the implementation should clear any references to either grid task or its class-loader, if any, making them generally available to GC.

Every time a task is released (either via this method, or somehow differently, based on SPI), GridDeploymentListener.onTaskReleased(GridDeploymentTask)} callback should be called by SPI.

Parameters:
taskName - Grid task name.

deployTask

void deployTask(GridDeploymentTask task)
                throws GridSpiException
Explicitely deploys or re-deploys a given task. After a task has been (re)deployed using this method it should immediately become available via GridDeploymentSpi.findTask(String).

Throws:
GridSpiException - If task is invalid.
Parameters:
task - Task to deploy.

setListener

void setListener(GridDeploymentListener listener)
Sets deployment event listener. Grid implementation will use this listener to properly remove any injected resources.

Parameters:
listener - Listener for deployment events.

GridGain™ 2.0.3
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.0.3.20052008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.