Class LocalDeploymentSpi
- java.lang.Object
-
- org.apache.ignite.spi.IgniteSpiAdapter
-
- org.apache.ignite.spi.deployment.local.LocalDeploymentSpi
-
- All Implemented Interfaces:
DeploymentSpi,IgniteSpi
@IgniteSpiMultipleInstancesSupport(true) @IgnoreIfPeerClassLoadingDisabled public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi
Local deployment SPI that implements only within VM deployment on local node viaregister(ClassLoader, Class)method. This SPI requires no configuration.Note that if peer class loading is enabled (which is default behavior, see
IgniteConfiguration.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 configureGridLocalDeploymentSpiwithIgniteConfigurationas it is used by default and has no configuration parameters.- See Also:
DeploymentSpi
-
-
Field Summary
Fields Modifier and Type Field Description static StringIGNITE_DEPLOYMENT_ADDITIONAL_CHECKEnables additional check for resource name on resources removal.-
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter
ignite, igniteInstanceName
-
-
Constructor Summary
Constructors Constructor Description LocalDeploymentSpi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable DeploymentResourcefindResource(String rsrcName)Finds class loader for the given class.booleanregister(ClassLoader ldr, Class<?> rsrc)Registers a class loader with this SPI.voidsetListener(DeploymentListener lsnr)Sets or unsets deployment event listener.LocalDeploymentSpisetName(String name)Sets SPI name.voidspiStart(@Nullable String igniteInstanceName)This method is called to start SPI.voidspiStop()This method is called to stop SPI.StringtoString()booleanunregister(String rsrcName)Unregisters all class loaders that have a class with given name or have a class with giveComputeTaskNamevalue.-
Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapter
addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, started, 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.apache.ignite.spi.IgniteSpi
getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
-
-
-
-
Field Detail
-
IGNITE_DEPLOYMENT_ADDITIONAL_CHECK
@SystemProperty("Enables an additional check of a resource name on resources removal") public static final String IGNITE_DEPLOYMENT_ADDITIONAL_CHECK
Enables additional check for resource name on resources removal.- See Also:
- Constant Field Values
-
-
Method Detail
-
spiStart
public void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiExceptionThis method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Specified by:
spiStartin interfaceIgniteSpi- Parameters:
igniteInstanceName- Name of Ignite instance this SPI is being started for (nullfor default Ignite instance).- Throws:
IgniteSpiException- Throws in case of any error during SPI start.
-
spiStop
public void spiStop() throws IgniteSpiExceptionThis 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:
spiStopin interfaceIgniteSpi- Throws:
IgniteSpiException- Thrown in case of any error during SPI stop.
-
findResource
@Nullable public @Nullable DeploymentResource findResource(String rsrcName)
Finds class loader for the given class.- Specified by:
findResourcein interfaceDeploymentSpi- Parameters:
rsrcName- Class name or class alias to find class loader for.- Returns:
- Deployed class loader, or
nullif not deployed.
-
register
public boolean register(ClassLoader ldr, Class<?> rsrc) throws IgniteSpiException
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
ComputeTaskNameannotations. The classes that have this annotation should be accessible by this name fromDeploymentSpi.findResource(String)method.- Specified by:
registerin interfaceDeploymentSpi- Parameters:
ldr- Class loader to register.rsrc- Class that should be checked for aliases. Currently the only alias in the system isComputeTaskNamefor task classes; in future, there may be others.- Returns:
Trueif resource was registered.- Throws:
IgniteSpiException- If registration failed.
-
unregister
public boolean unregister(String rsrcName)
Unregisters all class loaders that have a class with given name or have a class with giveComputeTaskNamevalue.- Specified by:
unregisterin interfaceDeploymentSpi- Parameters:
rsrcName- Either class name orComputeTaskNamevalue for a class whose class loader needs to be unregistered.- Returns:
Trueif resource was unregistered.
-
setListener
public void setListener(DeploymentListener lsnr)
Sets or unsets deployment event listener. Grid implementation will use this listener to properly add and remove various deployments.- Specified by:
setListenerin interfaceDeploymentSpi- Parameters:
lsnr- Listener for deployment events.nullto unset the listener.
-
setName
public LocalDeploymentSpi setName(String name)
Sets SPI name.- Overrides:
setNamein classIgniteSpiAdapter- Parameters:
name- SPI name.- Returns:
thisfor chaining.
-
-