use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformAbstractService method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(ServiceContext ctx) throws Exception {
assert ptr != 0;
assert platformCtx != null;
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeLong(ptr);
writer.writeBoolean(srvKeepBinary);
writeServiceContext(ctx, writer);
out.synchronize();
platformCtx.gateway().serviceExecute(mem.pointer());
} catch (IgniteCheckedException e) {
throw U.convertException(e);
}
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformAbstractService method cancel.
/**
* {@inheritDoc}
*/
@Override
public void cancel(ServiceContext ctx) {
assert ptr != 0;
assert platformCtx != null;
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeLong(ptr);
writer.writeBoolean(srvKeepBinary);
writeServiceContext(ctx, writer);
out.synchronize();
platformCtx.gateway().serviceCancel(mem.pointer());
} catch (IgniteCheckedException e) {
throw U.convertException(e);
}
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformAbstractService method invokeMethod.
/**
* {@inheritDoc}
*/
@Override
public Object invokeMethod(String mthdName, boolean srvKeepBinary, boolean deserializeResult, @Nullable Object[] args, @Nullable Map<String, Object> callAttrs) throws IgniteCheckedException {
assert ptr != 0;
assert platformCtx != null;
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeLong(ptr);
writer.writeBoolean(srvKeepBinary);
writer.writeString(mthdName);
if (args == null)
writer.writeBoolean(false);
else {
writer.writeBoolean(true);
writer.writeInt(args.length);
for (Object arg : args) writer.writeObjectDetached(arg);
}
writer.writeMap(callAttrs);
out.synchronize();
platformCtx.gateway().serviceInvokeMethod(mem.pointer());
PlatformInputStream in = mem.input();
in.synchronize();
BinaryRawReaderEx reader = platformCtx.reader(in);
return PlatformUtils.readInvocationResult(platformCtx, reader, deserializeResult);
}
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformAbstractService method init.
/**
* {@inheritDoc}
*/
@Override
public void init(ServiceContext ctx) throws Exception {
assert ptr == 0;
assert platformCtx != null;
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeBoolean(srvKeepBinary);
writer.writeObject(svc);
writeServiceContext(ctx, writer);
out.synchronize();
ptr = platformCtx.gateway().serviceInit(mem.pointer());
PlatformInputStream in = mem.input();
in.synchronize();
BinaryRawReaderEx reader = platformCtx.reader(in);
PlatformUtils.readInvocationResult(platformCtx, reader);
} catch (IgniteCheckedException e) {
throw U.convertException(e);
}
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformDotNetConfigurationClosure method prepare.
/**
* Prepare .Net size.
*
* @param igniteCfg Ignite configuration.
* @param interopCfg Interop configuration.
*/
private void prepare(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx interopCfg) {
cfg = igniteCfg;
try (PlatformMemory outMem = memMgr.allocate()) {
try (PlatformMemory inMem = memMgr.allocate()) {
PlatformOutputStream out = outMem.output();
GridBinaryMarshaller marshaller = PlatformUtils.marshaller();
BinaryRawWriterEx writer = marshaller.writer(out);
PlatformConfigurationUtils.writeDotNetConfiguration(writer, interopCfg.unwrap());
// Write .NET beans
List<PlatformDotNetLifecycleBean> beans = beans(igniteCfg);
writer.writeInt(beans.size());
for (PlatformDotNetLifecycleBean bean : beans) {
writer.writeString(bean.getTypeName());
writer.writeMap(bean.getProperties());
}
// Write .NET affinity functions
List<PlatformDotNetAffinityFunction> affFuncs = affinityFunctions(igniteCfg);
writer.writeInt(affFuncs.size());
for (PlatformDotNetAffinityFunction func : affFuncs) {
writer.writeString(func.getTypeName());
writer.writeMap(func.getProperties());
}
out.synchronize();
gate.extensionCallbackInLongLongOutLong(PlatformUtils.OP_PREPARE_DOT_NET, outMem.pointer(), inMem.pointer());
processPrepareResult(marshaller.reader(inMem.input()));
}
}
}
Aggregations