use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformProcessorImpl method start.
/** {@inheritDoc} */
@Override
public void start(boolean activeOnStart) throws IgniteCheckedException {
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeString(ctx.igniteInstanceName());
out.synchronize();
platformCtx.gateway().onStart(this, mem.pointer());
}
// At this moment all necessary native libraries must be loaded, so we can process with store creation.
storeLock.writeLock().lock();
try {
for (StoreInfo store : pendingStores) registerStore0(store.store, store.convertBinary);
pendingStores.clear();
started = true;
} finally {
storeLock.writeLock().unlock();
}
// Add Interop node attributes.
ctx.addNodeAttribute(PlatformUtils.ATTR_PLATFORM, interopCfg.platform());
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformTargetProxyImpl method inStreamAsync.
/** {@inheritDoc} */
@Override
public void inStreamAsync(int type, long memPtr) throws Exception {
try (PlatformMemory mem = platformCtx.memory().get(memPtr)) {
BinaryRawReaderEx reader = platformCtx.reader(mem);
long futId = reader.readLong();
int futTyp = reader.readInt();
final PlatformAsyncResult res = target.processInStreamAsync(type, reader);
if (res == null)
throw new IgniteException("PlatformTarget.processInStreamAsync should not return null.");
IgniteFuture fut = res.future();
if (fut == null)
throw new IgniteException("PlatformAsyncResult.future() should not return null.");
PlatformFutureUtils.listen(platformCtx, fut, futId, futTyp, new PlatformFutureUtils.Writer() {
/** {@inheritDoc} */
@Override
public void write(BinaryRawWriterEx writer, Object obj, Throwable err) {
res.write(writer, obj);
}
/** {@inheritDoc} */
@Override
public boolean canWrite(Object obj, Throwable err) {
return err == null;
}
}, target);
} catch (Exception e) {
throw target.convertException(e);
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformProcessorImpl method getIgniteConfiguration.
/** {@inheritDoc} */
@Override
public void getIgniteConfiguration(long memPtr) {
PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
BinaryRawWriterEx writer = platformCtx.writer(stream);
PlatformConfigurationUtils.writeIgniteConfiguration(writer, ignite().configuration());
stream.synchronize();
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformProcessorImpl method getCacheNames.
/** {@inheritDoc} */
@Override
public void getCacheNames(long memPtr) {
PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
BinaryRawWriterEx writer = platformCtx.writer(stream);
Collection<String> names = ignite().cacheNames();
writer.writeInt(names.size());
for (String name : names) writer.writeString(name);
stream.synchronize();
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformCacheEntryFilterImpl method setIgniteInstance.
/**
* @param ignite Ignite instance.
*/
@IgniteInstanceResource
public void setIgniteInstance(Ignite ignite) {
ctx = PlatformUtils.platformContext(ignite);
if (ptr != 0)
return;
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(pred);
out.synchronize();
ptr = ctx.gateway().cacheEntryFilterCreate(mem.pointer());
}
}
Aggregations