Search in sources :

Example 51 with PlatformOutputStream

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

the class PlatformTestPluginTarget method invokeCallback.

/**
 * Invokes the platform callback.
 *
 * @param val Value to send.
 * @return Result.
 */
private String invokeCallback(String val) {
    PlatformMemory outMem = platformCtx.memory().allocate();
    PlatformMemory inMem = platformCtx.memory().allocate();
    PlatformOutputStream outStream = outMem.output();
    BinaryRawWriterEx writer = platformCtx.writer(outStream);
    writer.writeString(val);
    outStream.synchronize();
    platformCtx.gateway().pluginCallback(1, outMem, inMem);
    BinaryRawReaderEx reader = platformCtx.reader(inMem);
    return reader.readString();
}
Also used : 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)

Aggregations

PlatformOutputStream (org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream)51 PlatformMemory (org.apache.ignite.internal.processors.platform.memory.PlatformMemory)48 BinaryRawWriterEx (org.apache.ignite.internal.binary.BinaryRawWriterEx)46 BinaryRawReaderEx (org.apache.ignite.internal.binary.BinaryRawReaderEx)11 PlatformInputStream (org.apache.ignite.internal.processors.platform.memory.PlatformInputStream)10 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)7 IgniteException (org.apache.ignite.IgniteException)7 PlatformContext (org.apache.ignite.internal.processors.platform.PlatformContext)4 PlatformNativeException (org.apache.ignite.internal.processors.platform.PlatformNativeException)4 CacheEntryListenerException (javax.cache.event.CacheEntryListenerException)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