use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformMessageLocalFilter method apply.
/**
* {@inheritDoc}
*/
@Override
public boolean apply(UUID uuid, Object m) {
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeObject(uuid);
writer.writeObject(m);
out.synchronize();
int res = platformCtx.gateway().messagingFilterApply(hnd, mem.pointer());
return res != 0;
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx 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.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformMessageFilterImpl method apply.
/**
* {@inheritDoc}
*/
@Override
public boolean apply(UUID uuid, Object m) {
if (ptr == 0)
// Destroyed.
return false;
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(uuid);
writer.writeObject(m);
out.synchronize();
return ctx.gateway().messagingFilterApply(ptr, mem.pointer()) != 0;
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformLocalEventListener method apply.
/**
* {@inheritDoc}
*/
@Override
public boolean apply(Event evt) {
assert ignite != null;
PlatformContext ctx = PlatformUtils.platformContext(ignite);
assert ctx != null;
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeInt(id);
ctx.writeEvent(writer, evt);
out.synchronize();
long res = ctx.gateway().eventLocalListenerApply(mem.pointer());
return res != 0;
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx 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