ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [04/22] incubator-ignite git commit: Ignite-107 Serialization fix
Date Tue, 27 Jan 2015 09:42:02 GMT
Ignite-107 Serialization fix


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

Branch: refs/heads/sprint-1
Commit: 5ed84ecf2a4f50c0136f5002c19ad475edd09da4
Parents: a3149f1
Author: avinogradov <avinogradov@gridgain.com>
Authored: Wed Jan 21 20:46:36 2015 +0300
Committer: avinogradov <avinogradov@gridgain.com>
Committed: Wed Jan 21 20:46:36 2015 +0300

----------------------------------------------------------------------
 .../closure/GridClosureProcessor.java           | 55 +++++++++++++++-----
 1 file changed, 43 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ed84ecf/modules/core/src/main/java/org/gridgain/grid/kernal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/closure/GridClosureProcessor.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/closure/GridClosureProcessor.java
index 47f5f5a..7f17c45 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/closure/GridClosureProcessor.java
@@ -992,11 +992,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
      * @return Grid job made out of closure.
      */
     @SuppressWarnings("IfMayBeConditional")
-    private ComputeJob job(final Callable<?> c) {
+    private <R> ComputeJob job(final Callable<R> c) {
         A.notNull(c, "job");
 
         if (c instanceof ComputeJobMasterLeaveAware)
-            return new C2(c);
+            return new C2<>(c);
         else {
             return new ComputeJobAdapter() {
                 @Override public Object execute() {
@@ -1020,11 +1020,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
      * @return Grid job made out of closure.
      */
     @SuppressWarnings(value = {"IfMayBeConditional", "UnusedDeclaration"})
-    private ComputeJob job(final Callable<?> c, @Nullable final String cacheName, final
Object affKey) {
+    private <R> ComputeJob job(final Callable<R> c, @Nullable final String cacheName,
final Object affKey) {
         A.notNull(c, "job");
 
         if (c instanceof ComputeJobMasterLeaveAware)
-            return new C3(c,cacheName,affKey);
+            return new C3<>(c,cacheName,affKey);
         else {
             return new ComputeJobAdapter() {
                 /** */
@@ -1684,6 +1684,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
         /**
          */
+        public C1(){
+            // No-op.
+        }
+
+        /**
+         */
         public C1(IgniteClosure<T, R> job, T arg) {
             this.job = job;
             this.arg = arg;
@@ -1714,16 +1720,22 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
     /**
      */
-    private static class C2 extends GridMasterLeaveAwareComputeJobAdapter {
+    private static class C2<R> extends GridMasterLeaveAwareComputeJobAdapter {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        private Callable<?> c;
+        private Callable<R> c;
 
         /**
          */
-        public C2(Callable<?> c) {
+        public C2(){
+            // No-op.
+        }
+
+        /**
+         */
+        public C2(Callable<R> c) {
             this.c = c;
         }
 
@@ -1749,13 +1761,13 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
         /** {@inheritDoc} */
         @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-            c = (Callable<?>) in.readObject();
+            c = (Callable<R>) in.readObject();
         }
     }
 
     /**
      */
-    private static class C3 extends GridMasterLeaveAwareComputeJobAdapter {
+    private static class C3<R> extends GridMasterLeaveAwareComputeJobAdapter {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -1767,12 +1779,19 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         @GridCacheAffinityKeyMapped
         private Object ak;
 
+
         /** */
-        private Callable<?> c;
+        private Callable<R> c;
 
         /**
          */
-        public C3(Callable<?> c, @Nullable String cacheName, Object affKey) {
+        public C3(){
+            // No-op.
+        }
+
+        /**
+         */
+        public C3(Callable<R> c, @Nullable String cacheName, Object affKey) {
             this.cn = cacheName;
             this.ak = affKey;
             this.c = c;
@@ -1804,7 +1823,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
             cn = (String) in.readObject();
             ak = in.readObject();
-            c = (Callable<?>) in.readObject();
+            c = (Callable<R>) in.readObject();
         }
     }
 
@@ -1819,6 +1838,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
         /**
          */
+        public C4(){
+            // No-op.
+        }
+
+        /**
+         */
         public C4(Runnable r) {
             this.r = r;
         }
@@ -1865,6 +1890,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
         /**
          */
+        public C5(){
+            // No-op.
+        }
+
+        /**
+         */
         public C5(Runnable r, @Nullable String cacheName, Object affKey) {
             this.cn = cacheName;
             this.ak = affKey;


Mime
View raw message