Interface IgniteSpi
-
- All Known Subinterfaces:
CheckpointSpi
,CollisionSpi
,CommunicationSpi<T>
,DeploymentSpi
,DiscoverySpi
,EncryptionSpi
,EventStorageSpi
,FailoverSpi
,IndexingSpi
,LoadBalancingSpi
,MetricExporterSpi
,SystemViewExporterSpi
,TracingSpi<S>
- All Known Implementing Classes:
AdaptiveLoadBalancingSpi
,AlwaysFailoverSpi
,CacheCheckpointSpi
,FifoQueueCollisionSpi
,IgniteSpiAdapter
,IsolatedDiscoverySpi
,JdbcCheckpointSpi
,JmxMetricExporterSpi
,JobStealingCollisionSpi
,JobStealingFailoverSpi
,KeystoreEncryptionSpi
,LocalDeploymentSpi
,LogExporterSpi
,MemoryEventStorageSpi
,NeverFailoverSpi
,NoopCheckpointSpi
,NoopCollisionSpi
,NoopEncryptionSpi
,NoopEventStorageSpi
,NoopIndexingSpi
,NoopMetricExporterSpi
,NoopTracingSpi
,OpenCensusMetricExporterSpi
,OpenCensusTracingSpi
,PriorityQueueCollisionSpi
,org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter
,RoundRobinLoadBalancingSpi
,SharedFsCheckpointSpi
,org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfigInitializer
,TcpCommunicationSpi
,TcpDiscoverySpi
,UriDeploymentSpi
,WeightedRandomLoadBalancingSpi
,ZookeeperDiscoverySpi
public interface IgniteSpi
This interface defines life-cycle of SPI implementation. Every SPI implementation should implement this interface. Kernal will not load SPI that doesn't implement this interface.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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getName()
Gets SPI name.Map<String,Object>
getNodeAttributes()
This method is called before SPI starts (before methodspiStart(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.
-
-
-
Method Detail
-
getName
String getName()
Gets SPI name.- Returns:
- SPI name.
-
getNodeAttributes
Map<String,Object> getNodeAttributes() throws IgniteSpiException
This method is called before SPI starts (before methodspiStart(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.- Returns:
- Map of local node attributes this SPI wants to add.
- Throws:
IgniteSpiException
- Throws in case of any error.
-
spiStart
void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiException
This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Parameters:
igniteInstanceName
- Name of Ignite instance this SPI is being started for (null
for default Ignite instance).- Throws:
IgniteSpiException
- Throws in case of any error during SPI start.
-
onContextInitialized
void onContextInitialized(IgniteSpiContext spiCtx) throws IgniteSpiException
Callback invoked when SPI context is initialized. SPI implementation may store SPI context for future access.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...- Parameters:
spiCtx
- Spi context.- Throws:
IgniteSpiException
- If context initialization failed (grid will be stopped).
-
onContextDestroyed
void onContextDestroyed()
Callback invoked prior to stopping grid before SPI context is destroyed. Once this method is complete, grid will begin shutdown sequence. Use this callback for de-initialization logic that may involve SPI context. Note that invoking SPI context after this callback is complete is considered illegal and may produce unknown results.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.
-
spiStop
void spiStop() throws IgniteSpiException
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.
- Throws:
IgniteSpiException
- Thrown in case of any error during SPI stop.
-
onClientDisconnected
void onClientDisconnected(IgniteFuture<?> reconnectFut)
Client node disconnected callback.- Parameters:
reconnectFut
- Future that will be completed when client reconnected.
-
onClientReconnected
void onClientReconnected(boolean clusterRestarted)
Client node reconnected callback.- Parameters:
clusterRestarted
-True
if all cluster nodes restarted while client was disconnected.
-
-