GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid.spi.deployment.local
Class GridLocalDeploymentSpi

java.lang.Object
  extended by org.gridgain.grid.spi.GridSpiAdapter
      extended by org.gridgain.grid.spi.deployment.local.GridLocalDeploymentSpi
All Implemented Interfaces:
GridDeploymentSpi, GridLocalDeploymentSpiMBean, GridSpi, GridSpiJsonConfigurable, GridSpiManagementMBean

@GridSpiInfo(author="GridGain Systems",
             url="www.gridgain.com",
             email="support@gridgain.com",
             version="3.6.0e.13012012")
@GridSpiMultipleInstancesSupport(value=true)
public class GridLocalDeploymentSpi
extends GridSpiAdapter
implements GridDeploymentSpi, GridLocalDeploymentSpiMBean

Local deployment SPI that implements only within VM deployment on local node via GridLocalDeploymentSpi.register(ClassLoader, Class) method. This SPI requires no configuration.

Note that if peer class loading is enabled (which is default behavior, see GridConfiguration.isPeerClassLoadingEnabled()), then it is enough to deploy a task only on one node and all other nodes will load required classes from the node that initiated task execution.

Configuration

This SPI requires no configuration.

Example

There is no point to explicitly configure GridLocalDeploymentSpi with GridConfiguration as it is used by default and has no configuration parameters.

Wiki & Forum:


Wiki
Forum

See Also:
GridDeploymentSpi
 

Constructor Summary
GridLocalDeploymentSpi()
           
 
Method Summary
 GridDeploymentResource findResource(String rsrcName)
          Finds class loader for the given class.
protected  List<String> getConsistentAttributeNames()
          Returns back a list of attributes that should be consistent for this SPI.
 boolean register(ClassLoader ldr, Class<?> rsrc)
          Registers a class loader with this SPI.
 void setListener(GridDeploymentListener lsnr)
          Sets or unsets deployment event listener.
 void spiStart(String gridName)
          This method is called to start SPI.
 void spiStop()
          This method is called to stop SPI.
 String toString()
          
 boolean unregister(String rsrcName)
          Unregisters all class loaders that have a class with given name or have a class with give GridTaskName value.
 
Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter
assertParameter, checkConfigurationConsistency, configInfo, createSpiAttributeName, getAuthor, getGridGainHome, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, injectables, onContextDestroyed, onContextInitialized, registerMBean, setJson, setName, startInfo, startStopwatch, stopInfo, unregisterMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.gridgain.grid.spi.GridSpi
getName, getNodeAttributes, onContextDestroyed, onContextInitialized
 
Methods inherited from interface org.gridgain.grid.spi.GridSpiJsonConfigurable
setJson
 
Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion
 

Constructor Detail

GridLocalDeploymentSpi

public GridLocalDeploymentSpi()
Method Detail

spiStart

public void spiStart(@Nullable
                     String gridName)
              throws GridSpiException
This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.

Specified by:
spiStart in interface GridSpi
Throws:
GridSpiException - Throws in case of any error during SPI start.
Parameters:
gridName - Name of grid instance this SPI is being started for (null for default grid).

spiStop

public void spiStop()
             throws GridSpiException
This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.

Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.

Specified by:
spiStop in interface GridSpi
Throws:
GridSpiException - Thrown in case of any error during SPI stop.

findResource

@Nullable
public GridDeploymentResource findResource(String rsrcName)
Finds class loader for the given class.

Specified by:
findResource in interface GridDeploymentSpi
Parameters:
rsrcName - Class name or class alias to find class loader for.
Returns:
Deployed class loader, or null if not deployed.

register

public boolean register(ClassLoader ldr,
                        Class<?> rsrc)
                 throws GridSpiException
Registers a class loader with this SPI. This method exists to be able to add external class loaders to deployment SPI. Deployment SPI may also have its own class loaders. For example, in case of GAR deployment, every GAR file is loaded and deployed with a separate class loader maintained internally by the SPI.

The array of classes passed in should be checked for presence of GridTaskName annotations. The classes that have this annotation should be accessible by this name from GridDeploymentSpi.findResource(String) method.

Specified by:
register in interface GridDeploymentSpi
Throws:
GridSpiException - If registration failed.
Parameters:
ldr - Class loader to register.
rsrc - Class that should be checked for aliases. Currently the only alias in the system is GridTaskName for task classes; in future, there may be others.
Returns:
True if resource was registered.

unregister

public boolean unregister(String rsrcName)
Unregisters all class loaders that have a class with given name or have a class with give GridTaskName value.

Specified by:
unregister in interface GridDeploymentSpi
Parameters:
rsrcName - Either class name or GridTaskName value for a class whose class loader needs to be unregistered.
Returns:
True if resource was unregistered.

setListener

public void setListener(GridDeploymentListener lsnr)
Sets or unsets deployment event listener. Grid implementation will use this listener to properly add and remove various deployments.

Specified by:
setListener in interface GridDeploymentSpi
Parameters:
lsnr - Listener for deployment events. null to unset the listener.

getConsistentAttributeNames

protected List<String> getConsistentAttributeNames()
Returns back a list of attributes that should be consistent for this SPI. Consistency means that remote node has to have the same attribute with the same value.

Overrides:
getConsistentAttributeNames in class GridSpiAdapter
Returns:
List or attribute names.

toString

public String toString()

Overrides:
toString in class Object

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube