|
GridGain 2.0.3
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gridgain.grid.spi.GridSpiAdapter
public abstract class GridSpiAdapter
This class provides convenient adapter for SPI implementations.
See Also:
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.0.3
![]() |
![]() |
![]() |
![]() |
| Constructor Summary | |
|---|---|
protected |
GridSpiAdapter()
Creates new adapter and initializes it from the current (this) class. |
| Method Summary | ||
|---|---|---|
protected void |
assertParameter(boolean cond,
String condDescr)
Throws exception with uniform error message if given parameter's assertion condition is false. |
|
protected void |
checkConfigurationConsistency(GridNode node)
Checks remote node SPI configuration and prints warnings if necessary. |
|
protected String |
configInfo(String name,
Object value)
Gets uniformed string for configuration parameter. |
|
String |
getAuthor()
Gets SPI provider's author. |
|
String |
getGridGainHome()
Gets Gridgain installation home folder. |
|
UUID |
getLocalNodeId()
Gets ID of the local node. |
|
Map<String,Serializable> |
getNodeAttributes()
This method is called before SPI starts (before method GridSpi.spiStart(String)
is called). |
|
protected GridSpiContext |
getSpiContext()
Gets SPI context. |
|
long |
getStartTimestamp()
Get start timestamp of this SPI. |
|
String |
getStartTimestampFormatted()
Gets string presentation of the start timestamp. |
|
long |
getUpTime()
Gets up-time of this SPI. |
|
String |
getUpTimeFormatted()
Gets string presentation of up-time for this SPI. |
|
String |
getVendorEmail()
Gets vendor's email (info or support). |
|
String |
getVendorUrl()
Gets vendor's URL. |
|
String |
getVersion()
Gets SPI implementation version. |
|
void |
onContextDestroyed()
Callback invoked prior to stopping grid before SPI context is destroyed. |
|
void |
onContextInitialized(GridSpiContext spiCtx)
Callback invoked when SPI context is initialized. |
|
protected
|
registerMBean(String gridName,
T impl,
Class<T> mbeanItf)
Registers SPI MBean. |
|
protected void |
setSpiContext(GridSpiContext spiCtx)
Sets SPI context. |
|
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. |
|
protected void |
warnSpi(String spiName,
Class<? extends GridSpi> spiCls,
String attrName)
Checks if dependent SPI is the same as expected. |
|
protected void |
warnSpiParameter(String param,
String attrName,
GridNode rmtNode)
Check if remote node has the same attribute value as local node. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.gridgain.grid.spi.GridSpi |
|---|
spiStart, spiStop |
| Constructor Detail |
|---|
protected GridSpiAdapter()
| Method Detail |
|---|
protected void startStopwatch()
public final String getAuthor()
getAuthor in interface GridSpiManagementMBeanpublic final String getVendorUrl()
getVendorUrl in interface GridSpiManagementMBeanpublic final String getVendorEmail()
getVendorEmail in interface GridSpiManagementMBeanpublic final String getVersion()
getVersion in interface GridSpiManagementMBeanpublic final String getStartTimestampFormatted()
getStartTimestampFormatted in interface GridSpiManagementMBeanpublic final String getUpTimeFormatted()
getUpTimeFormatted in interface GridSpiManagementMBeanpublic final long getStartTimestamp()
getStartTimestamp in interface GridSpiManagementMBeanpublic final long getUpTime()
getUpTime in interface GridSpiManagementMBeanpublic UUID getLocalNodeId()
getLocalNodeId in interface GridSpiManagementMBeanpublic final String getGridGainHome()
getGridGainHome in interface GridSpiManagementMBean
public void onContextInitialized(GridSpiContext spiCtx)
throws GridSpiException
This method is invoked after GridSpi.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 GridSpiGridSpiException - If context initialization failed (grid will be stopped).spiCtx - Spi context.public void onContextDestroyed()
If GridSpiAdapter 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 GridSpiprotected void setSpiContext(GridSpiContext spiCtx)
spiCtx - SPI context.protected GridSpiContext getSpiContext()
public Map<String,Serializable> getNodeAttributes()
throws GridSpiException
GridSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernel 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 GridSpiGridSpiException - Throws in case of any error.
protected final void assertParameter(boolean cond,
String condDescr)
throws GridSpiException
GridSpiException - Thrown if given condition is falsecond - Assertion condition to check.condDescr - 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.
protected final String startInfo()
throws GridSpiException
GridSpiException - If SPI is missing GridSpiInfo annotation.
protected final String stopInfo()
protected final String configInfo(String name,
Object value)
name - Parameter name.value - Parameter value.
protected final void warnSpiParameter(String param,
String attrName,
GridNode rmtNode)
param - Name of the configuration parameter.attrName - Name of the node attribute.rmtNode - Remote node.
protected final void warnSpi(String spiName,
Class<? extends GridSpi> spiCls,
String attrName)
spiName - SPI configuration name.spiCls - Expected SPI class.attrName - SPI attribute name.
protected final <T extends GridSpiManagementMBean> void registerMBean(String gridName,
T impl,
Class<T> mbeanItf)
throws GridSpiException
GridSpiException - If registration failed.T - Type of the MBeangridName - Grid name. If null, then name will be empty.impl - MBean implementation.mbeanItf - MBean interface (if null, then standard JMX
naming conventions are used.
protected final void unregisterMBean()
throws GridSpiException
GridSpiException - If bean could not be unregistered.protected void checkConfigurationConsistency(GridNode node)
node - Remote node.
|
GridGain 2.0.3
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.0.3.20052008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|