/** * Serialize object to byte array using marshaller. * * @param obj Object to convert to byte array. * @return Byte array. * @throws IgniteCheckedException If failed to convert. */ protected byte[] toBytes(Object obj) throws IgniteCheckedException { return U.marshal(marsh, obj); }
/** * @param marsh Marshaller. * @throws org.apache.ignite.IgniteCheckedException In case of error. */ void p2pMarshal(Marshaller marsh) throws IgniteCheckedException { assert marsh != null; prjPredBytes = U.marshal(marsh, prjPred); }
/** * Ensures that we have {@code keyBytes}. * * @param key Key. * @param keyBytes Optional key bytes. * @return Key bytes * @throws IgniteCheckedException If failed. */ private byte[] keyBytes(KeyCacheObject key, @Nullable byte[] keyBytes) throws IgniteCheckedException { assert key != null; return keyBytes != null ? keyBytes : U.marshal(marsh, key); }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (params != null && paramsBytes == null) paramsBytes = U.marshal(ctx, params); }
/** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { super.prepareMarshal(marsh); if (err != null && errBytes == null) errBytes = U.marshal(marsh, err); }
/** {@inheritDoc} */ @Override public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException { assert msg instanceof HadoopMessage : "Invalid message type: " + msg; return proceedSessionWrite(ses, U.marshal(marsh, msg), fut, ackC); }
/** {@inheritDoc} */ @Override public byte[] valueBytes(CacheObjectValueContext cacheCtx) throws IgniteCheckedException { if (valBytes != null) return valBytes; valBytes = U.marshal(ctx.marshaller(), this); return valBytes; }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (err != null && errBytes == null) errBytes = U.marshal(ctx, err); }
/** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (err != null && errBytes == null) errBytes = U.marshal(ctx, err); }
/** {@inheritDoc} */ @Override public void marshall(Marshaller m) { if (paramsBytes != null) return; assert params != null; try { paramsBytes = U.marshal(m, params); } catch (IgniteCheckedException e) { throw new IgniteException(e); } }
/** * @param obj Object. * @return Bytes. * @throws IgniteCheckedException If failed. */ byte[] marshalZip(Object obj) throws IgniteCheckedException { assert obj != null; return zip(U.marshal(marsh, obj)); }
/** {@inheritDoc} */ @Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException { super.prepareMarshal(marsh); if (err != null) errBytes = U.marshal(marsh, err); }
/** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (topic != null && topicBytes == null) topicBytes = U.marshal(ctx, topic); }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException { assert p != null; p.prepareMarshal(ctx); if (bytes == null) bytes = U.marshal(ctx.marshaller(), p); }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (err != null && errBytes == null) errBytes = U.marshal(ctx.marshaller(), err); }
/** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); GridCacheContext cctx = ctx.cacheContext(cacheId); if (entries != null) { for (GridCacheEntryInfo info : entries) info.marshal(cctx); } if (err != null && errBytes == null) errBytes = U.marshal(ctx, err); }
@Override public byte[] accept(Object payload) throws IgniteCheckedException { byte[] marshalled = U.marshal(ctx, payload); if(compress) marshalled = U.zip(marshalled, ctx.gridConfig().getNetworkCompressionLevel()); return marshalled; } });
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); GridCacheContext cctx = ctx.cacheContext(cacheId); if (err != null && errBytes == null) errBytes = U.marshal(ctx.marshaller(), err); if (res != null) res.prepareMarshal(cctx); }
/** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); prepareMarshalCacheObjects(vals, ctx.cacheContext(cacheId)); if (err != null && errBytes == null) errBytes = U.marshal(ctx.marshaller(), err); }
/** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (checkCommittedErr != null && checkCommittedErrBytes == null) checkCommittedErrBytes = U.marshal(ctx, checkCommittedErr); if (retVal != null && retVal.cacheId() != 0) { GridCacheContext cctx = ctx.cacheContext(retVal.cacheId()); assert cctx != null : retVal.cacheId(); retVal.prepareMarshal(cctx); } }