/** * Adds owned value. * * @param key Key. * @param ver DHT version. * @param val Value. */ public void addOwnedValue(IgniteTxKey key, GridCacheVersion ver, CacheObject val) { if (val == null) return; if (ownedVals == null) ownedVals = new HashMap<>(); CacheVersionedValue oVal = new CacheVersionedValue(val, ver); ownedVals.put(key, oVal); }
/** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { writer.setBuffer(buf); if (!writer.isHeaderWritten()) { if (!writer.writeHeader(directType(), fieldsCount())) return false; writer.onHeaderWritten(); } switch (writer.state()) { case 0: if (!writer.writeMessage("val", val)) return false; writer.incrementState(); case 1: if (!writer.writeMessage("ver", ver)) return false; writer.incrementState(); } return true; }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (ownedValKeys != null && ownedVals == null) { ownedVals = U.newHashMap(ownedValKeys.size()); assert ownedValKeys.size() == ownedValVals.size(); Iterator<IgniteTxKey> keyIter = ownedValKeys.iterator(); Iterator<CacheVersionedValue> valIter = ownedValVals.iterator(); while (keyIter.hasNext()) { IgniteTxKey key = keyIter.next(); GridCacheContext cctx = ctx.cacheContext(key.cacheId()); CacheVersionedValue val = valIter.next(); key.finishUnmarshal(cctx, ldr); val.finishUnmarshal(cctx, ldr); ownedVals.put(key, val); } } if (retVal != null && retVal.cacheId() != 0) { GridCacheContext cctx = ctx.cacheContext(retVal.cacheId()); assert cctx != null : retVal.cacheId(); retVal.finishUnmarshal(cctx, ldr); } if (filterFailedKeys != null) { for (IgniteTxKey key :filterFailedKeys) { GridCacheContext cctx = ctx.cacheContext(key.cacheId()); key.finishUnmarshal(cctx, ldr); } } }
/** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (ownedVals != null && ownedValKeys == null) { ownedValKeys = ownedVals.keySet(); ownedValVals = ownedVals.values(); for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : ownedVals.entrySet()) { GridCacheContext cacheCtx = ctx.cacheContext(entry.getKey().cacheId()); entry.getKey().prepareMarshal(cacheCtx); entry.getValue().prepareMarshal(cacheCtx.cacheObjectContext()); } } if (retVal != null && retVal.cacheId() != 0) { GridCacheContext cctx = ctx.cacheContext(retVal.cacheId()); assert cctx != null : retVal.cacheId(); retVal.prepareMarshal(cctx); } if (filterFailedKeys != null) { for (IgniteTxKey key : filterFailedKeys) { GridCacheContext cctx = ctx.cacheContext(key.cacheId()); key.prepareMarshal(cctx); } } }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (res != null) { GridCacheContext cctx = ctx.cacheContext(cacheId); if (res instanceof CacheObject) prepareMarshalCacheObject((CacheObject) res, cctx); else if (res instanceof CacheVersionedValue) ((CacheVersionedValue)res).prepareMarshal(cctx.cacheObjectContext()); else if (res instanceof GridCacheEntryInfo) ((GridCacheEntryInfo)res).marshal(cctx); } if (err != null && errBytes == null) errBytes = U.marshal(ctx, err); }
/** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { writer.setBuffer(buf); if (!writer.isHeaderWritten()) { if (!writer.writeHeader(directType(), fieldsCount())) return false; writer.onHeaderWritten(); } switch (writer.state()) { case 0: if (!writer.writeMessage("val", val)) return false; writer.incrementState(); case 1: if (!writer.writeMessage("ver", ver)) return false; writer.incrementState(); } return true; }
res0 = new CacheVersionedValue(info.value(), info.version()); else res0 = info.value();
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (res != null) { GridCacheContext cctx = ctx.cacheContext(cacheId()); if (res instanceof CacheObject) ((CacheObject)res).finishUnmarshal(cctx.cacheObjectContext(), ldr); else if (res instanceof CacheVersionedValue) ((CacheVersionedValue)res).finishUnmarshal(cctx, ldr); else if (res instanceof GridCacheEntryInfo) ((GridCacheEntryInfo)res).unmarshal(cctx, ldr); } if (errBytes != null && err == null) err = U.unmarshal(ctx, errBytes, U.resolveClassLoader(ldr, ctx.gridConfig())); }
/** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (ownedVals != null && ownedValKeys == null) { ownedValKeys = ownedVals.keySet(); ownedValVals = ownedVals.values(); for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : ownedVals.entrySet()) { GridCacheContext cacheCtx = ctx.cacheContext(entry.getKey().cacheId()); entry.getKey().prepareMarshal(cacheCtx); entry.getValue().prepareMarshal(cacheCtx.cacheObjectContext()); } } if (retVal != null && retVal.cacheId() != 0) { GridCacheContext cctx = ctx.cacheContext(retVal.cacheId()); assert cctx != null : retVal.cacheId(); retVal.prepareMarshal(cctx); } if (filterFailedKeys != null) { for (IgniteTxKey key : filterFailedKeys) { GridCacheContext cctx = ctx.cacheContext(key.cacheId()); key.prepareMarshal(cctx); } } }
/** * Adds owned value. * * @param key Key. * @param ver DHT version. * @param val Value. */ public void addOwnedValue(IgniteTxKey key, GridCacheVersion ver, CacheObject val) { if (val == null) return; if (ownedVals == null) ownedVals = new HashMap<>(); CacheVersionedValue oVal = new CacheVersionedValue(val, ver); ownedVals.put(key, oVal); }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (ownedValKeys != null && ownedVals == null) { ownedVals = U.newHashMap(ownedValKeys.size()); assert ownedValKeys.size() == ownedValVals.size(); Iterator<IgniteTxKey> keyIter = ownedValKeys.iterator(); Iterator<CacheVersionedValue> valIter = ownedValVals.iterator(); while (keyIter.hasNext()) { IgniteTxKey key = keyIter.next(); GridCacheContext cctx = ctx.cacheContext(key.cacheId()); CacheVersionedValue val = valIter.next(); key.finishUnmarshal(cctx, ldr); val.finishUnmarshal(cctx, ldr); ownedVals.put(key, val); } } if (retVal != null && retVal.cacheId() != 0) { GridCacheContext cctx = ctx.cacheContext(retVal.cacheId()); assert cctx != null : retVal.cacheId(); retVal.finishUnmarshal(cctx, ldr); } if (filterFailedKeys != null) { for (IgniteTxKey key :filterFailedKeys) { GridCacheContext cctx = ctx.cacheContext(key.cacheId()); key.finishUnmarshal(cctx, ldr); } } }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (res != null) { GridCacheContext cctx = ctx.cacheContext(cacheId); if (res instanceof CacheObject) prepareMarshalCacheObject((CacheObject) res, cctx); else if (res instanceof CacheVersionedValue) ((CacheVersionedValue)res).prepareMarshal(cctx.cacheObjectContext()); else if (res instanceof GridCacheEntryInfo) ((GridCacheEntryInfo)res).marshal(cctx); } if (err != null && errBytes == null) errBytes = U.marshal(ctx, err); }
msg = new CacheVersionedValue();
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (res != null) { GridCacheContext cctx = ctx.cacheContext(cacheId()); if (res instanceof CacheObject) ((CacheObject)res).finishUnmarshal(cctx.cacheObjectContext(), ldr); else if (res instanceof CacheVersionedValue) ((CacheVersionedValue)res).finishUnmarshal(cctx, ldr); else if (res instanceof GridCacheEntryInfo) ((GridCacheEntryInfo)res).unmarshal(cctx, ldr); } if (errBytes != null && err == null) err = U.unmarshal(ctx, errBytes, U.resolveClassLoader(ldr, ctx.gridConfig())); }
res0 = new CacheVersionedValue(info.value(), info.version()); else res0 = info.value();