ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [5/7] incubator-ignite git commit: #ignite-965: emit is a global function.
Date Wed, 24 Jun 2015 12:48:40 GMT
#ignite-965: emit is a global function.


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

Branch: refs/heads/ignite-965
Commit: 99d2c2ac161efb9703a5a934e831bb3f5b43abc4
Parents: e837781
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Jun 24 15:44:01 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Jun 24 15:44:01 2015 +0300

----------------------------------------------------------------------
 .../IgniteScriptingCommandHandler.java          |  2 +-
 .../scripting/IgniteScriptProcessor.java        | 28 ++++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99d2c2ac/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index edf9826..b48671e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -191,7 +191,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
                     data[i] = results.get(i).getData();
                 }
 
-                return new GridRestResponse(ctx.scripting().invokeFunction(reduceFunc, (Object)data));
+                return new GridRestResponse(ctx.scripting().invokeFunction(reduceFunc, data));
             }
             catch (IgniteCheckedException e) {
                 return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99d2c2ac/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
index 5073427..e1eb8b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
@@ -57,12 +57,9 @@ public class IgniteScriptProcessor extends GridProcessorAdapter {
         String createJSFunction = "function __createJSFunction(mapFunc) {" +
                 "return eval('(function() { return ' + mapFunc.trim() + '})()'); }";
 
-        String internalCall  = "function __internalCall(funcSource) { " +
-                "var func = __createJSFunction(funcSource); " +
-                "var arg = Array.prototype.slice.call(arguments, 0);" +
-                "arg.shift();" +
-                "return func.apply(null, arg);" +
-                "}";
+        String internalCall  = "function __internalCall(funcSource, arg) { " +
+            "var func = __createJSFunction(funcSource); " +
+            "return func.apply(null, arg); }";
 
         addEngineFunction(createJSFunction);
         addEngineFunction(internalCall);
@@ -99,18 +96,21 @@ public class IgniteScriptProcessor extends GridProcessorAdapter {
 
     /**
      * @param src Script src.
-     * @param args Arguments.
      * @return Result of the function.
      * @throws IgniteCheckedException If script failed.
      */
-    public Object invokeFunction(String src, Object... args) throws IgniteCheckedException
{
-        Object[] newArgs = new Object[args.length + 1];
-
-        newArgs[0] = src;
-
-        System.arraycopy(args, 0, newArgs, 1, args.length);
+    public Object invokeFunction(String src) throws IgniteCheckedException {
+        return invokeFunctionByName("__internalCall", src);
+    }
 
-        return invokeFunctionByName("__internalCall", newArgs);
+    /**
+     * @param src Script src.
+     * @param arg Argument.
+     * @return Result of the function.
+     * @throws IgniteCheckedException If script failed.
+     */
+    public Object invokeFunction(String src, Object arg) throws IgniteCheckedException {
+        return invokeFunctionByName("__internalCall", src, arg);
     }
 
     /**


Mime
View raw message