Class GridManagerAdapter<T extends IgniteSpi>
- java.lang.Object
-
- org.apache.ignite.internal.managers.GridManagerAdapter<T>
-
- Type Parameters:
T- SPI wrapped by this manager.
- All Implemented Interfaces:
GridComponent,GridManager
- Direct Known Subclasses:
GridCheckpointManager,GridCollisionManager,GridDeploymentManager,GridDiscoveryManager,GridEncryptionManager,GridEventStorageManager,GridFailoverManager,GridIndexingManager,GridIoManager,GridLoadBalancerManager,GridMetricManager,GridSystemViewManager,GridTracingManager
public abstract class GridManagerAdapter<T extends IgniteSpi> extends Object implements GridManager
Convenience adapter for grid managers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
Fields Modifier and Type Field Description protected GridKernalContextctxKernal context.protected IgniteLoggerlogLogger.
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridManagerAdapter(GridKernalContext ctx, T... spis)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertParameter(boolean cond, String condDesc)Throws exception with uniform error message if given parameter's assertion condition isfalse.voidcollectGridNodeData(DiscoveryDataBag dataBag)Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.voidcollectJoiningNodeData(DiscoveryDataBag dataBag)Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.@Nullable GridComponent.DiscoveryDataExchangeTypediscoveryDataType()Gets unique component type to distinguish components providing discovery data.booleanenabled()protected TgetSpi()Gets wrapped SPI.protected TgetSpi(@Nullable String name)protected T[]getSpis()protected voidinject()Injects resources to SPI.voidonAfterSpiStart()This method executed after manager started SPI.voidonBeforeSpiStart()This method executed before manager will start SPI.voidonDisconnected(IgniteFuture<?> reconnectFut)Client disconnected callback.voidonGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)Receives discovery data object from remote nodes (called on new node during discovery process).voidonJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)Method is called on nodes that are already in grid (not on joining node).voidonKernalStart(boolean active)Callback that notifies that kernal has successfully started, including all managers and processors.protected voidonKernalStart0()voidonKernalStop(boolean cancel)Callback to notify that kernal is about to stop.protected voidonKernalStop0(boolean cancel)IgniteInternalFuture<?>onReconnected(boolean clusterRestarted)Client reconnected callback.voidprintMemoryStats()Prints memory statistics (sizes of internal structures, etc.).protected StringstartInfo()protected voidstartSpi()Starts wrapped SPI.protected StringstopInfo()protected voidstopSpi()Stops wrapped SPI.StringtoString()@Nullable IgniteNodeValidationResultvalidateNode(ClusterNode node)Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.@Nullable IgniteNodeValidationResultvalidateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.GridComponent
start, stop
-
-
-
-
Field Detail
-
ctx
@GridToStringExclude protected final GridKernalContext ctx
Kernal context.
-
log
@GridToStringExclude protected final IgniteLogger log
Logger.
-
-
Constructor Detail
-
GridManagerAdapter
protected GridManagerAdapter(GridKernalContext ctx, T... spis)
- Parameters:
ctx- Kernal context.spis- Specific SPI instance.
-
-
Method Detail
-
getSpi
protected final T getSpi()
Gets wrapped SPI.- Returns:
- Wrapped SPI.
-
getSpi
protected final T getSpi(@Nullable @Nullable String name)
- Parameters:
name- SPI name- Returns:
- SPI for given name. If
nullor empty, then 1st SPI on the list is returned.
-
enabled
public boolean enabled()
- Specified by:
enabledin interfaceGridManager- Returns:
trueif at least one SPI does not have aNO-OPimplementation,falseotherwise.
-
getSpis
protected final T[] getSpis()
- Returns:
- Configured SPI's.
-
onBeforeSpiStart
public void onBeforeSpiStart()
This method executed before manager will start SPI.- Specified by:
onBeforeSpiStartin interfaceGridManager
-
onAfterSpiStart
public void onAfterSpiStart()
This method executed after manager started SPI.- Specified by:
onAfterSpiStartin interfaceGridManager
-
onDisconnected
public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException
Client disconnected callback.- Specified by:
onDisconnectedin interfaceGridComponent- Parameters:
reconnectFut- Reconnect future.- Throws:
IgniteCheckedException- If failed.
-
onReconnected
public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException
Client reconnected callback.- Specified by:
onReconnectedin interfaceGridComponent- Parameters:
clusterRestarted- Cluster restarted flag.- Returns:
- Future to wait before completing reconnect future.
- Throws:
IgniteCheckedException- If failed.
-
inject
protected void inject() throws IgniteCheckedExceptionInjects resources to SPI.- Throws:
IgniteCheckedException- If failed.
-
startSpi
protected final void startSpi() throws IgniteCheckedExceptionStarts wrapped SPI.- Throws:
IgniteCheckedException- If wrapped SPI could not be started.
-
stopSpi
protected final void stopSpi() throws IgniteCheckedExceptionStops wrapped SPI.- Throws:
IgniteCheckedException- If underlying SPI could not be stopped.
-
startInfo
protected final String startInfo()
- Returns:
- Uniformly formatted ack string.
-
stopInfo
protected final String stopInfo()
- Returns:
- Uniformly formatted ack string.
-
onKernalStart
public final void onKernalStart(boolean active) throws IgniteCheckedExceptionCallback that notifies that kernal has successfully started, including all managers and processors.- Specified by:
onKernalStartin interfaceGridComponent- Parameters:
active- Cluster active flag (note: should be used carefully since state can change concurrently).- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
onKernalStop
public final void onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.- Specified by:
onKernalStopin interfaceGridComponent- Parameters:
cancel- Flag indicating whether jobs should be canceled.
-
discoveryDataType
@Nullable public @Nullable GridComponent.DiscoveryDataExchangeType discoveryDataType()
Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements any of methodsGridComponent.collectJoiningNodeData(DiscoveryDataBag)orGridComponent.collectGridNodeData(DiscoveryDataBag).- Specified by:
discoveryDataTypein interfaceGridComponent- Returns:
- Unique component type for discovery data exchange.
-
collectJoiningNodeData
public void collectJoiningNodeData(DiscoveryDataBag dataBag)
Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.- Specified by:
collectJoiningNodeDatain interfaceGridComponent- Parameters:
dataBag- container object to store discovery data in.
-
collectGridNodeData
public void collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.- Specified by:
collectGridNodeDatain interfaceGridComponent- Parameters:
dataBag- container object to store discovery data in.
-
onGridDataReceived
public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called on new node during discovery process).- Specified by:
onGridDataReceivedin interfaceGridComponent- Parameters:
data-DiscoveryDataBag.GridDiscoveryDatainterface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).
-
onJoiningNodeDataReceived
public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
Method is called on nodes that are already in grid (not on joining node). It receives discovery data from joining node.- Specified by:
onJoiningNodeDataReceivedin interfaceGridComponent- Parameters:
data-DiscoveryDataBag.JoiningNodeDiscoveryDatainterface to retrieve discovery data of joining node.
-
onKernalStart0
protected void onKernalStart0() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
onKernalStop0
protected void onKernalStop0(boolean cancel)
- Parameters:
cancel- Cancel flag.
-
assertParameter
protected final void assertParameter(boolean cond, String condDesc) throws IgniteCheckedExceptionThrows exception with uniform error message if given parameter's assertion condition isfalse.- Parameters:
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.- Throws:
IgniteCheckedException- Thrown if given condition isfalse
-
printMemoryStats
public void printMemoryStats()
Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.- Specified by:
printMemoryStatsin interfaceGridComponent
-
validateNode
@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node)
Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.- Specified by:
validateNodein interfaceGridComponent- Parameters:
node- Joining node.- Returns:
- Validation result or
nullin case of success.
-
validateNode
@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.- Specified by:
validateNodein interfaceGridComponent- Parameters:
node- Joining node.discoData- Joining node discovery data.- Returns:
- Validation result or
nullin case of success.
-
-