You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/08/31 16:11:04 UTC

[11/18] ignite git commit: IGNITE-1325: Implemented platform extensions.

IGNITE-1325: Implemented platform extensions.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3e4052a6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3e4052a6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3e4052a6

Branch: refs/heads/ignite-843
Commit: 3e4052a6d2b50b538585f94443b354d803e235d2
Parents: a457ab1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Aug 31 13:16:09 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Aug 31 13:16:09 2015 +0300

----------------------------------------------------------------------
 .../processors/platform/PlatformTarget.java     | 36 +++++++++++++-----
 .../platform/PlatformAbstractTarget.java        | 40 ++++++++++++++++++++
 2 files changed, 67 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4052a6/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
index 6a22453..c45bea1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
@@ -46,15 +46,6 @@ public interface PlatformTarget {
     public Object inStreamOutObject(int type, long memPtr) throws Exception;
 
     /**
-     * Operation returning result to memory stream.
-     *
-     * @param type Operation type.
-     * @param memPtr Memory pointer.
-     * @throws Exception In case of failure.
-     */
-    public void outStream(int type, long memPtr) throws Exception;
-
-    /**
      * Operation accepting one memory stream and returning result to another memory stream.
      *
      * @param type Operation type.
@@ -76,6 +67,33 @@ public interface PlatformTarget {
     public void inObjectStreamOutStream(int type, @Nullable Object arg, long inMemPtr, long outMemPtr) throws Exception;
 
     /**
+     * Operation returning long result.
+     *
+     * @param type Operation type.
+     * @return Result.
+     * @throws Exception In case of failure.
+     */
+    public long outLong(int type) throws Exception;
+
+    /**
+     * Operation returning result to memory stream.
+     *
+     * @param type Operation type.
+     * @param memPtr Memory pointer.
+     * @throws Exception In case of failure.
+     */
+    public void outStream(int type, long memPtr) throws Exception;
+
+    /**
+     * Operation returning object result.
+     *
+     * @param type Operation type.
+     * @return Result.
+     * @throws Exception If failed.
+     */
+    public Object outObject(int type) throws Exception;
+
+    /**
      * Start listening for the future.
      *
      * @param futId Future ID.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4052a6/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
index 5864a7e..4c01bc0 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
@@ -85,6 +85,16 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
     }
 
     /** {@inheritDoc} */
+    @Override public long outLong(int type) throws Exception {
+        try {
+            return processOutLong(type);
+        }
+        catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public void outStream(int type, long memPtr) throws Exception {
         try (PlatformMemory mem = platformCtx.memory().get(memPtr)) {
             PlatformOutputStream out = mem.output();
@@ -101,6 +111,16 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
     }
 
     /** {@inheritDoc} */
+    @Override public Object outObject(int type) throws Exception {
+        try {
+            return processOutObject(type);
+        }
+        catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public void inStreamOutStream(int type, long inMemPtr, long outMemPtr) throws Exception {
         try (PlatformMemory inMem = platformCtx.memory().get(inMemPtr)) {
             PortableRawReaderEx reader = platformCtx.reader(inMem);
@@ -271,6 +291,16 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
      * Process OUT operation.
      *
      * @param type Type.
+     * @throws IgniteCheckedException In case of exception.
+     */
+    protected long processOutLong(int type) throws IgniteCheckedException {
+        return throwUnsupported(type);
+    }
+
+    /**
+     * Process OUT operation.
+     *
+     * @param type Type.
      * @param writer Portable writer.
      * @throws IgniteCheckedException In case of exception.
      */
@@ -279,6 +309,16 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
     }
 
     /**
+     * Process OUT operation.
+     *
+     * @param type Type.
+     * @throws IgniteCheckedException In case of exception.
+     */
+    protected Object processOutObject(int type) throws IgniteCheckedException {
+        return throwUnsupported(type);
+    }
+
+    /**
      * Throw an exception rendering unsupported operation type.
      *
      * @param type Operation type.