use of org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater in project ignite by apache.
the class GridCacheAdapter method localLoadCache.
/**
* {@inheritDoc}
*/
@Override
public void localLoadCache(final IgniteBiPredicate<K, V> p, Object[] args) throws IgniteCheckedException {
// TODO IGNITE-7954
MvccUtils.verifyMvccOperationSupport(ctx, "Load");
final boolean replicate = ctx.isDrEnabled();
final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
CacheOperationContext opCtx = ctx.operationContextPerCall();
ExpiryPolicy plc0 = opCtx != null ? opCtx.expiry() : null;
final ExpiryPolicy plc = plc0 != null ? plc0 : ctx.expiry();
final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
if (p != null)
ctx.kernalContext().resource().injectGeneric(p);
try {
if (ctx.store().isLocal()) {
DataStreamerImpl ldr = ctx.kernalContext().dataStream().dataStreamer(ctx.name());
try {
ldr.skipStore(true);
ldr.receiver(new IgniteDrDataStreamerCacheUpdater());
ldr.keepBinary(keepBinary);
LocalStoreLoadClosure c = new LocalStoreLoadClosure(p, ldr, plc);
ctx.store().loadCache(c, args);
c.onDone();
} finally {
ldr.closeEx(false);
}
} else {
// Version for all loaded entries.
final GridCacheVersion ver0 = ctx.versions().nextForLoad();
ctx.store().loadCache(new CIX3<KeyCacheObject, Object, GridCacheVersion>() {
@Override
public void applyx(KeyCacheObject key, Object val, @Nullable GridCacheVersion ver) throws IgniteException {
assert ver == null;
long ttl = CU.ttlForLoad(plc);
if (ttl == CU.TTL_ZERO)
return;
loadEntry(key, val, ver0, (IgniteBiPredicate<Object, Object>) p, topVer, replicate, ttl);
}
}, args);
}
} finally {
if (p instanceof PlatformCacheEntryFilter)
((PlatformCacheEntryFilter) p).onClose();
}
}
use of org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater in project ignite by apache.
the class GridCacheAdapter method localLoad.
/**
* @param keys Keys to load.
* @param plc Optional expiry policy.
* @throws IgniteCheckedException If failed.
*/
public void localLoad(Collection<? extends K> keys, @Nullable ExpiryPolicy plc, final boolean keepBinary) throws IgniteCheckedException {
// TODO IGNITE-7954
MvccUtils.verifyMvccOperationSupport(ctx, "Load");
final boolean replicate = ctx.isDrEnabled();
final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
final ExpiryPolicy plc0 = plc != null ? plc : ctx.expiry();
Collection<KeyCacheObject> keys0 = ctx.cacheKeysView(keys);
if (ctx.store().isLocal()) {
DataStreamerImpl ldr = ctx.kernalContext().dataStream().dataStreamer(ctx.name());
try {
ldr.skipStore(true);
ldr.keepBinary(keepBinary);
ldr.receiver(new IgniteDrDataStreamerCacheUpdater());
LocalStoreLoadClosure c = new LocalStoreLoadClosure(null, ldr, plc0);
ctx.store().localStoreLoadAll(null, keys0, c);
c.onDone();
} finally {
ldr.closeEx(false);
}
} else {
// Version for all loaded entries.
final GridCacheVersion ver0 = ctx.versions().nextForLoad();
ctx.store().loadAll(null, keys0, new CI2<KeyCacheObject, Object>() {
@Override
public void apply(KeyCacheObject key, Object val) {
long ttl = CU.ttlForLoad(plc0);
if (ttl == CU.TTL_ZERO)
return;
loadEntry(key, val, ver0, null, topVer, replicate, ttl);
}
});
}
}
Aggregations