use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformDotNetCacheStore method load.
/** {@inheritDoc} */
@Nullable
@Override
public V load(final K key) {
try {
final GridTuple<V> val = new GridTuple<>();
doInvoke(new IgniteInClosureX<BinaryRawWriterEx>() {
@Override
public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException {
writer.writeByte(OP_LOAD);
writer.writeLong(session());
writer.writeString(ses.cacheName());
writer.writeObject(key);
}
}, new IgniteInClosureX<BinaryRawReaderEx>() {
@Override
public void applyx(BinaryRawReaderEx reader) {
val.set((V) reader.readObjectDetached());
}
});
return val.get();
} catch (IgniteCheckedException e) {
throw new CacheLoaderException(e);
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformConfigurationUtils method writeDotNetConfiguration.
/**
* Write .Net configuration to the stream.
*
* @param writer Writer.
* @param cfg Configuration.
*/
public static void writeDotNetConfiguration(BinaryRawWriterEx writer, PlatformDotNetConfiguration cfg) {
// 1. Write assemblies.
PlatformUtils.writeNullableCollection(writer, cfg.getAssemblies());
PlatformDotNetBinaryConfiguration binaryCfg = cfg.getBinaryConfiguration();
if (binaryCfg != null) {
writer.writeBoolean(true);
PlatformUtils.writeNullableCollection(writer, binaryCfg.getTypesConfiguration(), new PlatformWriterClosure<PlatformDotNetBinaryTypeConfiguration>() {
@Override
public void write(BinaryRawWriterEx writer, PlatformDotNetBinaryTypeConfiguration typ) {
writer.writeString(typ.getTypeName());
writer.writeString(typ.getNameMapper());
writer.writeString(typ.getIdMapper());
writer.writeString(typ.getSerializer());
writer.writeString(typ.getAffinityKeyFieldName());
writer.writeObject(typ.getKeepDeserialized());
writer.writeBoolean(typ.isEnum());
}
});
PlatformUtils.writeNullableCollection(writer, binaryCfg.getTypes());
writer.writeString(binaryCfg.getDefaultNameMapper());
writer.writeString(binaryCfg.getDefaultIdMapper());
writer.writeString(binaryCfg.getDefaultSerializer());
writer.writeBoolean(binaryCfg.isDefaultKeepDeserialized());
} else
writer.writeBoolean(false);
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformMessageFilterImpl method initialize.
/** {@inheritDoc} */
@Override
public void initialize(GridKernalContext kernalCtx) {
if (ptr != 0)
return;
ctx = PlatformUtils.platformContext(kernalCtx.grid());
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(pred);
out.synchronize();
ptr = ctx.gateway().messagingFilterCreate(mem.pointer());
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx 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());
} catch (IgniteCheckedException e) {
throw U.convertException(e);
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx 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);
}
}
Aggregations