Search in sources :

Example 6 with PlatformInputStream

use of org.apache.ignite.internal.processors.platform.memory.PlatformInputStream in project ignite by apache.

the class PlatformFullJob method serialize.

/**
     * Internal job serialization routine.
     *
     * @throws org.apache.ignite.IgniteCheckedException If failed.
     */
private void serialize() throws IgniteCheckedException {
    try (PlatformMemory mem = ctx.memory().allocate()) {
        PlatformInputStream in = mem.input();
        boolean res = ctx.gateway().computeJobSerialize(ptr, mem.pointer()) == 1;
        in.synchronize();
        BinaryRawReaderEx reader = ctx.reader(in);
        if (res)
            job = reader.readObjectDetached();
        else
            throw new IgniteCheckedException(reader.readString());
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) PlatformInputStream(org.apache.ignite.internal.processors.platform.memory.PlatformInputStream) BinaryRawReaderEx(org.apache.ignite.internal.binary.BinaryRawReaderEx) PlatformMemory(org.apache.ignite.internal.processors.platform.memory.PlatformMemory)

Example 7 with PlatformInputStream

use of org.apache.ignite.internal.processors.platform.memory.PlatformInputStream in project ignite by apache.

the class PlatformCacheEntryProcessorImpl method execute0.

/**
     * Executes interop entry processor on a given entry, updates entry and returns result.
     *
     * @param ctx Context.
     * @param entry Entry.
     * @return Processing result.
     */
private Object execute0(PlatformContext ctx, MutableEntry entry) {
    try (PlatformMemory mem = ctx.memory().allocate()) {
        PlatformOutputStream out = mem.output();
        BinaryRawWriterEx writer = ctx.writer(out);
        writeEntryAndProcessor(entry, writer);
        out.synchronize();
        ctx.gateway().cacheInvoke(mem.pointer());
        PlatformInputStream in = mem.input();
        in.synchronize();
        BinaryRawReaderEx reader = ctx.reader(in);
        return readResultAndUpdateEntry(ctx, entry, reader);
    }
}
Also used : PlatformInputStream(org.apache.ignite.internal.processors.platform.memory.PlatformInputStream) PlatformOutputStream(org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream) BinaryRawReaderEx(org.apache.ignite.internal.binary.BinaryRawReaderEx) BinaryRawWriterEx(org.apache.ignite.internal.binary.BinaryRawWriterEx) PlatformMemory(org.apache.ignite.internal.processors.platform.memory.PlatformMemory)

Example 8 with PlatformInputStream

use of org.apache.ignite.internal.processors.platform.memory.PlatformInputStream in project ignite by apache.

the class PlatformAbstractBootstrap method start.

/** {@inheritDoc} */
@Override
public PlatformProcessor start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx, long envPtr, long dataPtr) {
    final PlatformInputStream input = new PlatformExternalMemory(null, dataPtr).input();
    Ignition.setClientMode(input.readBoolean());
    processInput(input, cfg);
    IgniteConfiguration cfg0 = closure(envPtr).apply(cfg);
    try {
        IgniteEx node = (IgniteEx) IgnitionEx.start(cfg0, springCtx);
        return node.context().platform();
    } catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IgniteEx(org.apache.ignite.internal.IgniteEx) PlatformInputStream(org.apache.ignite.internal.processors.platform.memory.PlatformInputStream) PlatformExternalMemory(org.apache.ignite.internal.processors.platform.memory.PlatformExternalMemory)

Aggregations

PlatformInputStream (org.apache.ignite.internal.processors.platform.memory.PlatformInputStream)8 PlatformMemory (org.apache.ignite.internal.processors.platform.memory.PlatformMemory)7 BinaryRawReaderEx (org.apache.ignite.internal.binary.BinaryRawReaderEx)6 PlatformOutputStream (org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream)6 BinaryRawWriterEx (org.apache.ignite.internal.binary.BinaryRawWriterEx)4 Nullable (org.jetbrains.annotations.Nullable)3 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 PlatformContext (org.apache.ignite.internal.processors.platform.PlatformContext)1 PlatformExtendedException (org.apache.ignite.internal.processors.platform.PlatformExtendedException)1 PlatformExternalMemory (org.apache.ignite.internal.processors.platform.memory.PlatformExternalMemory)1 PlatformMemoryManager (org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManager)1