Search in sources :

Example 1 with PlatformMemoryManager

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

the class PlatformFullTask method map.

/**
 * {@inheritDoc}
 */
@NotNull
@Override
public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) {
    assert arg == null;
    lock.readLock().lock();
    try {
        assert !done;
        Collection<ClusterNode> nodes = compute.clusterGroup().nodes();
        PlatformMemoryManager memMgr = ctx.memory();
        try (PlatformMemory mem = memMgr.allocate()) {
            PlatformOutputStream out = mem.output();
            BinaryRawWriterEx writer = ctx.writer(out);
            writer.writeLong(taskPtr);
            write(writer, nodes, subgrid);
            out.synchronize();
            ctx.gateway().computeTaskMap(mem.pointer());
            PlatformInputStream in = mem.input();
            in.synchronize();
            BinaryRawReaderEx reader = ctx.reader(in);
            return read(reader, nodes);
        }
    } finally {
        lock.readLock().unlock();
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) PlatformMemoryManager(org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManager) 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) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ClusterNode (org.apache.ignite.cluster.ClusterNode)1 BinaryRawReaderEx (org.apache.ignite.internal.binary.BinaryRawReaderEx)1 BinaryRawWriterEx (org.apache.ignite.internal.binary.BinaryRawWriterEx)1 PlatformInputStream (org.apache.ignite.internal.processors.platform.memory.PlatformInputStream)1 PlatformMemory (org.apache.ignite.internal.processors.platform.memory.PlatformMemory)1 PlatformMemoryManager (org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManager)1 PlatformOutputStream (org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream)1 NotNull (org.jetbrains.annotations.NotNull)1