Search in sources :

Example 1 with PlatformOutputStream

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());
}
Also used : PlatformOutputStream(org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream) BinaryRawWriterEx(org.apache.ignite.internal.binary.BinaryRawWriterEx) PlatformMemory(org.apache.ignite.internal.processors.platform.memory.PlatformMemory)

Example 2 with PlatformOutputStream

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();
}
Also used : PlatformOutputStream(org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream) BinaryRawWriterEx(org.apache.ignite.internal.binary.BinaryRawWriterEx)

Example 3 with PlatformOutputStream

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();
}
Also used : PlatformOutputStream(org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream) BinaryRawWriterEx(org.apache.ignite.internal.binary.BinaryRawWriterEx)

Example 4 with PlatformOutputStream

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);
    }
}
Also used : PlatformNativeException(org.apache.ignite.internal.processors.platform.PlatformNativeException) PlatformOutputStream(org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream) BinaryRawWriterEx(org.apache.ignite.internal.binary.BinaryRawWriterEx) PlatformMemory(org.apache.ignite.internal.processors.platform.memory.PlatformMemory)

Example 5 with PlatformOutputStream

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;
    }
}
Also used : PlatformOutputStream(org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream) BinaryRawWriterEx(org.apache.ignite.internal.binary.BinaryRawWriterEx) PlatformMemory(org.apache.ignite.internal.processors.platform.memory.PlatformMemory)

Aggregations

PlatformOutputStream (org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream)46 BinaryRawWriterEx (org.apache.ignite.internal.binary.BinaryRawWriterEx)43 PlatformMemory (org.apache.ignite.internal.processors.platform.memory.PlatformMemory)43 BinaryRawReaderEx (org.apache.ignite.internal.binary.BinaryRawReaderEx)10 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)7 IgniteException (org.apache.ignite.IgniteException)7 PlatformInputStream (org.apache.ignite.internal.processors.platform.memory.PlatformInputStream)7 PlatformNativeException (org.apache.ignite.internal.processors.platform.PlatformNativeException)4 CacheEntryListenerException (javax.cache.event.CacheEntryListenerException)3 PlatformContext (org.apache.ignite.internal.processors.platform.PlatformContext)3 PlatformExtendedException (org.apache.ignite.internal.processors.platform.PlatformExtendedException)3 Nullable (org.jetbrains.annotations.Nullable)3 CacheException (javax.cache.CacheException)2 PlatformTargetProxyImpl (org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl)2 IOException (java.io.IOException)1 Map (java.util.Map)1 CacheEntryEvent (javax.cache.event.CacheEntryEvent)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 ComputeJobResultPolicy (org.apache.ignite.compute.ComputeJobResultPolicy)1 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)1