use of org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware in project ignite by apache.
the class GridCacheIoManager method processMessage.
/**
* @param nodeId Node ID.
* @param msg Message.
* @param c Closure.
*/
private void processMessage(UUID nodeId, GridCacheMessage msg, IgniteBiInClosure<UUID, GridCacheMessage> c) {
try {
c.apply(nodeId, msg);
if (log.isDebugEnabled())
log.debug("Finished processing cache communication message [nodeId=" + nodeId + ", msg=" + msg + ']');
} catch (Throwable e) {
U.error(log, "Failed processing message [senderId=" + nodeId + ", msg=" + msg + ']', e);
if (e instanceof Error)
throw e;
} finally {
// Reset thread local context.
cctx.tm().resetContext();
GridCacheMvccManager mvcc = cctx.mvcc();
if (mvcc != null)
mvcc.contextReset();
// Unwind eviction notifications.
if (msg instanceof IgniteTxStateAware) {
IgniteTxState txState = ((IgniteTxStateAware) msg).txState();
if (txState != null)
txState.unwindEvicts(cctx);
} else {
GridCacheContext ctx = cctx.cacheContext(msg.cacheId());
if (ctx != null)
CU.unwindEvicts(ctx);
}
}
}
use of org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware in project ignite by apache.
the class GridCacheIoManager method onMessageProcessed.
/**
* @param msg Message.
*/
public void onMessageProcessed(GridCacheMessage msg) {
// Reset thread local context.
cctx.tm().resetContext();
GridCacheMvccManager mvcc = cctx.mvcc();
if (mvcc != null)
mvcc.contextReset();
// Unwind eviction notifications.
if (msg instanceof IgniteTxStateAware) {
IgniteTxState txState = ((IgniteTxStateAware) msg).txState();
if (txState != null)
txState.unwindEvicts(cctx);
} else if (msg instanceof GridCacheIdMessage) {
GridCacheContext ctx = cctx.cacheContext(((GridCacheIdMessage) msg).cacheId());
if (ctx != null)
CU.unwindEvicts(ctx);
}
}
Aggregations