use of org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl in project ignite by apache.
the class PlatformAffinityFunction method start.
/**
* {@inheritDoc}
*/
@Override
public void start() throws IgniteException {
// userFunc is null when there is nothing overridden
if (userFunc == null)
return;
assert ignite != null;
ctx = PlatformUtils.platformContext(ignite);
assert ctx != null;
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(userFunc);
out.synchronize();
baseTarget = baseFunc != null ? new PlatformAffinityFunctionTarget(ctx, baseFunc) : null;
PlatformTargetProxyImpl baseTargetProxy = baseTarget != null ? new PlatformTargetProxyImpl(baseTarget, ctx) : null;
ptr = ctx.gateway().affinityFunctionInit(mem.pointer(), baseTargetProxy);
}
}
use of org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl in project ignite by apache.
the class PlatformStreamReceiverImpl method receive.
/**
* {@inheritDoc}
*/
@Override
public void receive(IgniteCache<Object, Object> cache, Collection<Map.Entry<Object, Object>> collection) throws IgniteException {
assert ctx != null;
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
out.writeLong(ptr);
out.writeBoolean(keepBinary);
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(pred);
writer.writeInt(collection.size());
for (Map.Entry<Object, Object> e : collection) {
writer.writeObject(e.getKey());
writer.writeObject(e.getValue());
}
out.synchronize();
PlatformCache cache0 = new PlatformCache(ctx, cache, keepBinary);
PlatformTargetProxy cacheProxy = new PlatformTargetProxyImpl(cache0, ctx);
ctx.gateway().dataStreamerStreamReceiverInvoke(ptr, cacheProxy, mem.pointer(), keepBinary);
}
}
Aggregations