Class ClusterProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.processors.cluster.ClusterProcessor
-
- All Implemented Interfaces:
GridComponent,GridProcessor,DistributedMetastorageLifecycleListener
public class ClusterProcessor extends GridProcessorAdapter implements DistributedMetastorageLifecycleListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTIVE_BASELINE_NODESActive baseline nodes count metric name.static booleanDFLT_DIAGNOSTIC_ENABLEDstatic booleanDFLT_UPDATE_NOTIFIERstatic StringTOTAL_BASELINE_NODESTotal baseline nodes count metric name.static StringTOTAL_CLIENT_NODESTotal client nodes count metric name.static StringTOTAL_SERVER_NODESTotal server nodes count metric name.-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description ClusterProcessor(GridKernalContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IgniteFuture<?>clientReconnectFuture()StringclusterName()Get cluster name.voidcollectGridNodeData(DiscoveryDataBag dataBag)Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.voidcollectJoiningNodeData(DiscoveryDataBag dataBag)Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.booleandiagnosticEnabled()IgniteLoggerdiagnosticLog()voiddisableUpdateNotifier()Disables update notifier.@Nullable GridComponent.DiscoveryDataExchangeTypediscoveryDataType()Gets unique component type to distinguish components providing discovery data.IgniteClusterImplget()voidinitDiagnosticListeners()StringlatestVersion()voidonDisconnected(IgniteFuture<?> reconnectFut)Client disconnected callback.voidonGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)Receives discovery data object from remote nodes (called on new node during discovery process).voidonKernalStart(boolean active)Callback that notifies that kernal has successfully started, including all managers and processors.voidonKernalStop(boolean cancel)Callback to notify that kernal is about to stop.voidonLocalJoin()Node makes ID and tag available through public API on local join event.voidonReadyForRead(ReadableDistributedMetaStorage metastorage)Called when global metastorage is ready for reading.voidonReadyForWrite(DistributedMetaStorage metastorage)Called when global metastorage is available for writing.IgniteInternalFuture<?>onReconnected(boolean clusterRestarted)Client reconnected callback.voidregisterMetrics()Registers cluster metrics.IgniteInternalFuture<String>requestDiagnosticInfo(UUID nodeId, IgniteClosure<GridKernalContext,IgniteDiagnosticInfo> c, String baseMsg)Sends diagnostic message closure to remote node.voidstart()Starts grid component.voidstop(boolean cancel)Stops grid component.booleanupdateNotifierEnabled()voidupdateTag(String newTag)Method is called when user requests updating tag through public API.-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, onJoiningNodeDataReceived, printMemoryStats, toString, validateNode, validateNode
-
-
-
-
Field Detail
-
TOTAL_SERVER_NODES
public static final String TOTAL_SERVER_NODES
Total server nodes count metric name.- See Also:
- Constant Field Values
-
TOTAL_CLIENT_NODES
public static final String TOTAL_CLIENT_NODES
Total client nodes count metric name.- See Also:
- Constant Field Values
-
TOTAL_BASELINE_NODES
public static final String TOTAL_BASELINE_NODES
Total baseline nodes count metric name.- See Also:
- Constant Field Values
-
ACTIVE_BASELINE_NODES
public static final String ACTIVE_BASELINE_NODES
Active baseline nodes count metric name.- See Also:
- Constant Field Values
-
DFLT_UPDATE_NOTIFIER
public static final boolean DFLT_UPDATE_NOTIFIER
-
DFLT_DIAGNOSTIC_ENABLED
public static final boolean DFLT_DIAGNOSTIC_ENABLED
-
-
Constructor Detail
-
ClusterProcessor
public ClusterProcessor(GridKernalContext ctx)
- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
diagnosticEnabled
public boolean diagnosticEnabled()
- Returns:
- Diagnostic flag.
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
onReadyForRead
public void onReadyForRead(ReadableDistributedMetaStorage metastorage)
Called when global metastorage is ready for reading.
Normally this is the place where you should add listeners and read required data. Note that this data might be outdated.- Specified by:
onReadyForReadin interfaceDistributedMetastorageLifecycleListener- Parameters:
metastorage- Read-only global metastorage.- See Also:
DistributedMetaStorageListener
-
onReadyForWrite
public void onReadyForWrite(DistributedMetaStorage metastorage)
Called when global metastorage is available for writing. In persistent mode this method will be invoked every time cluster is reactivated.- Specified by:
onReadyForWritein interfaceDistributedMetastorageLifecycleListener- Parameters:
metastorage- Global metastorage instance.
-
updateTag
public void updateTag(String newTag) throws IgniteCheckedException
Method is called when user requests updating tag through public API.- Parameters:
newTag- New tag.- Throws:
IgniteCheckedException
-
onLocalJoin
public void onLocalJoin()
Node makes ID and tag available through public API on local join event. Two cases.- In in-memory scenario very first node of the cluster generates ID and tag, other nodes receives them on join.
- When persistence is enabled each node reads ID and tag from metastorage when it becomes ready for read.
-
onDisconnected
public void onDisconnected(IgniteFuture<?> reconnectFut)
Client disconnected callback.- Specified by:
onDisconnectedin interfaceGridComponent- Overrides:
onDisconnectedin classGridProcessorAdapter- Parameters:
reconnectFut- Reconnect future.
-
onReconnected
public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)
Client reconnected callback.- Specified by:
onReconnectedin interfaceGridComponent- Overrides:
onReconnectedin classGridProcessorAdapter- Parameters:
clusterRestarted- Cluster restarted flag.- Returns:
- Future to wait before completing reconnect future.
-
initDiagnosticListeners
public void initDiagnosticListeners() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
diagnosticLog
public IgniteLogger diagnosticLog()
- Returns:
- Logger for diagnostic category.
-
get
public IgniteClusterImpl get()
- Returns:
- Cluster.
-
clientReconnectFuture
public IgniteFuture<?> clientReconnectFuture()
- Returns:
- Client reconnect future.
-
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- Overrides:
discoveryDataTypein classGridProcessorAdapter- 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- Overrides:
collectJoiningNodeDatain classGridProcessorAdapter- 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- Overrides:
collectGridNodeDatain classGridProcessorAdapter- 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- Overrides:
onGridDataReceivedin classGridProcessorAdapter- Parameters:
data-DiscoveryDataBag.GridDiscoveryDatainterface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).
-
onKernalStart
public void onKernalStart(boolean active) throws IgniteCheckedExceptionCallback that notifies that kernal has successfully started, including all managers and processors.- Specified by:
onKernalStartin interfaceGridComponent- Overrides:
onKernalStartin classGridProcessorAdapter- 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 void onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.- Specified by:
onKernalStopin interfaceGridComponent- Overrides:
onKernalStopin classGridProcessorAdapter- Parameters:
cancel- Flag indicating whether jobs should be canceled.
-
stop
public void stop(boolean cancel) throws IgniteCheckedExceptionStops grid component.- Specified by:
stopin interfaceGridComponent- Overrides:
stopin classGridProcessorAdapter- Parameters:
cancel- Iftrue, then all ongoing tasks or jobs for relevant components need to be cancelled.- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
registerMetrics
public void registerMetrics()
Registers cluster metrics.
-
disableUpdateNotifier
public void disableUpdateNotifier()
Disables update notifier.
-
updateNotifierEnabled
public boolean updateNotifierEnabled()
- Returns:
- Update notifier status.
-
latestVersion
public String latestVersion()
- Returns:
- Latest version string.
-
clusterName
public String clusterName()
Get cluster name.- Returns:
- Cluster name.
-
requestDiagnosticInfo
public IgniteInternalFuture<String> requestDiagnosticInfo(UUID nodeId, IgniteClosure<GridKernalContext,IgniteDiagnosticInfo> c, String baseMsg)
Sends diagnostic message closure to remote node. When response received dumps remote message and local communication info about connection(s) with remote node.- Parameters:
nodeId- Target node ID.c- Closure to send.baseMsg- Local message to log.- Returns:
- Message future.
-
-