public interface DeploymentSpi extends IgniteSpi
Class loaders that are in charge of loading task classes (and other classes)
can be deployed directly by calling
register(ClassLoader, Class) method or
by SPI itself, for example by asynchronously scanning some folder for new tasks.
findResource(String) is called by the system, SPI must return a
class loader associated with given class. Every time a class loader
gets (re)deployed or released, callbacks
DeploymentListener.onUnregistered(ClassLoader)} must be called by SPI.
If peer class loading is enabled (which is default behavior, see
IgniteConfiguration.isPeerClassLoadingEnabled()), then it is usually
enough to deploy class loader 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
Ignite provides following
GridDeploymentSpi implementations out of the box:
Ignite.configuration()method to check its configuration properties or call other non-SPI methods. Note again that calling methods from this interface on the obtained instance can lead to undefined behavior and explicitly not supported.
|Modifier and Type||Method and Description|
Finds class loader for the given class.
Registers a class loader with this SPI.
Sets or unsets deployment event listener.
Unregisters all class loaders that have a class with given name or have a class with give
DeploymentResource findResource(String rsrcName)
rsrcName- Class name or class alias to find class loader for.
nullif not deployed.
boolean register(ClassLoader ldr, Class<?> rsrc) throws IgniteSpiException
boolean unregister(String rsrcName)
rsrcName- Either class name or
ComputeTaskNamevalue for a class whose class loader needs to be unregistered.
Trueif resource was unregistered.
void setListener(@Nullable DeploymentListener lsnr)
lsnr- Listener for deployment events.
nullto unset the listener.