/** * This method is called after the whole message is received * and is responsible for unmarshalling state. * * @param ctx Context. * @param ldr Class loader. * @throws IgniteCheckedException If failed. */ public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { if (val != null) val.finishUnmarshal(ctx.cacheObjectContext(), ldr); }
/** * @param ctx Context. * @param ldr Loader. * @throws IgniteCheckedException If failed. */ public void unmarshalValue(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException { if (val != null) val.finishUnmarshal(ctx.cacheObjectContext(), ldr); }
/** * @param ctx Context. * @throws IgniteCheckedException If failed. */ public void unmarshal(CacheObjectContext ctx) throws IgniteCheckedException { assert key != null; key.finishUnmarshal(ctx, null); if (val != null) val.finishUnmarshal(ctx, null); }
/** * @param obj CacheObject un to marshal * @param ctx context * @param ldr class loader * @throws IgniteCheckedException if error */ private void finishUnmarshalObject(@Nullable CacheObject obj, GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { if (obj != null) obj.finishUnmarshal(ctx.cacheObjectContext(), ldr); }
/** * @param ctx Cache context. * @param ldr Class loader. * @throws org.apache.ignite.IgniteCheckedException If unmarshalling failed. */ public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException { if (hasWriteVal && val != null) val.finishUnmarshal(ctx.cacheObjectContext(), ldr); }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { val.finishUnmarshal(ctx.cacheObjectContext(), ldr); }
/** * @param col Collection. * @param ctx Context. * @param ldr Class loader. * @throws IgniteCheckedException If failed. */ protected final void finishUnmarshalCacheObjects(@Nullable Collection<? extends CacheObject> col, GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { if (col == null) return; for (CacheObject obj : col) { if (obj != null) obj.finishUnmarshal(ctx.cacheObjectContext(), ldr); } }
/** * @param col Collection. * @param ctx Context. * @param ldr Class loader. * @throws IgniteCheckedException If failed. */ @SuppressWarnings("ForLoopReplaceableByForEach") public final void finishUnmarshalCacheObjects(@Nullable List<? extends CacheObject> col, GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { if (col == null) return; int size = col.size(); for (int i = 0 ; i < size; i++) { CacheObject obj = col.get(i); if (obj != null) obj.finishUnmarshal(ctx.cacheObjectContext(), ldr); } }
/** * Unmarshalls entry. * * @param ctx Cache context. * @param clsLdr Class loader. * @throws IgniteCheckedException If unmarshalling failed. */ public void unmarshal(CacheObjectContext ctx, ClassLoader clsLdr) throws IgniteCheckedException { key.finishUnmarshal(ctx, clsLdr); if (val != null) val.finishUnmarshal(ctx, clsLdr); long remaining = expireTime; expireTime = remaining < 0 ? 0 : U.currentTimeMillis() + remaining; // Account for overflow. if (expireTime < 0) expireTime = 0; }
/** * @param cctx Cache context. * @param ldr Class loader. * @throws IgniteCheckedException In case of error. */ void unmarshal(GridCacheContext cctx, @Nullable ClassLoader ldr) throws IgniteCheckedException { if (!isFiltered()) { if (key != null) key.finishUnmarshal(cctx.cacheObjectContext(), ldr); if (newVal != null) newVal.finishUnmarshal(cctx.cacheObjectContext(), ldr); if (oldVal != null) oldVal.finishUnmarshal(cctx.cacheObjectContext(), ldr); } }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); CacheObjectContext objCtx = ctx.cacheContext(cacheId).cacheObjectContext(); if (keys != null) { for (int i = 0; i < keys.size(); i++) { keys.get(i).finishUnmarshal(objCtx, ldr); if (vals != null) { Message val = vals.get(i); if (val instanceof CacheObject) ((CacheObject)val).finishUnmarshal(objCtx, ldr); else if (val instanceof CacheEntryInfoCollection) { for (GridCacheEntryInfo entry : ((CacheEntryInfoCollection)val).infos()) { CacheObject entryVal = entry.value(); if (entryVal != null) entryVal.finishUnmarshal(objCtx, ldr); } } else if (val instanceof GridInvokeValue) ((GridInvokeValue)val).finishUnmarshal(ctx, ldr); } } } }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (keys != null) { rows = new ArrayList<>(keys.length); CacheObjectContext objCtx = ctx.cacheContext(cacheId).cacheObjectContext(); for (int i = 0; i < keys.length; i++) { keys[i].finishUnmarshal(objCtx, ldr); if (op.isDeleteOrLock()) rows.add(keys[i]); else { if (values[i] != null) values[i].finishUnmarshal(objCtx, ldr); rows.add(new IgniteBiTuple<>(keys[i], values[i])); } } keys = null; values = null; } }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); GridCacheContext cctx = ctx.cacheContext(cacheId); key.finishUnmarshal(cctx.cacheObjectContext(), ldr); if (val != null) val.finishUnmarshal(cctx.cacheObjectContext(), ldr); }
/** * Perform internal unmarshal of this entry. It must be performed after entry is deserialized and before * its restored key/value are needed. * * @param ctx Context. * @param marsh Marshaller. * @throws IgniteCheckedException If failed. */ public void unmarshal(CacheObjectContext ctx, Marshaller marsh) throws IgniteCheckedException { unmarshalKey(ctx, marsh); if (val == null && valBytes != null) { val = U.unmarshal(marsh, valBytes, U.resolveClassLoader(ctx.kernalContext().config())); val.finishUnmarshal(ctx, null); } }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (keys != null) { rows = new ArrayList<>(keys.length); CacheObjectContext objCtx = ctx.cacheContext(cacheId).cacheObjectContext(); for (int i = 0; i < keys.length; i++) { keys[i].finishUnmarshal(objCtx, ldr); if (op.isDeleteOrLock()) rows.add(keys[i]); else { if (values[i] != null) { if(op.isInvoke()) ((GridInvokeValue)values[i]).finishUnmarshal(ctx, ldr); else ((CacheObject)values[i]).finishUnmarshal(objCtx, ldr); } rows.add(new IgniteBiTuple<>(keys[i], values[i])); } } keys = null; values = null; } if (filter != null) filter.finishUnmarshal(ctx.cacheContext(cacheId), ldr); }
/** {@inheritDoc} */ @Override public Value value(GridKernalContext ctx) throws IgniteCheckedException { CacheObjectValueContext valCtx = ctx.query().objectContext(); obj.finishUnmarshal(valCtx, ctx.cache().context().deploy().globalLoader()); return new GridH2ValueCacheObject(obj, valCtx); }
/** * @param ctx Cache context. * @param ldr Class loader. * @throws IgniteCheckedException If failed. */ public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { key.finishUnmarshal(ctx.cacheObjectContext(), ldr); if (errBytes != null && err == null) err = U.unmarshal(ctx.marshaller(), errBytes, U.resolveClassLoader(ldr, ctx.gridConfig())); if (res != null) res.finishUnmarshal(ctx.cacheObjectContext(), ldr); }
/** {@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())); }
/** * @param ctx Cache context. * @param ldr Class loader. * @throws IgniteCheckedException If failed. */ public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { loc = true; if (cacheObj != null) { cacheObj.finishUnmarshal(ctx.cacheObjectContext(), ldr); v = ctx.cacheObjectContext().unwrapBinaryIfNeeded(cacheObj, true, false); } if (invokeRes && invokeResCol != null) { for (CacheInvokeDirectResult res : invokeResCol) res.finishUnmarshal(ctx, ldr); Map<Object, CacheInvokeResult> map0 = U.newHashMap(invokeResCol.size()); for (CacheInvokeDirectResult res : invokeResCol) { CacheInvokeResult<?> res0 = res.error() == null ? CacheInvokeResult.fromResult(ctx.cacheObjectContext().unwrapBinaryIfNeeded(res.result(), true, false)) : CacheInvokeResult.fromError(res.error()); map0.put(ctx.cacheObjectContext().unwrapBinaryIfNeeded(res.key(), true, false), res0); } v = map0; } }
/** * @param info Entry to marshal. * @param ctx Context. * @param cacheObjCtx Cache object context. * @throws IgniteCheckedException If failed. */ protected final void marshalInfo(GridCacheEntryInfo info, GridCacheSharedContext ctx, CacheObjectContext cacheObjCtx ) throws IgniteCheckedException { assert ctx != null; if (info != null) { info.marshal(cacheObjCtx); if (addDepInfo) { if (info.key() != null) prepareObject(info.key().value(cacheObjCtx, false), ctx); CacheObject val = info.value(); if (val != null) { val.finishUnmarshal(cacheObjCtx, ctx.deploy().globalLoader()); prepareObject(val.value(cacheObjCtx, false), ctx); } } } }