use of org.infinispan.test.fwk.CacheEntryDelegator in project infinispan by infinispan.
the class NonTxStateTransferOverwritingValue2Test method blockEntryCommit.
private void blockEntryCommit(final CheckPoint checkPoint, AdvancedCache<Object, Object> cache) {
ClusteringDependentLogic cdl1 = TestingUtil.extractComponent(cache, ClusteringDependentLogic.class);
ClusteringDependentLogic replaceCdl = new ClusteringDependentLogicDelegator(cdl1) {
@Override
public CompletionStage<Void> commitEntry(CacheEntry entry, FlagAffectedCommand command, InvocationContext ctx, Flag trackFlag, boolean l1Invalidation) {
// skip for clear command!
if (entry instanceof ClearCacheEntry) {
return super.commitEntry(entry, command, ctx, trackFlag, l1Invalidation);
}
final Address source = ctx.getOrigin();
CacheEntry newEntry = new CacheEntryDelegator(entry) {
@Override
public void commit(DataContainer container) {
checkPoint.trigger("pre_commit_entry_" + getKey() + "_from_" + source);
try {
checkPoint.awaitStrict("resume_commit_entry_" + getKey() + "_from_" + source, 10, SECONDS);
} catch (InterruptedException | TimeoutException e) {
throw new RuntimeException(e);
}
super.commit(container);
checkPoint.trigger("post_commit_entry_" + getKey() + "_from_" + source);
}
};
return super.commitEntry(newEntry, command, ctx, trackFlag, l1Invalidation);
}
};
TestingUtil.replaceComponent(cache, ClusteringDependentLogic.class, replaceCdl, true);
}
Aggregations