IGNITE-4824 Removed deprecated AffinityTask.affinityKey method. This closes 
#1626.


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

Branch: refs/heads/ignite-4565-ddl
Commit: 837bae683931688cf2f8e77b11c1fbcbbdd3c4ed
Parents: 167d82d
Author: tledkov-gridgain <tled...@gridgain.com>
Authored: Mon Mar 20 10:24:01 2017 +0300
Committer: devozerov <voze...@gridgain.com>
Committed: Mon Mar 20 10:24:01 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/IgniteComputeImpl.java      | 13 ++++----
 .../failover/GridFailoverContextImpl.java       | 11 ------
 .../managers/failover/GridFailoverManager.java  |  3 --
 .../processors/closure/AffinityTask.java        |  6 ----
 .../closure/GridClosureProcessor.java           | 35 +++-----------------
 .../processors/task/GridTaskWorker.java         |  7 +---
 .../ignite/spi/failover/FailoverContext.java    | 10 ------
 .../spi/failover/GridFailoverTestContext.java   |  7 +---
 8 files changed, 12 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
index 3900c1f..58ce001 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
@@ -119,8 +119,7 @@ public class IgniteComputeImpl extends 
AsyncSupportAdapter<IgniteCompute>
                 throw new IgniteCheckedException("Failed map key to partition: 
[cache=" + cacheName + " key="
                     + affKey + ']');
 
-            
saveOrGet(ctx.closure().affinityRun(Collections.singletonList(cacheName), 
partId, affKey,
-                job, prj.nodes()));
+            
saveOrGet(ctx.closure().affinityRun(Collections.singletonList(cacheName), 
partId, job, prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -149,7 +148,7 @@ public class IgniteComputeImpl extends 
AsyncSupportAdapter<IgniteCompute>
                 throw new IgniteCheckedException("Failed map key to partition: 
[cache=" + cacheName + " key="
                     + affKey + ']');
 
-            saveOrGet(ctx.closure().affinityRun(cacheNames, partId, affKey, 
job, prj.nodes()));
+            saveOrGet(ctx.closure().affinityRun(cacheNames, partId, job, 
prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -168,7 +167,7 @@ public class IgniteComputeImpl extends 
AsyncSupportAdapter<IgniteCompute>
         guard();
 
         try {
-            saveOrGet(ctx.closure().affinityRun(cacheNames, partId, null, job, 
prj.nodes()));
+            saveOrGet(ctx.closure().affinityRun(cacheNames, partId, job, 
prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -194,7 +193,7 @@ public class IgniteComputeImpl extends 
AsyncSupportAdapter<IgniteCompute>
                 throw new IgniteCheckedException("Failed map key to partition: 
[cache=" + cacheName + " key="
                     + affKey + ']');
 
-            return 
saveOrGet(ctx.closure().affinityCall(Collections.singletonList(cacheName), 
partId, affKey, job,
+            return 
saveOrGet(ctx.closure().affinityCall(Collections.singletonList(cacheName), 
partId, job,
                 prj.nodes()));
         }
         catch (IgniteCheckedException e) {
@@ -226,7 +225,7 @@ public class IgniteComputeImpl extends 
AsyncSupportAdapter<IgniteCompute>
                 throw new IgniteCheckedException("Failed map key to partition: 
[cache=" + cacheName + " key="
                     + affKey + ']');
 
-            return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, 
affKey, job, prj.nodes()));
+            return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, 
job, prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -245,7 +244,7 @@ public class IgniteComputeImpl extends 
AsyncSupportAdapter<IgniteCompute>
         guard();
 
         try {
-            return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, 
null, job, prj.nodes()));
+            return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, 
job, prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
index ad77271..735fce9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
@@ -46,9 +46,6 @@ public class GridFailoverContextImpl implements 
FailoverContext {
     /** Partition key for affinityCall. */
     private final int partId;
 
-    /** Affinity key for affinityCall. */
-    private final Object affKey;
-
     /** Affinity cache name for affinityCall. */
     private final String affCacheName;
 
@@ -62,7 +59,6 @@ public class GridFailoverContextImpl implements 
FailoverContext {
      * @param jobRes Failed job result.
      * @param loadMgr Load manager.
      * @param partId Partition.
-     * @param affKey Affinity key.
      * @param affCacheName Affinity cache name.
      * @param topVer Affinity topology version.
      */
@@ -70,7 +66,6 @@ public class GridFailoverContextImpl implements 
FailoverContext {
         ComputeJobResult jobRes,
         GridLoadBalancerManager loadMgr,
         int partId,
-        @Nullable Object affKey,
         @Nullable String affCacheName,
         @Nullable AffinityTopologyVersion topVer) {
         assert taskSes != null;
@@ -81,7 +76,6 @@ public class GridFailoverContextImpl implements 
FailoverContext {
         this.jobRes = jobRes;
         this.loadMgr = loadMgr;
         this.partId = partId;
-        this.affKey = affKey;
         this.affCacheName = affCacheName;
         this.topVer = topVer;
     }
@@ -102,11 +96,6 @@ public class GridFailoverContextImpl implements 
FailoverContext {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public Object affinityKey() {
-        return affKey;
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public String affinityCacheName() {
         return affCacheName;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
index 52edd1d..d287e63 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
@@ -60,7 +60,6 @@ public class GridFailoverManager extends 
GridManagerAdapter<FailoverSpi> {
      * @param jobRes Job result.
      * @param top Collection of all topology nodes.
      * @param affPartId Partition number.
-     * @param affKey Affinity key.
      * @param affCacheName Affinity cache name.
      * @param topVer Affinity topology version.
      * @return New node to route this job to.
@@ -69,14 +68,12 @@ public class GridFailoverManager extends 
GridManagerAdapter<FailoverSpi> {
         ComputeJobResult jobRes,
         List<ClusterNode> top,
         int affPartId,
-        @Nullable Object affKey,
         @Nullable String affCacheName,
         @Nullable AffinityTopologyVersion topVer) {
         return getSpi(taskSes.getFailoverSpi()).failover(new 
GridFailoverContextImpl(taskSes,
             jobRes,
             ctx.loadBalancing(),
             affPartId,
-            affKey,
             affCacheName,
             topVer),
             top);

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
index 9007c8b..a6fd224 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
@@ -26,12 +26,6 @@ import org.jetbrains.annotations.Nullable;
  */
 public interface AffinityTask {
     /**
-     * @return Affinity key.
-     */
-    @Deprecated
-    @Nullable public Object affinityKey();
-
-    /**
      * @return Partition.
      */
     public int partition();

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/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 55f170f..1f21fd2 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
@@ -438,7 +438,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
     /**
      * @param cacheNames Cache names.
      * @param partId Partition.
-     * @param affKey Affinity key.
      * @param job Closure to execute.
      * @param nodes Grid nodes.
      * @return Grid future for collection of closure results.
@@ -446,7 +445,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
      */
     public <R> ComputeTaskInternalFuture<R> affinityCall(@NotNull 
Collection<String> cacheNames,
         int partId,
-        @Nullable Object affKey,
         Callable<R> job,
         @Nullable Collection<ClusterNode> nodes) throws IgniteCheckedException 
{
         assert partId >= 0 : partId;
@@ -467,7 +465,7 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
 
             ctx.task().setThreadContext(TC_SUBGRID, nodes);
 
-            return ctx.task().execute(new T5(node, job, cacheNames, partId, 
affKey, mapTopVer), null, false);
+            return ctx.task().execute(new T5(node, job, cacheNames, partId, 
mapTopVer), null, false);
         }
         finally {
             busyLock.readUnlock();
@@ -477,7 +475,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
     /**
      * @param cacheNames Cache names.
      * @param partId Partition.
-     * @param affKey Affinity key.
      * @param job Job.
      * @param nodes Grid nodes.
      * @return Job future.
@@ -485,7 +482,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
      */
     public ComputeTaskInternalFuture<?> affinityRun(@NotNull 
Collection<String> cacheNames,
         int partId,
-        @Nullable Object affKey,
         Runnable job,
         @Nullable Collection<ClusterNode> nodes) throws IgniteCheckedException 
{
         assert partId >= 0 : partId;
@@ -506,7 +502,7 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
 
             ctx.task().setThreadContext(TC_SUBGRID, nodes);
 
-            return ctx.task().execute(new T4(node, job, cacheNames, partId, 
affKey, mapTopVer), null, false);
+            return ctx.task().execute(new T4(node, job, cacheNames, partId, 
mapTopVer), null, false);
         }
         finally {
             busyLock.readUnlock();
@@ -518,6 +514,7 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
      * @param job Closure to execute.
      * @param nodes Grid nodes.
      * @param sys If {@code true}, then system pool will be used.
+     * @param timeout Timeout.
      * @param <R> Type.
      * @return Grid future for collection of closure results.
      */
@@ -1324,9 +1321,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
         private Runnable job;
 
         /** */
-        private Object affKey;
-
-        /** */
         private int partId;
 
         /** */
@@ -1335,16 +1329,14 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
         /** */
         private Collection<String> affCacheNames;
 
-
         /**
          * @param node Cluster node.
          * @param job Job affinity partition.
          * @param affCacheNames Affinity caches.
          * @param partId Partition.
-         * @param affKey Affinity key.
          * @param topVer Affinity topology version.
          */
-        private T4(ClusterNode node, Runnable job, Collection<String> 
affCacheNames, int partId, Object affKey,
+        private T4(ClusterNode node, Runnable job, Collection<String> 
affCacheNames, int partId,
             AffinityTopologyVersion topVer) {
             super(U.peerDeployAware0(job));
 
@@ -1354,7 +1346,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
             this.job = job;
             this.affCacheNames = affCacheNames;
             this.partId = partId;
-            this.affKey = affKey;
             this.topVer = topVer;
         }
 
@@ -1377,11 +1368,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
         @Nullable @Override public AffinityTopologyVersion topologyVersion() {
             return topVer;
         }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Object affinityKey() {
-            return affKey;
-        }
     }
 
     /**
@@ -1398,9 +1384,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
         private Callable<R> job;
 
         /** */
-        private Object affKey;
-
-        /** */
         private int partId;
 
         /** */
@@ -1409,21 +1392,17 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
         /** */
         private Collection<String> affCacheNames;
 
-
-
         /**
          * @param node Cluster node.
          * @param job Job affinity partition.
          * @param affCacheNames Affinity caches.
          * @param partId Partition.
-         * @param affKey Affinity key.
          * @param topVer Affinity topology version.
          */
         private T5(ClusterNode node,
             Callable<R> job,
             Collection<String> affCacheNames,
             int partId,
-            Object affKey,
             AffinityTopologyVersion topVer) {
             super(U.peerDeployAware0(job));
 
@@ -1431,7 +1410,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
             this.job = job;
             this.affCacheNames = affCacheNames;
             this.partId = partId;
-            this.affKey = affKey;
             this.topVer = topVer;
         }
 
@@ -1451,11 +1429,6 @@ public class GridClosureProcessor extends 
GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override public Object affinityKey() {
-            return affKey;
-        }
-
-        /** {@inheritDoc} */
         @Override public int partition() {
             return partId;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index b8a9e43..6305d23 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -194,9 +194,6 @@ class GridTaskWorker<T, R> extends GridWorker implements 
GridTimeoutObject {
     private final boolean noFailover;
 
     /** */
-    private final Object affKey;
-
-    /** */
     private final int affPartId;
 
     /** */
@@ -330,7 +327,6 @@ class GridTaskWorker<T, R> extends GridWorker implements 
GridTimeoutObject {
 
             affPartId = affTask.partition();
             affCacheName = F.first(affTask.affinityCacheNames());
-            affKey = affTask.affinityKey();
             mapTopVer = affTask.topologyVersion();
 
             affCacheIds = new int[affTask.affinityCacheNames().size()];
@@ -343,7 +339,6 @@ class GridTaskWorker<T, R> extends GridWorker implements 
GridTimeoutObject {
         else {
             affPartId = -1;
             affCacheName = null;
-            affKey = null;
             mapTopVer = null;
             affCacheIds = null;
         }
@@ -1175,7 +1170,7 @@ class GridTaskWorker<T, R> extends GridWorker implements 
GridTimeoutObject {
             ctx.resource().invokeAnnotated(dep, jobRes.getJob(), 
ComputeJobBeforeFailover.class);
 
             ClusterNode node = ctx.failover().failover(ses, jobRes, new 
ArrayList<>(top), affPartId,
-                affKey, affCacheName, mapTopVer);
+                affCacheName, mapTopVer);
 
             return checkTargetNode(res, jobRes, node);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
index b126db1..d9eec04 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
@@ -59,16 +59,6 @@ public interface FailoverContext {
     public ClusterNode getBalancedNode(List<ClusterNode> top) throws 
IgniteException;
 
     /**
-     * Gets affinity key for {@link IgniteCompute#affinityRun(String, Object, 
IgniteRunnable)},
-     * {@link IgniteCompute#affinityRun(Collection, Object, IgniteRunnable)},
-     * {@link IgniteCompute#affinityCall(String, Object, IgniteCallable)}
-     * and {@link IgniteCompute#affinityCall(Collection, Object, 
IgniteCallable)}.
-     *
-     * @return Affinity key.
-     */
-    @Nullable public Object affinityKey();
-
-    /**
      * Gets partition for {@link IgniteCompute#affinityRun(Collection, int, 
IgniteRunnable)}
      * and {@link IgniteCompute#affinityCall(Collection, int, IgniteCallable)}.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/837bae68/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
index 97a3e0b..c004fa2 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
@@ -70,12 +70,7 @@ public class GridFailoverTestContext implements 
FailoverContext {
     }
 
     /** {@inheritDoc} */
-    @Override public Object affinityKey() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public int partition() {
+    @Override public int partition() {
         return -1;
     }
 

Reply via email to