use of org.apache.ignite.internal.processors.platform.memory.PlatformMemory in project ignite by apache.
the class PlatformAbstractJob method createJob.
/**
* Create job in native platform if needed.
*
* @param ctx Context.
* @return {@code True} if job was created, {@code false} if this is local job and creation is not necessary.
* @throws org.apache.ignite.IgniteCheckedException If failed.
*/
protected boolean createJob(PlatformContext ctx) throws IgniteCheckedException {
if (ptr == 0) {
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(job);
out.synchronize();
ptr = ctx.gateway().computeJobCreate(mem.pointer());
}
return true;
} else
return false;
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformMemory in project ignite by apache.
the class PlatformTestPluginTarget method invokeCallback.
/**
* Invokes the platform callback.
*
* @param val Value to send.
* @return Result.
*/
private String invokeCallback(String val) {
PlatformMemory outMem = platformCtx.memory().allocate();
PlatformMemory inMem = platformCtx.memory().allocate();
PlatformOutputStream outStream = outMem.output();
BinaryRawWriterEx writer = platformCtx.writer(outStream);
writer.writeString(val);
outStream.synchronize();
platformCtx.gateway().pluginCallback(1, outMem, inMem);
BinaryRawReaderEx reader = platformCtx.reader(inMem);
return reader.readString();
}
Aggregations