use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream 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.processors.platform.memory.PlatformOutputStream 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.processors.platform.memory.PlatformOutputStream 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.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformLogger method log.
/**
* Logs the message.
*
* @param level Log level.
* @param msg Message.
* @param e Exception.
*/
private void log(int level, String msg, @Nullable Throwable e) {
String errorInfo = null;
if (e != null)
errorInfo = X.getFullStackTrace(e);
PlatformNativeException e0 = X.cause(e, PlatformNativeException.class);
if (ctx != null && e0 != null) {
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(e0.cause());
out.synchronize();
gate.loggerLog(level, msg, category, errorInfo, mem.pointer());
}
} else {
gate.loggerLog(level, msg, category, errorInfo, 0);
}
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream in project ignite by apache.
the class PlatformClusterNodeFilterImpl method apply.
/**
* {@inheritDoc}
*/
@Override
public boolean apply(ClusterNode clusterNode) {
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(pred);
ctx.writeNode(writer, clusterNode);
out.synchronize();
return ctx.gateway().clusterNodeFilterApply(mem.pointer()) != 0;
}
}
Aggregations