Class GridCacheIoManager
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
-
- org.apache.ignite.internal.processors.cache.GridCacheIoManager
-
- All Implemented Interfaces:
GridCacheSharedManager
public class GridCacheIoManager extends GridCacheSharedManagerAdapter
Cache communication manager.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMMON_MESSAGE_HANDLER_IDCommon message handler identifier that does not correspond to any particular cache.-
Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
cctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description GridCacheIoManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <Msg extends GridCacheGroupIdMessage>
voidaddCacheGroupHandler(int hndId, Class<Msg> type, IgniteBiInClosure<UUID,? super Msg> c)<Msg extends GridCacheMessage>
voidaddCacheHandler(int hndId, AffinityTopologyVersion startTopVer, Class<Msg> type, IgniteBiInClosure<UUID,? super Msg> c)<Msg extends GridCacheMessage>
voidaddCacheHandler(Class<Msg> type, IgniteBiInClosure<UUID,? super Msg> c)Registers a new message handler for the given messagetype.voidaddOrderedCacheGroupHandler(GridCacheSharedContext cctx, Object topic, IgniteBiInClosure<UUID,? extends GridCacheGroupIdMessage> c)voidaddOrderedCacheHandler(GridCacheSharedContext cctx, Object topic, IgniteBiInClosure<UUID,? extends GridCacheIdMessage> c)<Msg extends GridCacheMessage>
IgniteBiInClosure<UUID,? super Msg>cacheHandler(int hndId, Class<? extends GridCacheMessage> msgCls)Finds cache message handler by its ID and message class.booleancheckNodeLeft(UUID nodeId, IgniteCheckedException sndErr, boolean ping)voiddumpPendingMessages(StringBuilder sb)longnextIoId()protected voidonKernalStop0(boolean cancel)voidonMessageProcessed(GridCacheMessage msg)voidprintMemoryStats()Prints memory statistics (sizes of internal data structures, etc.).@Nullable LockreadLock()voidremoveHandler(boolean cacheGrp, int hndId, Class<? extends GridCacheMessage> type)voidremoveOrderedHandler(boolean cacheGrp, Object topic)Removed ordered message handler.voidsend(UUID nodeId, GridCacheMessage msg, byte plc)Sends communication message.voidsend(ClusterNode node, GridCacheMessage msg, byte plc)Sends communication message.voidsendOrderedMessage(ClusterNode node, Object topic, GridCacheMessage msg, byte plc, long timeout)voidstart0()voidwriteLock()voidwriteUnlock()-
Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
context, isStopping, kernalStartInfo, kernalStopInfo, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, onReconnected, start, startInfo, stop, stop0, stopInfo, toString
-
-
-
-
Field Detail
-
COMMON_MESSAGE_HANDLER_ID
public static final int COMMON_MESSAGE_HANDLER_ID
Common message handler identifier that does not correspond to any particular cache.- See Also:
- Constant Field Values
-
-
Method Detail
-
dumpPendingMessages
public void dumpPendingMessages(StringBuilder sb)
- Parameters:
sb- String builder.
-
start0
public void start0() throws IgniteCheckedException- Overrides:
start0in classGridCacheSharedManagerAdapter- Throws:
IgniteCheckedException- If failed.
-
readLock
@Nullable public @Nullable Lock readLock()
- Returns:
- Lock or
nullif node is stopping.
-
writeLock
public void writeLock()
-
writeUnlock
public void writeUnlock()
-
onKernalStop0
protected void onKernalStop0(boolean cancel)
- Overrides:
onKernalStop0in classGridCacheSharedManagerAdapter- Parameters:
cancel- Cancel flag.
-
onMessageProcessed
public void onMessageProcessed(GridCacheMessage msg)
- Parameters:
msg- Message.
-
checkNodeLeft
public boolean checkNodeLeft(UUID nodeId, IgniteCheckedException sndErr, boolean ping) throws IgniteClientDisconnectedCheckedException
- Parameters:
nodeId- Node ID.sndErr- Send error.ping-Trueif try ping node.- Returns:
Trueif node left.- Throws:
IgniteClientDisconnectedCheckedException- If ping failed.
-
send
public void send(ClusterNode node, GridCacheMessage msg, byte plc) throws IgniteCheckedException
Sends communication message.- Parameters:
node- Node to send the message to.msg- Message to send.plc- IO policy.- Throws:
IgniteCheckedException- If sending failed.ClusterTopologyCheckedException- If receiver left.
-
send
public void send(UUID nodeId, GridCacheMessage msg, byte plc) throws IgniteCheckedException
Sends communication message.- Parameters:
nodeId- ID of node to send the message to.msg- Message to send.plc- IO policy.- Throws:
IgniteCheckedException- If sending failed.
-
sendOrderedMessage
public void sendOrderedMessage(ClusterNode node, Object topic, GridCacheMessage msg, byte plc, long timeout) throws IgniteCheckedException
- Parameters:
node- Destination node.topic- Topic to send the message to.msg- Message to send.plc- IO policy.timeout- Timeout to keep a message on receiving queue.- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
nextIoId
public long nextIoId()
- Returns:
- ID that auto-grows based on local counter and counters received from other nodes.
-
addCacheHandler
public <Msg extends GridCacheMessage> void addCacheHandler(int hndId, AffinityTopologyVersion startTopVer, Class<Msg> type, IgniteBiInClosure<UUID,? super Msg> c)
- Parameters:
hndId- Message handler ID.type- Type of message.c- Handler.
-
addCacheHandler
public <Msg extends GridCacheMessage> void addCacheHandler(Class<Msg> type, IgniteBiInClosure<UUID,? super Msg> c)
Registers a new message handler for the given messagetype. This method is equivalent toaddCacheHandler(int, AffinityTopologyVersion, Class, IgniteBiInClosure)where is the handler id equals toCOMMON_MESSAGE_HANDLER_IDand deployment id isnull.- Parameters:
type- Type of message.c- Handler.
-
cacheHandler
public <Msg extends GridCacheMessage> IgniteBiInClosure<UUID,? super Msg> cacheHandler(int hndId, Class<? extends GridCacheMessage> msgCls)
Finds cache message handler by its ID and message class.- Parameters:
hndId- Message handler ID.msgCls- Message class.- Returns:
- Message handler.
-
addCacheGroupHandler
public <Msg extends GridCacheGroupIdMessage> void addCacheGroupHandler(int hndId, Class<Msg> type, IgniteBiInClosure<UUID,? super Msg> c)
- Parameters:
hndId- Message handler ID.type- Type of message.c- Handler.
-
removeHandler
public void removeHandler(boolean cacheGrp, int hndId, Class<? extends GridCacheMessage> type)- Parameters:
cacheGrp-Trueif cache group handler,falseif cache handler.hndId- Handler ID.type- Message type.
-
addOrderedCacheHandler
public void addOrderedCacheHandler(GridCacheSharedContext cctx, Object topic, IgniteBiInClosure<UUID,? extends GridCacheIdMessage> c)
- Parameters:
cctx- Context.topic- Topic.c- Handler.
-
addOrderedCacheGroupHandler
public void addOrderedCacheGroupHandler(GridCacheSharedContext cctx, Object topic, IgniteBiInClosure<UUID,? extends GridCacheGroupIdMessage> c)
- Parameters:
cctx- Context.topic- Topic.c- Handler.
-
removeOrderedHandler
public void removeOrderedHandler(boolean cacheGrp, Object topic)Removed ordered message handler.- Parameters:
cacheGrp-Trueif cache group message,falseif cache message.topic- Topic.
-
printMemoryStats
public void printMemoryStats()
Prints memory statistics (sizes of internal data structures, etc.). NOTE: this method is for testing and profiling purposes only.- Specified by:
printMemoryStatsin interfaceGridCacheSharedManager- Overrides:
printMemoryStatsin classGridCacheSharedManagerAdapter
-
-