use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridCacheMvccSelfTest method testMarshalUnmarshalCandidate.
/**
* @throws Exception If failed.
*/
public void testMarshalUnmarshalCandidate() throws Exception {
GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
GridCacheTestEntryEx parent = new GridCacheTestEntryEx(cache.context(), "1");
GridCacheMvccCandidate cand = new GridCacheMvccCandidate(parent, UUID.randomUUID(), UUID.randomUUID(), version(1), 123, version(2), /*local*/
false, /*reentry*/
false, true, false, false, false, null, false);
Marshaller marshaller = getTestResources().getMarshaller();
GridCacheMvccCandidate unmarshalled = marshaller.unmarshal(marshaller.marshal(cand), null);
info(unmarshalled.toString());
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridCacheMessage method unmarshalCollection.
/**
* @param byteCol Collection to unmarshal.
* @param ctx Context.
* @param ldr Loader.
* @return Unmarshalled collection.
* @throws IgniteCheckedException If failed.
*/
@Nullable
protected <T> List<T> unmarshalCollection(@Nullable Collection<byte[]> byteCol, GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
assert ldr != null;
assert ctx != null;
if (byteCol == null)
return null;
List<T> col = new ArrayList<>(byteCol.size());
Marshaller marsh = ctx.marshaller();
for (byte[] bytes : byteCol) col.add(bytes == null ? null : U.<T>unmarshal(marsh, bytes, U.resolveClassLoader(ldr, ctx.gridConfig())));
return col;
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridCacheMessage method unmarshalInvokeArguments.
/**
* @param byteCol Collection to unmarshal.
* @param ctx Context.
* @param ldr Loader.
* @return Unmarshalled collection.
* @throws IgniteCheckedException If failed.
*/
@Nullable
protected final Object[] unmarshalInvokeArguments(@Nullable byte[][] byteCol, GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
assert ldr != null;
assert ctx != null;
if (byteCol == null)
return null;
Object[] args = new Object[byteCol.length];
Marshaller marsh = ctx.marshaller();
for (int i = 0; i < byteCol.length; i++) args[i] = byteCol[i] == null ? null : U.unmarshal(marsh, byteCol[i], U.resolveClassLoader(ldr, ctx.gridConfig()));
return args;
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridCacheQueryRequest method finishUnmarshal.
/**
* {@inheritDoc}
*/
@Override
public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
Marshaller mrsh = ctx.marshaller();
if (keyValFilterBytes != null && keyValFilter == null)
keyValFilter = U.unmarshal(mrsh, keyValFilterBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
if (rdcBytes != null && rdc == null)
rdc = U.unmarshal(mrsh, rdcBytes, ldr);
if (transBytes != null && trans == null)
trans = U.unmarshal(mrsh, transBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
if (argsBytes != null && args == null)
args = U.unmarshal(mrsh, argsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridCacheQueryRequest method beforeLocalExecution.
/**
* @param ctx Context.
* @throws IgniteCheckedException In case of error.
*/
void beforeLocalExecution(GridCacheContext ctx) throws IgniteCheckedException {
Marshaller marsh = ctx.marshaller();
rdc = rdc != null ? U.<IgniteReducer<Object, Object>>unmarshal(marsh, U.marshal(marsh, rdc), U.resolveClassLoader(ctx.gridConfig())) : null;
trans = trans != null ? U.<IgniteClosure<Object, Object>>unmarshal(marsh, U.marshal(marsh, trans), U.resolveClassLoader(ctx.gridConfig())) : null;
}
Aggregations