Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Deployment SPI
Deployment SPI
Added by architect, last edited by morpheus on Dec 23, 2008  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.deployment Javadoc

Built-in Implementations

Gridgain comes with two deployment SPI's supported out of the box

Description

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

Grid task can be deployed directly by calling GridDeploymentSpi.deployTask(GridDeploymentTask) Javadoc method or by SPI itself, for example by asynchronously scanning some folder for new tasks. Another way is a task auto-deployment when task class is picked up from the local class path by task name. Note that directly deployed tasks has a priority over auto-deployed.
Whenever task is locally deployed through public API via Grid.deployTask(Class<? extends GridTask<?>>) Javadoc or Grid.deployTask(Class<? extends GridTask<?>>, ClassLoader) Javadoc methods, the system will call GridDeploymentSpi.deployTask(GridDeploymentTask) Javadoc method on the Deployment SPI automatically. If peer-class-loading is enabled (GridConfiguration.isPeerClassLoadingEnabled() Javadoc ), this task will be automatically deployed on other nodes.

When method GridDeploymentSpi.findTask(String) Javadoc is called by the system, SPI must return a locally deployed task class. Every time a task gets redeployed or released via GridDeploymentSpi.undeployTask(String) Javadoc method, callback GridDeploymentListener.onTaskReleased(GridDeploymentTask) Javadoc must be called by SPI.

Peer Class Loading

If peer class loading is enabled (which is default behavior, see GridConfiguration.isPeerClassLoadingEnabled() Javadoc ) in Grid Configuration, then it is 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 gets redeployed on a node, all other nodes will detect it and will redeploy this task as well.

Local vs. Peer Deployment

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 or task class from the local class path.

Configuration

GridDeploymentSpi is provided in Grid Configuration passed into GridFactory Javadoc at startup. You can configure a different collision SPI implementation as follows

GridConfigurationAdapter cfg = new GridConfigurationAdapter();

GridUriDeploymentSpi deploySpi = new GridUriDeploymentSpi();

// Configure your own deployment folder for URI deployment.
deploySpi.setUriList(Collections.singletonList("file:///my/deployment/folder");

cfg.setDeploymentSpi(deploySpi);

GridFactory.start(cfg);

Note that GridConfiguration Javadoc interface is just a bean and can also be configured using spring XML configuration.


For more information about using Spring framework for configuration click here.

Default Implementation

GridLocalDeploymentSpi is used by default, if no deployment SPI was explicitely provided in grid configuration.

GridLocalDeploymentSpi (GridGain User Guide)
GridUriDeploymentSpi (GridGain User Guide)

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