ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [29/50] [abbrv] incubator-ignite git commit: IGNITE-22 Optimize closure serialization.
Date Tue, 24 Feb 2015 10:37:33 GMT
IGNITE-22 Optimize closure serialization.


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

Branch: refs/heads/ignite-217
Commit: a22c06348d9c81b4332c3b5a764f6d8836e4bb5e
Parents: 08fa115
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Fri Feb 20 15:08:57 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Fri Feb 20 15:08:57 2015 +0300

----------------------------------------------------------------------
 .../closure/GridClosureProcessor.java           | 33 +++++++++++++++++---
 1 file changed, 28 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a22c0634/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 891b71b..efc3a9c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1021,6 +1021,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         /** */
         private boolean hadLocNode;
 
+        /** */
+        private byte[] closureBytes;
+
+        /** */
+        private IgniteClosure<?, ?> closure;
+
         /**
          * @param expJobCnt Expected Jobs count.
          */
@@ -1033,15 +1039,29 @@ public class GridClosureProcessor extends GridProcessorAdapter {
          * @param node Node.
          * @throws IgniteCheckedException In case of error.
          */
-        public void map(ComputeJob job, ClusterNode node) throws IgniteCheckedException {
-            assert job != null;
-            assert node != null;
-
+        public void map(@NotNull ComputeJob job, @NotNull ClusterNode node) throws IgniteCheckedException
{
             if (ctx.localNodeId().equals(node.id())) {
                 if (hadLocNode) {
                     Marshaller marsh = ctx.config().getMarshaller();
 
-                    job = marsh.unmarshal(marsh.marshal(job), null);
+                    if (job instanceof C1) {
+                        C1 c = (C1)job;
+
+                        if (closureBytes == null) {
+                            closure = c.job;
+
+                            closureBytes = marsh.marshal(c.job);
+                        }
+
+                        if (c.job == closure)
+                            c.job = marsh.unmarshal(closureBytes, null);
+                        else
+                            c.job = marsh.unmarshal(marsh.marshal(c.job), null);
+
+                        c.arg = marsh.unmarshal(marsh.marshal(c.arg), null);
+                    }
+                    else
+                        job = marsh.unmarshal(marsh.marshal(job), null);
                 }
                 else
                     hadLocNode = true;
@@ -1050,6 +1070,9 @@ public class GridClosureProcessor extends GridProcessorAdapter {
             map.put(job, node);
         }
 
+        /**
+         *
+         */
         public Map<ComputeJob, ClusterNode> map() {
             return map;
         }


Mime
View raw message