public abstract class IgniteSpiAdapter extends Object implements IgniteSpi
Modifier and Type | Field and Description |
---|---|
protected Ignite |
ignite
Ignite instance.
|
protected String |
igniteInstanceName
Ignite instance name.
|
protected IgniteLogger |
log |
Modifier | Constructor and Description |
---|---|
protected |
IgniteSpiAdapter()
Creates new adapter and initializes it from the current (this) class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addTimeoutObject(IgniteSpiTimeoutObject obj) |
protected void |
assertParameter(boolean cond,
String condDesc)
Throws exception with uniform error message if given parameter's assertion condition
is
false . |
protected void |
checkConfigurationConsistency0(IgniteSpiContext spiCtx,
ClusterNode node,
boolean starting)
Method which is called in the end of checkConfigurationConsistency() method.
|
long |
clientFailureDetectionTimeout()
Returns client failure detection timeout set to use for network related operations.
|
protected String |
configInfo(String name,
Object val)
Gets uniformed string for configuration parameter.
|
protected String |
createSpiAttributeName(String attrName)
Creates new name for the given attribute.
|
long |
failureDetectionTimeout()
Returns failure detection timeout set to use for network related operations.
|
boolean |
failureDetectionTimeoutEnabled()
Checks whether failure detection timeout is enabled for this
IgniteSpi . |
void |
failureDetectionTimeoutEnabled(boolean enabled)
Enables or disables failure detection timeout.
|
protected List<String> |
getConsistentAttributeNames()
Returns back a list of attributes that should be consistent
for this SPI.
|
org.apache.ignite.internal.util.IgniteExceptionRegistry |
getExceptionRegistry()
Gets Exception registry.
|
protected ClusterNode |
getLocalNode() |
String |
getName()
Gets SPI name.
|
Map<String,Object> |
getNodeAttributes()
This method is called before SPI starts (before method
IgniteSpi.spiStart(String)
is called). |
IgniteSpiContext |
getSpiContext()
Gets SPI context.
|
Ignite |
ignite()
Gets ignite instance.
|
protected void |
initFailureDetectionTimeout()
Initiates and checks failure detection timeout value.
|
Collection<Object> |
injectables()
This method returns SPI internal instances that need to be injected as well.
|
protected void |
injectResources(Ignite ignite)
Inject ignite instance.
|
protected boolean |
isNodeStopping() |
void |
onBeforeStart()
This method is called by built-in managers implementation to avoid
repeating SPI start attempts.
|
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.
|
protected void |
onContextDestroyed0()
Method to be called in the beginning of onContextDestroyed() method.
|
void |
onContextInitialized(IgniteSpiContext spiCtx)
Callback invoked when SPI context is initialized.
|
protected void |
onContextInitialized0(IgniteSpiContext spiCtx)
Method to be called in the end of onContextInitialized method.
|
protected <T extends IgniteSpiManagementMBean> |
registerMBean(String igniteInstanceName,
T impl,
Class<T> mbeanItf)
Registers SPI MBean.
|
protected void |
removeTimeoutObject(IgniteSpiTimeoutObject obj) |
IgniteSpiAdapter |
setName(String name)
Sets SPI name.
|
boolean |
started()
Checks if
onBeforeStart() has been called on this SPI instance. |
protected String |
startInfo()
Gets uniformly formatted message for SPI start.
|
protected void |
startStopwatch()
Starts startup stopwatch.
|
protected String |
stopInfo()
Gets uniformly format message for SPI stop.
|
protected void |
unregisterMBean()
Unregisters MBean.
|
@LoggerResource protected IgniteLogger log
protected Ignite ignite
protected String igniteInstanceName
protected IgniteSpiAdapter()
Class.getSimpleName()
).protected void startStopwatch()
public final void onBeforeStart()
public final boolean started()
onBeforeStart()
has been called on this SPI instance.True
if onBeforeStart()
has already been called.protected ClusterNode getLocalNode()
public String getName()
public Ignite ignite()
@IgniteSpiConfiguration(optional=true) public IgniteSpiAdapter setName(String name)
name
- SPI name.this
for chaining.public final void onContextInitialized(IgniteSpiContext spiCtx) throws IgniteSpiException
This method is invoked after IgniteSpi.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...
onContextInitialized
in interface IgniteSpi
spiCtx
- Spi context.IgniteSpiException
- If context initialization failed (grid will be stopped).protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException
spiCtx
- SPI context.IgniteSpiException
- In case of errors.public final 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.
onContextDestroyed
in interface IgniteSpi
public void onClientDisconnected(IgniteFuture<?> reconnectFut)
onClientDisconnected
in interface IgniteSpi
reconnectFut
- Future that will be completed when client reconnected.public void onClientReconnected(boolean clusterRestarted)
onClientReconnected
in interface IgniteSpi
clusterRestarted
- True
if all cluster nodes restarted while client was disconnected.@IgniteInstanceResource protected void injectResources(Ignite ignite)
ignite
- Ignite instance.protected void onContextDestroyed0()
public Collection<Object> injectables()
public IgniteSpiContext getSpiContext()
public org.apache.ignite.internal.util.IgniteExceptionRegistry getExceptionRegistry()
public Map<String,Object> getNodeAttributes() throws IgniteSpiException
IgniteSpi.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.getNodeAttributes
in interface IgniteSpi
IgniteSpiException
- Throws in case of any error.protected final void assertParameter(boolean cond, String condDesc) throws IgniteSpiException
false
.cond
- Assertion condition to check.condDesc
- Description of failed condition. Note that this description should include
JavaBean name of the property (not a variable name) as well condition in
Java syntax like, for example:
... assertParameter(dirPath != null, "dirPath != null"); ...Note that in case when variable name is the same as JavaBean property you can just copy Java condition expression into description as a string.
IgniteSpiException
- Thrown if given condition is false
protected final String startInfo()
protected final String stopInfo()
protected final String configInfo(String name, Object val)
name
- Parameter name.val
- Parameter value.protected final <T extends IgniteSpiManagementMBean> void registerMBean(String igniteInstanceName, T impl, Class<T> mbeanItf) throws IgniteSpiException
T
- Type of the MBeanigniteInstanceName
- Ignite instance name. If null, then name will be empty.impl
- MBean implementation.mbeanItf
- MBean interface (if null
, then standard JMX
naming conventions are used.IgniteSpiException
- If registration failed.protected final void unregisterMBean() throws IgniteSpiException
IgniteSpiException
- If bean could not be unregistered.protected final boolean isNodeStopping()
True
if node is stopping.protected void checkConfigurationConsistency0(IgniteSpiContext spiCtx, ClusterNode node, boolean starting) throws IgniteSpiException
spiCtx
- SPI context.node
- Remote node.starting
- If this node is starting or not.IgniteSpiException
- in case of errors.protected List<String> getConsistentAttributeNames()
protected String createSpiAttributeName(String attrName)
attrName
- SPI attribute name.protected void addTimeoutObject(IgniteSpiTimeoutObject obj)
obj
- Timeout object.IgniteSpiContext.addTimeoutObject(IgniteSpiTimeoutObject)
protected void removeTimeoutObject(IgniteSpiTimeoutObject obj)
obj
- Timeout object.IgniteSpiContext.removeTimeoutObject(IgniteSpiTimeoutObject)
protected void initFailureDetectionTimeout()
public void failureDetectionTimeoutEnabled(boolean enabled)
enabled
- true
if enable, false
otherwise.public boolean failureDetectionTimeoutEnabled()
IgniteSpi
.true
if enabled, false
otherwise.public long clientFailureDetectionTimeout()
0
if the timeout is disabled.public long failureDetectionTimeout()
0
if the timeout is disabled.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024