public interface IgniteSpi
Grid SPI's can be injected using IoC (dependency injection) with ignite resources. Both, field and method based injection are supported. The following ignite resources can be injected:
Refer to corresponding resource documentation for more information.Modifier and Type | Method and Description |
---|---|
String |
getName()
Gets SPI name.
|
Map<String,Object> |
getNodeAttributes()
This method is called before SPI starts (before method
spiStart(String)
is called). |
void |
onClientDisconnected(IgniteFuture<?> reconnectFut)
Client node disconnected callback.
|
void |
onClientReconnected(boolean clusterRestarted)
Client node reconnected callback.
|
void |
onContextDestroyed()
Callback invoked prior to stopping grid before SPI context is destroyed.
|
void |
onContextInitialized(IgniteSpiContext spiCtx)
Callback invoked when SPI context is initialized.
|
void |
spiStart(@Nullable String igniteInstanceName)
This method is called to start SPI.
|
void |
spiStop()
This method is called to stop SPI.
|
String getName()
Map<String,Object> getNodeAttributes() throws IgniteSpiException
spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernal collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes.IgniteSpiException
- Throws in case of any error.void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiException
igniteInstanceName
- Name of Ignite instance this SPI is being started for
(null
for default Ignite instance).IgniteSpiException
- Throws in case of any error during SPI start.void onContextInitialized(IgniteSpiContext spiCtx) throws IgniteSpiException
This method is invoked after spiStart(String)
method is
completed, so SPI should be fully functional at this point. Use this
method for post-start initialization, such as subscribing a discovery
listener, sending a message to remote node, etc...
spiCtx
- Spi context.IgniteSpiException
- If context initialization failed (grid will be stopped).void onContextDestroyed()
If IgniteSpiAdapter
is used for SPI implementation, then it will
replace actual context with dummy no-op context which is usually good-enough
since grid is about to shut down.
void spiStop() throws IgniteSpiException
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.
IgniteSpiException
- Thrown in case of any error during SPI stop.void onClientDisconnected(IgniteFuture<?> reconnectFut)
reconnectFut
- Future that will be completed when client reconnected.void onClientReconnected(boolean clusterRestarted)
clusterRestarted
- True
if all cluster nodes restarted while client was disconnected.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023