You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/03/29 14:02:25 UTC
[01/50] [abbrv] ignite git commit: IGNITE-4855 Fixed error on
switching between notebooks. [Forced Update!]
Repository: ignite
Updated Branches:
refs/heads/ignite-4003 c10dc2a8d -> ffa5f8266 (forced update)
IGNITE-4855 Fixed error on switching between notebooks.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a148e27
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a148e27
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a148e27
Branch: refs/heads/ignite-4003
Commit: 6a148e27c08e2542502593dcba4f9da0d574ba57
Parents: 0765ad3
Author: Andrey Novikov <an...@gridgain.com>
Authored: Thu Mar 23 09:32:38 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Mar 23 09:32:38 2017 +0700
----------------------------------------------------------------------
.../web-console/frontend/app/modules/sql/sql.module.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a148e27/modules/web-console/frontend/app/modules/sql/sql.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.module.js b/modules/web-console/frontend/app/modules/sql/sql.module.js
index 670e4f4..79614c2 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.module.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.module.js
@@ -34,9 +34,7 @@ angular.module('ignite-console.sql', [
.state('base.sql', {
url: '/queries',
abstract: true,
- template: '<ui-view></ui-view>',
- controller,
- controllerAs: '$ctrl'
+ template: '<ui-view></ui-view>'
})
.state('base.sql.notebook', {
url: '/notebook/{noteId}',
@@ -44,7 +42,9 @@ angular.module('ignite-console.sql', [
onEnter: AclRoute.checkAccess('query'),
metaTags: {
title: 'Query notebook'
- }
+ },
+ controller,
+ controllerAs: '$ctrl'
})
.state('base.sql.demo', {
url: '/demo',
@@ -52,7 +52,9 @@ angular.module('ignite-console.sql', [
onEnter: AclRoute.checkAccess('query'),
metaTags: {
title: 'SQL demo'
- }
+ },
+ controller,
+ controllerAs: '$ctrl'
});
}]
)
[36/50] [abbrv] ignite git commit: IGNITE-4872:
GridQueryProcessor.registerType() now return void.
Posted by ag...@apache.org.
IGNITE-4872: GridQueryProcessor.registerType() now return void.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/48701fb5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/48701fb5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/48701fb5
Branch: refs/heads/ignite-4003
Commit: 48701fb5d43ca340713fccb8060eb2048b84c774
Parents: 87477e0
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 28 11:59:03 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 28 11:59:03 2017 +0300
----------------------------------------------------------------------
.../processors/query/GridQueryProcessor.java | 8 ++++----
.../processors/query/QueryTypeDescriptorImpl.java | 17 -----------------
.../processors/query/h2/IgniteH2Indexing.java | 8 ++------
3 files changed, 6 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/48701fb5/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a58ca53..676c836 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -185,7 +185,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (altTypeId != null)
types.put(altTypeId, desc);
- desc.registered(idx.registerType(space, desc));
+ idx.registerType(space, desc);
}
}
catch (IgniteCheckedException | RuntimeException e) {
@@ -362,7 +362,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
QueryTypeDescriptorImpl desc = types.get(id);
- if (desc == null || !desc.registered())
+ if (desc == null)
return;
if (!binaryVal && !desc.valueClass().isAssignableFrom(valCls))
@@ -775,7 +775,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
for (Map.Entry<QueryTypeIdKey, QueryTypeDescriptorImpl> e : types.entrySet()) {
QueryTypeDescriptorImpl desc = e.getValue();
- if (desc.registered() && F.eq(e.getKey().space(), space))
+ if (F.eq(e.getKey().space(), space))
spaceTypes.add(desc);
}
@@ -793,7 +793,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
public QueryTypeDescriptorImpl type(@Nullable String space, String typeName) throws IgniteCheckedException {
QueryTypeDescriptorImpl type = typesByName.get(new QueryTypeNameKey(space, typeName));
- if (type == null || !type.registered())
+ if (type == null)
throw new IgniteCheckedException("Failed to find SQL table for type: " + typeName);
return type;
http://git-wip-us.apache.org/repos/asf/ignite/blob/48701fb5/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
index f22cc11..5b29fbb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
@@ -75,23 +75,6 @@ public class QueryTypeDescriptorImpl implements GridQueryTypeDescriptor {
/** */
private String affKey;
- /** SPI can decide not to register this type. */
- private boolean registered;
-
- /**
- * @return {@code True} if type registration in SPI was finished and type was not rejected.
- */
- public boolean registered() {
- return registered;
- }
-
- /**
- * @param registered Sets registered flag.
- */
- public void registered(boolean registered) {
- this.registered = registered;
- }
-
/** {@inheritDoc} */
@Override public String name() {
return name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/48701fb5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 79121e4..17bc7a7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1649,8 +1649,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*/
@Override public boolean registerType(@Nullable String spaceName, GridQueryTypeDescriptor type)
throws IgniteCheckedException {
- if (!validateTypeDescriptor(type))
- return false;
+ validateTypeDescriptor(type);
String schemaName = schema(spaceName);
@@ -1678,10 +1677,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* Validates properties described by query types.
*
* @param type Type descriptor.
- * @return True if type is valid.
* @throws IgniteCheckedException If validation failed.
*/
- private boolean validateTypeDescriptor(GridQueryTypeDescriptor type)
+ private void validateTypeDescriptor(GridQueryTypeDescriptor type)
throws IgniteCheckedException {
assert type != null;
@@ -1699,8 +1697,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (name.equalsIgnoreCase(KEY_FIELD_NAME) || name.equalsIgnoreCase(VAL_FIELD_NAME))
throw new IgniteCheckedException(MessageFormat.format(ptrn, name));
}
-
- return true;
}
/**
[45/50] [abbrv] ignite git commit: IGNITE-4659 Fixed typo.
Posted by ag...@apache.org.
IGNITE-4659 Fixed typo.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6f1e9709
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6f1e9709
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6f1e9709
Branch: refs/heads/ignite-4003
Commit: 6f1e97098dc5f5c6a91cffdcd7c3612dd08b82dd
Parents: db21f73
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Mar 29 10:53:25 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Mar 29 10:53:25 2017 +0700
----------------------------------------------------------------------
.../modules/states/configuration/clusters/general/discovery/s3.pug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f1e9709/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/s3.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/s3.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/s3.pug
index ed6e20e..853c32c 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/s3.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/s3.pug
@@ -22,6 +22,6 @@ include /app/helpers/jade/mixins
div
.details-row
- +text('Bucket name:', `${model}.bucketName`, `${discoveryKind}BucketName'`, required, 'Input bucket name', 'Bucket name for IP finder')
+ +text('Bucket name:', `${model}.bucketName`, `'${discoveryKind}BucketName'`, required, 'Input bucket name', 'Bucket name for IP finder')
.details-row
label Note, AWS credentials will be generated as stub
[18/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
index b5c6261..ad675c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
@@ -28,6 +28,7 @@ import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteAsyncSupported;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteReducer;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.lang.IgniteUuid;
@@ -113,6 +114,7 @@ import org.jetbrains.annotations.Nullable;
* checkpoints, etc.). If you need to override configured defaults, you should use compute task together with
* {@link ComputeTaskSpis} annotation. Refer to {@link ComputeTask} documentation for more information.
*/
+@SuppressWarnings("deprecation")
public interface IgniteCompute extends IgniteAsyncSupport {
/**
* Gets cluster group to which this {@code IgniteCompute} instance belongs.
@@ -137,6 +139,20 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public void affinityRun(@Nullable String cacheName, Object affKey, IgniteRunnable job) throws IgniteException;
/**
+ * Executes given job asynchronously on the node where data for provided affinity key is located
+ * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+ * will not be migrated from the target node while the job is executed.
+ *
+ * @param cacheName Name of the cache to use for affinity co-location.
+ * @param affKey Affinity key.
+ * @param job Job which will be co-located on the node with given affinity key.
+ * @return a Future representing pending completion of the affinity run.
+ * @throws IgniteException If job failed.
+ */
+ public IgniteFuture<Void> affinityRunAsync(@Nullable String cacheName, Object affKey, IgniteRunnable job)
+ throws IgniteException;
+
+ /**
* Executes given job on the node where data for provided affinity key is located
* (a.k.a. affinity co-location).
* </p>
@@ -154,6 +170,21 @@ public interface IgniteCompute extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Executes given job asynchronously on the node where data for provided affinity key is located
+ * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+ * will not be migrated from the target node while the job is executed. The data
+ * of the extra caches' partitions with the same partition number also will not be migrated.
+ *
+ * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+ * @param affKey Affinity key.
+ * @param job Job which will be co-located on the node with given affinity key.
+ * @return a Future representing pending completion of the affinity run.
+ * @throws IgniteException If job failed.
+ */
+ public IgniteFuture<Void> affinityRunAsync(@NotNull Collection<String> cacheNames, Object affKey,
+ IgniteRunnable job) throws IgniteException;
+
+ /**
* Executes given job on the node where partition is located (the partition is primary on the node)
* </p>
* It's guaranteed that the data of all the partitions of all participating caches,
@@ -170,6 +201,21 @@ public interface IgniteCompute extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Executes given job asynchronously on the node where partition is located (the partition is primary on the node)
+ * The data of the partition will not be migrated from the target node
+ * while the job is executed. The data of the extra caches' partitions with the same partition number
+ * also will not be migrated.
+ *
+ * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+ * @param partId Partition number.
+ * @param job Job which will be co-located on the node with given affinity key.
+ * @return a Future representing pending completion of the affinity run.
+ * @throws IgniteException If job failed.
+ */
+ public IgniteFuture<Void> affinityRunAsync(@NotNull Collection<String> cacheNames, int partId,
+ IgniteRunnable job) throws IgniteException;
+
+ /**
* Executes given job on the node where data for provided affinity key is located
* (a.k.a. affinity co-location).
* </p>
@@ -186,6 +232,20 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <R> R affinityCall(@Nullable String cacheName, Object affKey, IgniteCallable<R> job) throws IgniteException;
/**
+ * Executes given job asynchronously on the node where data for provided affinity key is located
+ * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+ * will not be migrated from the target node while the job is executed.
+ *
+ * @param cacheName Name of the cache to use for affinity co-location.
+ * @param affKey Affinity key.
+ * @param job Job which will be co-located on the node with given affinity key.
+ * @return a Future representing pending completion of the affinity call.
+ * @throws IgniteException If job failed.
+ */
+ public <R> IgniteFuture<R> affinityCallAsync(@Nullable String cacheName, Object affKey, IgniteCallable<R> job)
+ throws IgniteException;
+
+ /**
* Executes given job on the node where data for provided affinity key is located
* (a.k.a. affinity co-location).
* </p>
@@ -203,6 +263,21 @@ public interface IgniteCompute extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Executes given job asynchronously on the node where data for provided affinity key is located
+ * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+ * will not be migrated from the target node while the job is executed. The data
+ * of the extra caches' partitions with the same partition number also will not be migrated.
+ *
+ * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+ * @param affKey Affinity key.
+ * @param job Job which will be co-located on the node with given affinity key.
+ * @return a Future representing pending completion of the affinity call.
+ * @throws IgniteException If job failed.
+ */
+ public <R> IgniteFuture<R> affinityCallAsync(@NotNull Collection<String> cacheNames, Object affKey,
+ IgniteCallable<R> job) throws IgniteException;
+
+ /**
* Executes given job on the node where partition is located (the partition is primary on the node)
* </p>
* It's guaranteed that the data of all the partitions of all participating caches,
@@ -219,6 +294,21 @@ public interface IgniteCompute extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Executes given job asynchronously on the node where partition is located (the partition is primary on the node)
+ * The data of the partition will not be migrated from the target node
+ * while the job is executed. The data of the extra caches' partitions with the same partition number
+ * also will not be migrated.
+ *
+ * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+ * @param partId Partition to reserve.
+ * @param job Job which will be co-located on the node with given affinity key.
+ * @return a Future representing pending completion of the affinity call.
+ * @throws IgniteException If job failed.
+ */
+ public <R> IgniteFuture<R> affinityCallAsync(@NotNull Collection<String> cacheNames, int partId,
+ IgniteCallable<R> job) throws IgniteException;
+
+ /**
* Executes given task on within the cluster group. For step-by-step explanation of task execution process
* refer to {@link ComputeTask} documentation.
*
@@ -233,6 +323,20 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <T, R> R execute(Class<? extends ComputeTask<T, R>> taskCls, @Nullable T arg) throws IgniteException;
/**
+ * Executes given task asynchronously on within the cluster group. For step-by-step explanation of task execution
+ * process refer to {@link ComputeTask} documentation.
+ *
+ * @param taskCls Class of the task to execute. If class has {@link ComputeTaskName} annotation,
+ * then task is deployed under a name specified within annotation. Otherwise, full
+ * class name is used as task name.
+ * @param arg Optional argument of task execution, can be {@code null}.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If task failed.
+ */
+ public <T, R> ComputeTaskFuture<R> executeAsync(Class<? extends ComputeTask<T, R>> taskCls, @Nullable T arg)
+ throws IgniteException;
+
+ /**
* Executes given task within the cluster group. For step-by-step explanation of task execution process
* refer to {@link ComputeTask} documentation.
*
@@ -247,6 +351,19 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <T, R> R execute(ComputeTask<T, R> task, @Nullable T arg) throws IgniteException;
/**
+ * Executes given task asynchronously within the cluster group. For step-by-step explanation of task execution
+ * process refer to {@link ComputeTask} documentation.
+ *
+ * @param task Instance of task to execute. If task class has {@link ComputeTaskName} annotation,
+ * then task is deployed under a name specified within annotation. Otherwise, full
+ * class name is used as task name.
+ * @param arg Optional argument of task execution, can be {@code null}.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If task failed.
+ */
+ public <T, R> ComputeTaskFuture<R> executeAsync(ComputeTask<T, R> task, @Nullable T arg) throws IgniteException;
+
+ /**
* Executes given task within the cluster group. For step-by-step explanation of task execution process
* refer to {@link ComputeTask} documentation.
* <p>
@@ -263,6 +380,21 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <T, R> R execute(String taskName, @Nullable T arg) throws IgniteException;
/**
+ * Executes given task asynchronously within the cluster group. For step-by-step explanation of task execution
+ * process refer to {@link ComputeTask} documentation.
+ * <p>
+ * If task for given name has not been deployed yet, then {@code taskName} will be
+ * used as task class name to auto-deploy the task (see {@link #localDeployTask(Class, ClassLoader)} method).
+ *
+ * @param taskName Name of the task to execute.
+ * @param arg Optional argument of task execution, can be {@code null}.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If task failed.
+ * @see ComputeTask for information about task execution.
+ */
+ public <T, R> ComputeTaskFuture<R> executeAsync(String taskName, @Nullable T arg) throws IgniteException;
+
+ /**
* Broadcasts given job to all nodes in the cluster group.
*
* @param job Job to broadcast to all cluster group nodes.
@@ -272,6 +404,15 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public void broadcast(IgniteRunnable job) throws IgniteException;
/**
+ * Broadcasts given job asynchronously to all nodes in the cluster group.
+ *
+ * @param job Job to broadcast to all cluster group nodes.
+ * @return a Future representing pending completion of the broadcast execution of the job.
+ * @throws IgniteException If job failed.
+ */
+ public IgniteFuture<Void> broadcastAsync(IgniteRunnable job) throws IgniteException;
+
+ /**
* Broadcasts given job to all nodes in cluster group. Every participating node will return a
* job result. Collection of all returned job results is returned from the result future.
*
@@ -283,6 +424,16 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <R> Collection<R> broadcast(IgniteCallable<R> job) throws IgniteException;
/**
+ * Broadcasts given job asynchronously to all nodes in cluster group. Every participating node will return a
+ * job result. Collection of all returned job results is returned from the result future.
+ *
+ * @param job Job to broadcast to all cluster group nodes.
+ * @return a Future representing pending completion of the broadcast execution of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public <R> IgniteFuture<Collection<R>> broadcastAsync(IgniteCallable<R> job) throws IgniteException;
+
+ /**
* Broadcasts given closure job with passed in argument to all nodes in the cluster group.
* Every participating node will return a job result. Collection of all returned job results
* is returned from the result future.
@@ -296,6 +447,19 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <R, T> Collection<R> broadcast(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteException;
/**
+ * Broadcasts given closure job asynchronously with passed in argument to all nodes in the cluster group.
+ * Every participating node will return a job result. Collection of all returned job results
+ * is returned from the result future.
+ *
+ * @param job Job to broadcast to all cluster group nodes.
+ * @param arg Job closure argument.
+ * @return a Future representing pending completion of the broadcast execution of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public <R, T> IgniteFuture<Collection<R>> broadcastAsync(IgniteClosure<T, R> job, @Nullable T arg)
+ throws IgniteException;
+
+ /**
* Executes provided job on a node within the underlying cluster group.
*
* @param job Job closure to execute.
@@ -305,6 +469,15 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public void run(IgniteRunnable job) throws IgniteException;
/**
+ * Executes provided job asynchronously on a node within the underlying cluster group.
+ *
+ * @param job Job closure to execute.
+ * @return a Future representing pending completion of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public IgniteFuture<Void> runAsync(IgniteRunnable job) throws IgniteException;
+
+ /**
* Executes collection of jobs on grid nodes within the underlying cluster group.
*
* @param jobs Collection of jobs to execute.
@@ -314,6 +487,16 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public void run(Collection<? extends IgniteRunnable> jobs) throws IgniteException;
/**
+ * Executes collection of jobs asynchronously on grid nodes within the underlying cluster group.
+ * Executes asynchronously. Returns control immediately.
+ *
+ * @param jobs Collection of jobs to execute.
+ * @return a Future representing pending completion of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public IgniteFuture<Void> runAsync(Collection<? extends IgniteRunnable> jobs) throws IgniteException;
+
+ /**
* Executes provided job on a node within the underlying cluster group. The result of the
* job execution is returned from the result closure.
*
@@ -325,6 +508,16 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <R> R call(IgniteCallable<R> job) throws IgniteException;
/**
+ * Executes provided job asynchronously on a node within the underlying cluster group. The result of the
+ * job execution is returned from the result closure.
+ *
+ * @param job Job to execute.
+ * @return a Future representing pending completion of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public <R> IgniteFuture<R> callAsync(IgniteCallable<R> job) throws IgniteException;
+
+ /**
* Executes collection of jobs on nodes within the underlying cluster group.
* Collection of all returned job results is returned from the result future.
*
@@ -336,12 +529,23 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <R> Collection<R> call(Collection<? extends IgniteCallable<R>> jobs) throws IgniteException;
/**
+ * Executes collection of jobs asynchronously on nodes within the underlying cluster group.
+ * Collection of all returned job results is returned from the result future.
+ *
+ * @param jobs Collection of jobs to execute.
+ * @return a Future representing pending completion of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public <R> IgniteFuture<Collection<R>> callAsync(Collection<? extends IgniteCallable<R>> jobs)
+ throws IgniteException;
+
+ /**
* Executes collection of jobs on nodes within the underlying cluster group. The returned
* job results will be reduced into an individual result by provided reducer.
*
* @param jobs Collection of jobs to execute.
* @param rdc Reducer to reduce all job results into one individual return value.
- * @return Future with reduced job result for this execution.
+ * @return Reduced job result for this execution.
* @throws IgniteException If execution failed.
*/
@IgniteAsyncSupported
@@ -349,6 +553,18 @@ public interface IgniteCompute extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Executes collection of jobs asynchronously on nodes within the underlying cluster group. The returned
+ * job results will be reduced into an individual result by provided reducer.
+ *
+ * @param jobs Collection of jobs to execute.
+ * @param rdc Reducer to reduce all job results into one individual return value.
+ * @return a Future with reduced job result for this execution.
+ * @throws IgniteException If execution failed.
+ */
+ public <R1, R2> IgniteFuture<R2> callAsync(Collection<? extends IgniteCallable<R1>> jobs,
+ IgniteReducer<R1, R2> rdc) throws IgniteException;
+
+ /**
* Executes provided closure job on a node within the underlying cluster group. This method is different
* from {@code run(...)} and {@code call(...)} methods in a way that it receives job argument
* which is then passed into the closure at execution time.
@@ -362,6 +578,18 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <R, T> R apply(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteException;
/**
+ * Executes provided closure job asynchronously on a node within the underlying cluster group.
+ * This method is different from {@code run(...)} and {@code call(...)} methods in a way that
+ * it receives job argument which is then passed into the closure at execution time.
+ *
+ * @param job Job to run.
+ * @param arg Job argument.
+ * @return a Future representing pending completion of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public <R, T> IgniteFuture<R> applyAsync(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteException;
+
+ /**
* Executes provided closure job on nodes within the underlying cluster group. A new job is executed for
* every argument in the passed in collection. The number of actual job executions will be
* equal to size of the job arguments collection.
@@ -375,6 +603,19 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public <T, R> Collection<R> apply(IgniteClosure<T, R> job, Collection<? extends T> args) throws IgniteException;
/**
+ * Executes provided closure job asynchronously on nodes within the underlying cluster group. A new job is executed
+ * for every argument in the passed in collection. The number of actual job executions will be
+ * equal to size of the job arguments collection.
+ *
+ * @param job Job to run.
+ * @param args Job arguments.
+ * @return a Future representing pending completion of the job.
+ * @throws IgniteException If execution failed.
+ */
+ public <T, R> IgniteFuture<Collection<R>> applyAsync(IgniteClosure<T, R> job, Collection<? extends T> args)
+ throws IgniteException;
+
+ /**
* Executes provided closure job on nodes within the underlying cluster group. A new job is executed for
* every argument in the passed in collection. The number of actual job executions will be
* equal to size of the job arguments collection. The returned job results will be reduced
@@ -383,7 +624,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param job Job to run.
* @param args Job arguments.
* @param rdc Reducer to reduce all job results into one individual return value.
- * @return Future with reduced job result for this execution.
+ * @return Reduced job result for this execution.
* @throws IgniteException If execution failed.
*/
@IgniteAsyncSupported
@@ -391,6 +632,21 @@ public interface IgniteCompute extends IgniteAsyncSupport {
IgniteReducer<R1, R2> rdc) throws IgniteException;
/**
+ * Executes provided closure job asynchronously on nodes within the underlying cluster group. A new job is executed
+ * for every argument in the passed in collection. The number of actual job executions will be
+ * equal to size of the job arguments collection. The returned job results will be reduced
+ * into an individual result by provided reducer.
+ *
+ * @param job Job to run.
+ * @param args Job arguments.
+ * @param rdc Reducer to reduce all job results into one individual return value.
+ * @return a Future with reduced job result for this execution.
+ * @throws IgniteException If execution failed.
+ */
+ public <R1, R2, T> IgniteFuture<R2> applyAsync(IgniteClosure<T, R1> job, Collection<? extends T> args,
+ IgniteReducer<R1, R2> rdc) throws IgniteException;
+
+ /**
* Gets tasks future for active tasks started on local node.
*
* @return Map of active tasks keyed by their task task session ID.
@@ -489,8 +745,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
public void undeployTask(String taskName) throws IgniteException;
/** {@inheritDoc} */
+ @Deprecated
@Override public <R> ComputeTaskFuture<R> future();
/** {@inheritDoc} */
+ @Deprecated
@Override public IgniteCompute withAsync();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteEvents.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteEvents.java b/modules/core/src/main/java/org/apache/ignite/IgniteEvents.java
index c0e4d3b..c081f2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteEvents.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteEvents.java
@@ -25,6 +25,7 @@ import org.apache.ignite.events.Event;
import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteAsyncSupported;
import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
@@ -90,13 +91,27 @@ public interface IgniteEvents extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Asynchronously queries nodes in this cluster group for events using passed in predicate filter for event
+ * selection.
+ *
+ * @param p Predicate filter used to query events on remote nodes.
+ * @param timeout Maximum time to wait for result, {@code 0} to wait forever.
+ * @param types Event types to be queried.
+ * @return a Future representing pending completion of the query. The completed future contains
+ * collection of grid events returned from specified nodes.
+ * @throws IgniteException If query failed.
+ */
+ public <T extends Event> IgniteFuture<List<T>> remoteQueryAsync(IgnitePredicate<T> p, long timeout,
+ @Nullable int... types) throws IgniteException;
+
+ /**
* Adds event listener for specified events to all nodes in the cluster group (possibly including
* local node if it belongs to the cluster group as well). This means that all events occurring on
* any node within this cluster group that pass remote filter will be sent to local node for
* local listener notifications.
* <p>
* The listener can be unsubscribed automatically if local node stops, if {@code locLsnr} callback
- * returns {@code false} or if {@link #stopRemoteListen(UUID)} is called.
+ * returns {@code false} or if {@link #stopRemoteListen(UUID)} or {@link #stopRemoteListenAsync(UUID)} are called.
*
* @param locLsnr Listener callback that is called on local node. If {@code null}, this events will be handled
* on remote nodes by passed in {@code rmtFilter}.
@@ -108,7 +123,8 @@ public interface IgniteEvents extends IgniteAsyncSupport {
* @param types Types of events to listen for. If not provided, all events that pass the
* provided remote filter will be sent to local node.
* @param <T> Type of the event.
- * @return {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)} method to stop listening.
+ * @return {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)} or
+ * {@link #stopRemoteListenAsync(UUID)} methods to stop listening.
* @throws IgniteException If failed to add listener.
*/
@IgniteAsyncSupported
@@ -118,6 +134,35 @@ public interface IgniteEvents extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Asynchronously adds event listener for specified events to all nodes in the cluster group (possibly including
+ * local node if it belongs to the cluster group as well). This means that all events occurring on
+ * any node within this cluster group that pass remote filter will be sent to local node for
+ * local listener notifications.
+ * <p>
+ * The listener can be unsubscribed automatically if local node stops, if {@code locLsnr} callback
+ * returns {@code false} or if {@link #stopRemoteListen(UUID)} or {@link #stopRemoteListenAsync(UUID)} are called.
+ *
+ * @param <T> Type of the event.
+ * @param locLsnr Listener callback that is called on local node. If {@code null}, this events will be handled
+ * on remote nodes by passed in {@code rmtFilter}.
+ * @param rmtFilter Filter callback that is called on remote node. Only events that pass the remote filter
+ * will be sent to local node. If {@code null}, all events of specified types will
+ * be sent to local node. This remote filter can be used to pre-handle events remotely,
+ * before they are passed in to local callback. It will be auto-unsubsribed on the node
+ * where event occurred in case if it returns {@code false}.
+ * @param types Types of events to listen for. If not provided, all events that pass the
+ * provided remote filter will be sent to local node.
+ * @return a Future representing pending completion of the operation. The completed future contains
+ * {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)} or
+ * {@link #stopRemoteListenAsync(UUID)} methods to stop listening.
+ * @throws IgniteException If failed to add listener.
+ */
+ public <T extends Event> IgniteFuture<UUID> remoteListenAsync(@Nullable IgniteBiPredicate<UUID, T> locLsnr,
+ @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types)
+ throws IgniteException;
+
+ /**
* Adds event listener for specified events to all nodes in the cluster group (possibly including
* local node if it belongs to the cluster group as well). This means that all events occurring on
* any node within this cluster group that pass remote filter will be sent to local node for
@@ -148,9 +193,11 @@ public interface IgniteEvents extends IgniteAsyncSupport {
* @param types Types of events to listen for. If not provided, all events that pass the
* provided remote filter will be sent to local node.
* @param <T> Type of the event.
- * @return {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)} method to stop listening.
- * @see #stopRemoteListen(UUID)
+ * @return {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)} or
+ * {@link #stopRemoteListen(UUID)} methods to stop listening.
* @throws IgniteException If failed to add listener.
+ * @see #stopRemoteListen(UUID)
+ * @see #stopRemoteListenAsync(UUID)
*/
@IgniteAsyncSupported
public <T extends Event> UUID remoteListen(int bufSize,
@@ -162,6 +209,50 @@ public interface IgniteEvents extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Asynchronously adds event listener for specified events to all nodes in the cluster group (possibly including
+ * local node if it belongs to the cluster group as well). This means that all events occurring on
+ * any node within this cluster group that pass remote filter will be sent to local node for
+ * local listener notification.
+ *
+ * @param <T> Type of the event.
+ * @param bufSize Remote events buffer size. Events from remote nodes won't be sent until buffer
+ * is full or time interval is exceeded.
+ * @param interval Maximum time interval after which events from remote node will be sent. Events
+ * from remote nodes won't be sent until buffer is full or time interval is exceeded.
+ * @param autoUnsubscribe Flag indicating that event listeners on remote nodes should be
+ * automatically unregistered if master node (node that initiated event listening) leaves
+ * topology. If this flag is {@code false}, listeners will be unregistered only when
+ * {@link #stopRemoteListen(UUID)} method is called, or the {@code 'callback (locLsnr)'}
+ * passed in returns {@code false}.
+ * @param locLsnr Callback that is called on local node. If this predicate returns {@code true},
+ * the implementation will continue listening to events. Otherwise, events
+ * listening will be stopped and listeners will be unregistered on all nodes
+ * in the cluster group. If {@code null}, this events will be handled on remote nodes by
+ * passed in {@code rmtFilter} until local node stops (if {@code 'autoUnsubscribe'} is {@code true})
+ * or until {@link #stopRemoteListen(UUID)} is called.
+ * @param rmtFilter Filter callback that is called on remote node. Only events that pass the remote filter
+ * will be sent to local node. If {@code null}, all events of specified types will
+ * be sent to local node. This remote filter can be used to pre-handle events remotely,
+ * before they are passed in to local callback. It will be auto-unsubsribed on the node
+ * where event occurred in case if it returns {@code false}.
+ * @param types Types of events to listen for. If not provided, all events that pass the
+ * provided remote filter will be sent to local node.
+ * @return a Future representing pending completion of the operation. The completed future contains
+ * {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)}
+ * or {@link #stopRemoteListen(UUID)} methods to stop listening.
+ * @throws IgniteException If failed to add listener.
+ * @see #stopRemoteListen(UUID)
+ * @see #stopRemoteListenAsync(UUID)
+ */
+ public <T extends Event> IgniteFuture<UUID> remoteListenAsync(int bufSize,
+ long interval,
+ boolean autoUnsubscribe,
+ @Nullable IgniteBiPredicate<UUID, T> locLsnr,
+ @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types)
+ throws IgniteException;
+
+ /**
* Stops listening to remote events. This will unregister all listeners identified with provided
* operation ID on all nodes defined by {@link #clusterGroup()}.
* <p>
@@ -169,13 +260,27 @@ public interface IgniteEvents extends IgniteAsyncSupport {
*
* @param opId Operation ID that was returned from
* {@link #remoteListen(IgniteBiPredicate, IgnitePredicate, int...)} method.
- * @see #remoteListen(IgniteBiPredicate, IgnitePredicate, int...)
* @throws IgniteException If failed to stop listeners.
+ * @see #remoteListen(IgniteBiPredicate, IgnitePredicate, int...)
+ * @see #remoteListenAsync(int, long, boolean, IgniteBiPredicate, IgnitePredicate, int...)
*/
@IgniteAsyncSupported
public void stopRemoteListen(UUID opId) throws IgniteException;
/**
+ * Asynchronously stops listening to remote events. This will unregister all listeners identified with provided
+ * operation ID on all nodes defined by {@link #clusterGroup()}.
+ *
+ * @param opId Operation ID that was returned from
+ * {@link #remoteListen(IgniteBiPredicate, IgnitePredicate, int...)} method.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to stop listeners.
+ * @see #remoteListen(IgniteBiPredicate, IgnitePredicate, int...)
+ * @see #remoteListenAsync(int, long, boolean, IgniteBiPredicate, IgnitePredicate, int...)
+ */
+ public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException;
+
+ /**
* Waits for the specified events.
* <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}).
@@ -191,6 +296,18 @@ public interface IgniteEvents extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Create future to wait for the specified events.
+ *
+ * @param filter Optional filtering predicate. Only if predicates evaluates to {@code true} will the event
+ * end the wait.
+ * @param types Types of the events to wait for. If not provided, all events will be passed to the filter.
+ * @return a Future representing pending completion of the operation. The completed future contains grid event.
+ * @throws IgniteException If wait was interrupted.
+ */
+ public <T extends Event> IgniteFuture<T> waitForLocalAsync(@Nullable IgnitePredicate<T> filter,
+ @Nullable int... types) throws IgniteException;
+
+ /**
* Queries local node for events using passed-in predicate filter for event selection.
*
* @param p Predicate to filter events. All predicates must be satisfied for the
@@ -269,5 +386,6 @@ public interface IgniteEvents extends IgniteAsyncSupport {
public boolean isEnabled(int type);
/** {@inheritDoc} */
+ @Deprecated
@Override public IgniteEvents withAsync();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
index 8fb4fcd..78c86dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
@@ -32,6 +32,7 @@ import org.apache.ignite.igfs.mapreduce.IgfsRecordResolver;
import org.apache.ignite.igfs.mapreduce.IgfsTask;
import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteAsyncSupported;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import org.apache.ignite.igfs.IgfsPathNotFoundException;
@@ -275,6 +276,15 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
public void format() throws IgniteException;
/**
+ * Asynchronously formats the file system removing all existing entries from it.
+ * <p>
+ *
+ * @return a Future representing pending completion of the format operation.
+ * @throws IgniteException In case format has failed.
+ */
+ public IgniteFuture<Void> formatAsync() throws IgniteException;
+
+ /**
* Executes IGFS task.
* <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}).
@@ -291,6 +301,20 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
/**
+ * Executes IGFS task asynchronously.
+ *
+ * @param task Task to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param arg Optional task argument.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If execution failed.
+ */
+ public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
+
+
+ /**
* Executes IGFS task with overridden maximum range length (see
* {@link org.apache.ignite.configuration.FileSystemConfiguration#getMaximumTaskRangeLength()} for more information).
* <p>
@@ -313,6 +337,25 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Executes IGFS task asynchronously with overridden maximum range length (see
+ * {@link org.apache.ignite.configuration.FileSystemConfiguration#getMaximumTaskRangeLength()} for more information).
+ *
+ * @param task Task to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
+ * be ignored. Otherwise an exception will be thrown.
+ * @param maxRangeLen Optional maximum range length. If {@code 0}, then by default all consecutive
+ * IGFS blocks will be included.
+ * @param arg Optional task argument.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If execution failed.
+ */
+ public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
+ throws IgniteException;
+
+ /**
* Executes IGFS task.
* <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}).
@@ -329,6 +372,20 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
/**
+ * Executes IGFS task asynchronously.
+ *
+ * @param taskCls Task class to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param arg Optional task argument.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If execution failed.
+ */
+ public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
+
+
+ /**
* Executes IGFS task with overridden maximum range length (see
* {@link org.apache.ignite.configuration.FileSystemConfiguration#getMaximumTaskRangeLength()} for more information).
* <p>
@@ -350,6 +407,24 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
long maxRangeLen, @Nullable T arg) throws IgniteException;
/**
+ * Executes IGFS task asynchronously with overridden maximum range length (see
+ * {@link org.apache.ignite.configuration.FileSystemConfiguration#getMaximumTaskRangeLength()} for more information).
+ *
+ * @param taskCls Task class to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
+ * be ignored. Otherwise an exception will be thrown.
+ * @param maxRangeLen Maximum range length.
+ * @param arg Optional task argument.
+ * @return a Future representing pending completion of the task.
+ * @throws IgniteException If execution failed.
+ */
+ public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
+ long maxRangeLen, @Nullable T arg) throws IgniteException;
+
+ /**
* Checks if the specified path exists in the file system.
*
* @param path Path to check for existence in the file system.
@@ -473,5 +548,6 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
public long usedSpaceSize() throws IgniteException;
/** {@inheritDoc} */
+ @Deprecated
@Override public IgniteFileSystem withAsync();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java b/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
index e64ded5..f8257d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteAsyncSupported;
import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteFuture;
import org.jetbrains.annotations.Nullable;
/**
@@ -159,6 +160,22 @@ public interface IgniteMessaging extends IgniteAsyncSupport {
public UUID remoteListen(@Nullable Object topic, IgniteBiPredicate<UUID, ?> p) throws IgniteException;
/**
+ * Asynchronously adds a message listener for a given topic to all nodes in the cluster group (possibly including
+ * this node if it belongs to the cluster group as well). This means that any node within this cluster
+ * group can send a message for a given topic and all nodes within the cluster group will receive
+ * listener notifications.
+ *
+ * @param topic Topic to subscribe to, {@code null} means default topic.
+ * @param p Predicate that is called on each node for each received message. If predicate returns {@code false},
+ * then it will be unsubscribed from any further notifications.
+ * @return a Future representing pending completion of the operation. The completed future contains
+ * {@code Operation ID} that can be passed to {@link #stopRemoteListen(UUID)} method to stop listening.
+ * @throws IgniteException If failed to add listener.
+ */
+ public IgniteFuture<UUID> remoteListenAsync(@Nullable Object topic, IgniteBiPredicate<UUID, ?> p)
+ throws IgniteException;
+
+ /**
* Unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
* <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}).
@@ -169,6 +186,16 @@ public interface IgniteMessaging extends IgniteAsyncSupport {
@IgniteAsyncSupported
public void stopRemoteListen(UUID opId) throws IgniteException;
+ /**
+ * Asynchronously unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
+ *
+ * @param opId Listen ID that was returned from {@link #remoteListen(Object, IgniteBiPredicate)} method.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to unregister listeners.
+ */
+ public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException;
+
/** {@inheritDoc} */
+ @Deprecated
@Override IgniteMessaging withAsync();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteServices.java b/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
index 8365ec7..1c01598 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteAsyncSupported;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceConfiguration;
@@ -150,7 +151,8 @@ public interface IgniteServices extends IgniteAsyncSupport {
* when a singleton service instance will be active on more than one node (e.g. crash detection delay).
* <p>
* This method is analogous to calling
- * {@link #deployMultiple(String, org.apache.ignite.services.Service, int, int) deployMultiple(name, svc, 1, 1)} method.
+ * {@link #deployMultiple(String, org.apache.ignite.services.Service, int, int) deployMultiple(name, svc, 1, 1)}
+ * method.
*
* @param name Service name.
* @param svc Service instance.
@@ -160,13 +162,35 @@ public interface IgniteServices extends IgniteAsyncSupport {
public void deployClusterSingleton(String name, Service svc) throws IgniteException;
/**
+ * Asynchronously deploys a cluster-wide singleton service. Ignite will guarantee that there is always
+ * one instance of the service in the cluster. In case if grid node on which the service
+ * was deployed crashes or stops, Ignite will automatically redeploy it on another node.
+ * However, if the node on which the service is deployed remains in topology, then the
+ * service will always be deployed on that node only, regardless of topology changes.
+ * <p>
+ * Note that in case of topology changes, due to network delays, there may be a temporary situation
+ * when a singleton service instance will be active on more than one node (e.g. crash detection delay).
+ * <p>
+ * This method is analogous to calling
+ * {@link #deployMultipleAsync(String, org.apache.ignite.services.Service, int, int)
+ * deployMultipleAsync(name, svc, 1, 1)} method.
+ *
+ * @param name Service name.
+ * @param svc Service instance.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to deploy service.
+ */
+ public IgniteFuture<Void> deployClusterSingletonAsync(String name, Service svc) throws IgniteException;
+
+ /**
* Deploys a per-node singleton service. Ignite will guarantee that there is always
* one instance of the service running on each node. Whenever new nodes are started
* within the underlying cluster group, Ignite will automatically deploy one instance of
* the service on every new node.
* <p>
* This method is analogous to calling
- * {@link #deployMultiple(String, org.apache.ignite.services.Service, int, int) deployMultiple(name, svc, 0, 1)} method.
+ * {@link #deployMultiple(String, org.apache.ignite.services.Service, int, int) deployMultiple(name, svc, 0, 1)}
+ * method.
*
* @param name Service name.
* @param svc Service instance.
@@ -176,6 +200,23 @@ public interface IgniteServices extends IgniteAsyncSupport {
public void deployNodeSingleton(String name, Service svc) throws IgniteException;
/**
+ * Asynchronously deploys a per-node singleton service. Ignite will guarantee that there is always
+ * one instance of the service running on each node. Whenever new nodes are started
+ * within the underlying cluster group, Ignite will automatically deploy one instance of
+ * the service on every new node.
+ * <p>
+ * This method is analogous to calling
+ * {@link #deployMultipleAsync(String, org.apache.ignite.services.Service, int, int)
+ * deployMultipleAsync(name, svc, 0, 1)} method.
+ *
+ * @param name Service name.
+ * @param svc Service instance.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to deploy service.
+ */
+ public IgniteFuture<Void> deployNodeSingletonAsync(String name, Service svc) throws IgniteException;
+
+ /**
* Deploys one instance of this service on the primary node for a given affinity key.
* Whenever topology changes and primary node assignment changes, Ignite will always
* make sure that the service is undeployed on the previous primary node and deployed
@@ -184,8 +225,8 @@ public interface IgniteServices extends IgniteAsyncSupport {
* Note that in case of topology changes, due to network delays, there may be a temporary situation
* when a service instance will be active on more than one node (e.g. crash detection delay).
* <p>
- * This method is analogous to the invocation of {@link #deploy(org.apache.ignite.services.ServiceConfiguration)} method
- * as follows:
+ * This method is analogous to the invocation of {@link #deploy(org.apache.ignite.services.ServiceConfiguration)}
+ * method as follows:
* <pre name="code" class="java">
* ServiceConfiguration cfg = new ServiceConfiguration();
*
@@ -211,6 +252,41 @@ public interface IgniteServices extends IgniteAsyncSupport {
throws IgniteException;
/**
+ * Asynchronously deploys one instance of this service on the primary node for a given affinity key.
+ * Whenever topology changes and primary node assignment changes, Ignite will always
+ * make sure that the service is undeployed on the previous primary node and deployed
+ * on the new primary node.
+ * <p>
+ * Note that in case of topology changes, due to network delays, there may be a temporary situation
+ * when a service instance will be active on more than one node (e.g. crash detection delay).
+ * <p>
+ * This method is analogous to the invocation of
+ * {@link #deployAsync(org.apache.ignite.services.ServiceConfiguration)} method as follows:
+ * <pre name="code" class="java">
+ * ServiceConfiguration cfg = new ServiceConfiguration();
+ *
+ * cfg.setName(name);
+ * cfg.setService(svc);
+ * cfg.setCacheName(cacheName);
+ * cfg.setAffinityKey(affKey);
+ * cfg.setTotalCount(1);
+ * cfg.setMaxPerNodeCount(1);
+ *
+ * ignite.services().deployAsync(cfg);
+ * </pre>
+ *
+ * @param name Service name.
+ * @param svc Service instance.
+ * @param cacheName Name of the cache on which affinity for key should be calculated, {@code null} for
+ * default cache.
+ * @param affKey Affinity cache key.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to deploy service.
+ */
+ public IgniteFuture<Void> deployKeyAffinitySingletonAsync(String name, Service svc, @Nullable String cacheName,
+ Object affKey) throws IgniteException;
+
+ /**
* Deploys multiple instances of the service on the grid. Ignite will deploy a
* maximum amount of services equal to {@code 'totalCnt'} parameter making sure that
* there are no more than {@code 'maxPerNodeCnt'} service instances running
@@ -221,8 +297,8 @@ public interface IgniteServices extends IgniteAsyncSupport {
* Note that at least one of {@code 'totalCnt'} or {@code 'maxPerNodeCnt'} parameters must have
* value greater than {@code 0}.
* <p>
- * This method is analogous to the invocation of {@link #deploy(org.apache.ignite.services.ServiceConfiguration)} method
- * as follows:
+ * This method is analogous to the invocation of {@link #deploy(org.apache.ignite.services.ServiceConfiguration)}
+ * method as follows:
* <pre name="code" class="java">
* ServiceConfiguration cfg = new ServiceConfiguration();
*
@@ -244,20 +320,57 @@ public interface IgniteServices extends IgniteAsyncSupport {
public void deployMultiple(String name, Service svc, int totalCnt, int maxPerNodeCnt) throws IgniteException;
/**
+ * Asynchronously deploys multiple instances of the service on the grid. Ignite will deploy a
+ * maximum amount of services equal to {@code 'totalCnt'} parameter making sure that
+ * there are no more than {@code 'maxPerNodeCnt'} service instances running
+ * on each node. Whenever topology changes, Ignite will automatically rebalance
+ * the deployed services within cluster to make sure that each node will end up with
+ * about equal number of deployed instances whenever possible.
+ * <p>
+ * Note that at least one of {@code 'totalCnt'} or {@code 'maxPerNodeCnt'} parameters must have
+ * value greater than {@code 0}.
+ * <p>
+ * This method is analogous to the invocation of
+ * {@link #deployAsync(org.apache.ignite.services.ServiceConfiguration)} method as follows:
+ * <pre name="code" class="java">
+ * ServiceConfiguration cfg = new ServiceConfiguration();
+ *
+ * cfg.setName(name);
+ * cfg.setService(svc);
+ * cfg.setTotalCount(totalCnt);
+ * cfg.setMaxPerNodeCount(maxPerNodeCnt);
+ *
+ * ignite.services().deployAsync(cfg);
+ * </pre>
+ *
+ * @param name Service name.
+ * @param svc Service instance.
+ * @param totalCnt Maximum number of deployed services in the grid, {@code 0} for unlimited.
+ * @param maxPerNodeCnt Maximum number of deployed services on each node, {@code 0} for unlimited.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to deploy service.
+ */
+ public IgniteFuture<Void> deployMultipleAsync(String name, Service svc, int totalCnt, int maxPerNodeCnt)
+ throws IgniteException;
+
+ /**
* Deploys multiple instances of the service on the grid according to provided
* configuration. Ignite will deploy a maximum amount of services equal to
* {@link org.apache.ignite.services.ServiceConfiguration#getTotalCount() cfg.getTotalCount()} parameter
- * making sure that there are no more than {@link org.apache.ignite.services.ServiceConfiguration#getMaxPerNodeCount() cfg.getMaxPerNodeCount()}
+ * making sure that there are no more than
+ * {@link org.apache.ignite.services.ServiceConfiguration#getMaxPerNodeCount() cfg.getMaxPerNodeCount()}
* service instances running on each node. Whenever topology changes, Ignite will automatically rebalance
* the deployed services within cluster to make sure that each node will end up with
* about equal number of deployed instances whenever possible.
* <p>
- * If {@link org.apache.ignite.services.ServiceConfiguration#getAffinityKey() cfg.getAffinityKey()} is not {@code null}, then Ignite
- * will deploy the service on the primary node for given affinity key. The affinity will be calculated
- * on the cache with {@link org.apache.ignite.services.ServiceConfiguration#getCacheName() cfg.getCacheName()} name.
+ * If {@link org.apache.ignite.services.ServiceConfiguration#getAffinityKey() cfg.getAffinityKey()}
+ * is not {@code null}, then Ignite will deploy the service on the primary node for given affinity key.
+ * The affinity will be calculated on the cache with
+ * {@link org.apache.ignite.services.ServiceConfiguration#getCacheName() cfg.getCacheName()} name.
* <p>
- * If {@link org.apache.ignite.services.ServiceConfiguration#getNodeFilter() cfg.getNodeFilter()} is not {@code null}, then
- * Ignite will deploy service on all grid nodes for which the provided filter evaluates to {@code true}.
+ * If {@link org.apache.ignite.services.ServiceConfiguration#getNodeFilter() cfg.getNodeFilter()}
+ * is not {@code null}, then Ignite will deploy service on all grid nodes for which
+ * the provided filter evaluates to {@code true}.
* The node filter will be checked in addition to the underlying cluster group filter, or the
* whole grid, if the underlying cluster group includes all the cluster nodes.
* <p>
@@ -283,12 +396,56 @@ public interface IgniteServices extends IgniteAsyncSupport {
public void deploy(ServiceConfiguration cfg) throws IgniteException;
/**
+ * Asynchronously deploys multiple instances of the service on the grid according to provided
+ * configuration. Ignite will deploy a maximum amount of services equal to
+ * {@link org.apache.ignite.services.ServiceConfiguration#getTotalCount() cfg.getTotalCount()} parameter
+ * making sure that there are no more than
+ * {@link org.apache.ignite.services.ServiceConfiguration#getMaxPerNodeCount() cfg.getMaxPerNodeCount()}
+ * service instances running on each node. Whenever topology changes, Ignite will automatically rebalance
+ * the deployed services within cluster to make sure that each node will end up with
+ * about equal number of deployed instances whenever possible.
+ * <p>
+ * If {@link org.apache.ignite.services.ServiceConfiguration#getAffinityKey() cfg.getAffinityKey()}
+ * is not {@code null}, then Ignite
+ * will deploy the service on the primary node for given affinity key. The affinity will be calculated
+ * on the cache with {@link org.apache.ignite.services.ServiceConfiguration#getCacheName() cfg.getCacheName()} name.
+ * <p>
+ * If {@link org.apache.ignite.services.ServiceConfiguration#getNodeFilter() cfg.getNodeFilter()}
+ * is not {@code null}, then Ignite will deploy service on all grid nodes
+ * for which the provided filter evaluates to {@code true}.
+ * The node filter will be checked in addition to the underlying cluster group filter, or the
+ * whole grid, if the underlying cluster group includes all the cluster nodes.
+ * <p>
+ * Note that at least one of {@code 'totalCnt'} or {@code 'maxPerNodeCnt'} parameters must have
+ * value greater than {@code 0}.
+ * <p>
+ * Here is an example of creating service deployment configuration:
+ * <pre name="code" class="java">
+ * ServiceConfiguration cfg = new ServiceConfiguration();
+ *
+ * cfg.setName(name);
+ * cfg.setService(svc);
+ * cfg.setTotalCount(0); // Unlimited.
+ * cfg.setMaxPerNodeCount(2); // Deploy 2 instances of service on each node.
+ *
+ * ignite.services().deployAsync(cfg);
+ * </pre>
+ *
+ * @param cfg Service configuration.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to deploy service.
+ */
+ public IgniteFuture<Void> deployAsync(ServiceConfiguration cfg) throws IgniteException;
+
+ /**
* Cancels service deployment. If a service with specified name was deployed on the grid,
- * then {@link org.apache.ignite.services.Service#cancel(org.apache.ignite.services.ServiceContext)} method will be called on it.
+ * then {@link org.apache.ignite.services.Service#cancel(org.apache.ignite.services.ServiceContext)}
+ * method will be called on it.
* <p>
- * Note that Ignite cannot guarantee that the service exits from {@link org.apache.ignite.services.Service#execute(org.apache.ignite.services.ServiceContext)}
- * method whenever {@link org.apache.ignite.services.Service#cancel(org.apache.ignite.services.ServiceContext)} is called. It is up to the user to
- * make sure that the service code properly reacts to cancellations.
+ * Note that Ignite cannot guarantee that the service exits from
+ * {@link org.apache.ignite.services.Service#execute(org.apache.ignite.services.ServiceContext)}
+ * method whenever {@link org.apache.ignite.services.Service#cancel(org.apache.ignite.services.ServiceContext)}
+ * is called. It is up to the user to make sure that the service code properly reacts to cancellations.
* <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}).
*
@@ -299,6 +456,23 @@ public interface IgniteServices extends IgniteAsyncSupport {
public void cancel(String name) throws IgniteException;
/**
+ * Asynchronously cancels service deployment. If a service with specified name was deployed on the grid,
+ * then {@link org.apache.ignite.services.Service#cancel(org.apache.ignite.services.ServiceContext)}
+ * method will be called on it.
+ * <p>
+ * Note that Ignite cannot guarantee that the service exits from
+ * {@link org.apache.ignite.services.Service#execute(org.apache.ignite.services.ServiceContext)}
+ * method whenever {@link org.apache.ignite.services.Service#cancel(org.apache.ignite.services.ServiceContext)}
+ * is called. It is up to the user to
+ * make sure that the service code properly reacts to cancellations.
+ *
+ * @param name Name of service to cancel.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to cancel service.
+ */
+ public IgniteFuture<Void> cancelAsync(String name) throws IgniteException;
+
+ /**
* Cancels all deployed services.
* <p>
* Note that depending on user logic, it may still take extra time for a service to
@@ -312,6 +486,17 @@ public interface IgniteServices extends IgniteAsyncSupport {
public void cancelAll() throws IgniteException;
/**
+ * Asynchronously cancels all deployed services.
+ * <p>
+ * Note that depending on user logic, it may still take extra time for a service to
+ * finish execution, even after it was cancelled.
+ *
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to cancel services.
+ */
+ public IgniteFuture<Void> cancelAllAsync() throws IgniteException;
+
+ /**
* Gets metadata about all deployed services in the grid.
*
* @return Metadata about all deployed services in the grid.
@@ -364,8 +549,10 @@ public interface IgniteServices extends IgniteAsyncSupport {
* @return Either proxy over remote service or local service if it is deployed locally.
* @throws IgniteException If failed to create service proxy.
*/
- public <T> T serviceProxy(String name, Class<? super T> svcItf, boolean sticky, long timeout) throws IgniteException;
+ public <T> T serviceProxy(String name, Class<? super T> svcItf, boolean sticky, long timeout)
+ throws IgniteException;
/** {@inheritDoc} */
+ @Deprecated
@Override public IgniteServices withAsync();
}
[09/50] [abbrv] ignite git commit: IGNITE-3579: Changed communication
message type to short. This closes #1501.
Posted by ag...@apache.org.
IGNITE-3579: Changed communication message type to short. This closes #1501.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/906b6926
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/906b6926
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/906b6926
Branch: refs/heads/ignite-4003
Commit: 906b69268bda1db93485e9bee7913b07ae4e5a0c
Parents: 88b6124
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Mar 27 12:54:10 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 12:54:12 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/GridJobCancelRequest.java | 2 +-
.../ignite/internal/GridJobExecuteRequest.java | 2 +-
.../ignite/internal/GridJobExecuteResponse.java | 2 +-
.../ignite/internal/GridJobSiblingsRequest.java | 2 +-
.../internal/GridJobSiblingsResponse.java | 2 +-
.../ignite/internal/GridTaskCancelRequest.java | 2 +-
.../ignite/internal/GridTaskSessionRequest.java | 2 +-
.../internal/binary/BinaryEnumObjectImpl.java | 2 +-
.../internal/binary/BinaryObjectImpl.java | 2 +-
.../binary/BinaryObjectOffheapImpl.java | 2 +-
.../internal/direct/DirectMessageWriter.java | 4 +-
.../stream/v1/DirectByteBufferStreamImplV1.java | 8 +-
.../stream/v2/DirectByteBufferStreamImplV2.java | 9 +-
.../checkpoint/GridCheckpointRequest.java | 2 +-
.../managers/communication/GridIoMessage.java | 2 +-
.../communication/GridIoMessageFactory.java | 6 +-
.../communication/GridIoUserMessage.java | 2 +-
.../communication/IgniteIoTestMessage.java | 2 +-
.../deployment/GridDeploymentInfoBean.java | 2 +-
.../deployment/GridDeploymentRequest.java | 2 +-
.../deployment/GridDeploymentResponse.java | 2 +-
.../eventstorage/GridEventStorageMessage.java | 2 +-
.../affinity/AffinityTopologyVersion.java | 2 +-
.../cache/CacheEntryInfoCollection.java | 2 +-
.../cache/CacheEntryPredicateAdapter.java | 2 +-
.../cache/CacheEntryPredicateContainsValue.java | 2 +-
.../cache/CacheEntrySerializablePredicate.java | 2 +-
.../processors/cache/CacheEvictionEntry.java | 2 +-
.../cache/CacheInvokeDirectResult.java | 2 +-
.../cache/CacheObjectByteArrayImpl.java | 2 +-
.../processors/cache/CacheObjectImpl.java | 2 +-
.../processors/cache/GridCacheEntryInfo.java | 2 +-
.../cache/GridCacheEvictionRequest.java | 2 +-
.../cache/GridCacheEvictionResponse.java | 2 +-
.../processors/cache/GridCacheReturn.java | 2 +-
.../processors/cache/KeyCacheObjectImpl.java | 2 +-
.../distributed/GridCacheTtlUpdateRequest.java | 2 +-
.../distributed/GridCacheTxRecoveryRequest.java | 2 +-
.../GridCacheTxRecoveryResponse.java | 2 +-
.../distributed/GridDistributedLockRequest.java | 2 +-
.../GridDistributedLockResponse.java | 2 +-
.../GridDistributedTxFinishRequest.java | 2 +-
.../GridDistributedTxFinishResponse.java | 2 +-
.../GridDistributedTxPrepareRequest.java | 2 +-
.../GridDistributedTxPrepareResponse.java | 2 +-
.../GridDistributedUnlockRequest.java | 2 +-
.../dht/GridDhtAffinityAssignmentRequest.java | 2 +-
.../dht/GridDhtAffinityAssignmentResponse.java | 2 +-
.../distributed/dht/GridDhtLockRequest.java | 2 +-
.../distributed/dht/GridDhtLockResponse.java | 2 +-
.../distributed/dht/GridDhtTxFinishRequest.java | 2 +-
.../dht/GridDhtTxFinishResponse.java | 2 +-
.../dht/GridDhtTxOnePhaseCommitAckRequest.java | 2 +-
.../dht/GridDhtTxPrepareRequest.java | 2 +-
.../dht/GridDhtTxPrepareResponse.java | 2 +-
.../distributed/dht/GridDhtUnlockRequest.java | 2 +-
.../GridDhtAtomicDeferredUpdateResponse.java | 2 +-
.../dht/atomic/GridDhtAtomicNearResponse.java | 2 +-
.../GridDhtAtomicSingleUpdateRequest.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 2 +-
.../GridNearAtomicCheckUpdateRequest.java | 2 +-
.../atomic/GridNearAtomicFullUpdateRequest.java | 2 +-
...GridNearAtomicSingleUpdateFilterRequest.java | 2 +-
...GridNearAtomicSingleUpdateInvokeRequest.java | 2 +-
.../GridNearAtomicSingleUpdateRequest.java | 2 +-
.../atomic/GridNearAtomicUpdateResponse.java | 2 +-
.../dht/atomic/NearCacheUpdates.java | 2 +-
.../distributed/dht/atomic/UpdateErrors.java | 2 +-
.../dht/preloader/GridDhtForceKeysRequest.java | 2 +-
.../dht/preloader/GridDhtForceKeysResponse.java | 2 +-
.../GridDhtPartitionDemandMessage.java | 2 +-
.../preloader/GridDhtPartitionExchangeId.java | 2 +-
.../GridDhtPartitionSupplyMessage.java | 2 +-
.../GridDhtPartitionSupplyMessageV2.java | 2 +-
.../preloader/GridDhtPartitionsFullMessage.java | 2 +-
.../GridDhtPartitionsSingleMessage.java | 2 +-
.../GridDhtPartitionsSingleRequest.java | 2 +-
.../distributed/near/CacheVersionedValue.java | 2 +-
.../distributed/near/GridNearGetRequest.java | 2 +-
.../distributed/near/GridNearGetResponse.java | 2 +-
.../distributed/near/GridNearLockRequest.java | 2 +-
.../distributed/near/GridNearLockResponse.java | 2 +-
.../near/GridNearSingleGetRequest.java | 2 +-
.../near/GridNearSingleGetResponse.java | 2 +-
.../near/GridNearTxFinishRequest.java | 2 +-
.../near/GridNearTxFinishResponse.java | 2 +-
.../near/GridNearTxPrepareRequest.java | 2 +-
.../near/GridNearTxPrepareResponse.java | 2 +-
.../distributed/near/GridNearUnlockRequest.java | 2 +-
.../cache/query/GridCacheQueryRequest.java | 2 +-
.../cache/query/GridCacheQueryResponse.java | 2 +-
.../cache/query/GridCacheSqlQuery.java | 2 +-
.../CacheContinuousQueryBatchAck.java | 2 +-
.../continuous/CacheContinuousQueryEntry.java | 2 +-
.../cache/transactions/IgniteTxEntry.java | 2 +-
.../cache/transactions/IgniteTxKey.java | 2 +-
.../cache/transactions/TxEntryValueHolder.java | 2 +-
.../processors/cache/transactions/TxLock.java | 2 +-
.../cache/transactions/TxLockList.java | 2 +-
.../cache/transactions/TxLocksRequest.java | 2 +-
.../cache/transactions/TxLocksResponse.java | 2 +-
.../version/GridCacheRawVersionedEntry.java | 2 +-
.../cache/version/GridCacheVersion.java | 2 +-
.../cache/version/GridCacheVersionEx.java | 2 +-
.../clock/GridClockDeltaSnapshotMessage.java | 2 +-
.../processors/clock/GridClockDeltaVersion.java | 2 +-
.../continuous/GridContinuousMessage.java | 2 +-
.../datastreamer/DataStreamerEntry.java | 2 +-
.../datastreamer/DataStreamerRequest.java | 2 +-
.../datastreamer/DataStreamerResponse.java | 2 +-
.../internal/processors/hadoop/HadoopJobId.java | 2 +-
.../shuffle/HadoopDirectShuffleMessage.java | 2 +-
.../hadoop/shuffle/HadoopShuffleAck.java | 2 +-
.../shuffle/HadoopShuffleFinishRequest.java | 2 +-
.../shuffle/HadoopShuffleFinishResponse.java | 2 +-
.../hadoop/shuffle/HadoopShuffleMessage.java | 2 +-
.../processors/igfs/IgfsAckMessage.java | 2 +-
.../internal/processors/igfs/IgfsBlockKey.java | 3 +-
.../processors/igfs/IgfsBlocksMessage.java | 2 +-
.../processors/igfs/IgfsDeleteMessage.java | 2 +-
.../processors/igfs/IgfsFileAffinityRange.java | 2 +-
.../igfs/IgfsFragmentizerRequest.java | 2 +-
.../igfs/IgfsFragmentizerResponse.java | 2 +-
.../processors/igfs/IgfsSyncMessage.java | 2 +-
.../MissingMappingRequestMessage.java | 2 +-
.../MissingMappingResponseMessage.java | 2 +-
.../messages/GridQueryCancelRequest.java | 2 +-
.../twostep/messages/GridQueryFailResponse.java | 2 +-
.../messages/GridQueryNextPageRequest.java | 2 +-
.../messages/GridQueryNextPageResponse.java | 2 +-
.../h2/twostep/messages/GridQueryRequest.java | 2 +-
.../handlers/task/GridTaskResultRequest.java | 2 +-
.../handlers/task/GridTaskResultResponse.java | 2 +-
.../ignite/internal/util/GridByteArrayList.java | 2 +-
.../ignite/internal/util/GridLongList.java | 2 +-
.../internal/util/GridMessageCollection.java | 2 +-
.../internal/util/UUIDCollectionMessage.java | 2 +-
.../internal/util/nio/GridDirectParser.java | 12 +-
.../extensions/communication/Message.java | 5 +-
.../communication/MessageFactory.java | 2 +-
.../extensions/communication/MessageWriter.java | 5 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../jobstealing/JobStealingRequest.java | 2 +-
.../communication/tcp/TcpCommunicationSpi.java | 131 +++++++++++++------
.../internal/GridAffinityNoCacheSelfTest.java | 2 +-
...ByteBufferStreamImplV2ByteOrderSelfTest.java | 2 +-
...GridManagerLocalMessageListenerSelfTest.java | 2 +-
.../GridCommunicationSendMessageSelfTest.java | 83 ++++++++++--
.../communication/GridIoManagerSelfTest.java | 2 +-
.../GridCacheConditionalDeploymentSelfTest.java | 4 +-
.../nio/IgniteExceptionInNioWorkerSelfTest.java | 2 +-
.../communication/GridTestMessage.java | 2 +-
.../communication/GridCacheMessageSelfTest.java | 20 +--
.../spi/communication/GridTestMessage.java | 4 +-
.../ignite/util/GridMessageCollectionTest.java | 5 +-
.../query/h2/twostep/msg/GridH2Array.java | 2 +-
.../query/h2/twostep/msg/GridH2Boolean.java | 2 +-
.../query/h2/twostep/msg/GridH2Byte.java | 2 +-
.../query/h2/twostep/msg/GridH2Bytes.java | 2 +-
.../query/h2/twostep/msg/GridH2CacheObject.java | 2 +-
.../query/h2/twostep/msg/GridH2Date.java | 2 +-
.../query/h2/twostep/msg/GridH2Decimal.java | 2 +-
.../query/h2/twostep/msg/GridH2Double.java | 2 +-
.../query/h2/twostep/msg/GridH2Float.java | 2 +-
.../query/h2/twostep/msg/GridH2Geometry.java | 2 +-
.../h2/twostep/msg/GridH2IndexRangeRequest.java | 2 +-
.../twostep/msg/GridH2IndexRangeResponse.java | 2 +-
.../query/h2/twostep/msg/GridH2Integer.java | 2 +-
.../query/h2/twostep/msg/GridH2JavaObject.java | 2 +-
.../query/h2/twostep/msg/GridH2Long.java | 2 +-
.../query/h2/twostep/msg/GridH2Null.java | 2 +-
.../h2/twostep/msg/GridH2QueryRequest.java | 2 +-
.../query/h2/twostep/msg/GridH2RowMessage.java | 2 +-
.../query/h2/twostep/msg/GridH2RowRange.java | 2 +-
.../h2/twostep/msg/GridH2RowRangeBounds.java | 2 +-
.../query/h2/twostep/msg/GridH2Short.java | 2 +-
.../query/h2/twostep/msg/GridH2String.java | 2 +-
.../query/h2/twostep/msg/GridH2Time.java | 2 +-
.../query/h2/twostep/msg/GridH2Timestamp.java | 2 +-
.../query/h2/twostep/msg/GridH2Uuid.java | 2 +-
.../twostep/msg/GridH2ValueMessageFactory.java | 2 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 2 +-
183 files changed, 379 insertions(+), 258 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
index c9ce023..aaa69ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
@@ -188,7 +188,7 @@ public class GridJobCancelRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
index ed431d8..a7e8309 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
@@ -837,7 +837,7 @@ public class GridJobExecuteRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
index 9724bc0..312435e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
@@ -376,7 +376,7 @@ public class GridJobExecuteResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 2;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
index 6fe6237..8a11cef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
@@ -148,7 +148,7 @@ public class GridJobSiblingsRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 3;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
index 727e79b..3911446 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
@@ -128,7 +128,7 @@ public class GridJobSiblingsResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 4;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
index 41ea281..273d0a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
@@ -111,7 +111,7 @@ public class GridTaskCancelRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 5;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
index 15baac0..dbac893 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
@@ -176,7 +176,7 @@ public class GridTaskSessionRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 6;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index 3318988..47e0392 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -286,7 +286,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 119;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index 6fe1a3b..03e5632 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -635,7 +635,7 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 113;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
index 3f095f7..d3ee6f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
@@ -453,7 +453,7 @@ public class BinaryObjectOffheapImpl extends BinaryObjectExImpl implements Exter
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
index 28993c6..3ce4dfe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
@@ -66,10 +66,10 @@ public class DirectMessageWriter implements MessageWriter {
}
/** {@inheritDoc} */
- @Override public boolean writeHeader(byte type, byte fieldCnt) {
+ @Override public boolean writeHeader(short type, byte fieldCnt) {
DirectByteBufferStream stream = state.item().stream;
- stream.writeByte(type);
+ stream.writeShort(type);
return stream.lastFinished();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
index 2187945..dccf725 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
@@ -506,7 +506,7 @@ public class DirectByteBufferStreamImplV1 implements DirectByteBufferStream {
lastFinished = false;
}
else
- writeByte(Byte.MIN_VALUE);
+ writeShort(Short.MIN_VALUE);
}
/** {@inheritDoc} */
@@ -808,15 +808,15 @@ public class DirectByteBufferStreamImplV1 implements DirectByteBufferStream {
@SuppressWarnings("unchecked")
@Override public <T extends Message> T readMessage(MessageReader reader) {
if (!msgTypeDone) {
- if (!buf.hasRemaining()) {
+ if (buf.remaining() < Message.DIRECT_TYPE_SIZE) {
lastFinished = false;
return null;
}
- byte type = readByte();
+ short type = readShort();
- msg = type == Byte.MIN_VALUE ? null : msgFactory.create(type);
+ msg = type == Short.MIN_VALUE ? null : msgFactory.create(type);
msgTypeDone = true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
index d7dc990..9464186 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
@@ -653,7 +653,7 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
lastFinished = false;
}
else
- writeByte(Byte.MIN_VALUE);
+ writeShort(Short.MIN_VALUE);
}
/** {@inheritDoc} */
@@ -1133,15 +1133,15 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
@SuppressWarnings("unchecked")
@Override public <T extends Message> T readMessage(MessageReader reader) {
if (!msgTypeDone) {
- if (!buf.hasRemaining()) {
+ if (buf.remaining() < Message.DIRECT_TYPE_SIZE) {
lastFinished = false;
return null;
}
- byte type = readByte();
+ short type = readShort();
- msg = type == Byte.MIN_VALUE ? null : msgFactory.create(type);
+ msg = type == Short.MIN_VALUE ? null : msgFactory.create(type);
msgTypeDone = true;
}
@@ -1356,6 +1356,7 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
* @param off Offset.
* @param len Length.
* @param typeSize Primitive type size in bytes. Needs for byte reverse.
+ * @param shiftCnt Shift for length.
* @return Whether array was fully written.
*/
private boolean writeArrayLE(Object arr, long off, int len, int typeSize, int shiftCnt) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
index 95bf05b..ddb4f26 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
@@ -162,7 +162,7 @@ public class GridCheckpointRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 7;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
index b1a26e9..2ad4a0b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
@@ -313,7 +313,7 @@ public class GridIoMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 8;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 07e8941..1d84ead 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -160,7 +160,7 @@ import org.jsr166.ConcurrentHashMap8;
*/
public class GridIoMessageFactory implements MessageFactory {
/** Custom messages registry. Used for test purposes. */
- private static final Map<Byte, IgniteOutClosure<Message>> CUSTOM = new ConcurrentHashMap8<>();
+ private static final Map<Short, IgniteOutClosure<Message>> CUSTOM = new ConcurrentHashMap8<>();
/** Extensions. */
private final MessageFactory[] ext;
@@ -173,7 +173,7 @@ public class GridIoMessageFactory implements MessageFactory {
}
/** {@inheritDoc} */
- @Override public Message create(byte type) {
+ @Override public Message create(short type) {
Message msg = null;
switch (type) {
@@ -895,7 +895,7 @@ public class GridIoMessageFactory implements MessageFactory {
* @param type Message type.
* @param c Message producer.
*/
- public static void registerCustom(byte type, IgniteOutClosure<Message> c) {
+ public static void registerCustom(short type, IgniteOutClosure<Message> c) {
assert c != null;
CUSTOM.put(type, c);
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
index 9d03d3e..332a9de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
@@ -345,7 +345,7 @@ public class GridIoUserMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 9;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteIoTestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteIoTestMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteIoTestMessage.java
index 77aaa09..98278ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteIoTestMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteIoTestMessage.java
@@ -214,7 +214,7 @@ public class IgniteIoTestMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -43;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
index 00ca67c..68f45da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
@@ -253,7 +253,7 @@ public class GridDeploymentInfoBean implements Message, GridDeploymentInfo, Exte
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 10;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
index 72873b7..729cf4c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
@@ -265,7 +265,7 @@ public class GridDeploymentRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 11;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
index 7a81f5a..d1b0384 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
@@ -184,7 +184,7 @@ public class GridDeploymentResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 12;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
index 8b06831..515500b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
@@ -432,7 +432,7 @@ public class GridEventStorageMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 13;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java
index 80f0078..f564e28 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java
@@ -190,7 +190,7 @@ public class AffinityTopologyVersion implements Comparable<AffinityTopologyVersi
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 111;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryInfoCollection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryInfoCollection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryInfoCollection.java
index 93bebec..49f77fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryInfoCollection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryInfoCollection.java
@@ -108,7 +108,7 @@ public class CacheEntryInfoCollection implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 92;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
index 3d56ee3..2822411 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java
@@ -50,7 +50,7 @@ public abstract class CacheEntryPredicateAdapter implements CacheEntryPredicate
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
assert false : this;
return 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
index 3db8ae8..76806a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
@@ -127,7 +127,7 @@ public class CacheEntryPredicateContainsValue extends CacheEntryPredicateAdapter
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 98;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
index 623fc4b..9057e41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
@@ -148,7 +148,7 @@ public class CacheEntrySerializablePredicate implements CacheEntryPredicate {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 99;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
index dae103a..2717b1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictionEntry.java
@@ -83,7 +83,7 @@ public class CacheEvictionEntry implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 97;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
index cc453f9..05b3c86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
@@ -133,7 +133,7 @@ public class CacheInvokeDirectResult implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 93;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
index 0416f09..6e9ab24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
@@ -154,7 +154,7 @@ public class CacheObjectByteArrayImpl implements CacheObject, Externalizable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 105;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
index be04d6b..accde29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
@@ -115,7 +115,7 @@ public class CacheObjectImpl extends CacheObjectAdapter {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 89;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
index f281227..e50fbfe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
@@ -328,7 +328,7 @@ public class GridCacheEntryInfo implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 91;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
index 09652a9..cb454f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
@@ -232,7 +232,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage implements GridCa
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 14;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
index ebaee6a..69ec09f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
@@ -209,7 +209,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 15;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index c5d4066..551d70d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -351,7 +351,7 @@ public class GridCacheReturn implements Externalizable, Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 88;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
index 48797b8..b9efab1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
@@ -118,7 +118,7 @@ public class KeyCacheObjectImpl extends CacheObjectAdapter implements KeyCacheOb
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 90;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
index 8177c98..5d1885e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
@@ -319,7 +319,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 20;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
index 76f39b0..45d1f1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
@@ -254,7 +254,7 @@ public class GridCacheTxRecoveryRequest extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 16;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
index c087a3d..a9ac26b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
@@ -193,7 +193,7 @@ public class GridCacheTxRecoveryResponse extends GridDistributedBaseMessage impl
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 17;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
index 48c01f0..b1c2c27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
@@ -554,7 +554,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 21;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index ceba71d..4b21896 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -285,7 +285,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 22;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index ab9f0ff..ea9336b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@ -547,7 +547,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMessage i
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 23;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
index 2c446c3..561c292 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
@@ -213,7 +213,7 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 24;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index acf6bc8..4b11414f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -675,7 +675,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 25;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 53a1391..7cd3ad8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@ -242,7 +242,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseMessage
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 26;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
index be7ecf8..ca2bdab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
@@ -158,7 +158,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 27;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
index 6959906..94f11ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
@@ -69,7 +69,7 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 28;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
index cad1617..52dd190 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
@@ -189,7 +189,7 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 29;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
index 50167d8..1f81764 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
@@ -521,7 +521,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 30;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
index 63e3309..ea6ca06 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
@@ -285,7 +285,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 31;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index d9b3ae7..90f3687 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@ -464,7 +464,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 32;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
index bc9503f..d777a22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
@@ -237,7 +237,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 33;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxOnePhaseCommitAckRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxOnePhaseCommitAckRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxOnePhaseCommitAckRequest.java
index 0c8ae69..c483408 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxOnePhaseCommitAckRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxOnePhaseCommitAckRequest.java
@@ -123,7 +123,7 @@ public class GridDhtTxOnePhaseCommitAckRequest extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -27;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
index 8898803..c7c4280 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
@@ -538,7 +538,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 34;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index fba68ce..5dcb98c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@ -335,7 +335,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 35;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
index 752df54..5671d7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
@@ -149,7 +149,7 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 36;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
index 9fe183f..92ef149 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
@@ -155,7 +155,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage implem
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 37;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
index 08a7e28..74b7885 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
@@ -165,7 +165,7 @@ public class GridDhtAtomicNearResponse extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -45;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 6b92c02..852beec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -443,7 +443,7 @@ public class GridDhtAtomicSingleUpdateRequest extends GridDhtAtomicAbstractUpdat
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -36;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 6b8af8d..d8e7f24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -774,7 +774,7 @@ public class GridDhtAtomicUpdateRequest extends GridDhtAtomicAbstractUpdateReque
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 38;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index ab7aa6c..693d658 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -255,7 +255,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 39;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicCheckUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicCheckUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicCheckUpdateRequest.java
index 4d0726a..54c9723 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicCheckUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicCheckUpdateRequest.java
@@ -95,7 +95,7 @@ public class GridNearAtomicCheckUpdateRequest extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -47;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index ade9976..9c27135 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -606,7 +606,7 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 40;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
index c32501a..849a1a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -203,7 +203,7 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 127;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
index 298ea05..9733440 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -291,7 +291,7 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 126;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index 14c70aa..cce8305 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -316,7 +316,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 125;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 8b52ba8..eba7b3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -522,7 +522,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 41;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
index a340a62..76b8bc3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
@@ -314,7 +314,7 @@ public class NearCacheUpdates implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -48;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
index 1d415c8..83ac1af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/UpdateErrors.java
@@ -201,7 +201,7 @@ public class UpdateErrors implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -46;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
index 15243d5..d129ae8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
@@ -245,7 +245,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implements GridCac
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 42;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
index 8d90158..c4c57a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
@@ -305,7 +305,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage implements GridCa
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 43;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
index bb952d4..dad1b93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
@@ -322,7 +322,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 44;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java
index 976405e..012634e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java
@@ -233,7 +233,7 @@ public class GridDhtPartitionExchangeId implements Message, Comparable<GridDhtPa
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 87;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
index 7a07f9a..cc30321 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
@@ -393,7 +393,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage implements G
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 45;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessageV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessageV2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessageV2.java
index 4451cbc..2294582 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessageV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessageV2.java
@@ -365,7 +365,7 @@ public class GridDhtPartitionSupplyMessageV2 extends GridCacheMessage implements
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 114;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index 90d6242..8a7adfc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -365,7 +365,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 46;
}
[41/50] [abbrv] ignite git commit: IGNITE-4617: CPP: Added
Field-access methods for BinaryObject
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/src/impl/binary/binary_type_handler.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_handler.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_handler.cpp
index 5e70707..3602608 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_handler.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_type_handler.cpp
@@ -25,54 +25,23 @@ namespace ignite
{
namespace binary
{
- BinaryTypeHandler::BinaryTypeHandler(SPSnap snap) : snap(snap), fieldIds(NULL), fields(NULL)
+ BinaryTypeHandler::BinaryTypeHandler(SPSnap snap) :
+ origin(snap),
+ updated()
{
// No-op.
}
-
- BinaryTypeHandler::~BinaryTypeHandler()
- {
- if (fieldIds)
- delete fieldIds;
-
- if (fields)
- delete fields;
- }
void BinaryTypeHandler::OnFieldWritten(int32_t fieldId, std::string fieldName, int32_t fieldTypeId)
{
- if (!snap.Get() || !snap.Get()->ContainsFieldId(fieldId))
+ if (!origin.Get() || !origin.Get()->ContainsFieldId(fieldId))
{
- if (!HasDifference())
- {
- fieldIds = new std::set<int32_t>();
- fields = new std::map<std::string, int32_t>();
- }
+ if (!updated.Get())
+ updated = SPSnap(new Snap(*origin.Get()));
- fieldIds->insert(fieldId);
- (*fields)[fieldName] = fieldTypeId;
+ updated.Get()->AddField(fieldId, fieldName, fieldTypeId);
}
}
-
- SPSnap BinaryTypeHandler::GetSnapshot()
- {
- return snap;
- }
-
- bool BinaryTypeHandler::HasDifference()
- {
- return fieldIds ? true : false;
- }
-
- std::set<int32_t>* BinaryTypeHandler::GetFieldIds()
- {
- return fieldIds;
- }
-
- std::map<std::string, int32_t>* BinaryTypeHandler::GetFields()
- {
- return fields;
- }
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
index 2a7b617..4a8c14c 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
@@ -18,20 +18,23 @@
#include <ignite/common/concurrent.h>
#include "ignite/impl/binary/binary_type_manager.h"
+#include <algorithm>
using namespace ignite::common::concurrent;
namespace ignite
-{
+{
namespace impl
{
namespace binary
{
- BinaryTypeManager::BinaryTypeManager() :
- snapshots(SharedPointer<std::map<int32_t, SPSnap> >(new std::map<int32_t, SPSnap>)),
- pending(new std::vector<SPSnap>()),
- cs(new CriticalSection()),
- pendingVer(0), ver(0)
+ BinaryTypeManager::BinaryTypeManager() :
+ snapshots(new std::map<int32_t, SPSnap>),
+ pending(new std::vector<SPSnap>),
+ cs(),
+ updater(0),
+ pendingVer(0),
+ ver(0)
{
// No-op.
}
@@ -41,156 +44,134 @@ namespace ignite
pending->erase(pending->begin(), pending->end());
delete pending;
- delete cs;
}
- SharedPointer<BinaryTypeHandler> BinaryTypeManager::GetHandler(int32_t typeId)
+ SharedPointer<BinaryTypeHandler> BinaryTypeManager::GetHandler(const std::string& typeName, int32_t typeId)
{
- SPSnap snapshot = (*snapshots.Get())[typeId];
+ std::map<int32_t, SPSnap>& snapshots0 = *snapshots.Get();
+
+ { // Locking scope.
+ CsLockGuard guard(cs);
+
+ std::map<int32_t, SPSnap>::iterator it = snapshots0.find(typeId);
+ if (it != snapshots0.end())
+ return SharedPointer<BinaryTypeHandler>(new BinaryTypeHandler(it->second));
+ }
+
+ SPSnap snapshot = SPSnap(new Snap(typeName ,typeId));
return SharedPointer<BinaryTypeHandler>(new BinaryTypeHandler(snapshot));
}
- void BinaryTypeManager::SubmitHandler(std::string typeName, int32_t typeId,
- BinaryTypeHandler* hnd)
+ void BinaryTypeManager::SubmitHandler(BinaryTypeHandler& hnd)
{
- Snap* snap = hnd->GetSnapshot().Get();
-
// If this is the very first write of a class or difference exists,
// we need to enqueue it for write.
- if (!snap || hnd->HasDifference())
+ if (hnd.HasUpdate())
{
- std::set<int32_t>* newFieldIds = new std::set<int32_t>();
- std::map<std::string, int32_t>* newFields = new std::map<std::string, int32_t>();
-
- CopyFields(snap, newFieldIds, newFields);
-
- if (hnd->HasDifference())
- {
- std::set<int32_t>* diffFieldIds = hnd->GetFieldIds();
- std::map<std::string, int32_t>* diffFields = hnd->GetFields();
-
- for (std::set<int32_t>::iterator it = diffFieldIds->begin(); it != diffFieldIds->end(); ++it)
- newFieldIds->insert(*it);
+ CsLockGuard guard(cs);
- for (std::map<std::string, int32_t>::iterator it = diffFields->begin(); it != diffFields->end(); ++it)
- (*newFields)[it->first] = it->second;
- }
-
- Snap* diffSnap = new Snap(typeName, typeId, newFieldIds, newFields);
-
- cs->Enter();
-
- pending->push_back(SPSnap(diffSnap));
+ pending->push_back(hnd.GetUpdated());
- pendingVer++;
-
- cs->Leave();
+ ++pendingVer;
}
}
- int32_t BinaryTypeManager::GetVersion()
+ int32_t BinaryTypeManager::GetVersion() const
{
Memory::Fence();
return ver;
}
- bool BinaryTypeManager::IsUpdatedSince(int32_t oldVer)
+ bool BinaryTypeManager::IsUpdatedSince(int32_t oldVer) const
{
Memory::Fence();
return pendingVer > oldVer;
}
- bool BinaryTypeManager::ProcessPendingUpdates(BinaryTypeUpdater* updater, IgniteError* err)
+ bool BinaryTypeManager::ProcessPendingUpdates(IgniteError& err)
{
- bool success = true; // Optimistically assume that all will be fine.
+ if (!updater)
+ return false;
- CsLockGuard guard(*cs);
+ CsLockGuard guard(cs);
for (std::vector<SPSnap>::iterator it = pending->begin(); it != pending->end(); ++it)
{
Snap* pendingSnap = it->Get();
- if (updater->Update(pendingSnap, *err))
+ if (!updater->Update(*pendingSnap, err))
+ return false; // Stop as we cannot move further.
+
+ // Perform copy-on-write update of snapshot collection.
+ SharedPointer< std::map<int32_t, SPSnap> > newSnapshots(new std::map<int32_t, SPSnap>());
+ std::map<int32_t, SPSnap>& newSnapshots0 = *newSnapshots.Get();
+
+ bool snapshotFound = false;
+
+ for (std::map<int32_t, SPSnap>::iterator snapIt = snapshots.Get()->begin();
+ snapIt != snapshots.Get()->end(); ++snapIt)
{
- // Perform copy-on-write update of snapshot collection.
- std::map<int32_t, SPSnap>* newSnapshots = new std::map<int32_t, SPSnap>();
-
- bool snapshotFound = false;
+ int32_t curTypeId = snapIt->first;
+ Snap* curSnap = snapIt->second.Get();
- for (std::map<int32_t, SPSnap>::iterator snapIt = snapshots.Get()->begin();
- snapIt != snapshots.Get()->end(); ++snapIt)
+ if (pendingSnap->GetTypeId() != curTypeId)
{
- int32_t curTypeId = snapIt->first;
- Snap* curSnap = snapIt->second.Get();
-
- if (pendingSnap->GetTypeId() == curTypeId)
- {
- // Have to create snapshot with updated fields.
- std::set<int32_t>* newFieldIds = new std::set<int32_t>();
- std::map<std::string, int32_t>* newFields = new std::map<std::string, int32_t>();
-
- // Add old fields.
- CopyFields(curSnap, newFieldIds, newFields);
-
- // Add new fields.
- CopyFields(pendingSnap, newFieldIds, newFields);
-
- // Create new snapshot.
- Snap* newSnap = new Snap(pendingSnap->GetTypeName(), pendingSnap->GetTypeId(),
- newFieldIds, newFields);
-
- (*newSnapshots)[curTypeId] = SPSnap(newSnap);
-
- snapshotFound = true;
- }
- else
- (*newSnapshots)[curTypeId] = snapIt->second; // Just transfer exising snapshot.
+ // Just transfer exising snapshot.
+ newSnapshots0[curTypeId] = snapIt->second;
+
+ continue;
}
- // Handle situation when completely new snapshot is found.
- if (!snapshotFound)
- (*newSnapshots)[pendingSnap->GetTypeId()] = *it;
+ // Create new snapshot.
+ SPSnap newSnap(new Snap(*pendingSnap));
- snapshots = SharedPointer<std::map<int32_t, SPSnap> >(newSnapshots);
- }
- else
- {
- // Stop as we cannot move further.
- success = false;
+ // Add old fields.
+ newSnap.Get()->CopyFieldsFrom(curSnap);
+
+ newSnapshots0[curTypeId].Swap(newSnap);
- break;
+ snapshotFound = true;
}
- }
- if (success)
- {
- pending->erase(pending->begin(), pending->end());
+ // Handle situation when completely new snapshot is found.
+ if (!snapshotFound)
+ newSnapshots0[pendingSnap->GetTypeId()] = *it;
- ver = pendingVer;
+ snapshots.Swap(newSnapshots);
}
- return success;
+ pending->clear();
+
+ ver = pendingVer;
+
+ return true;
}
- void BinaryTypeManager::CopyFields(Snap* snap, std::set<int32_t>* fieldIds,
- std::map<std::string, int32_t>* fields)
+ SPSnap BinaryTypeManager::GetMeta(int32_t typeId)
{
- if (snap && snap->HasFields())
- {
- std::set<int32_t>* snapFieldIds = snap->GetFieldIds();
- std::map<std::string, int32_t>* snapFields = snap->GetFields();
+ std::map<int32_t, SPSnap>::iterator it = snapshots.Get()->find(typeId);
+
+ if (it != snapshots.Get()->end() && it->second.Get())
+ return it->second;
- for (std::set<int32_t>::iterator oldIt = snapFieldIds->begin();
- oldIt != snapFieldIds->end(); ++oldIt)
- fieldIds->insert(*oldIt);
+ for (int32_t i = 0; i < pending->size(); ++i)
+ {
+ SPSnap& snap = (*pending)[i];
- for (std::map<std::string, int32_t>::iterator newFieldsIt = snapFields->begin();
- newFieldsIt != snapFields->end(); ++newFieldsIt)
- (*fields)[newFieldsIt->first] = newFieldsIt->second;
+ if (snap.Get()->GetTypeId() == typeId)
+ return snap;
}
+
+ IgniteError err;
+
+ SPSnap snap = updater->GetMeta(typeId, err);
+
+ IgniteError::ThrowIfNeeded(err);
+
+ return snap;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp
index f34732f..05962b1 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp
@@ -23,47 +23,37 @@ namespace ignite
{
namespace binary
{
- BinaryTypeSnapshot::BinaryTypeSnapshot(std::string typeName, int32_t typeId,
- std::set<int32_t>* fieldIds, std::map<std::string, int32_t>* fields) :
- typeName(typeName), typeId(typeId), fieldIds(fieldIds), fields(fields)
+ BinaryTypeSnapshot::BinaryTypeSnapshot(std::string typeName, int32_t typeId) :
+ typeName(typeName),
+ typeId(typeId),
+ fieldIds(),
+ fields()
{
// No-op.
}
- BinaryTypeSnapshot::~BinaryTypeSnapshot()
+ BinaryTypeSnapshot::BinaryTypeSnapshot(const BinaryTypeSnapshot& another) :
+ typeName(another.typeName),
+ typeId(another.typeId),
+ fieldIds(another.fieldIds),
+ fields(another.fields)
{
- delete fieldIds;
- delete fields;
- }
-
- bool BinaryTypeSnapshot::ContainsFieldId(int32_t fieldId)
- {
- return fieldIds && fieldIds->count(fieldId) == 1;
- }
-
- std::string BinaryTypeSnapshot::GetTypeName()
- {
- return typeName;
- }
-
- int32_t BinaryTypeSnapshot::GetTypeId()
- {
- return typeId;
- }
-
- bool BinaryTypeSnapshot::HasFields()
- {
- return !fieldIds->empty();
+ // No-op.
}
- std::set<int32_t>* BinaryTypeSnapshot::GetFieldIds()
+ void BinaryTypeSnapshot::AddField(int32_t fieldId, const std::string& fieldName, int32_t fieldTypeId)
{
- return fieldIds;
+ fieldIds.insert(fieldId);
+ fields[fieldName] = BinaryFieldMeta(fieldTypeId, fieldId);
}
- std::map<std::string, int32_t>* BinaryTypeSnapshot::GetFields()
+ void BinaryTypeSnapshot::CopyFieldsFrom(const BinaryTypeSnapshot* another)
{
- return fields;
+ if (another && another->HasFields())
+ {
+ fieldIds.insert(another->fieldIds.begin(), another->fieldIds.end());
+ fields.insert(another->fields.begin(), another->fields.end());
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/src/impl/binary/binary_type_updater.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_updater.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_updater.cpp
deleted file mode 100644
index b3436e9..0000000
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_updater.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ignite/impl/binary/binary_type_updater.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace binary
- {
- BinaryTypeUpdater::~BinaryTypeUpdater()
- {
- // No-op.
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core-test/config/cache-identity.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-identity.xml b/modules/platforms/cpp/core-test/config/cache-identity.xml
index ace9f6a..c4e0b1b 100644
--- a/modules/platforms/cpp/core-test/config/cache-identity.xml
+++ b/modules/platforms/cpp/core-test/config/cache-identity.xml
@@ -99,6 +99,39 @@
</list>
</property>
</bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache3"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="queryEntities">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryEntity">
+ <property name="keyType" value="ComplexType2"/>
+ <property name="valueType" value="java.lang.Integer"/>
+
+ <property name="fields">
+ <map>
+ <entry key="i32Field" value="java.lang.Integer"/>
+ <entry key="objField" value="InnerObject"/>
+ <entry key="strField" value="java.lang.String"/>
+ </map>
+ </property>
+
+ <property name="keyFields">
+ <list>
+ <value>i32Field</value>
+ <value>objField</value>
+ <value>strField</value>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
</list>
</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h b/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h
index 2965797..196c6d3 100644
--- a/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h
+++ b/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h
@@ -122,6 +122,11 @@ namespace ignite_test
{
return 0;
}
+
+ virtual BinaryIdResolver* Clone() const
+ {
+ return new DummyIdResolver();
+ }
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp b/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
index 9a06c3c..55b77bd 100644
--- a/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
@@ -33,6 +33,7 @@
#include "ignite/binary/binary_array_identity_resolver.h"
#include "ignite/test_utils.h"
+#include "ignite/complex_type.h"
using namespace boost::unit_test;
@@ -137,6 +138,8 @@ struct GetHashDefined : TestUserClassBase {};
struct ResolverDefined : TestUserClassBase {};
struct BothDefined : TestUserClassBase {};
+struct ComplexType2 : ComplexType { };
+
struct CustomIdResolver : binary::BinaryIdentityResolver
{
int32_t GetHashCode(const BinaryObject& obj)
@@ -159,6 +162,29 @@ struct CustomIdResolver : binary::BinaryIdentityResolver
}
};
+struct CustomFieldIdResolver : binary::BinaryIdentityResolver
+{
+ static int32_t lastHash;
+
+ int32_t GetHashCode(const BinaryObject& obj)
+ {
+ int32_t hash = 0;
+
+ if (obj.HasField("objField"))
+ {
+ BinaryObject inner = obj.GetField<BinaryObject>("objField");
+
+ hash = inner.GetField<int32_t>("f1");
+ }
+
+ lastHash = hash;
+
+ return hash;
+ }
+};
+
+int32_t CustomFieldIdResolver::lastHash = 0;
+
namespace ignite
{
namespace binary
@@ -312,7 +338,7 @@ namespace ignite
};
/**
- * Binary type definition for CompositeKey.
+ * Binary type definition for CompositeKeySimple.
*/
template<>
struct BinaryType<CompositeKeySimple>
@@ -341,6 +367,42 @@ namespace ignite
return val;
}
};
+
+ /**
+ * Binary type definition for ComplexType2.
+ */
+ template<>
+ struct BinaryType<ComplexType2>
+ {
+ IGNITE_BINARY_GET_TYPE_ID_AS_HASH(ComplexType2)
+ IGNITE_BINARY_GET_TYPE_NAME_AS_IS(ComplexType2)
+ IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+ IGNITE_BINARY_IS_NULL_FALSE(ComplexType2)
+ IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(ComplexType2)
+
+ ignite::Reference<ignite::binary::BinaryIdentityResolver> GetIdentityResolver()
+ {
+ return ignite::MakeReferenceFromCopy(CustomFieldIdResolver());
+ }
+
+ void Write(BinaryWriter& writer, ComplexType2 obj)
+ {
+ writer.WriteInt32("i32Field", obj.i32Field);
+ writer.WriteObject("objField", obj.objField);
+ writer.WriteString("strField", obj.strField);
+ }
+
+ ComplexType2 Read(BinaryReader& reader)
+ {
+ ComplexType2 obj;
+
+ obj.i32Field = reader.ReadInt32("i32Field");
+ obj.objField = reader.ReadObject<InnerObject>("objField");
+ obj.strField = reader.ReadString("strField");
+
+ return obj;
+ }
+ };
}
}
@@ -384,7 +446,7 @@ int32_t CalculateHashCode(const T& value)
FillMem<T>(mem, value);
- BinaryObject obj(mem, 0);
+ BinaryObject obj(mem, 0, 0, 0);
R resolver;
@@ -398,7 +460,7 @@ int32_t RetrieveHashCode(const T& value)
FillMem<T>(mem, value);
- BinaryObjectImpl obj(mem, 0);
+ BinaryObjectImpl obj(mem, 0, 0, 0);
return obj.GetHashCode();
}
@@ -519,4 +581,27 @@ BOOST_AUTO_TEST_CASE(TestBothDefined)
BOOST_CHECK_EQUAL(RetrieveHashCode(val), val.field * 42);
}
+BOOST_AUTO_TEST_CASE(ComplexTypeWithFieldsIdentityResolver)
+{
+ BOOST_CHECKPOINT("Node startup");
+ Ignite node = ignite_test::StartNode("cache-identity.xml");
+
+ ComplexType2 key;
+
+ key.strField = "ComplexType2";
+ key.i32Field = 58943095;
+ key.objField.f1 = 812;
+ key.objField.f2 = "InnerType";
+
+ int32_t value = -12345890;
+
+ BOOST_CHECKPOINT("Cache creation");
+ Cache<ComplexType2, int32_t> cache = node.GetOrCreateCache<ComplexType2, int32_t>("cache3");
+
+ BOOST_CHECKPOINT("Value Put");
+ cache.Put(key, value);
+
+ BOOST_CHECK_EQUAL(key.objField.f1, CustomFieldIdResolver::lastHash);
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core-test/src/binary_object_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_object_test.cpp b/modules/platforms/cpp/core-test/src/binary_object_test.cpp
index 6378266..bc30428 100644
--- a/modules/platforms/cpp/core-test/src/binary_object_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_object_test.cpp
@@ -21,6 +21,7 @@
#include <boost/test/unit_test.hpp>
+#include <ignite/common/utils.h>
#include <ignite/common/fixed_size_array.h>
#include <ignite/binary/binary_object.h>
#include <ignite/binary/binary_writer.h>
@@ -28,6 +29,7 @@
#include "ignite/binary_test_defs.h"
#include "ignite/test_type.h"
#include "ignite/complex_type.h"
+#include "ignite/test_utils.h"
using namespace ignite;
using namespace ignite::binary;
@@ -53,7 +55,7 @@ void CheckSimple(const T& value)
FillMem<T>(mem, value);
- BinaryObject obj(BinaryObjectImpl::FromMemory(mem, 0));
+ BinaryObject obj(BinaryObjectImpl::FromMemory(mem, 0, 0));
T actual = obj.Deserialize<T>();
@@ -67,7 +69,7 @@ void CheckSimpleNP(const T& value)
FillMem<T>(mem, value);
- BinaryObject obj(BinaryObjectImpl::FromMemory(mem, 0));
+ BinaryObject obj(BinaryObjectImpl::FromMemory(mem, 0, 0));
T actual = obj.Deserialize<T>();
@@ -100,7 +102,7 @@ void CheckData(const T& obj)
InteropUnpooledMemory mem(1024);
FillMem<T>(mem, obj);
- BinaryObjectImpl binObj(BinaryObjectImpl::FromMemory(mem, 0));
+ BinaryObjectImpl binObj(BinaryObjectImpl::FromMemory(mem, 0, 0));
BOOST_REQUIRE_EQUAL(binObj.GetLength(), objData.GetSize());
@@ -110,6 +112,50 @@ void CheckData(const T& obj)
BOOST_CHECK_EQUAL(objData[i], binObjData[i]);
}
+template<typename F, typename T>
+void CheckField(const T& obj, const char* field, const F& expected)
+{
+ InteropUnpooledMemory mem(1024);
+ FillMem<T>(mem, obj);
+
+ TemplatedBinaryIdResolver<T> resolver;
+ BinaryObject binObj(mem, 0, &resolver, 0);
+
+ BOOST_REQUIRE(binObj.HasField(field));
+
+ F actual = binObj.GetField<F>(field);
+
+ BOOST_CHECK_EQUAL(actual, expected);
+}
+
+template<typename F, typename T>
+void CheckFieldNP(const T& obj, const char* field, const F& expected)
+{
+ InteropUnpooledMemory mem(1024);
+ FillMem<T>(mem, obj);
+
+ TemplatedBinaryIdResolver<T> resolver;
+ BinaryObject binObj(mem, 0, &resolver, 0);
+
+ BOOST_REQUIRE(binObj.HasField(field));
+
+ F actual = binObj.GetField<F>(field);
+
+ BOOST_CHECK(actual == expected);
+}
+
+template<typename T>
+void CheckNoField(const T& obj, const char* field)
+{
+ InteropUnpooledMemory mem(1024);
+ FillMem<T>(mem, obj);
+
+ TemplatedBinaryIdResolver<T> resolver;
+ BinaryObject binObj(mem, 0, &resolver, 0);
+
+ BOOST_REQUIRE(!binObj.HasField(field));
+}
+
BOOST_AUTO_TEST_SUITE(BinaryObjectTestSuite)
BOOST_AUTO_TEST_CASE(UserTestType)
@@ -173,4 +219,172 @@ BOOST_AUTO_TEST_CASE(UserBinaryFieldsGetData)
CheckData(BinaryFields(423425, 961851, 18946, 180269165));
}
+BOOST_AUTO_TEST_CASE(UserBinaryFieldsGetField)
+{
+ BinaryFields dflt;
+
+ CheckField<int32_t>(dflt, "val1", dflt.val1);
+ CheckField<int32_t>(dflt, "val2", dflt.val2);
+
+ CheckNoField(dflt, "rawVal1");
+ CheckNoField(dflt, "rawVal2");
+ CheckNoField(dflt, "some");
+ CheckNoField(dflt, "unknown");
+ CheckNoField(dflt, "");
+
+ BinaryFields some(423425, 961851, 18946, 180269165);
+
+ CheckField<int32_t>(some, "val1", some.val1);
+ CheckField<int32_t>(some, "val2", some.val2);
+
+ CheckNoField(some, "rawVal1");
+ CheckNoField(some, "rawVal2");
+ CheckNoField(some, "some");
+ CheckNoField(some, "unknown");
+ CheckNoField(some, "");
+}
+
+BOOST_AUTO_TEST_CASE(UserTestTypeGetField)
+{
+ TestType dflt;
+
+ CheckField<int8_t>(dflt, "i8Field", dflt.i8Field);
+ CheckField<int16_t>(dflt, "i16Field", dflt.i16Field);
+ CheckField<int32_t>(dflt, "i32Field", dflt.i32Field);
+ CheckField<int64_t>(dflt, "i64Field", dflt.i64Field);
+ CheckField<std::string>(dflt, "strField", dflt.strField);
+ CheckField<float>(dflt, "floatField", dflt.floatField);
+ CheckField<double>(dflt, "doubleField", dflt.doubleField);
+ CheckField<bool>(dflt, "boolField", dflt.boolField);
+ CheckField<Guid>(dflt, "guidField", dflt.guidField);
+ CheckFieldNP<Date>(dflt, "dateField", dflt.dateField);
+ CheckFieldNP<Time>(dflt, "timeField", dflt.timeField);
+ CheckFieldNP<Timestamp>(dflt, "timestampField", dflt.timestampField);
+
+ CheckNoField(dflt, "some");
+ CheckNoField(dflt, "unknown");
+ CheckNoField(dflt, "");
+
+ TestType some(31, 2314, 54363467, -534180269165, "Lorem ipsum", 45364.46462f, 0.0750732, true,
+ Guid(8934658962, 56784598325), common::MakeDateGmt(1997, 3, 21), common::MakeTimeGmt(23, 50, 11),
+ common::MakeTimestampGmt(2002, 4, 12, 14, 36, 29, 438576348));
+
+ CheckField<int8_t>(some, "i8Field", some.i8Field);
+ CheckField<int16_t>(some, "i16Field", some.i16Field);
+ CheckField<int32_t>(some, "i32Field", some.i32Field);
+ CheckField<int64_t>(some, "i64Field", some.i64Field);
+ CheckField<std::string>(some, "strField", some.strField);
+ CheckField<float>(some, "floatField", some.floatField);
+ CheckField<double>(some, "doubleField", some.doubleField);
+ CheckField<bool>(some, "boolField", some.boolField);
+ CheckField<Guid>(some, "guidField", some.guidField);
+ CheckFieldNP<Date>(some, "dateField", some.dateField);
+ CheckFieldNP<Time>(some, "timeField", some.timeField);
+ CheckFieldNP<Timestamp>(some, "timestampField", some.timestampField);
+
+ CheckNoField(some, "some");
+ CheckNoField(some, "unknown");
+ CheckNoField(some, "");
+}
+
+BOOST_AUTO_TEST_CASE(UserBinaryOuterGetField)
+{
+ BinaryOuter some(1895298, 592856);
+
+ InteropUnpooledMemory mem(1024);
+ FillMem(mem, some);
+
+ TemplatedBinaryIdResolver<BinaryOuter> resolver;
+ BinaryObject binObj(mem, 0, &resolver, 0);
+
+ BOOST_REQUIRE(binObj.HasField("val"));
+ BOOST_REQUIRE(binObj.HasField("inner"));
+
+ int32_t outer = binObj.GetField<int32_t>("val");
+ BinaryObject inner = binObj.GetField<BinaryObject>("inner");
+
+ BOOST_CHECK_EQUAL(outer, some.GetValue());
+}
+
+BOOST_AUTO_TEST_CASE(ExceptionSafety)
+{
+ BinaryFields some(43956293, 567894632, 253945, 107576622);
+
+ InteropUnpooledMemory mem(1024);
+ FillMem(mem, some);
+
+ TemplatedBinaryIdResolver<BinaryOuter> resolver;
+ BinaryObject binObj(mem, 0, &resolver, 0);
+
+ BOOST_CHECK_THROW(binObj.Deserialize<TestType>(), IgniteError);
+
+ BinaryFields restored = binObj.Deserialize<BinaryFields>();
+
+ BOOST_CHECK(restored == some);
+}
+
+BOOST_AUTO_TEST_CASE(RemoteSchemaRetrieval)
+{
+ try
+ {
+ BOOST_CHECKPOINT("Node1 startup");
+ Ignite node1 = ignite_test::StartNode("cache-test.xml", "node1");
+
+ BOOST_CHECKPOINT("Creating cache");
+ cache::Cache<int32_t, BinaryFields> cache = node1.GetOrCreateCache<int32_t, BinaryFields>("cache");
+
+ BinaryFields some(25675472, 67461, 457542, 87073456);
+
+ BOOST_CHECKPOINT("Putting value");
+ cache.Put(42, some);
+
+ BOOST_CHECKPOINT("Node2 startup");
+ Ignite node2 = ignite_test::StartNode("cache-test.xml", "node2");
+
+ impl::IgniteImpl* nodeImpl = impl::IgniteImpl::GetFromProxy(node2);
+ impl::IgniteEnvironment* env = nodeImpl->GetEnvironment();
+
+ InteropUnpooledMemory mem(1024);
+ FillMem<BinaryFields>(mem, some);
+
+ BOOST_CHECKPOINT("Creating BinaryObject");
+ BinaryObject binObj(mem, 0, 0, env->GetTypeManager());
+
+ BOOST_CHECK(binObj.HasField("val1"));
+ BOOST_CHECK(binObj.HasField("val2"));
+
+ int32_t val1 = binObj.GetField<int32_t>("val1");
+ int32_t val2 = binObj.GetField<int32_t>("val2");
+
+ BOOST_CHECK_EQUAL(val1, some.val1);
+ BOOST_CHECK_EQUAL(val2, some.val2);
+
+ BOOST_CHECK(!binObj.HasField("rawVal1"));
+ BOOST_CHECK(!binObj.HasField("rawVal2"));
+ BOOST_CHECK(!binObj.HasField("some"));
+ BOOST_CHECK(!binObj.HasField("unknown"));
+ BOOST_CHECK(!binObj.HasField("some_really_long_and_FancyName32047_20567934065286584067325693462"));
+ }
+ catch (...)
+ {
+ Ignition::StopAll(true);
+ throw;
+ }
+
+ Ignition::StopAll(true);
+}
+
+BOOST_AUTO_TEST_CASE(GetEnumValueInvalid)
+{
+ BinaryFields some(43956293, 567894632, 253945, 107576622);
+
+ InteropUnpooledMemory mem(1024);
+ FillMem(mem, some);
+
+ TemplatedBinaryIdResolver<BinaryOuter> resolver;
+ BinaryObjectImpl binObj(mem, 0, &resolver, 0);
+
+ BOOST_CHECK_THROW(binObj.GetEnumValue(), IgniteError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp b/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
index 1b548a6..db304e2 100644
--- a/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
@@ -33,6 +33,8 @@
#include "ignite/ignite_binding_context.h"
#include "ignite/cache/cache_entry_processor.h"
+#include "ignite/test_utils.h"
+
using namespace boost::unit_test;
using namespace ignite;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core-test/src/cluster_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cluster_test.cpp b/modules/platforms/cpp/core-test/src/cluster_test.cpp
index 8dfd39d..7b206d2 100644
--- a/modules/platforms/cpp/core-test/src/cluster_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cluster_test.cpp
@@ -32,7 +32,10 @@ using namespace boost::unit_test;
/*
* Test setup fixture.
*/
-struct ClusterTestSuiteFixture {
+struct ClusterTestSuiteFixture
+{
+ Ignite grid;
+
/*
* Constructor.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core/include/ignite/impl/binary/binary_type_updater_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_type_updater_impl.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_type_updater_impl.h
index 02ecd06..11d0aba 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_type_updater_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_type_updater_impl.h
@@ -18,8 +18,6 @@
#ifndef _IGNITE_IMPL_BINARY_BINARY_TYPE_UPDATER_IMPL
#define _IGNITE_IMPL_BINARY_BINARY_TYPE_UPDATER_IMPL
-#include <ignite/jni/exports.h>
-
#include "ignite/impl/ignite_environment.h"
#include "ignite/impl/binary/binary_type_updater.h"
@@ -48,7 +46,9 @@ namespace ignite
*/
~BinaryTypeUpdaterImpl();
- bool Update(Snap* snapshot, IgniteError& err);
+ virtual bool Update(const Snap& snap, IgniteError& err);
+
+ virtual SPSnap GetMeta(int32_t typeId, IgniteError& err);
private:
/** Environment. */
IgniteEnvironment& env;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
index 776678d..24fc989 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
@@ -170,6 +170,17 @@ namespace ignite
}
/**
+ * Get environment.
+ * Internal method. Should not be used by user.
+ *
+ * @return Environment pointer.
+ */
+ IgniteEnvironment* GetEnvironment()
+ {
+ return env.Get();
+ }
+
+ /**
* Get transactions.
*
* @return TransactionsImpl instance.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
index 5ce8cfa..0d32561 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
@@ -65,7 +65,7 @@ namespace ignite
* Internal out operation.
*
* @param opType Operation type.
- * @param inOp Input.
+ * @param outOp Input.
* @param err Error.
* @return Result.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
index 42d6fd0..73c96fd 100644
--- a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
@@ -15,10 +15,13 @@
* limitations under the License.
*/
+#include <iterator>
+
#include "ignite/impl/binary/binary_type_updater_impl.h"
#include "ignite/impl/interop/interop_output_stream.h"
#include "ignite/impl/binary/binary_writer_impl.h"
-#include "ignite/binary/binary_raw_writer.h"
+#include "ignite/binary/binary_writer.h"
+#include "ignite/binary/binary_reader.h"
using namespace ignite::common::concurrent;
using namespace ignite::jni::java;
@@ -33,8 +36,14 @@ namespace ignite
{
namespace binary
{
- /** Operation: metadata update. */
- const int32_t OP_PUT_META = 3;
+ enum Operation
+ {
+ /** Operation: metadata get. */
+ OP_GET_META = 1,
+
+ /** Operation: metadata update. */
+ OP_PUT_META = 3
+ };
BinaryTypeUpdaterImpl::BinaryTypeUpdaterImpl(IgniteEnvironment& env, jobject javaRef) :
env(env),
@@ -48,33 +57,35 @@ namespace ignite
JniContext::Release(javaRef);
}
- bool BinaryTypeUpdaterImpl::Update(Snap* snap, IgniteError& err)
+ bool BinaryTypeUpdaterImpl::Update(const Snap& snap, IgniteError& err)
{
JniErrorInfo jniErr;
SharedPointer<InteropMemory> mem = env.AllocateMemory();
InteropOutputStream out(mem.Get());
- BinaryWriterImpl writer(&out, NULL);
+ BinaryWriterImpl writer(&out, 0);
BinaryRawWriter rawWriter(&writer);
// We always pass only one meta at a time in current implementation for simplicity.
rawWriter.WriteInt32(1);
- rawWriter.WriteInt32(snap->GetTypeId());
- rawWriter.WriteString(snap->GetTypeName());
- rawWriter.WriteString(NULL); // Affinity key is not supported for now.
+ rawWriter.WriteInt32(snap.GetTypeId());
+ rawWriter.WriteString(snap.GetTypeName());
+ rawWriter.WriteString(0); // Affinity key is not supported for now.
- if (snap->HasFields())
+ if (snap.HasFields())
{
- std::map<std::string, int32_t>* fields = snap->GetFields();
+ const Snap::FieldMap& fields = snap.GetFieldMap();
- rawWriter.WriteInt32(static_cast<int32_t>(fields->size()));
+ rawWriter.WriteInt32(static_cast<int32_t>(fields.size()));
- for (std::map<std::string, int32_t>::iterator it = fields->begin(); it != fields->end(); ++it)
+ for (Snap::FieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it)
{
+ const BinaryFieldMeta& fieldMeta = it->second;
+
rawWriter.WriteString(it->first);
- rawWriter.WriteInt32(it->second);
+ fieldMeta.Write(rawWriter);
}
}
else
@@ -90,10 +101,66 @@ namespace ignite
IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- return res == 1;
- else
- return false;
+ return jniErr.code == IGNITE_JNI_ERR_SUCCESS && res == 1;
+ }
+
+ SPSnap BinaryTypeUpdaterImpl::GetMeta(int32_t typeId, IgniteError& err)
+ {
+ JniErrorInfo jniErr;
+
+ SharedPointer<InteropMemory> outMem = env.AllocateMemory();
+ SharedPointer<InteropMemory> inMem = env.AllocateMemory();
+
+ InteropOutputStream out(outMem.Get());
+ BinaryWriterImpl writer(&out, 0);
+
+ writer.WriteInt32(typeId);
+
+ out.Synchronize();
+
+ env.Context()->TargetInStreamOutStream(javaRef, OP_GET_META,
+ outMem.Get()->PointerLong(), inMem.Get()->PointerLong(), &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ return SPSnap();
+
+ InteropInputStream in(inMem.Get());
+ BinaryReaderImpl reader(&in);
+ BinaryRawReader rawReader(&reader);
+
+ bool found = rawReader.ReadBool();
+
+ if (!found)
+ return SPSnap();
+
+ int32_t readTypeId = rawReader.ReadInt32();
+
+ assert(typeId == readTypeId);
+
+ std::string typeName = rawReader.ReadString();
+
+ SPSnap res(new Snap(typeName, readTypeId));
+
+ // Skipping affinity key field name.
+ rawReader.ReadString();
+
+ int32_t fieldsNum = rawReader.ReadInt32();
+
+ for (int32_t i = 0; i < fieldsNum; ++i)
+ {
+ std::string fieldName = rawReader.ReadString();
+ BinaryFieldMeta fieldMeta;
+ fieldMeta.Read(rawReader);
+
+ res.Get()->AddField(fieldMeta.GetFieldId(), fieldName, fieldMeta.GetTypeId());
+ }
+
+ // Skipping isEnum info.
+ rawReader.ReadBool();
+
+ return res;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
index 1a1c80f..b37fa8f 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
@@ -198,6 +198,8 @@ namespace ignite
jobject binaryProc = Context()->ProcessorBinaryProcessor(proc.Get());
metaUpdater = new BinaryTypeUpdaterImpl(*this, binaryProc);
+ metaMgr->SetUpdater(metaUpdater);
+
common::dynamic::Module currentModule = common::dynamic::GetCurrent();
moduleMgr.Get()->RegisterModule(currentModule);
}
@@ -335,7 +337,7 @@ namespace ignite
if (local)
throw IgniteError(IgniteError::IGNITE_ERR_UNSUPPORTED_OPERATION, "Local invokation is not supported.");
- BinaryObjectImpl binProcHolder = BinaryObjectImpl::FromMemory(*mem.Get(), inStream.Position());
+ BinaryObjectImpl binProcHolder = BinaryObjectImpl::FromMemory(*mem.Get(), inStream.Position(), 0);
BinaryObjectImpl binProc = binProcHolder.GetField(0);
int64_t procId = binProc.GetTypeId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
index 1c7bb82..3904dfa 100644
--- a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
+++ b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
@@ -57,7 +57,7 @@ namespace ignite
if (metaMgr->IsUpdatedSince(metaVer))
{
- if (!metaMgr->ProcessPendingUpdates(env.Get()->GetTypeUpdater(), &err))
+ if (!metaMgr->ProcessPendingUpdates(err))
return 0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index f3757b4..333b9bc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -188,6 +188,7 @@
<Compile Include="Common\Package-Info.cs" />
<Compile Include="Impl\Binary\DateTimeSerializer.cs" />
<Compile Include="Impl\Binary\IO\IBinaryStreamProcessor.cs" />
+ <Compile Include="Impl\Binary\Metadata\BinaryField.cs" />
<Compile Include="Impl\Binary\SerializableSerializer.cs" />
<Compile Include="Impl\Binary\BinaryWriterExtensions.cs" />
<Compile Include="Cache\Affinity\AffinityFunctionBase.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index 6e8df0b..e77cbae 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -537,7 +537,7 @@ namespace Apache.Ignite.Core.Impl.Binary
// 3. Handle metadata.
if (metaHnd != null)
{
- IDictionary<string, int> meta = metaHnd.OnObjectWriteFinished();
+ IDictionary<string, BinaryField> meta = metaHnd.OnObjectWriteFinished();
if (meta != null)
_parent._ctx.Writer.SaveMetadata(desc, meta);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
index 6935fa2..f5bc370 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
@@ -120,7 +120,8 @@ namespace Apache.Ignite.Core.Impl.Binary
foreach (var field in fields)
{
w.WriteString(field.Key);
- w.WriteInt(field.Value);
+ w.WriteInt(field.Value.TypeId);
+ w.WriteInt(field.Value.FieldId);
}
w.WriteBoolean(meta.IsEnum);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index 5ec649a..0490ec8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -1468,7 +1468,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="desc">The descriptor.</param>
/// <param name="fields">Fields metadata.</param>
- internal void SaveMetadata(IBinaryTypeDescriptor desc, IDictionary<string, int> fields)
+ internal void SaveMetadata(IBinaryTypeDescriptor desc, IDictionary<string, BinaryField> fields)
{
Debug.Assert(desc != null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 9ec4216..b929f3a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -346,13 +346,13 @@ namespace Apache.Ignite.Core.Impl.Binary
{
foreach (var meta in newMetas)
{
- var mergeInfo = new Dictionary<int, Tuple<string, int>>(meta.GetFieldsMap().Count);
+ var mergeInfo = new Dictionary<int, Tuple<string, BinaryField>>(meta.GetFieldsMap().Count);
- foreach (KeyValuePair<string, int> fieldMeta in meta.GetFieldsMap())
+ foreach (var fieldMeta in meta.GetFieldsMap())
{
int fieldId = BinaryUtils.FieldId(meta.TypeId, fieldMeta.Key, null, null);
- mergeInfo[fieldId] = new Tuple<string, int>(fieldMeta.Key, fieldMeta.Value);
+ mergeInfo[fieldId] = new Tuple<string, BinaryField>(fieldMeta.Key, fieldMeta.Value);
}
_metas[meta.TypeId].Merge(mergeInfo);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryField.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryField.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryField.cs
new file mode 100644
index 0000000..483b3eb
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryField.cs
@@ -0,0 +1,72 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary.Metadata
+{
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Binary field metadata.
+ /// </summary>
+ internal struct BinaryField
+ {
+ /** Type ID. */
+ private readonly int _typeId;
+
+ /** Field ID. */
+ private readonly int _fieldId;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinaryField" /> class.
+ /// </summary>
+ /// <param name="typeId">Type ID.</param>
+ /// <param name="fieldId">Field ID.</param>
+ public BinaryField(int typeId, int fieldId)
+ {
+ _typeId = typeId;
+ _fieldId = fieldId;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinaryField" /> class.
+ /// </summary>
+ /// <param name="reader">Reader.</param>
+ public BinaryField(IBinaryRawReader reader)
+ {
+ _typeId = reader.ReadInt();
+ _fieldId = reader.ReadInt();
+ }
+
+ /// <summary>
+ /// Type ID.
+ /// </summary>
+ /// <returns>Type ID</returns>
+ public int TypeId
+ {
+ get { return _typeId; }
+ }
+
+ /// <summary>
+ /// Field ID.
+ /// </summary>
+ /// <returns>Field ID</returns>
+ public int FieldId
+ {
+ get { return _fieldId; }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index cb0d3cd..837c28a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Binary metadata implementation.
@@ -32,7 +33,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null, false);
/** Empty dictionary. */
- private static readonly IDictionary<string, int> EmptyDict = new Dictionary<string, int>();
+ private static readonly IDictionary<string, BinaryField> EmptyDict = new Dictionary<string, BinaryField>();
/** Empty list. */
private static readonly ICollection<string> EmptyList = new List<string>().AsReadOnly();
@@ -41,7 +42,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
private static readonly string[] TypeNames = new string[byte.MaxValue];
/** Fields. */
- private readonly IDictionary<string, int> _fields;
+ private readonly IDictionary<string, BinaryField> _fields;
/** Enum flag. */
private readonly bool _isEnum;
@@ -121,7 +122,19 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
_typeId = reader.ReadInt();
_typeName = reader.ReadString();
_affinityKeyFieldName = reader.ReadString();
- _fields = reader.ReadDictionaryAsGeneric<string, int>();
+
+ int fieldsNum = reader.ReadInt();
+
+ _fields = new Dictionary<string, BinaryField>(fieldsNum);
+
+ for (int i = 0; i < fieldsNum; ++i)
+ {
+ string name = reader.ReadString();
+ BinaryField field = new BinaryField(reader);
+
+ _fields[name] = field;
+ }
+
_isEnum = reader.ReadBoolean();
}
@@ -130,7 +143,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// </summary>
/// <param name="desc">Descriptor.</param>
/// <param name="fields">Fields.</param>
- public BinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null)
+ public BinaryType(IBinaryTypeDescriptor desc, IDictionary<string, BinaryField> fields = null)
: this (desc.TypeId, desc.TypeName, fields, desc.AffinityKeyFieldName, desc.IsEnum)
{
_descriptor = desc;
@@ -144,7 +157,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <param name="fields">Fields.</param>
/// <param name="affKeyFieldName">Affinity key field name.</param>
/// <param name="isEnum">Enum flag.</param>
- public BinaryType(int typeId, string typeName, IDictionary<string, int> fields,
+ public BinaryType(int typeId, string typeName, IDictionary<string, BinaryField> fields,
string affKeyFieldName, bool isEnum)
{
_typeId = typeId;
@@ -188,13 +201,18 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// </returns>
public string GetFieldTypeName(string fieldName)
{
+ IgniteArgumentCheck.NotNullOrEmpty(fieldName, "fieldName");
+
if (_fields != null)
{
- int typeId;
+ BinaryField fieldMeta;
- _fields.TryGetValue(fieldName, out typeId);
+ if (!_fields.TryGetValue(fieldName, out fieldMeta))
+ {
+ throw new BinaryObjectException("BinaryObject field does not exist: " + fieldName);
+ }
- return GetTypeName(typeId);
+ return GetTypeName(fieldMeta.TypeId);
}
return null;
@@ -226,7 +244,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// Gets fields map.
/// </summary>
/// <returns>Fields map.</returns>
- public IDictionary<string, int> GetFieldsMap()
+ public IDictionary<string, BinaryField> GetFieldsMap()
{
return _fields ?? EmptyDict;
}
@@ -234,7 +252,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <summary>
/// Updates the fields.
/// </summary>
- public void UpdateFields(IDictionary<string, int> fields)
+ public void UpdateFields(IDictionary<string, BinaryField> fields)
{
if (fields == null || fields.Count == 0)
return;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHashsetHandler.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHashsetHandler.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHashsetHandler.cs
index af5902f..a8d26d3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHashsetHandler.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHashsetHandler.cs
@@ -25,13 +25,13 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
internal class BinaryTypeHashsetHandler : IBinaryTypeHandler
{
/** Empty fields collection. */
- private static readonly IDictionary<string, int> EmptyFields = new Dictionary<string, int>();
+ private static readonly IDictionary<string, BinaryField> EmptyFields = new Dictionary<string, BinaryField>();
/** IDs known when serialization starts. */
private readonly ICollection<int> _ids;
/** New fields. */
- private IDictionary<string, int> _fieldMap;
+ private IDictionary<string, BinaryField> _fieldMap;
/** */
private readonly bool _newType;
@@ -53,15 +53,15 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
if (!_ids.Contains(fieldId))
{
if (_fieldMap == null)
- _fieldMap = new Dictionary<string, int>();
+ _fieldMap = new Dictionary<string, BinaryField>();
if (!_fieldMap.ContainsKey(fieldName))
- _fieldMap[fieldName] = typeId;
+ _fieldMap[fieldName] = new BinaryField(typeId, fieldId);
}
}
/** <inheritdoc /> */
- public IDictionary<string, int> OnObjectWriteFinished()
+ public IDictionary<string, BinaryField> OnObjectWriteFinished()
{
return _fieldMap ?? (_newType ? EmptyFields : null);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
index 1f290d8..cdbc687 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
@@ -101,7 +101,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// Merge newly sent field metadatas into existing ones.
/// </summary>
/// <param name="newMap">New field metadatas map.</param>
- public void Merge(IDictionary<int, Tuple<string, int>> newMap)
+ public void Merge(IDictionary<int, Tuple<string, BinaryField>> newMap)
{
_saved = true;
@@ -116,11 +116,12 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
var newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
- IDictionary<string, int> newFields = meta0 != null ?
- new Dictionary<string, int>(meta0.GetFieldsMap()) : new Dictionary<string, int>(newMap.Count);
+ IDictionary<string, BinaryField> newFields = meta0 != null
+ ? new Dictionary<string, BinaryField>(meta0.GetFieldsMap())
+ : new Dictionary<string, BinaryField>(newMap.Count);
// 2. Add new fields.
- foreach (KeyValuePair<int, Tuple<string, int>> newEntry in newMap)
+ foreach (var newEntry in newMap)
{
if (!newIds.Contains(newEntry.Key))
newIds.Add(newEntry.Key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
index a02764e..a98ab58 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
@@ -36,6 +36,6 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// Callback invoked when object write is finished and it is time to collect missing metadata.
/// </summary>
/// <returns>Collected metadata.</returns>
- IDictionary<string, int> OnObjectWriteFinished();
+ IDictionary<string, BinaryField> OnObjectWriteFinished();
}
}
[26/50] [abbrv] ignite git commit: IGNITE-4827: Remove compatibility
logic for 1.x versions. This closes #1654.
Posted by ag...@apache.org.
IGNITE-4827: Remove compatibility logic for 1.x versions. This closes #1654.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/488b25e1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/488b25e1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/488b25e1
Branch: refs/heads/ignite-4003
Commit: 488b25e191d66eb970cba9339c41bc0d88479878
Parents: 12e240a
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Mar 27 15:18:01 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 15:18:01 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/MarshallerContextImpl.java | 5 +-
.../ignite/internal/binary/BinaryContext.java | 12 +-
.../communication/GridIoMessageFactory.java | 5 +-
.../discovery/GridDiscoveryManager.java | 38 +-
.../cache/CacheAffinitySharedManager.java | 4 -
.../processors/cache/GridCacheAdapter.java | 184 ++-----
.../GridCachePartitionExchangeManager.java | 62 +--
.../binary/CacheObjectBinaryProcessorImpl.java | 39 --
.../dht/GridClientPartitionTopology.java | 34 +-
.../dht/GridDhtAffinityAssignmentResponse.java | 101 +---
.../dht/GridDhtPartitionTopology.java | 6 +-
.../dht/GridDhtPartitionTopologyImpl.java | 34 +-
.../dht/GridPartitionedGetFuture.java | 8 +-
.../dht/GridPartitionedSingleGetFuture.java | 53 +-
.../dht/preloader/GridDhtPartitionDemander.java | 505 ++-----------------
.../dht/preloader/GridDhtPartitionFullMap.java | 45 +-
.../dht/preloader/GridDhtPartitionMap.java | 210 +++++++-
.../dht/preloader/GridDhtPartitionMap2.java | 329 ------------
.../GridDhtPartitionsAbstractMessage.java | 4 -
.../GridDhtPartitionsExchangeFuture.java | 2 +-
.../preloader/GridDhtPartitionsFullMessage.java | 6 +-
.../GridDhtPartitionsSingleMessage.java | 10 +-
.../dht/preloader/GridDhtPreloader.java | 18 +-
.../CacheContinuousQueryBatchAck.java | 4 -
.../continuous/CacheContinuousQueryHandler.java | 2 +-
.../continuous/CacheContinuousQueryManager.java | 87 +---
.../store/GridCacheStoreManagerAdapter.java | 25 -
.../closure/GridClosureProcessor.java | 398 +--------------
.../continuous/GridContinuousProcessor.java | 3 -
.../h2/twostep/messages/GridQueryRequest.java | 368 --------------
.../service/GridServiceProcessor.java | 132 +----
.../ignite/internal/visor/cache/VisorCache.java | 84 ++-
.../cache/VisorCacheAggregatedMetrics.java | 2 +-
.../visor/cache/VisorCacheConfiguration.java | 20 +-
.../internal/visor/cache/VisorCacheMetrics.java | 26 +
.../cache/VisorCacheMetricsCollectorTask.java | 18 +-
.../visor/cache/VisorCacheMetricsV2.java | 66 ---
.../cache/VisorCacheQueryConfiguration.java | 11 +
.../cache/VisorCacheQueryConfigurationV2.java | 47 --
.../cache/VisorCacheStoreConfiguration.java | 12 +
.../cache/VisorCacheStoreConfigurationV2.java | 48 --
.../internal/visor/cache/VisorCacheV2.java | 73 ---
.../internal/visor/cache/VisorCacheV3.java | 52 --
.../internal/visor/cache/VisorCacheV4.java | 124 -----
.../visor/event/VisorGridDiscoveryEvent.java | 18 +-
.../visor/event/VisorGridDiscoveryEventV2.java | 80 ---
.../visor/node/VisorNodeDataCollectorJob.java | 52 +-
.../internal/visor/query/VisorQueryArg.java | 39 +-
.../internal/visor/query/VisorQueryArgV2.java | 49 --
.../internal/visor/query/VisorQueryArgV3.java | 51 --
.../internal/visor/query/VisorQueryJob.java | 8 +-
.../internal/visor/util/VisorEventMapper.java | 4 +-
.../internal/visor/util/VisorTaskUtils.java | 15 -
.../communication/tcp/TcpCommunicationSpi.java | 17 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 104 +---
.../spi/discovery/tcp/TcpDiscoverySpi.java | 9 -
.../messages/TcpDiscoveryClientAckResponse.java | 4 -
.../resources/META-INF/classnames.properties | 106 ++--
...CacheExchangeMessageDuplicatedStateTest.java | 12 +-
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 12 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 4 +-
.../GridCacheRebalancingSyncSelfTest.java | 7 +-
.../TcpDiscoverySpiFailureTimeoutSelfTest.java | 60 ---
.../junits/common/GridCommonAbstractTest.java | 4 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 39 --
.../h2/twostep/GridReduceQueryExecutor.java | 62 +--
.../commands/cache/VisorCacheCommand.scala | 19 +-
.../commands/cache/VisorCacheScanCommand.scala | 2 +-
.../commands/disco/VisorDiscoveryCommand.scala | 2 +-
.../cache/WaitMapExchangeFinishCallable.java | 4 +-
.../IgniteFailoverAbstractBenchmark.java | 4 +-
71 files changed, 741 insertions(+), 3362 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index 5416ff0..ce79b4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -34,12 +34,11 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
import org.apache.ignite.internal.processors.marshaller.MappedName;
import org.apache.ignite.internal.processors.marshaller.MappingExchangeResult;
@@ -121,7 +120,7 @@ public class MarshallerContextImpl implements MarshallerContext {
processResource(jdkClsNames);
checkHasClassName(GridDhtPartitionFullMap.class.getName(), ldr, CLS_NAMES_FILE);
- checkHasClassName(GridDhtPartitionMap2.class.getName(), ldr, CLS_NAMES_FILE);
+ checkHasClassName(GridDhtPartitionMap.class.getName(), ldr, CLS_NAMES_FILE);
checkHasClassName(HashMap.class.getName(), ldr, JDK_CLS_NAMES_FILE);
if (plugins != null && !plugins.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index febfb04..5f9e4ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -189,12 +189,12 @@ public class BinaryContext {
sysClss.add(IgfsClientUpdateCallable.class.getName());
// Closure processor classes.
- sysClss.add(GridClosureProcessor.C1V2.class.getName());
- sysClss.add(GridClosureProcessor.C1MLAV2.class.getName());
- sysClss.add(GridClosureProcessor.C2V2.class.getName());
- sysClss.add(GridClosureProcessor.C2MLAV2.class.getName());
- sysClss.add(GridClosureProcessor.C4V2.class.getName());
- sysClss.add(GridClosureProcessor.C4MLAV2.class.getName());
+ sysClss.add(GridClosureProcessor.C1.class.getName());
+ sysClss.add(GridClosureProcessor.C1MLA.class.getName());
+ sysClss.add(GridClosureProcessor.C2.class.getName());
+ sysClss.add(GridClosureProcessor.C2MLA.class.getName());
+ sysClss.add(GridClosureProcessor.C4.class.getName());
+ sysClss.add(GridClosureProcessor.C4MLA.class.getName());
sysClss.add(IgniteUuid.class.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 1d84ead..7bf3de2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -141,7 +141,6 @@ import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQuery
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse;
-import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest;
import org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest;
import org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultResponse;
import org.apache.ignite.internal.util.GridByteArrayList;
@@ -793,8 +792,8 @@ public class GridIoMessageFactory implements MessageFactory {
break;
case 110:
- msg = new GridQueryRequest();
-
+ // EMPTY type
+ // GridQueryRequest was removed
break;
case 111:
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index b2c4ced..b261a56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.managers.GridManagerAdapter;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.jobmetrics.GridJobMetrics;
@@ -1111,12 +1110,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
", locNodeId=" + locNode.id() + ", rmtNodeId=" + n.id() + ']');
}
- boolean rmtLateAssign;
-
- if (n.version().compareToIgnoreTimestamp(CacheAffinitySharedManager.LATE_AFF_ASSIGN_SINCE) >= 0)
- rmtLateAssign = n.attribute(ATTR_LATE_AFFINITY_ASSIGNMENT);
- else
- rmtLateAssign = false;
+ boolean rmtLateAssign = n.attribute(ATTR_LATE_AFFINITY_ASSIGNMENT);
if (locDelayAssign != rmtLateAssign) {
throw new IgniteCheckedException("Remote node has cache affinity assignment mode different from local " +
@@ -1127,26 +1121,16 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
", rmtAddrs=" + U.addressesAsString(n) + ']');
}
- if (n.version().compareToIgnoreTimestamp(GridServiceProcessor.LAZY_SERVICES_CFG_SINCE) >= 0) {
- Boolean rmtSrvcCompatibilityEnabled = n.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
-
- if (!F.eq(locSrvcCompatibilityEnabled, rmtSrvcCompatibilityEnabled)) {
- throw new IgniteCheckedException("Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
- " property value differs from remote node's value " +
- "(to make sure all nodes in topology have identical IgniteServices compatibility mode enabled, " +
- "configure system property explicitly) " +
- "[locSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
- ", rmtSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
- ", locNodeAddrs=" + U.addressesAsString(locNode) +
- ", rmtNodeAddrs=" + U.addressesAsString(n) +
- ", locNodeId=" + locNode.id() + ", rmtNodeId=" + n.id() + ']');
- }
- }
- else if (Boolean.FALSE.equals(locSrvcCompatibilityEnabled)) {
- throw new IgniteCheckedException("Remote node doesn't support lazy services configuration and " +
- "local node cannot join node because local node's "
- + IGNITE_SERVICES_COMPATIBILITY_MODE + " property value explicitly set to 'false'" +
- "[locNodeAddrs=" + U.addressesAsString(locNode) +
+ Boolean rmtSrvcCompatibilityEnabled = n.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
+
+ if (!F.eq(locSrvcCompatibilityEnabled, rmtSrvcCompatibilityEnabled)) {
+ throw new IgniteCheckedException("Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
+ " property value differs from remote node's value " +
+ "(to make sure all nodes in topology have identical IgniteServices compatibility mode enabled, " +
+ "configure system property explicitly) " +
+ "[locSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
+ ", rmtSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
+ ", locNodeAddrs=" + U.addressesAsString(locNode) +
", rmtNodeAddrs=" + U.addressesAsString(n) +
", locNodeId=" + locNode.id() + ", rmtNodeId=" + n.id() + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index d287188..35d68e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -53,7 +53,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -69,9 +68,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdapter<K, V> {
- /** */
- public static final IgniteProductVersion LATE_AFF_ASSIGN_SINCE = IgniteProductVersion.fromString("1.6.0");
-
/** Late affinity assignment flag. */
private boolean lateAffAssign;
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 3bfd1f8..63c46c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -100,7 +100,6 @@ import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFi
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
-import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -129,7 +128,6 @@ import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.mxbean.CacheMetricsMXBean;
import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -165,12 +163,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** Maximum number of retries when topology changes. */
public static final int MAX_RETRIES = IgniteSystemProperties.getInteger(IGNITE_CACHE_RETRIES_COUNT, 100);
- /** */
- public static final IgniteProductVersion LOAD_CACHE_JOB_SINCE = IgniteProductVersion.fromString("1.5.7");
-
- /** */
- public static final IgniteProductVersion LOAD_CACHE_JOB_V2_SINCE = IgniteProductVersion.fromString("1.5.19");
-
/** Deserialization stash. */
private static final ThreadLocal<IgniteBiTuple<String, String>> stash = new ThreadLocal<IgniteBiTuple<String,
String>>() {
@@ -3485,7 +3477,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
*
* @param keys Keys.
* @param plc Expiry policy.
- * @param keepBinary Keep binary flag. Will be ignored for releases older than {@link #LOAD_CACHE_JOB_V2_SINCE}.
+ * @param keepBinary Keep binary flag.
* @return Operation future.
*/
private IgniteInternalFuture<?> runLoadKeysCallable(final Set<? extends K> keys, final ExpiryPolicy plc,
@@ -3495,27 +3487,11 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (nodes.isEmpty())
return new GridFinishedFuture<>();
- Collection<ClusterNode> oldNodes = ctx.grid().cluster().forDataNodes(name()).forPredicate(
- new IgnitePredicate<ClusterNode>() {
- @Override public boolean apply(ClusterNode node) {
- return node.version().compareToIgnoreTimestamp(LOAD_CACHE_JOB_V2_SINCE) < 0;
- }
- }).nodes();
-
- if (oldNodes.isEmpty()) {
return ctx.closures().callAsyncNoFailover(BROADCAST,
- new LoadKeysCallableV2<>(ctx.name(), keys, update, plc, keepBinary),
+ new LoadKeysCallable<>(ctx.name(), keys, update, plc, keepBinary),
nodes,
true,
0);
- }
- else {
- return ctx.closures().callAsyncNoFailover(BROADCAST,
- new LoadKeysCallable<>(ctx.name(), keys, update, plc),
- nodes,
- true,
- 0);
- }
}
/**
@@ -3617,27 +3593,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
*/
IgniteInternalFuture<?> globalLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args)
throws IgniteCheckedException {
- ClusterGroup oldNodes = ctx.kernalContext().grid().cluster().forDataNodes(ctx.name())
- .forPredicate(new IgnitePredicate<ClusterNode>() {
- @Override public boolean apply(ClusterNode node) {
- return node.version().compareToIgnoreTimestamp(LOAD_CACHE_JOB_SINCE) < 0;
- }
- });
-
- ClusterGroup newNodes = ctx.kernalContext().grid().cluster().forDataNodes(ctx.name())
- .forPredicate(new IgnitePredicate<ClusterNode>() {
- @Override public boolean apply(ClusterNode node) {
- return node.version().compareToIgnoreTimestamp(LOAD_CACHE_JOB_SINCE) >= 0 &&
- node.version().compareToIgnoreTimestamp(LOAD_CACHE_JOB_V2_SINCE) < 0;
- }
- });
-
- ClusterGroup newNodesV2 = ctx.kernalContext().grid().cluster().forDataNodes(ctx.name())
- .forPredicate(new IgnitePredicate<ClusterNode>() {
- @Override public boolean apply(ClusterNode node) {
- return node.version().compareToIgnoreTimestamp(LOAD_CACHE_JOB_V2_SINCE) >= 0;
- }
- });
ctx.kernalContext().task().setThreadContext(TC_NO_FAILOVER, true);
@@ -3645,37 +3600,17 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ExpiryPolicy plc = opCtx != null ? opCtx.expiry() : null;
- GridCompoundFuture<Object, ?> fut = new GridCompoundFuture<>();
-
- if (!F.isEmpty(oldNodes.nodes())) {
- ComputeTaskInternalFuture oldNodesFut = ctx.kernalContext().closure().callAsync(BROADCAST,
- Collections.singletonList(new LoadCacheClosure<>(ctx.name(), p, args, plc)),
- oldNodes.nodes());
+ Collection<ClusterNode> nodes = ctx.kernalContext().grid().cluster().forDataNodes(ctx.name()).nodes();
- fut.add(oldNodesFut);
- }
-
- if (!F.isEmpty(newNodes.nodes())) {
- ComputeTaskInternalFuture newNodesFut = ctx.kernalContext().closure().callAsync(BROADCAST,
- Collections.singletonList(
- new LoadCacheJob<>(ctx.name(), ctx.affinity().affinityTopologyVersion(), p, args, plc)),
- newNodes.nodes());
+ assert !F.isEmpty(nodes) : "There are not datanodes fo cache: " + ctx.name();
- fut.add(newNodesFut);
- }
-
- if (!F.isEmpty(newNodesV2.nodes())) {
- final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
-
- ComputeTaskInternalFuture newNodesV2Fut = ctx.kernalContext().closure().callAsync(BROADCAST,
- Collections.singletonList(
- new LoadCacheJobV2<>(ctx.name(), ctx.affinity().affinityTopologyVersion(), p, args, plc, keepBinary)),
- newNodesV2.nodes());
+ final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
- fut.add(newNodesV2Fut);
- }
+ ComputeTaskInternalFuture fut = ctx.kernalContext().closure().callAsync(BROADCAST,
+ Collections.singletonList(
+ new LoadCacheJobV2<>(ctx.name(), ctx.affinity().affinityTopologyVersion(), p, args, plc, keepBinary)),
+ nodes);
- fut.markInitialized();
return fut;
}
@@ -3786,8 +3721,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
Collection<ClusterNode> nodes = grp.forPredicate(new IgnitePredicate<ClusterNode>() {
/** {@inheritDoc} */
@Override public boolean apply(ClusterNode clusterNode) {
- return clusterNode.version().compareTo(PartitionSizeLongTask.SINCE_VER) >= 0 &&
- ((modes.primary && aff.primaryByPartition(clusterNode, part, topVer)) ||
+ return ((modes.primary && aff.primaryByPartition(clusterNode, part, topVer)) ||
(modes.backup && aff.backupByPartition(clusterNode, part, topVer)));
}
}).nodes();
@@ -3934,6 +3868,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
+ * @param opCtx Cache operation context.
* @return JCache Iterator.
*/
private Iterator<Cache.Entry<K, V>> localIteratorHonorExpirePolicy(final CacheOperationContext opCtx) {
@@ -3978,7 +3913,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
- * @param keepBinary
+ * @param keepBinary Keep binary flag.
* @return Distributed ignite cache iterator.
* @throws IgniteCheckedException If failed.
*/
@@ -4339,6 +4274,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* @param tx Transaction.
* @param op Cache operation.
+ * @param opCtx Cache operation context.
* @param <T> Return type.
* @return Future.
*/
@@ -5887,6 +5823,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private ExpiryPolicy plc;
+ /** */
+ private boolean keepBinary;
+
/**
* Required by {@link Externalizable}.
*/
@@ -5900,30 +5839,19 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
* @param update If {@code true} calls {@link #localLoadAndUpdate(Collection)}
* otherwise {@link #localLoad(Collection, ExpiryPolicy, boolean)}.
* @param plc Expiry policy.
+ * @param keepBinary Keep binary flag.
*/
- LoadKeysCallable(String cacheName,
- Collection<? extends K> keys,
- boolean update,
- ExpiryPolicy plc) {
+ LoadKeysCallable(final String cacheName, final Collection<? extends K> keys, final boolean update,
+ final ExpiryPolicy plc, final boolean keepBinary) {
this.cacheName = cacheName;
this.keys = keys;
this.update = update;
this.plc = plc;
+ this.keepBinary = keepBinary;
}
/** {@inheritDoc} */
@Override public Void call() throws Exception {
- return call0(false);
- }
-
- /**
- * Internal call routine.
- *
- * @param keepBinary Keep binary flag.
- * @return Result (always {@code null}).
- * @throws Exception If failed.
- */
- protected Void call0(boolean keepBinary) throws Exception {
GridCacheAdapter<K, V> cache = ((IgniteKernal)ignite).context().cache().internalCache(cacheName);
assert cache != null : cacheName;
@@ -5944,7 +5872,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
+ @Override public void writeExternal(final ObjectOutput out) throws IOException {
U.writeString(out, cacheName);
U.writeCollection(out, keys);
@@ -5952,10 +5880,12 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
out.writeBoolean(update);
out.writeObject(plc != null ? new IgniteExternalizableExpiryPolicy(plc) : null);
+
+ out.writeBoolean(keepBinary);
}
/** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
cacheName = U.readString(in);
keys = U.readCollection(in);
@@ -5963,56 +5893,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
update = in.readBoolean();
plc = (ExpiryPolicy)in.readObject();
- }
- }
-
- /**
- *
- */
- static class LoadKeysCallableV2<K, V> extends LoadKeysCallable<K, V> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private boolean keepBinary;
-
- /**
- * Required by {@link Externalizable}.
- */
- public LoadKeysCallableV2() {
- // No-op.
- }
-
- /**
- * @param cacheName Cache name.
- * @param keys Keys.
- * @param update If {@code true} calls {@link #localLoadAndUpdate(Collection)}
- * otherwise {@link #localLoad(Collection, ExpiryPolicy, boolean)}.
- * @param plc Expiry policy.
- * @param keepBinary Keep binary flag.
- */
- LoadKeysCallableV2(final String cacheName, final Collection<? extends K> keys, final boolean update,
- final ExpiryPolicy plc, final boolean keepBinary) {
- super(cacheName, keys, update, plc);
-
- this.keepBinary = keepBinary;
- }
-
- /** {@inheritDoc} */
- @Override public Void call() throws Exception {
- return call0(keepBinary);
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(final ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeBoolean(keepBinary);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
keepBinary = in.readBoolean();
}
@@ -6531,9 +6411,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** */
- private static final IgniteProductVersion SINCE_VER = IgniteProductVersion.fromString("1.5.30");
-
/** Partition */
private final int partition;
@@ -6616,9 +6493,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** */
- public static final IgniteProductVersion NEAR_JOB_SINCE = IgniteProductVersion.fromString("1.5.0");
-
/** Cache name. */
private final String cacheName;
@@ -6652,7 +6526,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
for (ClusterNode node : subgrid) {
ComputeJob job;
- if (near && node.version().compareTo(NEAR_JOB_SINCE) >= 0) {
+ if (near) {
job = keys == null ? new GlobalClearAllNearJob(cacheName, topVer) :
new GlobalClearKeySetNearJob<>(cacheName, topVer, keys);
}
@@ -6795,6 +6669,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Constructor.
* @param internalIterator Internal iterator.
+ * @param keepBinary Keep binary.
*/
private EntryIterator(Iterator<GridCacheMapEntry> internalIterator, boolean keepBinary) {
this.internalIterator = internalIterator;
@@ -6819,7 +6694,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
throw new IllegalStateException();
try {
- GridCacheAdapter.this.getAndRemove((K)current.wrapLazyValue(keepBinary).getKey());
+ getAndRemove((K)current.wrapLazyValue(keepBinary).getKey());
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -6840,7 +6715,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** Keep binary flag. */
private final boolean keepBinary;
- /** Constructor. */
+ /** Constructor.
+ * @param internalSet Internal set.
+ * @param keepBinary Keep binary flag.
+ */
private EntrySet(Set<GridCacheMapEntry> internalSet, boolean keepBinary) {
this.internalSet = internalSet;
this.keepBinary = keepBinary;
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 3668910..231dff8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -67,7 +67,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -853,21 +852,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
lastVer,
exchId != null ? exchId.topologyVersion() : AffinityTopologyVersion.NONE);
- boolean useOldApi = false;
-
- if (nodes != null) {
- for (ClusterNode node : nodes) {
- if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0) {
- useOldApi = true;
- compress = false;
-
- break;
- }
- else if (!canUsePartitionMapCompression(node))
- compress = false;
- }
- }
-
m.compress(compress);
Map<Object, T2<Integer, GridDhtPartitionFullMap>> dupData = new HashMap<>();
@@ -890,13 +874,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (affCache != null) {
GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
- if (useOldApi) {
- locMap = new GridDhtPartitionFullMap(locMap.nodeId(),
- locMap.nodeOrder(),
- locMap.updateSequence(),
- locMap);
- }
-
addFullPartitionsMap(m,
dupData,
compress,
@@ -955,7 +932,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
map.nodeOrder(),
map.updateSequence());
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : map.entrySet())
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : map.entrySet())
map0.put(e.getKey(), e.getValue().emptyCopy());
map = map0;
@@ -1007,25 +984,20 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
boolean clientOnlyExchange,
boolean sndCounters)
{
- boolean compress = canUsePartitionMapCompression(targetNode);
-
GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(exchangeId,
clientOnlyExchange,
cctx.versions().last(),
- compress);
+ true);
Map<Object, T2<Integer,Map<Integer, GridDhtPartitionState>>> dupData = new HashMap<>();
for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
if (!cacheCtx.isLocal()) {
- GridDhtPartitionMap2 locMap = cacheCtx.topology().localPartitionMap();
-
- if (targetNode.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
- locMap = new GridDhtPartitionMap(locMap.nodeId(), locMap.updateSequence(), locMap.map());
+ GridDhtPartitionMap locMap = cacheCtx.topology().localPartitionMap();
addPartitionMap(m,
dupData,
- compress,
+ true,
cacheCtx.cacheId(),
locMap,
cacheCtx.affinity().affinityCache().similarAffinityKey());
@@ -1039,11 +1011,11 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (m.partitions() != null && m.partitions().containsKey(top.cacheId()))
continue;
- GridDhtPartitionMap2 locMap = top.localPartitionMap();
+ GridDhtPartitionMap locMap = top.localPartitionMap();
addPartitionMap(m,
dupData,
- compress,
+ true,
top.cacheId(),
locMap,
top.similarAffinityKey());
@@ -1067,7 +1039,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
Map<Object, T2<Integer, Map<Integer, GridDhtPartitionState>>> dupData,
boolean compress,
Integer cacheId,
- GridDhtPartitionMap2 map,
+ GridDhtPartitionMap map,
Object affKey) {
Integer dupDataCache = null;
@@ -1292,7 +1264,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
boolean updated = false;
- for (Map.Entry<Integer, GridDhtPartitionMap2> entry : msg.partitions().entrySet()) {
+ for (Map.Entry<Integer, GridDhtPartitionMap> entry : msg.partitions().entrySet()) {
Integer cacheId = entry.getKey();
GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
@@ -1575,24 +1547,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
- * @param node Target node.
- * @return {@code True} if can use compression for partition map messages.
- */
- @SuppressWarnings("SimplifiableIfStatement")
- private boolean canUsePartitionMapCompression(ClusterNode node) {
- IgniteProductVersion ver = node.version();
-
- if (ver.compareToIgnoreTimestamp(GridDhtPartitionsAbstractMessage.PART_MAP_COMPRESS_SINCE) >= 0) {
- if (ver.minor() == 7 && ver.maintenance() < 4)
- return false;
-
- return true;
- }
-
- return false;
- }
-
- /**
* Exchange future thread. All exchanges happen only by one thread and next
* exchange will not start until previous one completes.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index c11f71f..656e70a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -39,7 +39,6 @@ import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryBasicNameMapper;
import org.apache.ignite.binary.BinaryField;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
@@ -99,7 +98,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.jetbrains.annotations.Nullable;
@@ -115,9 +113,6 @@ import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED;
public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorImpl implements
CacheObjectBinaryProcessor {
/** */
- public static final IgniteProductVersion BINARY_CFG_CHECK_SINCE = IgniteProductVersion.fromString("1.5.7");
-
- /** */
private final CountDownLatch startLatch = new CountDownLatch(1);
/** */
@@ -351,37 +346,6 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
startLatch.countDown();
}
- /** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
- super.onKernalStart();
-
- if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK) && marsh instanceof BinaryMarshaller) {
- BinaryConfiguration bcfg = ctx.config().getBinaryConfiguration();
-
- for (ClusterNode rmtNode : ctx.discovery().remoteNodes()) {
- if (rmtNode.version().compareTo(BINARY_CFG_CHECK_SINCE) < 0) {
- if (bcfg == null || bcfg.getNameMapper() == null) {
- throw new IgniteCheckedException("When BinaryMarshaller is used and topology contains old " +
- "nodes, then " + BinaryBasicNameMapper.class.getName() + " mapper have to be set " +
- "explicitely into binary configuration and 'simpleName' property of the mapper " +
- "have to be set to 'true'.");
- }
-
- if (!(bcfg.getNameMapper() instanceof BinaryBasicNameMapper)
- || !((BinaryBasicNameMapper)bcfg.getNameMapper()).isSimpleName()) {
- U.quietAndWarn(log, "When BinaryMarshaller is used and topology contains old" +
- " nodes, it's strongly recommended, to set " + BinaryBasicNameMapper.class.getName() +
- " mapper into binary configuration explicitely " +
- " and 'simpleName' property of the mapper set to 'true' (fix configuration or set " +
- "-D" + IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true system property).");
- }
-
- break;
- }
- }
- }
- }
-
/**
* @param key Metadata key.
* @param newMeta Metadata.
@@ -926,9 +890,6 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
Object rmtBinaryCfg = rmtNode.attribute(IgniteNodeAttributes.ATTR_BINARY_CONFIGURATION);
- if (rmtNode.version().compareTo(BINARY_CFG_CHECK_SINCE) < 0)
- return null;
-
ClusterNode locNode = ctx.discovery().localNode();
Object locBinaryCfg = locNode.attribute(IgniteNodeAttributes.ATTR_BINARY_CONFIGURATION);
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 6ca15de..13a2f59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -37,7 +37,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.GridAtomicLong;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -158,7 +158,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
* @return Full map string representation.
*/
@SuppressWarnings( {"ConstantConditions"})
- private String mapString(GridDhtPartitionMap2 map) {
+ private String mapString(GridDhtPartitionMap map) {
return map == null ? "null" : FULL_MAP_DEBUG ? map.toFullString() : map.toString();
}
@@ -377,11 +377,11 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public GridDhtPartitionMap2 localPartitionMap() {
+ @Override public GridDhtPartitionMap localPartitionMap() {
lock.readLock().lock();
try {
- return new GridDhtPartitionMap2(cctx.localNodeId(), updateSeq.get(), topVer,
+ return new GridDhtPartitionMap(cctx.localNodeId(), updateSeq.get(), topVer,
Collections.<Integer, GridDhtPartitionState>emptyMap(), true);
}
finally {
@@ -394,7 +394,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
lock.readLock().lock();
try {
- GridDhtPartitionMap2 partMap = node2part.get(nodeId);
+ GridDhtPartitionMap partMap = node2part.get(nodeId);
if (partMap != null) {
GridDhtPartitionState state = partMap.get(part);
@@ -587,8 +587,8 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
lastExchangeId = exchId;
if (node2part != null) {
- for (GridDhtPartitionMap2 part : node2part.values()) {
- GridDhtPartitionMap2 newPart = partMap.get(part.nodeId());
+ for (GridDhtPartitionMap part : node2part.values()) {
+ GridDhtPartitionMap newPart = partMap.get(part.nodeId());
// If for some nodes current partition has a newer map,
// then we keep the newer value.
@@ -618,7 +618,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
Map<Integer, Set<UUID>> p2n = new HashMap<>();
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : partMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> ids = p2n.get(p);
@@ -650,7 +650,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@Nullable @Override public boolean update(@Nullable GridDhtPartitionExchangeId exchId,
- GridDhtPartitionMap2 parts,
+ GridDhtPartitionMap parts,
Map<Integer, Long> cntrMap,
boolean checkEvictions) {
if (log.isDebugEnabled())
@@ -686,7 +686,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
node2part = new GridDhtPartitionFullMap();
}
- GridDhtPartitionMap2 cur = node2part.get(parts.nodeId());
+ GridDhtPartitionMap cur = node2part.get(parts.nodeId());
if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
if (log.isDebugEnabled())
@@ -797,10 +797,10 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
}
- GridDhtPartitionMap2 map = node2part.get(nodeId);
+ GridDhtPartitionMap map = node2part.get(nodeId);
if (map == null)
- node2part.put(nodeId, map = new GridDhtPartitionMap2(nodeId, updateSeq, topVer,
+ node2part.put(nodeId, map = new GridDhtPartitionMap(nodeId, updateSeq, topVer,
Collections.<Integer, GridDhtPartitionState>emptyMap(), false));
map.updateSequence(updateSeq, topVer);
@@ -838,7 +838,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
part2node = new HashMap<>(part2node);
- GridDhtPartitionMap2 parts = node2part.remove(nodeId);
+ GridDhtPartitionMap parts = node2part.remove(nodeId);
if (parts != null) {
for (Integer p : parts.keySet()) {
@@ -926,7 +926,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
", locNodeId=" + cctx.localNodeId() +
", igniteInstanceName=" + cctx.igniteInstanceName() + ']';
- for (GridDhtPartitionMap2 map : node2part.values()) {
+ for (GridDhtPartitionMap map : node2part.values()) {
if (map.hasMovingPartitions())
return true;
}
@@ -956,7 +956,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
if (nodeId == null)
return false;
- GridDhtPartitionMap2 parts = node2part.get(nodeId);
+ GridDhtPartitionMap parts = node2part.get(nodeId);
// Set can be null if node has been removed.
if (parts != null) {
@@ -984,7 +984,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
if (node2part == null)
return;
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : node2part.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> nodeIds = part2node.get(p);
@@ -996,7 +996,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
for (Map.Entry<Integer, Set<UUID>> e : part2node.entrySet()) {
for (UUID nodeId : e.getValue()) {
- GridDhtPartitionMap2 map = node2part.get(nodeId);
+ GridDhtPartitionMap map = node2part.get(nodeId);
assert map != null : "Failed consistency check [part=" + e.getKey() + ", nodeId=" + nodeId + ']';
assert map.containsKey(e.getKey()) : "Failed consistency check [part=" + e.getKey() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
index 52dd190..e8094e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
@@ -47,14 +47,6 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
/** Topology version. */
private AffinityTopologyVersion topVer;
- /** Affinity assignment. */
- @GridDirectTransient
- @GridToStringInclude
- private List<List<ClusterNode>> affAssignment;
-
- /** Affinity assignment bytes. */
- private byte[] affAssignmentBytes;
-
/** */
@GridDirectTransient
private List<List<UUID>> affAssignmentIds;
@@ -80,19 +72,14 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
* @param cacheId Cache ID.
* @param topVer Topology version.
* @param affAssignment Affinity assignment.
- * @param sndNodeIds If {@code true} sends only node IDs instead of nodes.
*/
public GridDhtAffinityAssignmentResponse(int cacheId,
@NotNull AffinityTopologyVersion topVer,
- List<List<ClusterNode>> affAssignment,
- boolean sndNodeIds) {
+ List<List<ClusterNode>> affAssignment) {
this.cacheId = cacheId;
this.topVer = topVer;
- if (!sndNodeIds)
- this.affAssignment = affAssignment;
- else
- affAssignmentIds = ids(affAssignment);
+ affAssignmentIds = ids(affAssignment);
}
/** {@inheritDoc} */
@@ -112,16 +99,14 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
* @return Affinity assignment.
*/
public List<List<ClusterNode>> affinityAssignment(GridDiscoveryManager disco) {
- if (affAssignment != null)
- return affAssignment;
-
if (affAssignmentIds != null)
- affAssignment = nodes(disco, affAssignmentIds);
+ return nodes(disco, affAssignmentIds);
- return affAssignment;
+ return null;
}
/**
+ * @param disco Discovery manager.
* @return Ideal affinity assignment.
*/
public List<List<ClusterNode>> idealAffinityAssignment(GridDiscoveryManager disco) {
@@ -167,6 +152,7 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
/**
* @param assignments Assignment.
+ * @return Assignment where cluster nodes are converted to their ids.
*/
private List<List<UUID>> ids(List<List<ClusterNode>> assignments) {
if (assignments != null) {
@@ -195,7 +181,7 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 7;
+ return 6;
}
/**
@@ -204,13 +190,9 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
- assert affAssignment != null ^ affAssignmentIds != null;
-
- if (affAssignment != null && affAssignmentBytes == null)
- affAssignmentBytes = U.marshal(ctx, affAssignment);
+ assert affAssignmentIds != null;
- if (affAssignmentIds != null && affAssignmentIdsBytes == null)
- affAssignmentIdsBytes = U.marshal(ctx, affAssignmentIds);
+ affAssignmentIdsBytes = U.marshal(ctx, affAssignmentIds);
if (idealAffAssignment != null && idealAffAssignmentBytes == null)
idealAffAssignmentBytes = U.marshal(ctx, idealAffAssignment);
@@ -220,55 +202,16 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- assert affAssignmentBytes != null ^ affAssignmentIdsBytes != null;
+ assert affAssignmentIdsBytes != null;
ldr = U.resolveClassLoader(ldr, ctx.gridConfig());
- if (affAssignmentBytes != null && affAssignment == null)
- affAssignment = unmarshalNodes(affAssignmentBytes, ctx, ldr);
-
- if (affAssignmentIdsBytes != null && affAssignmentIds == null)
- affAssignmentIds = U.unmarshal(ctx, affAssignmentIdsBytes, ldr);
+ affAssignmentIds = U.unmarshal(ctx, affAssignmentIdsBytes, ldr);
if (idealAffAssignmentBytes != null && idealAffAssignment == null)
idealAffAssignment = U.unmarshal(ctx, idealAffAssignmentBytes, ldr);
}
- /**
- * @param bytes Assignment bytes.
- * @param ctx Context.
- * @param ldr Class loader.
- * @return Assignment.
- * @throws IgniteCheckedException If failed.
- */
- @SuppressWarnings("ForLoopReplaceableByForEach")
- private List<List<ClusterNode>> unmarshalNodes(byte[] bytes,
- GridCacheSharedContext ctx,
- ClassLoader ldr)
- throws IgniteCheckedException
- {
- List<List<ClusterNode>> affAssignment = U.unmarshal(ctx, bytes,
- U.resolveClassLoader(ldr, ctx.gridConfig()));
-
- // TODO IGNITE-2110: setting 'local' for nodes not needed when IGNITE-2110 is implemented.
- int assignments = affAssignment.size();
-
- for (int n = 0; n < assignments; n++) {
- List<ClusterNode> nodes = affAssignment.get(n);
-
- int size = nodes.size();
-
- for (int i = 0; i < size; i++) {
- ClusterNode node = nodes.get(i);
-
- if (node instanceof TcpDiscoveryNode)
- ((TcpDiscoveryNode)node).local(node.id().equals(ctx.localNodeId()));
- }
- }
-
- return affAssignment;
- }
-
/** {@inheritDoc} */
@Override public boolean addDeploymentInfo() {
return false;
@@ -290,24 +233,18 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
switch (writer.state()) {
case 3:
- if (!writer.writeByteArray("affAssignmentBytes", affAssignmentBytes))
- return false;
-
- writer.incrementState();
-
- case 4:
if (!writer.writeByteArray("affAssignmentIdsBytes", affAssignmentIdsBytes))
return false;
writer.incrementState();
- case 5:
+ case 4:
if (!writer.writeByteArray("idealAffAssignmentBytes", idealAffAssignmentBytes))
return false;
writer.incrementState();
- case 6:
+ case 5:
if (!writer.writeMessage("topVer", topVer))
return false;
@@ -330,14 +267,6 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
switch (reader.state()) {
case 3:
- affAssignmentBytes = reader.readByteArray("affAssignmentBytes");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 4:
affAssignmentIdsBytes = reader.readByteArray("affAssignmentIdsBytes");
if (!reader.isLastRead())
@@ -345,7 +274,7 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
reader.incrementState();
- case 5:
+ case 4:
idealAffAssignmentBytes = reader.readByteArray("idealAffAssignmentBytes");
if (!reader.isLastRead())
@@ -353,7 +282,7 @@ public class GridDhtAffinityAssignmentResponse extends GridCacheMessage {
reader.incrementState();
- case 6:
+ case 5:
topVer = reader.readMessage("topVer");
if (!reader.isLastRead())
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index 605150a..aec3d7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.jetbrains.annotations.Nullable;
@@ -148,7 +148,7 @@ public interface GridDhtPartitionTopology {
/**
* @return Local IDs.
*/
- public GridDhtPartitionMap2 localPartitionMap();
+ public GridDhtPartitionMap localPartitionMap();
/**
* @param nodeId Node ID.
@@ -230,7 +230,7 @@ public interface GridDhtPartitionTopology {
* @return {@code True} if topology state changed.
*/
@Nullable public boolean update(@Nullable GridDhtPartitionExchangeId exchId,
- GridDhtPartitionMap2 parts,
+ GridDhtPartitionMap parts,
@Nullable Map<Integer, Long> cntrMap,
boolean checkEvictions);
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index c476886..7a98366 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -43,7 +43,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.GridAtomicLong;
import org.apache.ignite.internal.util.StripedCompositeReadWriteLock;
@@ -176,7 +176,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
* @return Full map string representation.
*/
@SuppressWarnings({"ConstantConditions"})
- private String mapString(GridDhtPartitionMap2 map) {
+ private String mapString(GridDhtPartitionMap map) {
return map == null ? "null" : FULL_MAP_DEBUG ? map.toFullString() : map.toString();
}
@@ -781,7 +781,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public GridDhtPartitionMap2 localPartitionMap() {
+ @Override public GridDhtPartitionMap localPartitionMap() {
Map<Integer, GridDhtPartitionState> map = new HashMap<>();
lock.readLock().lock();
@@ -796,7 +796,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
map.put(i, part.state());
}
- return new GridDhtPartitionMap2(cctx.nodeId(),
+ return new GridDhtPartitionMap(cctx.nodeId(),
updateSeq.get(),
topVer,
Collections.unmodifiableMap(map),
@@ -812,7 +812,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
lock.readLock().lock();
try {
- GridDhtPartitionMap2 partMap = node2part.get(nodeId);
+ GridDhtPartitionMap partMap = node2part.get(nodeId);
if (partMap != null) {
GridDhtPartitionState state = partMap.get(part);
@@ -1059,8 +1059,8 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
lastExchangeId = exchId;
if (node2part != null) {
- for (GridDhtPartitionMap2 part : node2part.values()) {
- GridDhtPartitionMap2 newPart = partMap.get(part.nodeId());
+ for (GridDhtPartitionMap part : node2part.values()) {
+ GridDhtPartitionMap newPart = partMap.get(part.nodeId());
// If for some nodes current partition has a newer map,
// then we keep the newer value.
@@ -1095,7 +1095,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
Map<Integer, Set<UUID>> p2n = U.newHashMap(cctx.affinity().partitions());
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : partMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> ids = p2n.get(p);
@@ -1136,7 +1136,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@Override public boolean update(@Nullable GridDhtPartitionExchangeId exchId,
- GridDhtPartitionMap2 parts,
+ GridDhtPartitionMap parts,
@Nullable Map<Integer, Long> cntrMap,
boolean checkEvictions) {
if (log.isDebugEnabled())
@@ -1187,7 +1187,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
// Create invalid partition map.
node2part = new GridDhtPartitionFullMap();
- GridDhtPartitionMap2 cur = node2part.get(parts.nodeId());
+ GridDhtPartitionMap cur = node2part.get(parts.nodeId());
if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
if (log.isDebugEnabled())
@@ -1400,10 +1400,10 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
UUID locNodeId = cctx.localNodeId();
- GridDhtPartitionMap2 map = node2part.get(locNodeId);
+ GridDhtPartitionMap map = node2part.get(locNodeId);
if (map == null) {
- map = new GridDhtPartitionMap2(locNodeId,
+ map = new GridDhtPartitionMap(locNodeId,
updateSeq,
topVer,
Collections.<Integer, GridDhtPartitionState>emptyMap(),
@@ -1448,7 +1448,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
else
node2part = new GridDhtPartitionFullMap(node2part, node2part.updateSequence());
- GridDhtPartitionMap2 parts = node2part.remove(nodeId);
+ GridDhtPartitionMap parts = node2part.remove(nodeId);
if (parts != null) {
for (Integer p : parts.keySet()) {
@@ -1574,7 +1574,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
", locNodeId=" + cctx.localNode().id() +
", locName=" + cctx.igniteInstanceName() + ']';
- for (GridDhtPartitionMap2 map : node2part.values()) {
+ for (GridDhtPartitionMap map : node2part.values()) {
if (map.hasMovingPartitions())
return true;
}
@@ -1660,7 +1660,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
if (nodeId == null)
return false;
- GridDhtPartitionMap2 parts = node2part.get(nodeId);
+ GridDhtPartitionMap parts = node2part.get(nodeId);
// Set can be null if node has been removed.
if (parts != null) {
@@ -1688,7 +1688,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
if (node2part == null)
return;
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : node2part.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
for (Integer p : e.getValue().keySet()) {
Set<UUID> nodeIds = part2node.get(p);
@@ -1700,7 +1700,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
for (Map.Entry<Integer, Set<UUID>> e : part2node.entrySet()) {
for (UUID nodeId : e.getValue()) {
- GridDhtPartitionMap2 map = node2part.get(nodeId);
+ GridDhtPartitionMap map = node2part.get(nodeId);
assert map != null : "Failed consistency check [part=" + e.getKey() + ", nodeId=" + nodeId + ']';
assert map.containsKey(e.getKey()) : "Failed consistency check [part=" + e.getKey() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 519239a..f555b84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -53,15 +53,12 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CIX1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.SINGLE_GET_MSG_SINCE;
-
/**
* Colocated get future.
*/
@@ -72,9 +69,6 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
/** Logger reference. */
private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
- /** Dummy version sent to older nodes for backward compatibility, */
- private static final GridCacheVersion DUMMY_VER = new GridCacheVersion(0, 0, 0, 0);
-
/** Logger. */
private static IgniteLogger log;
@@ -335,7 +329,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
cctx.cacheId(),
futId,
fut.futureId(),
- n.version().compareTo(SINGLE_GET_MSG_SINCE) >= 0 ? null : DUMMY_VER,
+ null,
mappedKeys,
readThrough,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index a3f6b72..47f4066 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -41,7 +41,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.near.CacheVersionedValue;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetResponse;
@@ -53,7 +52,6 @@ import org.apache.ignite.internal.util.typedef.CIX1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.jetbrains.annotations.Nullable;
@@ -68,9 +66,6 @@ public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object> im
/** */
private static final long serialVersionUID = 0L;
- /** */
- public static final IgniteProductVersion SINGLE_GET_MSG_SINCE = IgniteProductVersion.fromString("1.5.0");
-
/** Logger reference. */
private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
@@ -270,41 +265,19 @@ public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object> im
cctx.mvcc().addFuture(this, futId);
}
- GridCacheMessage req;
-
- if (node.version().compareTo(SINGLE_GET_MSG_SINCE) >= 0) {
- req = new GridNearSingleGetRequest(cctx.cacheId(),
- futId.localId(),
- key,
- readThrough,
- topVer,
- subjId,
- taskName == null ? 0 : taskName.hashCode(),
- expiryPlc != null ? expiryPlc.forCreate() : -1L,
- expiryPlc != null ? expiryPlc.forAccess() : -1L,
- skipVals,
- /**add reader*/false,
- needVer,
- cctx.deploymentEnabled());
- }
- else {
- Map<KeyCacheObject, Boolean> map = Collections.singletonMap(key, false);
-
- req = new GridNearGetRequest(
- cctx.cacheId(),
- futId,
- futId,
- cctx.versions().next(),
- map,
- readThrough,
- topVer,
- subjId,
- taskName == null ? 0 : taskName.hashCode(),
- expiryPlc != null ? expiryPlc.forCreate() : -1L,
- expiryPlc != null ? expiryPlc.forAccess() : -1L,
- skipVals,
- cctx.deploymentEnabled());
- }
+ GridCacheMessage req = new GridNearSingleGetRequest(cctx.cacheId(),
+ futId.localId(),
+ key,
+ readThrough,
+ topVer,
+ subjId,
+ taskName == null ? 0 : taskName.hashCode(),
+ expiryPlc != null ? expiryPlc.forCreate() : -1L,
+ expiryPlc != null ? expiryPlc.forAccess() : -1L,
+ skipVals,
+ /**add reader*/false,
+ needVer,
+ cctx.deploymentEnabled());
try {
cctx.io().send(node, req, cctx.ioPolicy());
[44/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/db21f735
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/db21f735
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/db21f735
Branch: refs/heads/ignite-4003
Commit: db21f73548efca8a3380b24577a08aad88b964fe
Parents: 118492d d44de99
Author: Sergi Vladykin <se...@gmail.com>
Authored: Tue Mar 28 18:12:05 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Tue Mar 28 18:12:05 2017 +0300
----------------------------------------------------------------------
.../internal/binary/BinaryClassDescriptor.java | 10 +-
.../ignite/internal/binary/BinaryContext.java | 2 +-
.../internal/binary/BinaryFieldMetadata.java | 127 +++++++++++
.../ignite/internal/binary/BinaryMetadata.java | 20 +-
.../binary/BinaryMetadataCollector.java | 17 +-
.../ignite/internal/binary/BinaryUtils.java | 14 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 14 +-
.../binary/CacheObjectBinaryProcessor.java | 3 +-
.../binary/CacheObjectBinaryProcessorImpl.java | 3 +-
.../platform/PlatformContextImpl.java | 82 +++----
modules/platforms/cpp/binary/Makefile.am | 2 +-
.../platforms/cpp/binary/include/Makefile.am | 1 +
.../include/ignite/binary/binary_object.h | 75 ++++++-
.../ignite/impl/binary/binary_field_meta.h | 110 ++++++++++
.../ignite/impl/binary/binary_id_resolver.h | 96 +++++++-
.../ignite/impl/binary/binary_object_header.h | 13 ++
.../ignite/impl/binary/binary_object_impl.h | 124 +++++++++--
.../include/ignite/impl/binary/binary_schema.h | 10 +-
.../ignite/impl/binary/binary_type_handler.h | 47 ++--
.../ignite/impl/binary/binary_type_manager.h | 48 ++--
.../ignite/impl/binary/binary_type_snapshot.h | 82 +++++--
.../ignite/impl/binary/binary_type_updater.h | 19 +-
.../ignite/impl/binary/binary_writer_impl.h | 17 +-
.../cpp/binary/project/vs/binary.vcxproj | 3 +-
.../binary/project/vs/binary.vcxproj.filters | 9 +-
.../src/impl/binary/binary_field_meta.cpp | 42 ++++
.../src/impl/binary/binary_object_impl.cpp | 139 +++++++++++-
.../src/impl/binary/binary_type_handler.cpp | 45 +---
.../src/impl/binary/binary_type_manager.cpp | 187 +++++++---------
.../src/impl/binary/binary_type_snapshot.cpp | 50 ++---
.../src/impl/binary/binary_type_updater.cpp | 32 ---
.../cpp/core-test/config/cache-identity.xml | 33 +++
.../core-test/include/ignite/binary_test_defs.h | 5 +
.../src/binary_identity_resolver_test.cpp | 91 +++++++-
.../cpp/core-test/src/binary_object_test.cpp | 220 ++++++++++++++++++-
.../cpp/core-test/src/cache_invoke_test.cpp | 2 +
.../cpp/core-test/src/cluster_test.cpp | 5 +-
.../impl/binary/binary_type_updater_impl.h | 6 +-
.../cpp/core/include/ignite/impl/ignite_impl.h | 11 +
.../ignite/impl/interop/interop_target.h | 2 +-
.../impl/binary/binary_type_updater_impl.cpp | 101 +++++++--
.../cpp/core/src/impl/ignite_environment.cpp | 4 +-
.../core/src/impl/interop/interop_target.cpp | 2 +-
.../Apache.Ignite.Core.csproj | 1 +
.../Impl/Binary/BinaryObjectBuilder.cs | 2 +-
.../Impl/Binary/BinaryProcessor.cs | 3 +-
.../Impl/Binary/BinaryWriter.cs | 2 +-
.../Impl/Binary/Marshaller.cs | 6 +-
.../Impl/Binary/Metadata/BinaryField.cs | 72 ++++++
.../Impl/Binary/Metadata/BinaryType.cs | 38 +++-
.../Binary/Metadata/BinaryTypeHashsetHandler.cs | 10 +-
.../Impl/Binary/Metadata/BinaryTypeHolder.cs | 9 +-
.../Impl/Binary/Metadata/IBinaryTypeHandler.cs | 2 +-
53 files changed, 1586 insertions(+), 484 deletions(-)
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: IGNITE-4827: Remove compatibility
logic for 1.x versions. This closes #1654.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 347043f..6d8dc14 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -65,7 +65,6 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
-import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlSortColumn;
@@ -74,7 +73,6 @@ import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQuery
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse;
-import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.typedef.CIX2;
@@ -113,9 +111,6 @@ import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySpl
*/
public class GridReduceQueryExecutor {
/** */
- private static final IgniteProductVersion DISTRIBUTED_JOIN_SINCE = IgniteProductVersion.fromString("1.7.0");
-
- /** */
private static final String MERGE_INDEX_UNSORTED = "merge_scan";
/** */
@@ -623,9 +618,6 @@ public class GridReduceQueryExecutor {
.parameters(mapQry.parameters(), mapQry.parameterIndexes()));
}
- IgniteProductVersion minNodeVer = cctx.shared().exchange().minimumNodeVersion(topVer);
-
- final boolean oldStyle = minNodeVer.compareToIgnoreTimestamp(DISTRIBUTED_JOIN_SINCE) < 0;
final boolean distributedJoins = qry.distributedJoins();
final Collection<ClusterNode> finalNodes = nodes;
@@ -638,9 +630,6 @@ public class GridReduceQueryExecutor {
boolean retry = false;
- if (oldStyle && distributedJoins)
- throw new CacheException("Failed to enable distributed joins. Topology contains older data nodes.");
-
// Always enforce join order on map side to have consistent behavior.
int flags = GridH2QueryRequest.FLAG_ENFORCE_JOIN_ORDER;
@@ -654,15 +643,6 @@ public class GridReduceQueryExecutor {
flags |= GridH2QueryRequest.FLAG_EXPLAIN;
if (send(nodes,
- oldStyle ?
- new GridQueryRequest(qryReqId,
- r.pageSize,
- space,
- mapQrys,
- topVer,
- extraSpaces(space, qry.spaces()),
- null,
- timeoutMillis) :
new GridH2QueryRequest()
.requestId(qryReqId)
.topologyVersion(topVer)
@@ -673,7 +653,7 @@ public class GridReduceQueryExecutor {
.queries(mapQrys)
.flags(flags)
.timeout(timeoutMillis),
- oldStyle && partsMap != null ? new ExplicitPartitionsSpecializer(partsMap) : null,
+ null,
false)) {
awaitAllReplies(r, nodes, cancel);
@@ -1215,26 +1195,6 @@ public class GridReduceQueryExecutor {
}
/**
- * @param msg Message to copy.
- * @param node Node.
- * @param partsMap Partitions map.
- * @return Copy of message with partitions set.
- */
- private Message copy(Message msg, ClusterNode node, Map<ClusterNode,IntArray> partsMap) {
- assert partsMap != null;
-
- GridQueryRequest res = new GridQueryRequest((GridQueryRequest)msg);
-
- IntArray parts = partsMap.get(node);
-
- assert parts != null : node;
-
- res.partitions(toArray(parts));
-
- return res;
- }
-
- /**
* @param ints Ints.
* @return Array.
*/
@@ -1458,24 +1418,4 @@ public class GridReduceQueryExecutor {
state(e, null);
}
}
-
- /**
- *
- */
- private class ExplicitPartitionsSpecializer implements IgniteBiClosure<ClusterNode,Message,Message> {
- /** */
- private final Map<ClusterNode,IntArray> partsMap;
-
- /**
- * @param partsMap Partitions map.
- */
- private ExplicitPartitionsSpecializer(Map<ClusterNode,IntArray> partsMap) {
- this.partsMap = partsMap;
- }
-
- /** {@inheritDoc} */
- @Override public Message apply(ClusterNode n, Message msg) {
- return copy(msg, n, partsMap);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 04a68ae..19b04f2 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -431,15 +431,12 @@ class VisorCacheCommand {
formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
X.timeSpan2HMSM(nm.getUpTime),
- cm match {
- case v2: VisorCacheMetricsV2 => (
- "Total: " + (v2.keySize() + v2.offHeapEntriesCount()),
- " Heap: " + v2.keySize(),
- " Off-Heap: " + v2.offHeapEntriesCount(),
- " Off-Heap Memory: " + formatMemory(v2.offHeapAllocatedSize())
- )
- case v1 => v1.keySize()
- },
+ (
+ "Total: " + (cm.keySize() + cm.offHeapEntriesCount()),
+ " Heap: " + cm.keySize(),
+ " Off-Heap: " + cm.offHeapEntriesCount(),
+ " Off-Heap Memory: " + formatMemory(cm.offHeapAllocatedSize())
+ ),
(
"Hi: " + cm.hits(),
"Mi: " + cm.misses(),
@@ -923,7 +920,7 @@ object VisorCacheCommand {
cacheT += ("Store Class", safe(storeCfg.store()))
cacheT += ("Store Factory Class", storeCfg.storeFactory())
cacheT += ("Store Keep Binary", storeCfg match {
- case cfg: VisorCacheStoreConfigurationV2 => cfg.storeKeepBinary()
+ case cfg: VisorCacheStoreConfiguration => cfg.storeKeepBinary()
case _ => false
})
cacheT += ("Store Read Through", bool2Str(storeCfg.readThrough()))
@@ -949,7 +946,7 @@ object VisorCacheCommand {
cacheT +=("Query Execution Time Threshold", queryCfg.longQueryWarningTimeout())
cacheT +=("Query Schema Name", queryCfg match {
- case cfg: VisorCacheQueryConfigurationV2 => cfg.sqlSchema()
+ case cfg: VisorCacheQueryConfiguration => cfg.sqlSchema()
case _ => null
})
cacheT +=("Query Escaped Names", bool2Str(queryCfg.sqlEscapeAll()))
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
index 3aa2a19..9668072 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
@@ -139,7 +139,7 @@ class VisorCacheScanCommand {
val firstPage =
try
executeRandom(groupForDataNode(node, cacheName),
- classOf[VisorQueryTask], new VisorQueryArg(cacheName, null, false, pageSize)) match {
+ classOf[VisorQueryTask], new VisorQueryArg(cacheName, null, false, false, false, pageSize)) match {
case x if x.get1() != null =>
error(x.get1())
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
index 9ff7118..b0f2c82 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
@@ -216,7 +216,7 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
if (nodeStartTime > System.currentTimeMillis() - tmFrame) {
val root = new VisorGridDiscoveryEvent(EVT_NODE_JOINED, null, U.gridEventName(EVT_NODE_JOINED),
- node.id(), nodeStartTime, "", "", node.id, node.addresses().head, node.isDaemon)
+ node.id(), nodeStartTime, "", "", node.id, node.addresses().head, node.isDaemon, 0)
evts = Seq(root) ++ evts
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
index ac91b51..83c50bd 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.yardstickframework.BenchmarkUtils;
@@ -53,7 +53,7 @@ public class WaitMapExchangeFinishCallable implements IgniteCallable<Void> {
boolean success = true;
if (top.topologyVersion().topologyVersion() == ignite.cluster().topologyVersion()) {
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : top.partitionMap(true).entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : top.partitionMap(true).entrySet()) {
for (Map.Entry<Integer, GridDhtPartitionState> p : e.getValue().entrySet()) {
if (p.getValue() != GridDhtPartitionState.OWNING) {
BenchmarkUtils.println("Not owning partition [part=" + p.getKey() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
index a025bb5..b90573b 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
@@ -38,7 +38,7 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.mxbean.IgniteMXBean;
@@ -188,7 +188,7 @@ public abstract class IgniteFailoverAbstractBenchmark<K, V> extends IgniteCacheA
GridDhtPartitionFullMap partMap = dht.topology().partitionMap(true);
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : partMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
log.info("Checking node: " + e.getKey());
for (Map.Entry<Integer, GridDhtPartitionState> e1 : e.getValue().entrySet()) {
[13/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index e47a18d..4bada88 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -56,6 +56,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.cache.CacheEntry;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cache.CachePeekMode;
@@ -225,6 +226,41 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
for (int i = 0; i < gridCount(); i++)
assertEquals(globalPrimarySize, jcache(i).size(PRIMARY));
+ for (int i = 0; i < gridCount(); i++)
+ assertEquals(globalPrimarySize, jcache(i).sizeLong(PRIMARY));
+
+ for (int i = 0; i < gridCount(); i++)
+ assertEquals(globalPrimarySize, (int)jcache(i).sizeAsync(PRIMARY).get());
+
+ for (int i = 0; i < gridCount(); i++)
+ assertEquals((long)globalPrimarySize, (long)jcache(i).sizeLongAsync(PRIMARY).get());
+
+ for (int i = 0; i < gridCount(); i++) {
+ IgniteCacheProxy cache = (IgniteCacheProxy)jcache(i);
+
+ long cacheSize = 0;
+
+ int parts = cache.context().affinity().partitions();
+
+ for (int part = 0; part < parts; ++part)
+ cacheSize += jcache(i).sizeLong(part, PRIMARY);
+
+ assertEquals((long)globalPrimarySize, cacheSize);
+ }
+
+ for (int i = 0; i < gridCount(); i++) {
+ IgniteCacheProxy cache = (IgniteCacheProxy)jcache(i);
+
+ long cacheSize = 0;
+
+ int parts = cache.context().affinity().partitions();
+
+ for (int part = 0; part < parts; ++part)
+ cacheSize += jcache(i).sizeLongAsync(part, PRIMARY).get();
+
+ assertEquals((long)globalPrimarySize, cacheSize);
+ }
+
int times = 1;
if (cacheMode() == REPLICATED)
@@ -242,10 +278,21 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception In case of error.
*/
public void testContainsKey() throws Exception {
- jcache().put("testContainsKey", 1);
- checkContainsKey(true, "testContainsKey");
+ Map<String, Integer> vals = new HashMap<>();
+
+ for (int i = 0; i < CNT; i++)
+ vals.put("key" + i, i);
+
+ jcache().putAll(vals);
+
+ checkContainsKey(true, "key0");
checkContainsKey(false, "testContainsKeyWrongKey");
+
+ for (int i = 0; i < gridCount(); i++) {
+ assertTrue(jcache(i).containsKeys(vals.keySet()));
+ assertTrue(jcache(i).containsKeysAsync(vals.keySet()).get());
+ }
}
/**
@@ -420,7 +467,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testGetAsync() throws Exception {
+ public void testGetAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
cache.put("key1", 1);
@@ -448,6 +495,26 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testGetAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ IgniteFuture<Integer> fut1 = cache.getAsync("key1");
+
+ IgniteFuture<Integer> fut2 = cache.getAsync("key2");
+
+ IgniteFuture<Integer> fut3 = cache.getAsync("wrongKey");
+
+ assert fut1.get() == 1;
+ assert fut2.get() == 2;
+ assert fut3.get() == null;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testGetAll() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() {
@@ -570,7 +637,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testGetAllAsync() throws Exception {
+ public void testGetAllAsyncOld() throws Exception {
final IgniteCache<String, Integer> cache = jcache();
final IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -601,6 +668,33 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testGetAllAsync() throws Exception {
+ final IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ cache.getAllAsync(null);
+
+ return null;
+ }
+ }, NullPointerException.class, null);
+
+ IgniteFuture<Map<String, Integer>> fut2 = cache.getAllAsync(Collections.<String>emptySet());
+
+ IgniteFuture<Map<String, Integer>> fut3 = cache.getAllAsync(ImmutableSet.of("key1", "key2"));
+
+ assert fut2.get().isEmpty();
+ assert fut3.get().size() == 2 : "Invalid map: " + fut3.get();
+ assert fut3.get().get("key1") == 1;
+ assert fut3.get().get("key2") == 2;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testPut() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
@@ -899,6 +993,50 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @throws Exception If failed.
+ */
+ public void testInvokeAllAsyncOptimisticReadCommitted() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ checkInvokeAllAsync(OPTIMISTIC, READ_COMMITTED);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeAllAsyncOptimisticRepeatableRead() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ checkInvokeAllAsync(OPTIMISTIC, REPEATABLE_READ);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeAllAsyncPessimisticReadCommitted() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ checkInvokeAllAsync(PESSIMISTIC, READ_COMMITTED);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeAllAsyncPessimisticRepeatableRead() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ checkInvokeAllAsync(PESSIMISTIC, REPEATABLE_READ);
+ }
+ });
+ }
+
+ /**
* @param concurrency Transaction concurrency.
* @param isolation Transaction isolation.
* @throws Exception If failed.
@@ -994,6 +1132,103 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @param concurrency Transaction concurrency.
+ * @param isolation Transaction isolation.
+ * @throws Exception If failed.
+ */
+ private void checkInvokeAllAsync(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
+ // TODO IGNITE-2664: enable tests for all modes when IGNITE-2664 will be fixed.
+ if (dataMode != DataMode.EXTERNALIZABLE && gridCount() > 1)
+ return;
+
+ final Object key1 = key(1);
+ final Object key2 = key(2);
+ final Object key3 = key(3);
+
+ final Object val1 = value(1);
+ final Object val2 = value(2);
+ final Object val3 = value(3);
+ final Object val4 = value(4);
+
+ final IgniteCache<Object, Object> cache = jcache();
+
+ cache.put(key2, val1);
+ cache.put(key3, val3);
+
+ if (txShouldBeUsed()) {
+ Map<Object, EntryProcessorResult<Object>> res;
+
+ try (Transaction tx = ignite(0).transactions().txStart(concurrency, isolation)) {
+ res = cache.invokeAllAsync(F.asSet(key1, key2, key3), INCR_PROCESSOR, dataMode).get();
+
+ tx.commit();
+ }
+
+ assertEquals(val1, cache.get(key1));
+ assertEquals(val2, cache.get(key2));
+ assertEquals(val4, cache.get(key3));
+
+ assertNull(res.get(key1));
+ assertEquals(val1, res.get(key2).get());
+ assertEquals(val3, res.get(key3).get());
+
+ assertEquals(2, res.size());
+
+ cache.remove(key1);
+ cache.put(key2, val1);
+ cache.put(key3, val3);
+ }
+
+ Map<Object, EntryProcessorResult<Object>> res =
+ cache.invokeAllAsync(F.asSet(key1, key2, key3), RMV_PROCESSOR).get();
+
+ for (int i = 0; i < gridCount(); i++) {
+ assertNull(jcache(i).localPeek(key1, ONHEAP));
+ assertNull(jcache(i).localPeek(key2, ONHEAP));
+ assertNull(jcache(i).localPeek(key3, ONHEAP));
+ }
+
+ assertNull(res.get(key1));
+ assertEquals(val1, res.get(key2).get());
+ assertEquals(val3, res.get(key3).get());
+
+ assertEquals(2, res.size());
+
+ cache.remove(key1);
+ cache.put(key2, val1);
+ cache.put(key3, val3);
+
+ res = cache.invokeAllAsync(F.asSet(key1, key2, key3), INCR_PROCESSOR, dataMode).get();
+
+ assertEquals(val1, cache.get(key1));
+ assertEquals(val2, cache.get(key2));
+ assertEquals(val4, cache.get(key3));
+
+ assertNull(res.get(key1));
+ assertEquals(val1, res.get(key2).get());
+ assertEquals(val3, res.get(key3).get());
+
+ assertEquals(2, res.size());
+
+ cache.remove(key1);
+ cache.put(key2, val1);
+ cache.put(key3, val3);
+
+ res = cache.invokeAllAsync(
+ F.asMap(key1, INCR_PROCESSOR, key2, INCR_PROCESSOR, key3, INCR_PROCESSOR), dataMode).get();
+
+ assertEquals(val1, cache.get(key1));
+ assertEquals(val2, cache.get(key2));
+ assertEquals(val4, cache.get(key3));
+
+ assertNull(res.get(key1));
+ assertEquals(val1, res.get(key2).get());
+ assertEquals(val3, res.get(key3).get());
+
+ assertEquals(2, res.size());
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testInvokeAllWithNulls() throws Exception {
@@ -1295,7 +1530,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testGetAndPutAsync() throws Exception {
+ public void testGetAndPutAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -1321,7 +1556,27 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testPutAsync0() throws Exception {
+ public void testGetAndPutAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ IgniteFuture<Integer> fut1 = cache.getAndPutAsync("key1", 10);
+
+ IgniteFuture<Integer> fut2 = cache.getAndPutAsync("key2", 11);
+
+ assertEquals((Integer)1, fut1.get(5000));
+ assertEquals((Integer)2, fut2.get(5000));
+
+ assertEquals((Integer)10, cache.get("key1"));
+ assertEquals((Integer)11, cache.get("key2"));
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testPutAsyncOld0() throws Exception {
IgniteCache cacheAsync = jcache().withAsync();
cacheAsync.getAndPut("key1", 0);
@@ -1337,9 +1592,21 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @throws Exception In case of error.
+ */
+ public void testPutAsync0() throws Exception {
+ IgniteFuture<?> fut1 = jcache().getAndPutAsync("key1", 0);
+
+ IgniteFuture<?> fut2 = jcache().getAndPutAsync("key2", 1);
+
+ assert fut1.get(5000) == null;
+ assert fut2.get(5000) == null;
+ }
+
+ /**
* @throws Exception If failed.
*/
- public void testInvokeAsync() throws Exception {
+ public void testInvokeAsyncOld() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
final Object key1 = key(1);
@@ -1386,6 +1653,46 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception If failed.
*/
+ public void testInvokeAsync() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ final Object key1 = key(1);
+ final Object key2 = key(2);
+ final Object key3 = key(3);
+
+ final Object val1 = value(1);
+ final Object val2 = value(2);
+ final Object val3 = value(3);
+
+ IgniteCache<Object, Object> cache = jcache();
+
+ cache.put(key2, val1);
+ cache.put(key3, val3);
+
+ IgniteFuture<?> fut0 = cache.invokeAsync(key1, INCR_PROCESSOR, dataMode);
+
+ IgniteFuture<?> fut1 = cache.invokeAsync(key2, INCR_PROCESSOR, dataMode);
+
+
+ IgniteFuture<?> fut2 = cache.invokeAsync(key3, RMV_PROCESSOR);
+
+ fut0.get();
+ fut1.get();
+ fut2.get();
+
+ assertEquals(val1, cache.get(key1));
+ assertEquals(val2, cache.get(key2));
+ assertNull(cache.get(key3));
+
+ for (int i = 0; i < gridCount(); i++)
+ assertNull(jcache(i).localPeek(key3, ONHEAP));
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testInvoke() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
@@ -1492,7 +1799,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception If failed.
*/
- public void testPutAsync() throws Exception {
+ public void testPutAsyncOld() throws Exception {
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache cacheAsync = jcache().withAsync();
@@ -1535,6 +1842,45 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @throws Exception If failed.
+ */
+ public void testPutAsync() throws Exception {
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ jcache().put("key2", 1);
+
+ IgniteFuture<?> fut1 = jcache().putAsync("key1", 10);
+
+ IgniteFuture<?> fut2 = jcache().putAsync("key2", 11);
+
+ IgniteFuture<Void> f = null;
+
+ if (tx != null)
+ f = tx.commitAsync();
+
+ assertNull(fut1.get());
+ assertNull(fut2.get());
+
+ try {
+ if (f != null)
+ f.get();
+ } catch (Throwable t) {
+ assert false : "Unexpected exception " + t;
+ }
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ checkSize(F.asSet("key1", "key2"));
+
+ assert (Integer)jcache().get("key1") == 10;
+ assert (Integer)jcache().get("key2") == 11;
+ }
+
+ /**
* @throws Exception In case of error.
*/
public void testPutAll() throws Exception {
@@ -1782,7 +2128,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testPutAllAsync() throws Exception {
+ public void testPutAllAsyncOld() throws Exception {
Map<String, Integer> map = F.asMap("key1", 1, "key2", 2);
IgniteCache<String, Integer> cache = jcache();
@@ -1812,6 +2158,30 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testPutAllAsync() throws Exception {
+ Map<String, Integer> map = F.asMap("key1", 1, "key2", 2);
+
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteFuture<?> f1 = cache.putAllAsync(map);
+
+ map.put("key1", 10);
+ map.put("key2", 20);
+
+ IgniteFuture<?> f2 = cache.putAllAsync(map);
+
+ assertNull(f2.get());
+ assertNull(f1.get());
+
+ checkSize(F.asSet("key1", "key2"));
+
+ assert cache.get("key1") == 10;
+ assert cache.get("key2") == 20;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testGetAndPutIfAbsent() throws Exception {
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
@@ -1898,7 +2268,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception If failed.
*/
- public void testGetAndPutIfAbsentAsync() throws Exception {
+ public void testGetAndPutIfAbsentAsyncOld() throws Exception {
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache<String, Integer> cache = jcache();
@@ -1979,6 +2349,75 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception If failed.
*/
+ public void testGetAndPutIfAbsentAsync() throws Exception {
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ IgniteCache<String, Integer> cache = jcache();
+
+ try {
+ IgniteFuture<Integer> fut1 = cache.getAndPutIfAbsentAsync("key", 1);
+
+ assertNull(fut1.get());
+ assertEquals((Integer)1, cache.get("key"));
+
+ IgniteFuture<Integer> fut2 = cache.getAndPutIfAbsentAsync("key", 2);
+
+ assertEquals((Integer)1, fut2.get());
+ assertEquals((Integer)1, cache.get("key"));
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ if (!storeEnabled())
+ return;
+
+ // Check swap.
+ cache.put("key2", 1);
+
+ cache.localEvict(Collections.singleton("key2"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key2");
+
+ assertEquals((Integer)1, cache.getAndPutIfAbsentAsync("key2", 3).get());
+
+ // Check db.
+ if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) {
+ putToStore("key3", 3);
+
+ assertEquals((Integer)3, cache.getAndPutIfAbsentAsync("key3", 4).get());
+ }
+
+ cache.localEvict(Collections.singleton("key2"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key2");
+
+ // Same checks inside tx.
+ tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ assertEquals(1, (int) cache.getAndPutIfAbsentAsync("key2", 3).get());
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals((Integer)1, cache.get("key2"));
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testPutIfAbsent() throws Exception {
IgniteCache<String, Integer> cache = jcache();
@@ -2033,6 +2472,21 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testPutxIfAbsentAsyncOld() throws Exception {
+ if (txShouldBeUsed())
+ checkPutxIfAbsentAsyncOld(true);
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testPutxIfAbsentAsyncOldNoTx() throws Exception {
+ checkPutxIfAbsentAsyncOld(false);
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testPutxIfAbsentAsync() throws Exception {
if (txShouldBeUsed())
checkPutxIfAbsentAsync(true);
@@ -2049,7 +2503,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @param inTx In tx flag.
* @throws Exception If failed.
*/
- private void checkPutxIfAbsentAsync(boolean inTx) throws Exception {
+ private void checkPutxIfAbsentAsyncOld(boolean inTx) throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2126,9 +2580,74 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @param inTx In tx flag.
+ * @throws Exception If failed.
+ */
+ private void checkPutxIfAbsentAsync(boolean inTx) throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteFuture<Boolean> fut1 = cache.putIfAbsentAsync("key", 1);
+
+ assert fut1.get();
+ assert cache.get("key") != null && cache.get("key") == 1;
+
+ IgniteFuture<Boolean> fut2 = cache.putIfAbsentAsync("key", 2);
+
+ assert !fut2.get();
+ assert cache.get("key") != null && cache.get("key") == 1;
+
+ if (!storeEnabled())
+ return;
+
+ // Check swap.
+ cache.put("key2", 1);
+
+ cache.localEvict(Collections.singleton("key2"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key2");
+
+ assertFalse(cache.putIfAbsentAsync("key2", 3).get());
+
+ // Check db.
+ if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) {
+ putToStore("key3", 3);
+
+ assertFalse(cache.putIfAbsentAsync("key3", 4).get());
+ }
+
+ cache.localEvict(Collections.singletonList("key2"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key2");
+
+ // Same checks inside tx.
+ Transaction tx = inTx ? transactions().txStart() : null;
+
+ try {
+ assertFalse(cache.putIfAbsentAsync("key2", 3).get());
+
+ if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm())
+ assertFalse(cache.putIfAbsentAsync("key3", 4).get());
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ assertEquals((Integer)1, cache.get("key2"));
+
+ if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm())
+ assertEquals((Integer)3, cache.get("key3"));
+ }
+
+ /**
* @throws Exception In case of error.
*/
- public void testPutIfAbsentAsyncConcurrent() throws Exception {
+ public void testPutIfAbsentAsyncOldConcurrent() throws Exception {
IgniteCache cacheAsync = jcache().withAsync();
cacheAsync.putIfAbsent("key1", 1);
@@ -2144,6 +2663,20 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @throws Exception In case of error.
+ */
+ public void testPutIfAbsentAsyncConcurrent() throws Exception {
+ IgniteCache cache = jcache();
+
+ IgniteFuture<Boolean> fut1 = cache.putIfAbsentAsync("key1", 1);
+
+ IgniteFuture<Boolean> fut2 = cache.putIfAbsentAsync("key2", 2);
+
+ assert fut1.get();
+ assert fut2.get();
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testGetAndReplace() throws Exception {
@@ -2297,7 +2830,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception If failed.
*/
- public void testGetAndReplaceAsync() throws Exception {
+ public void testGetAndReplaceAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2386,7 +2919,78 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception If failed.
*/
- public void testReplacexAsync() throws Exception {
+ public void testGetAndReplaceAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key", 1);
+
+ assert cache.get("key") == 1;
+
+ assert cache.getAndReplaceAsync("key", 2).get() == 1;
+
+ assert cache.get("key") == 2;
+
+ assert cache.getAndReplaceAsync("wrong", 0).get() == null;
+
+ assert cache.get("wrong") == null;
+
+ assert !cache.replaceAsync("key", 0, 3).get();
+
+ assert cache.get("key") == 2;
+
+ assert !cache.replaceAsync("key", 0, 3).get();
+
+ assert cache.get("key") == 2;
+
+ assert cache.replaceAsync("key", 2, 3).get();
+
+ assert cache.get("key") == 3;
+
+ if (!storeEnabled())
+ return;
+
+ cache.localEvict(Collections.singleton("key"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key");
+
+ assert cache.replaceAsync("key", 3, 4).get();
+
+ assert cache.get("key") == 4;
+
+ if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) {
+ putToStore("key2", 5);
+
+ assert cache.replaceAsync("key2", 5, 6).get();
+
+ assertEquals((Integer)6, cache.get("key2"));
+ }
+
+ cache.localEvict(Collections.singleton("key"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key");
+
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ assert cache.replaceAsync("key", 4, 5).get();
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ assert cache.get("key") == 5;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplacexAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2455,6 +3059,65 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @throws Exception If failed.
+ */
+ public void testReplacexAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key", 1);
+
+ assert cache.get("key") == 1;
+
+ assert cache.replaceAsync("key", 2).get();
+
+ info("Finished replace.");
+
+ assertEquals((Integer)2, cache.get("key"));
+
+ assert !cache.replaceAsync("wrond", 2).get();
+
+ if (!storeEnabled())
+ return;
+
+ cache.localEvict(Collections.singleton("key"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key");
+
+ assert cache.replaceAsync("key", 4).get();
+
+ assert cache.get("key") == 4;
+
+ if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) {
+ putToStore("key2", 5);
+
+ assert cache.replaceAsync("key2", 6).get();
+
+ assert cache.get("key2") == 6;
+ }
+
+ cache.localEvict(Collections.singleton("key"));
+
+ if (!isLoadPreviousValue())
+ cache.get("key");
+
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ assert cache.replaceAsync("key", 5).get();
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ assert cache.get("key") == 5;
+ }
+
+ /**
* @throws Exception In case of error.
*/
public void testGetAndRemove() throws Exception {
@@ -2602,7 +3265,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testRemoveAsync() throws Exception {
+ public void testRemoveAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2636,6 +3299,30 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testRemoveAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ assert !cache.removeAsync("key1", 0).get();
+
+ assert cache.get("key1") != null && cache.get("key1") == 1;
+
+ assert cache.removeAsync("key1", 1).get();
+
+ assert cache.get("key1") == null;
+
+ assert cache.getAndRemoveAsync("key2").get() == 2;
+
+ assert cache.get("key2") == null;
+
+ assert cache.getAndRemoveAsync("key2").get() == null;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testRemove() throws Exception {
IgniteCache<String, Integer> cache = jcache();
@@ -2649,7 +3336,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testRemovexAsync() throws Exception {
+ public void testRemovexAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2670,22 +3357,45 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testRemovexAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+
+ assert cache.removeAsync("key1").get();
+
+ assert cache.get("key1") == null;
+
+ assert !cache.removeAsync("key1").get();
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testGlobalRemoveAll() throws Exception {
- globalRemoveAll(false);
+ globalRemoveAll(false, false);
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testGlobalRemoveAllAsyncOld() throws Exception {
+ globalRemoveAll(true, true);
}
/**
* @throws Exception In case of error.
*/
public void testGlobalRemoveAllAsync() throws Exception {
- globalRemoveAll(true);
+ globalRemoveAll(true, false);
}
/**
* @param async If {@code true} uses asynchronous operation.
+ * @param oldAsync Use old async API.
* @throws Exception In case of error.
*/
- private void globalRemoveAll(boolean async) throws Exception {
+ private void globalRemoveAll(boolean async, boolean oldAsync) throws Exception {
IgniteCache<String, Integer> cache = jcache();
cache.put("key1", 1);
@@ -2699,9 +3409,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
IgniteCache<String, Integer> asyncCache = cache.withAsync();
if (async) {
- asyncCache.removeAll(F.asSet("key1", "key2"));
+ if (oldAsync) {
+ asyncCache.removeAll(F.asSet("key1", "key2"));
- asyncCache.future().get();
+ asyncCache.future().get();
+ }
+ else
+ cache.removeAllAsync(F.asSet("key1", "key2")).get();
}
else
cache.removeAll(F.asSet("key1", "key2"));
@@ -2720,11 +3434,15 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
atomicClockModeDelay(cache);
if (async) {
- IgniteCache asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync();
+ if (oldAsync) {
+ IgniteCache asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync();
- asyncCache0.removeAll();
+ asyncCache0.removeAll();
- asyncCache0.future().get();
+ asyncCache0.future().get();
+ }
+ else
+ jcache(gridCount() > 1 ? 1 : 0).removeAllAsync().get();
}
else
jcache(gridCount() > 1 ? 1 : 0).removeAll();
@@ -2741,9 +3459,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
atomicClockModeDelay(cache);
if (async) {
- asyncCache.removeAll();
+ if (oldAsync) {
+ asyncCache.removeAll();
- asyncCache.future().get();
+ asyncCache.future().get();
+ }
+ else
+ cache.removeAllAsync().get();
}
else
cache.removeAll();
@@ -2843,7 +3565,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
- public void testRemoveAllAsync() throws Exception {
+ public void testRemoveAllAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2868,6 +3590,27 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @throws Exception In case of error.
*/
+ public void testRemoveAllAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+ cache.put("key3", 3);
+
+ checkSize(F.asSet("key1", "key2", "key3"));
+
+ assertNull(cache.removeAllAsync(F.asSet("key1", "key2")).get());
+
+ checkSize(F.asSet("key3"));
+
+ checkContainsKey(false, "key1");
+ checkContainsKey(false, "key2");
+ checkContainsKey(true, "key3");
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testLoadAll() throws Exception {
if (!storeEnabled())
return;
@@ -3101,21 +3844,29 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception If failed.
*/
public void testGlobalClearAll() throws Exception {
- globalClearAll(false);
+ globalClearAll(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGlobalClearAllAsyncOld() throws Exception {
+ globalClearAll(true, true);
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearAllAsync() throws Exception {
- globalClearAll(true);
+ globalClearAll(true, false);
}
/**
* @param async If {@code true} uses async method.
+ * @param oldAsync Use old async API.
* @throws Exception If failed.
*/
- protected void globalClearAll(boolean async) throws Exception {
+ protected void globalClearAll(boolean async, boolean oldAsync) throws Exception {
// Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
// because some of them were blocked due to having readers.
for (int i = 0; i < gridCount(); i++) {
@@ -3124,11 +3875,15 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
if (async) {
- IgniteCache asyncCache = jcache().withAsync();
+ if (oldAsync) {
+ IgniteCache asyncCache = jcache().withAsync();
- asyncCache.clear();
+ asyncCache.clear();
- asyncCache.future().get();
+ asyncCache.future().get();
+ }
+ else
+ jcache().clearAsync().get();
}
else
jcache().clear();
@@ -4189,8 +4944,10 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception If failed.
*/
private void checkContainsKey(boolean exp, Object key) throws Exception {
- if (nearEnabled())
+ if (nearEnabled()) {
assertEquals(exp, jcache().containsKey(key));
+ assertEquals(exp, (boolean)jcache().containsKeyAsync(key).get());
+ }
else {
boolean contains = false;
@@ -4207,6 +4964,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @param key Key.
+ * @return Ignite instance of the primary node for the specified key.
*/
protected Ignite primaryIgnite(String key) {
ClusterNode node = grid(0).affinity(cacheName()).mapKeyToNode(key);
@@ -4235,6 +4993,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
/**
* @param gridIdx Grid index.
* @param cnt Keys count.
+ * @param startFrom Key value to start.
* @return Collection of keys for which given cache is primary.
*/
protected List<String> primaryKeysForCache(int gridIdx, int cnt, int startFrom) {
@@ -4633,36 +5392,51 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception If failed.
*/
public void testGlobalClearKey() throws Exception {
- testGlobalClearKey(false, Arrays.asList("key25"));
+ testGlobalClearKey(false, false, Arrays.asList("key25"));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGlobalClearKeyAsyncOld() throws Exception {
+ testGlobalClearKey(true, true, Arrays.asList("key25"));
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearKeyAsync() throws Exception {
- testGlobalClearKey(true, Arrays.asList("key25"));
+ testGlobalClearKey(true, false, Arrays.asList("key25"));
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearKeys() throws Exception {
- testGlobalClearKey(false, Arrays.asList("key25", "key100", "key150"));
+ testGlobalClearKey(false, false, Arrays.asList("key25", "key100", "key150"));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGlobalClearKeysAsyncOld() throws Exception {
+ testGlobalClearKey(true, true, Arrays.asList("key25", "key100", "key150"));
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearKeysAsync() throws Exception {
- testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"));
+ testGlobalClearKey(true, false, Arrays.asList("key25", "key100", "key150"));
}
/**
* @param async If {@code true} uses async method.
+ * @param oldAsync Use old async API.
* @param keysToRmv Keys to remove.
* @throws Exception If failed.
*/
- protected void testGlobalClearKey(boolean async, Collection<String> keysToRmv) throws Exception {
+ protected void testGlobalClearKey(boolean async, boolean oldAsync, Collection<String> keysToRmv) throws Exception {
// Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
// because some of them were blocked due to having readers.
for (int i = 0; i < 500; ++i) {
@@ -4674,14 +5448,22 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
if (async) {
- IgniteCache asyncCache = jcache().withAsync();
+ if (oldAsync) {
+ IgniteCache asyncCache = jcache().withAsync();
- if (keysToRmv.size() == 1)
- asyncCache.clear(F.first(keysToRmv));
- else
- asyncCache.clearAll(new HashSet<>(keysToRmv));
+ if (keysToRmv.size() == 1)
+ asyncCache.clear(F.first(keysToRmv));
+ else
+ asyncCache.clearAll(new HashSet<>(keysToRmv));
- asyncCache.future().get();
+ asyncCache.future().get();
+ }
+ else {
+ if (keysToRmv.size() == 1)
+ jcache().clearAsync(F.first(keysToRmv)).get();
+ else
+ jcache().clearAllAsync(new HashSet<>(keysToRmv)).get();
+ }
}
else {
if (keysToRmv.size() == 1)
@@ -5254,20 +6036,29 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception If failed.
*/
public void testGetOutTx() throws Exception {
- checkGetOutTx(false);
+ checkGetOutTx(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetOutTxAsyncOld() throws Exception {
+ checkGetOutTx(true, true);
}
/**
* @throws Exception If failed.
*/
public void testGetOutTxAsync() throws Exception {
- checkGetOutTx(true);
+ checkGetOutTx(true, false);
}
/**
+ * @param async Use async API.
+ * @param oldAsync Uase old style async API.
* @throws Exception If failed.
*/
- private void checkGetOutTx(boolean async) throws Exception {
+ private void checkGetOutTx(boolean async, boolean oldAsync) throws Exception {
final AtomicInteger lockEvtCnt = new AtomicInteger();
IgnitePredicate<Event> lsnr = new IgnitePredicate<Event>() {
@@ -5290,21 +6081,40 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
- if (async)
+ if (async && oldAsync)
cache = cache.withAsync();
try (Transaction tx = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- Integer val0 = cache.get(keys.get(0));
+ Integer val0;
+
+ if (async) {
+ if (oldAsync) {
+ cache.get(keys.get(0));
+
+ val0 = cache.<Integer>future().get();
+ }
+ else
+ val0 = cache.getAsync(keys.get(0)).get();
+ }
+ else
+ val0 = cache.get(keys.get(0));
- if (async)
- val0 = cache.<Integer>future().get();
assertEquals(0, val0.intValue());
- Map<String, Integer> allOutTx = cache.getAllOutTx(F.asSet(keys.get(1)));
+ Map<String, Integer> allOutTx;
+
+ if (async) {
+ if (oldAsync) {
+ cache.getAllOutTx(F.asSet(keys.get(1)));
- if (async)
- allOutTx = cache.<Map<String, Integer>>future().get();
+ allOutTx = cache.<Map<String, Integer>>future().get();
+ }
+ else
+ allOutTx = cache.getAllOutTxAsync(F.asSet(keys.get(1))).get();
+ }
+ else
+ allOutTx = cache.getAllOutTx(F.asSet(keys.get(1)));
assertEquals(1, allOutTx.size());
@@ -5337,13 +6147,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception If failed.
*/
public void testInvokeException() throws Exception {
- final IgniteCache cache = jcache().withAsync();
+ final IgniteCache cache = jcache();
- cache.invoke("key2", ERR_PROCESSOR);
+ final IgniteFuture fut = cache.invokeAsync("key2", ERR_PROCESSOR);
assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- IgniteFuture fut = cache.future().chain(new IgniteClosure<IgniteFuture, Object>() {
+ fut.chain(new IgniteClosure<IgniteFuture, Object>() {
@Override public Object apply(IgniteFuture o) {
return o.get();
}
@@ -5457,6 +6267,45 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
}
/**
+ * @throws Exception If failed.
+ */
+ public void testGetEntry() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ Map<String, Integer> vals = new HashMap<>();
+
+ for (int i = 0; i < CNT; i++)
+ vals.put("key" + i, i);
+
+ jcache(0).putAll(vals);
+
+ for (int i = 0; i < gridCount(); i++) {
+ assertEquals(0, jcache(i).getEntry("key0").getValue());
+ assertEquals(0, jcache(i).getEntryAsync("key0").get().getValue());
+
+ assertTrue(
+ F.transform(
+ jcache(i).getEntries(vals.keySet()),
+ new IgniteClosure<CacheEntry<Object, Object>, Object>() {
+ @Override public Object apply(CacheEntry<Object, Object> entry) {
+ return entry.getValue();
+ }
+ }).containsAll(vals.values()));
+
+ assertTrue(
+ F.transform(
+ jcache(i).getEntriesAsync(vals.keySet()).get(),
+ new IgniteClosure<CacheEntry<Object, Object>, Object>() {
+ @Override public Object apply(CacheEntry<Object, Object> entry) {
+ return entry.getValue();
+ }
+ }).containsAll(vals.values()));
+ }
+ }
+ });
+ }
+
+ /**
* Sets given value, returns old value.
*/
public static final class SetValueProcessor implements EntryProcessor<String, Integer, Integer> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
index 51a70b9..9681e97 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
@@ -178,13 +178,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
checkValue(key, 63);
- IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
-
- assertTrue(asyncCache.isAsync());
-
- assertNull(asyncCache.invoke(key, incProcessor));
-
- IgniteFuture<Integer> fut = asyncCache.future();
+ IgniteFuture<Integer> fut = cache.invokeAsync(key, incProcessor);
assertNotNull(fut);
@@ -484,13 +478,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
checkValue(key, null);
}
- IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
-
- assertTrue(asyncCache.isAsync());
-
- assertNull(asyncCache.invokeAll(keys, new IncrementProcessor()));
-
- IgniteFuture<Map<Integer, EntryProcessorResult<Integer>>> fut = asyncCache.future();
+ IgniteFuture<Map<Integer, EntryProcessorResult<Integer>>> fut = cache.invokeAllAsync(keys, new IncrementProcessor());
Map<Integer, EntryProcessorResult<Integer>> resMap = fut.get();
@@ -509,9 +497,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
for (Integer key : keys)
invokeMap.put(key, incProcessor);
- assertNull(asyncCache.invokeAll(invokeMap));
-
- fut = asyncCache.future();
+ fut = cache.invokeAllAsync(invokeMap);
resMap = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
index cb9c2d7..76667c5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
@@ -74,7 +74,7 @@ public class IgniteCacheManyAsyncOperationsTest extends IgniteCacheAbstractTest
try (Ignite client = startGrid(gridCount())) {
assertTrue(client.configuration().isClientMode());
- IgniteCache<Object, Object> cache = client.cache(null).withAsync();
+ IgniteCache<Object, Object> cache = client.cache(null);
final int ASYNC_OPS = cache.getConfiguration(CacheConfiguration.class).getMaxConcurrentAsyncOperations();
@@ -91,9 +91,7 @@ public class IgniteCacheManyAsyncOperationsTest extends IgniteCacheAbstractTest
List<IgniteFuture<?>> futs = new ArrayList<>(ASYNC_OPS);
for (int i = 0; i < ASYNC_OPS; i++) {
- cache.putAll(map);
-
- futs.add(cache.future());
+ futs.add(cache.putAllAsync(map));
if (i % 50 == 0)
log.info("Created futures: " + (i + 1));
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
index fa1677c..343653c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
@@ -394,8 +394,6 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
if (cacheMode() == LOCAL) {
IgniteCache<Integer, String> cache0 = jcache(0);
- IgniteCache<Integer, String> cacheAsync0 = cache0.withAsync();
-
for (int i = 0; i < HEAP_ENTRIES; i++) {
cache0.put(i, String.valueOf(i));
@@ -413,13 +411,9 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
assertEquals(size, cache0.size(NEAR));
assertEquals(size, cache0.size(ALL));
- cacheAsync0.size();
-
- assertEquals(size, cacheAsync0.future().get());
-
- cacheAsync0.size(PRIMARY);
+ assertEquals(size, (int) cache0.sizeAsync().get());
- assertEquals(size, cacheAsync0.future().get());
+ assertEquals(size, (int) cache0.sizeAsync(PRIMARY).get());
}
for (int i = 0; i < HEAP_ENTRIES; i++) {
@@ -439,9 +433,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
assertEquals(size, cache0.size(NEAR));
assertEquals(size, cache0.size(ALL));
- cacheAsync0.size();
-
- assertEquals(size, cacheAsync0.future().get());
+ assertEquals(size, (int) cache0.sizeAsync().get());
}
checkEmpty();
@@ -514,8 +506,6 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
int part = 0;
IgniteCache<Integer, String> cache0 = jcache(0);
- IgniteCache<Integer, String> cacheAsync0 = cache0.withAsync();
-
for (int i = 0; i < HEAP_ENTRIES; i++) {
cache0.put(i, String.valueOf(i));
@@ -533,13 +523,9 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
assertEquals(size, cache0.sizeLong(part, NEAR));
assertEquals(size, cache0.sizeLong(part, ALL));
- cacheAsync0.size();
+ assertEquals(size, (long) cache0.sizeAsync().get());
- assertEquals(size, (long) cacheAsync0.<Integer>future().get());
-
- cacheAsync0.sizeLong(part, PRIMARY);
-
- assertEquals(size, cacheAsync0.future().get());
+ assertEquals(size, (long) cache0.sizeLongAsync(part, PRIMARY).get());
}
for (int i = 0; i < HEAP_ENTRIES; i++) {
@@ -559,9 +545,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
assertEquals(size, cache0.sizeLong(part, NEAR));
assertEquals(size, cache0.sizeLong(part, ALL));
- cacheAsync0.size();
-
- assertEquals(size, (long) cacheAsync0.<Integer>future().get());
+ assertEquals(size, (long) cache0.sizeAsync().get());
}
}
@@ -995,6 +979,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
* @param nodeIdx Node index.
* @param part Cache partition
* @return Tuple with number of primary and backup keys (one or both will be zero).
+ * @throws IgniteCheckedException If failed.
*/
private T2<Integer, Integer> swapKeysCount(int nodeIdx, int part) throws IgniteCheckedException {
GridCacheContext ctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache().context();
@@ -1331,15 +1316,11 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
for (int i = 0; i < gridCount(); i++) {
IgniteCache<Integer, String> cache = jcache(i);
- IgniteCache<Integer, String> cacheAsync = cache.withAsync();
-
assertEquals(exp, cache.size(PRIMARY));
size += cache.localSize(PRIMARY);
- cacheAsync.size(PRIMARY);
-
- assertEquals(exp, cacheAsync.future().get());
+ assertEquals(exp, (int) cache.sizeAsync(PRIMARY).get());
}
assertEquals(exp, size);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java
index 3e6b0b0..a8eb01d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java
@@ -31,6 +31,7 @@ import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheEntry;
import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.testframework.junits.IgniteCacheConfigVariationsAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -180,7 +181,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
public void testRemovePutGetAsync() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- final IgniteCache cache = jcache().withKeepBinary().withAsync();
+ final IgniteCache cache = jcache().withKeepBinary();
final Set keys = new LinkedHashSet() {{
for (int i = 0; i < CNT; i++)
@@ -189,22 +190,17 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
runInAllTxModes(new TestRunnable() {
@Override public void run() throws Exception {
- for (Object key : keys) {
- cache.remove(key);
-
- cache.future().get();
- }
+ for (Object key : keys)
+ cache.removeAsync(key).get();
}
});
runInAllTxModes(new TestRunnable() {
@Override public void run() throws Exception {
for (Object key : keys) {
- cache.get(key);
- assertNull(cache.future().get());
+ assertNull(cache.getAsync(key).get());
- cache.getEntry(key);
- assertNull(cache.future().get());
+ assertNull(cache.getEntryAsync(key).get());
}
}
});
@@ -215,17 +211,14 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
@Override public void run() throws Exception {
Object val = value(valueOf(key));
- cache.put(key, val);
-
- cache.future().get();
+ cache.putAsync(key, val).get();
- cache.get(key);
- BinaryObject retVal = (BinaryObject)cache.future().get();
+ BinaryObject retVal = (BinaryObject)cache.getAsync(key).get();
assertEquals(val, retVal.deserialize());
- cache.getEntry(key);
- CacheEntry<BinaryObject, BinaryObject> e = (CacheEntry<BinaryObject, BinaryObject>)cache.future().get();
+ CacheEntry<BinaryObject, BinaryObject> e =
+ (CacheEntry<BinaryObject, BinaryObject>)cache.getEntryAsync(key).get();
assertEquals(key, deserializeBinary(e.getKey()));
@@ -311,7 +304,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
public void testPutAllGetAllAsync() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- final IgniteCache cache = jcache().withKeepBinary().withAsync();
+ final IgniteCache cache = jcache().withKeepBinary();
final Set keys = new LinkedHashSet() {{
for (int i = 0; i < CNT; i++)
@@ -320,8 +313,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
runInAllTxModes(new TestRunnable() {
@Override public void run() throws Exception {
- cache.getAll(keys);
- Map res = (Map)cache.future().get();
+ Map res = (Map)cache.getAllAsync(keys).get();
for (Object val : res.values())
assertNull(val);
@@ -330,9 +322,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
runInAllTxModes(new TestRunnable() {
@Override public void run() throws Exception {
- cache.<CacheEntry>getEntries(keys);
-
- Collection<CacheEntry> entries = (Collection<CacheEntry>)cache.future().get();
+ Collection<CacheEntry> entries =
+ (Collection<CacheEntry>)cache.<CacheEntry>getEntriesAsync(keys).get();
for (CacheEntry e : entries)
assertNull(e.getValue());
@@ -349,12 +340,10 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
}
}};
- cache.putAll(keyValMap);
-
- cache.future().get();
+ cache.putAllAsync(keyValMap).get();
- cache.getAll(keys);
- Set<Map.Entry<BinaryObject, BinaryObject>> set = ((Map)cache.future().get()).entrySet();
+ Set<Map.Entry<BinaryObject, BinaryObject>> set =
+ ((Map)cache.getAllAsync(keys).get()).entrySet();
for (Map.Entry<BinaryObject, BinaryObject> e : set) {
Object expVal = value(valueOf(e.getKey().deserialize()));
@@ -362,10 +351,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
assertEquals(expVal, e.getValue().deserialize());
}
- cache.getEntries(keys);
-
Collection<CacheEntry<BinaryObject, BinaryObject>> entries =
- (Collection<CacheEntry<BinaryObject, BinaryObject>>)cache.future().get();
+ (Collection<CacheEntry<BinaryObject, BinaryObject>>)cache.getEntriesAsync(keys).get();
for (CacheEntry<BinaryObject, BinaryObject> e : entries) {
assertTrue(e.getKey() instanceof BinaryObject);
@@ -375,9 +362,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
assertEquals(expVal, e.getValue().deserialize());
}
- cache.removeAll(keys);
+ cache.removeAllAsync(keys).get();
- cache.future().get();
}
});
}
@@ -575,7 +561,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
public void testInvokeAsync() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- final IgniteCache cache = jcache().withKeepBinary().withAsync();
+ final IgniteCache cache = jcache().withKeepBinary();
Set keys = new LinkedHashSet() {{
for (int i = 0; i < CNT; i++)
@@ -583,41 +569,27 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
}};
for (final Object key : keys) {
- cache.invoke(key, NOOP_ENTRY_PROC);
-
- Object res = cache.future().get();
+ Object res = cache.invokeAsync(key, NOOP_ENTRY_PROC).get();
assertNull(res);
- cache.get(key);
-
- assertNull(cache.future().get());
+ assertNull(cache.getAsync(key).get());
}
for (final Object key : keys) {
- cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
-
- Object res = cache.future().get();
+ Object res = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
assertNull(res);
- cache.get(key);
-
- assertEquals(value(0), deserializeBinary(cache.future().get()));
-
- cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
+ assertEquals(value(0), deserializeBinary(cache.getAsync(key).get()));
- res = cache.future().get();
+ res = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
assertEquals(value(0), deserializeBinary(res));
- cache.get(key);
+ assertEquals(value(1), deserializeBinary(cache.getAsync(key).get()));
- assertEquals(value(1), deserializeBinary(cache.future().get()));
-
- cache.remove(key);
-
- assertTrue((Boolean)cache.future().get());
+ assertTrue((Boolean)cache.removeAsync(key).get());
}
// TODO IGNITE-2973: should be always false.
@@ -625,30 +597,20 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
try {
for (final Object key : keys) {
- cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- Object res = cache.future().get();
+ Object res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
assertNull(res);
- cache.get(key);
-
- assertEquals(value(0), deserializeBinary(cache.future().get()));
+ assertEquals(value(0), deserializeBinary(cache.getAsync(key).get()));
- cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- res = cache.future().get();
+ res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
// TODO IGNITE-2953: uncomment the following assert when the issue will be fixed.
// assertEquals(value(0), res);
- cache.get(key);
-
- assertEquals(value(1), deserializeBinary(cache.future().get()));
+ assertEquals(value(1), deserializeBinary(cache.getAsync(key).get()));
- cache.remove(key);
-
- assertTrue((Boolean)cache.future().get());
+ assertTrue((Boolean)cache.removeAsync(key).get());
}
}
finally {
@@ -683,7 +645,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
public void checkInvokeAsyncTx(final TransactionConcurrency conc, final TransactionIsolation isolation) throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- final IgniteCache cache = jcache().withKeepBinary().withAsync();
+ final IgniteCache cache = jcache().withKeepBinary();
Set keys = new LinkedHashSet() {{
for (int i = 0; i < CNT; i++)
@@ -692,15 +654,11 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
for (final Object key : keys) {
- cache.invoke(key, NOOP_ENTRY_PROC);
-
- Object res = cache.future().get();
+ Object res = cache.invokeAsync(key, NOOP_ENTRY_PROC).get();
assertNull(res);
- cache.get(key);
-
- assertNull(cache.future().get());
+ assertNull(cache.getAsync(key).get());
}
tx.commit();
@@ -710,37 +668,31 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
Object res;
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
-
- res = cache.future().get();
+ res = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
tx.commit();
}
assertNull(res);
- cache.get(key);
+ assertEquals(value(0), deserializeBinary(cache.getAsync(key).get()));
- assertEquals(value(0), deserializeBinary(cache.future().get()));
+ IgniteFuture f;
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
+ f = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
tx.commit();
}
- res = cache.future().get();
+ res = f.get();
assertEquals(value(0), deserializeBinary(res));
- cache.get(key);
-
- assertEquals(value(1), deserializeBinary(cache.future().get()));
+ assertEquals(value(1), deserializeBinary(cache.getAsync(key).get()));
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.remove(key);
-
- assertTrue((Boolean)cache.future().get());
+ assertTrue((Boolean)cache.removeAsync(key).get());
tx.commit();
}
@@ -754,23 +706,17 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
Object res;
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- res = cache.future().get();
+ res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
tx.commit();
}
assertNull(res);
- cache.get(key);
-
- assertEquals(value(0), deserializeBinary(cache.future().get()));
+ assertEquals(value(0), deserializeBinary(cache.getAsync(key).get()));
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- res = cache.future().get();
+ res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
tx.commit();
}
@@ -778,14 +724,10 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
// TODO IGNITE-2953: uncomment the following assert when the issue will be fixed.
// assertEquals(value(0), res);
- cache.get(key);
-
- assertEquals(value(1), deserializeBinary(cache.future().get()));
+ assertEquals(value(1), deserializeBinary(cache.getAsync(key).get()));
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.remove(key);
-
- assertTrue((Boolean)cache.future().get());
+ assertTrue((Boolean)cache.removeAsync(key).get());
tx.commit();
}
@@ -988,17 +930,15 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
public void testInvokeAllAsync() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- final IgniteCache cache = jcache().withKeepBinary().withAsync();
+ final IgniteCache cache = jcache().withKeepBinary();
final Set keys = new LinkedHashSet() {{
for (int i = 0; i < CNT; i++)
add(key(i));
}};
- cache.invokeAll(keys, NOOP_ENTRY_PROC);
-
Map<Object, EntryProcessorResult<Object>> resMap =
- (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ (Map<Object, EntryProcessorResult<Object>>)cache.invokeAllAsync(keys, NOOP_ENTRY_PROC).get();
for (Map.Entry<Object, EntryProcessorResult<Object>> e : resMap.entrySet()) {
assertTrue("Wrong key type, binary object expected: " + e.getKey(), e.getKey() instanceof BinaryObject);
@@ -1006,41 +946,33 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
assertNull(e.getValue().get());
}
- cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
checkInvokeAllAsyncResult(cache, resMap, null, value(0), true);
- cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), true);
- cache.removeAll(keys);
-
- cache.future().get();
+ cache.removeAllAsync(keys).get();
// TODO IGNITE-2973: should be always false.
interceptorBinaryObjExp = atomicityMode() == TRANSACTIONAL;
try {
- cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
checkInvokeAllAsyncResult(cache, resMap, null, value(0), false);
- cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), false);
- cache.removeAll(keys);
-
- cache.future().get();
+ cache.removeAllAsync(keys).get();
}
finally {
interceptorBinaryObjExp = true;
@@ -1070,12 +1002,12 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
*
* @param conc Concurrency.
* @param isolation Isolation.
- * @throws Exception
+ * @throws Exception If failed.
*/
private void checkInvokeAllAsycnTx(final TransactionConcurrency conc, final TransactionIsolation isolation) throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- final IgniteCache cache = jcache().withKeepBinary().withAsync();
+ final IgniteCache cache = jcache().withKeepBinary();
final Set keys = new LinkedHashSet() {{
for (int i = 0; i < CNT; i++)
@@ -1085,9 +1017,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
Map<Object, EntryProcessorResult<Object>> resMap;
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invokeAll(keys, NOOP_ENTRY_PROC);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, NOOP_ENTRY_PROC).get();
tx.commit();
}
@@ -1099,9 +1030,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
}
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
tx.commit();
}
@@ -1109,9 +1039,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
checkInvokeAllAsyncResult(cache, resMap, null, value(0), true);
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get();
tx.commit();
}
@@ -1119,9 +1048,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), true);
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.removeAll(keys);
-
- cache.future().get();
+ cache.removeAllAsync(keys).get();
tx.commit();
}
@@ -1131,9 +1058,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
try {
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
tx.commit();
}
@@ -1141,9 +1067,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
checkInvokeAllAsyncResult(cache, resMap, null, value(0), false);
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode);
-
- resMap = (Map<Object, EntryProcessorResult<Object>>)cache.future().get();
+ resMap = (Map<Object, EntryProcessorResult<Object>>)
+ cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get();
tx.commit();
}
@@ -1151,9 +1076,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), false);
try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) {
- cache.removeAll(keys);
-
- cache.future().get();
+ cache.removeAllAsync(keys).get();
tx.commit();
}
@@ -1185,9 +1108,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
if (deserializeRes)
assertEquals(expRes, deserializeRes ? deserializeBinary(res) : res);
- cache.get(e.getKey());
-
- assertEquals(cacheVal, deserializeBinary(cache.future().get()));
+ assertEquals(cacheVal, deserializeBinary(cache.getAsync(e.getKey()).get()));
}
}
@@ -1203,6 +1124,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA
/**
* @param task Task.
+ * @throws Exception If failed.
*/
protected void runInAllTxModes(TestRunnable task) throws Exception {
info("Executing implicite tx");
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
index 1e05400..bc9214f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
@@ -102,8 +102,6 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
IgniteCache cache = ignite(0).cache(null).withKeepBinary();
- IgniteCache asyncCache = cache.withAsync();
-
cache.put(new TestKey(1), new TestValue(10));
cache.put(new TestKey(1), new TestValue(10));
@@ -111,16 +109,14 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
BinaryObject obj = (BinaryObject)cache.get(new TestKey(1));
assertEquals(10, (int)obj.field("val"));
- asyncCache.get(new TestKey(1));
- obj = (BinaryObject)asyncCache.future().get();
+ obj = (BinaryObject)cache.getAsync(new TestKey(1)).get();
assertEquals(10, (int)obj.field("val"));
Cache.Entry<BinaryObject, BinaryObject> e = (Cache.Entry)cache.getEntry(new TestKey(1));
assertEquals(1, (int)e.getKey().field("key"));
assertEquals(10, (int)e.getValue().field("val"));
- asyncCache.getEntry(new TestKey(1));
- e = (Cache.Entry)asyncCache.future().get();
+ e = (Cache.Entry)cache.getEntryAsync(new TestKey(1)).get();
assertEquals(1, (int)e.getKey().field("key"));
assertEquals(10, (int)e.getValue().field("val"));
@@ -157,8 +153,6 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
IgniteCache cache = ignite(0).cache(null).withKeepBinary();
- IgniteCache asyncCache = cache.withAsync();
-
cache.put(1, 10);
cache.put(1, 10);
@@ -166,16 +160,14 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
Integer obj = (Integer)cache.get(1);
assertEquals((Integer)10, obj);
- asyncCache.get(1);
- obj = (Integer)asyncCache.future().get();
+ obj = (Integer)cache.getAsync(1).get();
assertEquals((Integer)10, obj);
Cache.Entry<Integer, Integer> e = (Cache.Entry)cache.getEntry(1);
assertEquals((Integer)1, e.getKey());
assertEquals((Integer)10, e.getValue());
- asyncCache.getEntry(1);
- e = (Cache.Entry)asyncCache.future().get();
+ e = (Cache.Entry)cache.getEntryAsync(1).get();
assertEquals((Integer)1, e.getKey());
assertEquals((Integer)10, e.getValue());
[30/50] [abbrv] ignite git commit: IGNITE-4650: Now queries are
executed in QUERY_POOL. This closes #1534.
Posted by ag...@apache.org.
IGNITE-4650: Now queries are executed in QUERY_POOL. This closes #1534.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3f8cdea9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3f8cdea9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3f8cdea9
Branch: refs/heads/ignite-4003
Commit: 3f8cdea95596cf11d51db2ad3fa773ecc174f13a
Parents: eab8334
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Mar 27 17:43:32 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 17:43:32 2017 +0300
----------------------------------------------------------------------
.../query/GridCacheDistributedQueryManager.java | 7 +-
.../cache/query/GridCacheLocalQueryFuture.java | 3 +-
.../query/IgniteQueryDedicatedPoolTest.java | 223 +++++++++++++++++++
.../query/IgniteSqlQueryDedicatedPoolTest.java | 110 ---------
.../IgniteCacheQuerySelfTestSuite.java | 4 +-
5 files changed, 231 insertions(+), 116 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8cdea9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
index eb5e214..06a3416 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.util.GridBoundedConcurrentOrderedSet;
@@ -324,7 +325,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
node,
topic,
res,
- cctx.ioPolicy(),
+ GridIoPolicy.QUERY_POOL,
timeout > 0 ? timeout : Long.MAX_VALUE);
return true;
@@ -799,7 +800,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
// For example, a remote reducer has a state, we should not serialize and then send
// the reducer changed by the local node.
if (!F.isEmpty(rmtNodes)) {
- cctx.io().safeSend(rmtNodes, req, cctx.ioPolicy(), new P1<ClusterNode>() {
+ cctx.io().safeSend(rmtNodes, req, GridIoPolicy.QUERY_POOL, new P1<ClusterNode>() {
@Override public boolean apply(ClusterNode node) {
fut.onNodeLeft(node.id());
@@ -817,7 +818,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
return null;
}
- });
+ }, GridIoPolicy.QUERY_POOL);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8cdea9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
index 6eaca29..3762ef7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.query;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.util.lang.GridPlainRunnable;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -54,7 +55,7 @@ public class GridCacheLocalQueryFuture<K, V, R> extends GridCacheQueryFutureAdap
* Executes query runnable.
*/
void execute() {
- fut = cctx.kernalContext().closure().runLocalSafe(run, true);
+ fut = cctx.kernalContext().closure().runLocalSafe(run, GridIoPolicy.QUERY_POOL);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8cdea9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
new file mode 100644
index 0000000..711db2f
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SpiQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.managers.communication.GridIoManager;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
+import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.spi.IgniteSpiAdapter;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.indexing.IndexingQueryFilter;
+import org.apache.ignite.spi.indexing.IndexingSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Ensures that SQL queries are executed in a dedicated thread pool.
+ */
+public class IgniteQueryDedicatedPoolTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Name of the cache for test */
+ private static final String CACHE_NAME = "query_pool_test";
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ startGrid("server");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+
+ spi.setIpFinder(IP_FINDER);
+
+ CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+
+ ccfg.setIndexedTypes(Integer.class, Integer.class);
+ ccfg.setIndexedTypes(Byte.class, Byte.class);
+ ccfg.setSqlFunctionClasses(IgniteQueryDedicatedPoolTest.class);
+ ccfg.setName(CACHE_NAME);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ if ("client".equals(gridName))
+ cfg.setClientMode(true);
+
+
+ cfg.setIndexingSpi(new TestIndexingSpi());
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * Tests that SQL queries are executed in dedicated pool
+ * @throws Exception If failed.
+ */
+ public void testSqlQueryUsesDedicatedThreadPool() throws Exception {
+ try (Ignite client = startGrid("client")) {
+ IgniteCache<Integer, Integer> cache = client.cache(CACHE_NAME);
+
+ QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery("select currentPolicy()"));
+
+ List<List<?>> result = cursor.getAll();
+
+ cursor.close();
+
+ assertEquals(1, result.size());
+
+ Byte plc = (Byte)result.get(0).get(0);
+
+ assert plc != null;
+ assert plc == GridIoPolicy.QUERY_POOL;
+ }
+ }
+
+ /**
+ * Tests that Scan queries are executed in dedicated pool
+ * @throws Exception If failed.
+ */
+ public void testScanQueryUsesDedicatedThreadPool() throws Exception {
+ try (Ignite client = startGrid("client")) {
+ IgniteCache<Integer, Integer> cache = client.cache(CACHE_NAME);
+
+ cache.put(0, 0);
+
+ QueryCursor<Cache.Entry<Object, Object>> cursor = cache.query(
+ new ScanQuery<>(new IgniteBiPredicate<Object, Object>() {
+ @Override public boolean apply(Object o, Object o2) {
+ return F.eq(GridIoManager.currentPolicy(), GridIoPolicy.QUERY_POOL);
+ }
+ }));
+
+ assertEquals(1, cursor.getAll().size());
+
+ cursor.close();
+ }
+ }
+
+ /**
+ * Tests that SPI queries are executed in dedicated pool
+ * @throws Exception If failed.
+ */
+ public void testSpiQueryUsesDedicatedThreadPool() throws Exception {
+ try (Ignite client = startGrid("client")) {
+ IgniteCache<Byte, Byte> cache = client.cache(CACHE_NAME);
+
+ for (byte b = 0; b < Byte.MAX_VALUE; ++b)
+ cache.put(b, b);
+
+ QueryCursor<Cache.Entry<Byte, Byte>> cursor = cache.query(new SpiQuery<Byte, Byte>());
+
+ List<Cache.Entry<Byte, Byte>> all = cursor.getAll();
+
+ assertEquals(1, all.size());
+ assertEquals(GridIoPolicy.QUERY_POOL, (byte)all.get(0).getValue());
+
+ cursor.close();
+ }
+ }
+
+ /**
+ * Custom SQL function to return current thread name from inside query executor
+ * @return Current IO policy
+ */
+ @SuppressWarnings("unused")
+ @QuerySqlFunction(alias = "currentPolicy")
+ public static Byte currentPolicy() {
+ return GridIoManager.currentPolicy();
+ }
+
+ /**
+ * Indexing Spi implementation for test
+ */
+ private static class TestIndexingSpi extends IgniteSpiAdapter implements IndexingSpi {
+ /** Index. */
+ private final SortedMap<Object, Object> idx = new TreeMap<>();
+
+ /** {@inheritDoc} */
+ @Override public void spiStart(@Nullable String gridName) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void spiStop() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public Iterator<Cache.Entry<?, ?>> query(@Nullable String spaceName, Collection<Object> params,
+ @Nullable IndexingQueryFilter filters) {
+ return idx.containsKey(GridIoPolicy.QUERY_POOL) ?
+ Collections.<Cache.Entry<?, ?>>singletonList(
+ new CacheEntryImpl<>(GridIoPolicy.QUERY_POOL, GridIoPolicy.QUERY_POOL)).iterator()
+ : Collections.<Cache.Entry<?, ?>>emptyList().iterator();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void store(@Nullable String spaceName, Object key, Object val, long expirationTime) {
+ idx.put(key, val);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void remove(@Nullable String spaceName, Object key) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSwap(@Nullable String spaceName, Object key) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) {
+ // No-op.
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8cdea9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlQueryDedicatedPoolTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlQueryDedicatedPoolTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlQueryDedicatedPoolTest.java
deleted file mode 100644
index bba3642..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlQueryDedicatedPoolTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.managers.communication.GridIoManager;
-import org.apache.ignite.internal.managers.communication.GridIoPolicy;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import java.util.List;
-
-/**
- * Ensures that SQL queries are executed in a dedicated thread pool.
- */
-public class IgniteSqlQueryDedicatedPoolTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** Name of the cache for test */
- private static final String CACHE_NAME = "query_pool_test";
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- startGrid("server");
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
-
- spi.setIpFinder(IP_FINDER);
-
- CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
-
- ccfg.setIndexedTypes(Integer.class, Integer.class);
- ccfg.setSqlFunctionClasses(IgniteSqlQueryDedicatedPoolTest.class);
- ccfg.setName(CACHE_NAME);
-
- cfg.setCacheConfiguration(ccfg);
-
- if ("client".equals(gridName))
- cfg.setClientMode(true);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
-
- stopAllGrids();
- }
-
- /**
- * Test that SQL queries are executed in dedicated pool
- */
- public void testSqlQueryUsesDedicatedThreadPool() throws Exception {
- try (Ignite client = startGrid("client")) {
- IgniteCache<Integer, Integer> cache = client.cache(CACHE_NAME);
-
- QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery("select currentPolicy()"));
-
- List<List<?>> result = cursor.getAll();
-
- cursor.close();
-
- assertEquals(1, result.size());
-
- Byte plc = (Byte)result.get(0).get(0);
-
- assert plc != null;
- assert plc == GridIoPolicy.QUERY_POOL;
- }
- }
-
- /**
- * Custom SQL function to return current thread name from inside query executor
- */
- @SuppressWarnings("unused")
- @QuerySqlFunction(alias = "currentPolicy")
- public static Byte currentPolicy() {
- return GridIoManager.currentPolicy();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8cdea9/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 7d49fb4..5b74de7 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -98,7 +98,7 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheSwapScanQueryS
import org.apache.ignite.internal.processors.cache.query.IgniteCacheQueryCacheDestroySelfTest;
import org.apache.ignite.internal.processors.cache.query.IndexingSpiQuerySelfTest;
import org.apache.ignite.internal.processors.cache.query.IndexingSpiQueryTxSelfTest;
-import org.apache.ignite.internal.processors.query.IgniteSqlQueryDedicatedPoolTest;
+import org.apache.ignite.internal.processors.query.IgniteQueryDedicatedPoolTest;
import org.apache.ignite.internal.processors.query.IgniteSqlEntryCacheModeAgnosticTest;
import org.apache.ignite.internal.processors.query.IgniteSqlSchemaIndexingTest;
import org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexSelfTest;
@@ -249,7 +249,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(CacheOffheapBatchIndexingSingleTypeTest.class);
suite.addTestSuite(CacheSqlQueryValueCopySelfTest.class);
suite.addTestSuite(IgniteCacheQueryCacheDestroySelfTest.class);
- suite.addTestSuite(IgniteSqlQueryDedicatedPoolTest.class);
+ suite.addTestSuite(IgniteQueryDedicatedPoolTest.class);
suite.addTestSuite(IgniteSqlEntryCacheModeAgnosticTest.class);
suite.addTestSuite(QueryEntityCaseMismatchTest.class);
[15/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/ComputeJobCancelWithServiceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ComputeJobCancelWithServiceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ComputeJobCancelWithServiceSelfTest.java
index bf23bdf..9c3611c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ComputeJobCancelWithServiceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ComputeJobCancelWithServiceSelfTest.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.compute.ComputeJob;
@@ -71,11 +70,7 @@ public class ComputeJobCancelWithServiceSelfTest extends GridCommonAbstractTest
Ignite client = startGrid("client");
- IgniteCompute compute = client.compute().withAsync();
-
- compute.execute(new MyTask(), null);
-
- ComputeTaskFuture<Integer> fut = compute.future();
+ ComputeTaskFuture<Integer> fut = client.compute().executeAsync(new MyTask(), null);
Thread.sleep(3000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
index 75affc4..61ed2b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
@@ -59,7 +59,7 @@ public class GridCancelOnGridStopSelfTest extends GridCommonAbstractTest {
try (Ignite g = startGrid(1)) {
cnt = new CountDownLatch(1);
- g.compute().withAsync().execute(CancelledTask.class, null);
+ g.compute().executeAsync(CancelledTask.class, null);
cnt.await();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
index 79b6505..39677c5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
@@ -54,7 +53,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonTest;
*/
@GridCommonTest(group = "Kernal Self")
public class GridCancelledJobsMetricsSelfTest extends GridCommonAbstractTest {
-
/** */
private static GridCancelCollisionSpi colSpi = new GridCancelCollisionSpi();
@@ -87,13 +85,8 @@ public class GridCancelledJobsMetricsSelfTest extends GridCommonAbstractTest {
Collection<ComputeTaskFuture<?>> futs = new ArrayList<>();
- IgniteCompute comp = ignite.compute().withAsync();
-
- for (int i = 1; i <= 10; i++) {
- comp.execute(CancelledTask.class, null);
-
- futs.add(comp.future());
- }
+ for (int i = 1; i <= 10; i++)
+ futs.add(ignite.compute().executeAsync(CancelledTask.class, null));
// Wait to be sure that metrics were updated.
GridTestUtils.waitForCondition(new GridAbsPredicate() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
index d224fc5..6589dce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
@@ -28,7 +28,6 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
@@ -75,15 +74,9 @@ public class GridContinuousTaskSelfTest extends GridCommonAbstractTest {
try {
Ignite ignite = startGrid(0);
- IgniteCompute comp = ignite.compute().withAsync();
+ ComputeTaskFuture<Integer> fut1 = ignite.compute().executeAsync(TestJobsChainTask.class, true);
- comp.execute(TestJobsChainTask.class, true);
-
- ComputeTaskFuture<Integer> fut1 = comp.future();
-
- comp.execute(TestJobsChainTask.class, false);
-
- ComputeTaskFuture<Integer> fut2 = comp.future();
+ ComputeTaskFuture<Integer> fut2 = ignite.compute().executeAsync(TestJobsChainTask.class, false);
assert fut1.get() == 55;
assert fut2.get() == 55;
@@ -105,15 +98,9 @@ public class GridContinuousTaskSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override public void run() {
try {
- IgniteCompute comp = ignite.compute().withAsync();
-
- comp.execute(TestJobsChainTask.class, true);
-
- ComputeTaskFuture<Integer> fut1 = comp.future();
-
- comp.execute(TestJobsChainTask.class, false);
+ ComputeTaskFuture<Integer> fut1 = ignite.compute().executeAsync(TestJobsChainTask.class, true);
- ComputeTaskFuture<Integer> fut2 = comp.future();
+ ComputeTaskFuture<Integer> fut2 = ignite.compute().executeAsync(TestJobsChainTask.class, false);
assert fut1.get() == 55;
assert fut2.get() == 55;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
index c78003a..30a16b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
@@ -361,14 +360,9 @@ public class GridEventStorageCheckAllEventsSelfTest extends GridCommonAbstractTe
* @throws Exception If failed.
*/
private ComputeTaskFuture<?> generateEvents(@Nullable Long timeout, ComputeJob job) throws Exception {
- IgniteCompute comp = ignite.compute().withAsync();
-
- if (timeout == null)
- comp.execute(GridAllEventsTestTask.class.getName(), job);
- else
- comp.withTimeout(timeout).execute(GridAllEventsTestTask.class.getName(), job);
-
- return comp.future();
+ return timeout == null
+ ? ignite.compute().executeAsync(GridAllEventsTestTask.class.getName(), job)
+ : ignite.compute().withTimeout(timeout).executeAsync(GridAllEventsTestTask.class.getName(), job);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
index 6f70373..ea0c6eb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
@@ -24,7 +24,6 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
@@ -96,11 +95,7 @@ public class GridFailoverCustomTopologySelfTest extends GridCommonAbstractTest {
ComputeTaskFuture<String> fut;
synchronized(mux){
- IgniteCompute comp = ignite1.compute().withAsync();
-
- comp.execute(JobTask.class, null);
-
- fut = comp.future();
+ fut = ignite1.compute().executeAsync(JobTask.class, null);
mux.wait();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
index 608eab4..0a55de1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.affinity.Affinity;
@@ -152,7 +151,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
Ignite g = startGrid(0);
- g.compute().withAsync().execute(new TestTask(1), null);
+ g.compute().executeAsync(new TestTask(1), null);
jobLatch.await();
@@ -189,8 +188,8 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
int lastGridIdx = GRID_CNT - 1;
- compute(grid(lastGridIdx).cluster().forPredicate(excludeLastPredicate())).withAsync().
- execute(new TestTask(GRID_CNT - 1), null);
+ compute(grid(lastGridIdx).cluster().forPredicate(excludeLastPredicate()))
+ .executeAsync(new TestTask(GRID_CNT - 1), null);
jobLatch.await();
@@ -214,8 +213,8 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
int lastGridIdx = GRID_CNT - 1;
- compute(grid(lastGridIdx).cluster().forPredicate(excludeLastPredicate())).withAsync().
- execute(new TestTask(GRID_CNT - 1), null);
+ compute(grid(lastGridIdx).cluster().forPredicate(excludeLastPredicate()))
+ .executeAsync(new TestTask(GRID_CNT - 1), null);
jobLatch.await();
@@ -243,8 +242,8 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
int lastGridIdx = GRID_CNT - 1;
- compute(grid(lastGridIdx).cluster().forPredicate(excludeLastPredicate())).withAsync().
- execute(new TestTask(GRID_CNT - 1), null);
+ compute(grid(lastGridIdx).cluster().forPredicate(excludeLastPredicate()))
+ .executeAsync(new TestTask(GRID_CNT - 1), null);
jobLatch.await();
@@ -273,11 +272,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testApply1() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup grid) {
- IgniteCompute comp = compute(grid).withAsync();
-
- comp.apply(new TestClosure(), "arg");
-
- return comp.future();
+ return compute(grid).applyAsync(new TestClosure(), "arg");
}
});
}
@@ -288,11 +283,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testApply2() throws Exception {
testMasterLeaveAwareCallback(2, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup grid) {
- IgniteCompute comp = compute(grid).withAsync();
-
- comp.apply(new TestClosure(), Arrays.asList("arg1", "arg2"));
-
- return comp.future();
+ return compute(grid).applyAsync(new TestClosure(), Arrays.asList("arg1", "arg2"));
}
});
}
@@ -303,9 +294,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testApply3() throws Exception {
testMasterLeaveAwareCallback(2, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup grid) {
- IgniteCompute comp = compute(grid).withAsync();
-
- comp.apply(new TestClosure(),
+ return compute(grid).applyAsync(new TestClosure(),
Arrays.asList("arg1", "arg2"),
new IgniteReducer<Void, Object>() {
@Override public boolean collect(@Nullable Void aVoid) {
@@ -316,8 +305,6 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
return null;
}
});
-
- return comp.future();
}
});
}
@@ -328,11 +315,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testRun1() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.run(new TestRunnable());
-
- return comp.future();
+ return compute(prj).runAsync(new TestRunnable());
}
});
}
@@ -343,11 +326,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testRun2() throws Exception {
testMasterLeaveAwareCallback(2, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.run(Arrays.asList(new TestRunnable(), new TestRunnable()));
-
- return comp.future();
+ return compute(prj).runAsync(Arrays.asList(new TestRunnable(), new TestRunnable()));
}
});
}
@@ -358,11 +337,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testCall1() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.call(new TestCallable());
-
- return comp.future();
+ return compute(prj).callAsync(new TestCallable());
}
});
}
@@ -373,11 +348,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testCall2() throws Exception {
testMasterLeaveAwareCallback(2, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.call(Arrays.asList(new TestCallable(), new TestCallable()));
-
- return comp.future();
+ return compute(prj).callAsync(Arrays.asList(new TestCallable(), new TestCallable()));
}
});
}
@@ -388,9 +359,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testCall3() throws Exception {
testMasterLeaveAwareCallback(2, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.call(
+ return compute(prj).callAsync(
Arrays.asList(new TestCallable(), new TestCallable()),
new IgniteReducer<Void, Object>() {
@Override public boolean collect(@Nullable Void aVoid) {
@@ -401,8 +370,6 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
return null;
}
});
-
- return comp.future();
}
});
}
@@ -413,11 +380,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testBroadcast1() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(new TestRunnable());
-
- return comp.future();
+ return compute(prj).broadcastAsync(new TestRunnable());
}
});
}
@@ -428,11 +391,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testBroadcast2() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(new TestCallable());
-
- return comp.future();
+ return compute(prj).broadcastAsync(new TestCallable());
}
});
}
@@ -443,11 +402,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testBroadcast3() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(new TestClosure(), "arg");
-
- return comp.future();
+ return compute(prj).broadcastAsync(new TestClosure(), "arg");
}
});
}
@@ -458,15 +413,11 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testAffinityRun() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
Affinity<Object> aff = prj.ignite().affinity(null);
ClusterNode node = F.first(prj.nodes());
- comp.affinityRun((String)null, keyForNode(aff, node), new TestRunnable());
-
- return comp.future();
+ return compute(prj).affinityRunAsync((String)null, keyForNode(aff, node), new TestRunnable());
}
});
}
@@ -477,15 +428,11 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
public void testAffinityCall() throws Exception {
testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
- IgniteCompute comp = compute(prj).withAsync();
-
Affinity<Object> aff = prj.ignite().affinity(null);
ClusterNode node = F.first(prj.nodes());
- comp.affinityCall((String)null, keyForNode(aff, node), new TestCallable());
-
- return comp.future();
+ return compute(prj).affinityCallAsync((String)null, keyForNode(aff, node), new TestCallable());
}
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
index 0970ba4..5776a15 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
@@ -21,9 +21,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cache.affinity.AffinityKeyMapped;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.CAX;
@@ -162,11 +160,7 @@ public class GridMultipleJobsSelfTest extends GridCommonAbstractTest {
throw new IgniteCheckedException("Could not instantiate a job.", e);
}
- IgniteCompute comp = ignite1.compute().withAsync();
-
- comp.call(job);
-
- ComputeTaskFuture<Boolean> fut = comp.future();
+ IgniteFuture<Boolean> fut = ignite1.compute().callAsync(job);
if (cnt % LOG_MOD == 0)
X.println("Submitted jobs: " + cnt);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridReduceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridReduceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridReduceSelfTest.java
index 4b89241..827e2a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridReduceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridReduceSelfTest.java
@@ -20,11 +20,10 @@ package org.apache.ignite.internal;
import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.internal.util.typedef.R1;
import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -90,9 +89,7 @@ public class GridReduceSelfTest extends GridCommonAbstractTest {
List<ReducerTestClosure> closures = closures(ignite.cluster().nodes().size());
- IgniteCompute comp = compute(ignite.cluster().forLocal()).withAsync();
-
- comp.call(closures, new R1<Long, Long>() {
+ IgniteFuture<Long> fut = compute(ignite.cluster().forLocal()).callAsync(closures, new R1<Long, Long>() {
private long sum;
@Override public boolean collect(Long e) {
@@ -109,8 +106,6 @@ public class GridReduceSelfTest extends GridCommonAbstractTest {
}
});
- ComputeTaskFuture<Long> fut = comp.future();
-
assertEquals((Long)1L, fut.get());
assertTrue(closures.get(0).isFinished);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridTaskCancelSingleNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskCancelSingleNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskCancelSingleNodeSelfTest.java
index 0557e04..950f89d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskCancelSingleNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskCancelSingleNodeSelfTest.java
@@ -22,7 +22,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
@@ -118,11 +117,7 @@ public class GridTaskCancelSingleNodeSelfTest extends GridCommonAbstractTest {
}
}, EVT_JOB_STARTED, EVT_JOB_FINISHED, EVT_JOB_CANCELLED, EVT_JOB_REJECTED);
- IgniteCompute comp = grid().compute().withAsync();
-
- comp.execute(TestTask.class, null);
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = grid().compute().executeAsync(TestTask.class, null);
if (timeoutBeforeCancel > 0L)
Thread.sleep(timeoutBeforeCancel);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
index 996acd6..a98c578 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
@@ -68,11 +68,7 @@ public class GridTaskExecutionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testSynchronousExecute() throws Exception {
- IgniteCompute comp = ignite.compute().withAsync();
-
- assertNull(comp.execute(GridTestTask.class, "testArg"));
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite.compute().executeAsync(GridTestTask.class, "testArg");
assert fut != null;
@@ -89,10 +85,10 @@ public class GridTaskExecutionSelfTest extends GridCommonAbstractTest {
ArrayList<IgniteFuture<Object>> futs = new ArrayList<>(2016);
- IgniteCompute compute = grid(1).compute(grid(1).cluster().forNodeId(grid(3).localNode().id())).withAsync();
+ IgniteCompute compute = grid(1).compute(grid(1).cluster().forNodeId(grid(3).localNode().id()));
for (int i = 0; i < 1000; i++) {
- compute.call(new IgniteCallable<Object>() {
+ futs.add(compute.callAsync(new IgniteCallable<Object>() {
@JobContextResource
ComputeJobContext ctx;
@@ -107,9 +103,7 @@ public class GridTaskExecutionSelfTest extends GridCommonAbstractTest {
return null;
}
- });
-
- futs.add(compute.future());
+ }));
}
info("Finished first loop.");
@@ -118,10 +112,10 @@ public class GridTaskExecutionSelfTest extends GridCommonAbstractTest {
idx.set(locId);
- IgniteCompute compute1 = grid(2).compute(grid(2).cluster().forNodeId(grid(3).localNode().id())).withAsync();
+ IgniteCompute compute1 = grid(2).compute(grid(2).cluster().forNodeId(grid(3).localNode().id()));
for (int i = 0; i < 100; i++) {
- compute1.call(new IgniteCallable<Object>() {
+ futs.add(compute1.callAsync(new IgniteCallable<Object>() {
@JobContextResource
ComputeJobContext ctx;
@@ -136,9 +130,7 @@ public class GridTaskExecutionSelfTest extends GridCommonAbstractTest {
return null;
}
- });
-
- futs.add(compute1.future());
+ }));
}
for (IgniteFuture<Object> fut : futs)
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
index 5760c19..da6875c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -110,8 +109,6 @@ public class GridTaskFailoverAffinityRunTest extends GridCommonAbstractTest {
assertEquals((Boolean)clientMode, grid(0).configuration().isClientMode());
- IgniteCompute comp = grid(0).compute().withAsync();
-
final AtomicBoolean stop = new AtomicBoolean();
final AtomicInteger gridIdx = new AtomicInteger(1);
@@ -137,9 +134,7 @@ public class GridTaskFailoverAffinityRunTest extends GridCommonAbstractTest {
Collection<IgniteFuture<?>> futs = new ArrayList<>(1000);
for (int i = 0; i < 1000; i++) {
- comp.affinityCall((String)null, i, new TestJob());
-
- IgniteFuture<?> fut0 = comp.future();
+ IgniteFuture<?> fut0 = grid(0).compute().affinityCallAsync((String)null, i, new TestJob());
assertNotNull(fut0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridTaskInstanceExecutionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskInstanceExecutionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskInstanceExecutionSelfTest.java
index 32fc350..2f153bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskInstanceExecutionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskInstanceExecutionSelfTest.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.List;
import org.apache.ignite.GridTestTask;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobResult;
@@ -59,11 +58,7 @@ public class GridTaskInstanceExecutionSelfTest extends GridCommonAbstractTest {
assert task.getState() != null;
assert task.getState() == testState;
- IgniteCompute comp = ignite.compute().withAsync();
-
- assertNull(comp.execute(task, "testArg"));
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite.compute().executeAsync(task, "testArg");
assert fut != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/GridTaskJobRejectSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskJobRejectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskJobRejectSelfTest.java
index ed3ad63..68abc95 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskJobRejectSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskJobRejectSelfTest.java
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
@@ -126,9 +125,7 @@ public class GridTaskJobRejectSelfTest extends GridCommonAbstractTest {
final ClusterNode node = grid(1).localNode();
- IgniteCompute comp = grid(1).compute().withAsync();
-
- comp.execute(new ComputeTaskAdapter<Void, Void>() {
+ ComputeTaskFuture<?> fut = grid(1).compute().executeAsync(new ComputeTaskAdapter<Void, Void>() {
@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable Void arg) {
return F.asMap(new SleepJob(), node, new SleepJob(), node);
@@ -140,8 +137,6 @@ public class GridTaskJobRejectSelfTest extends GridCommonAbstractTest {
}
}, null);
- ComputeTaskFuture<?> fut = comp.future();
-
assert startedLatch.await(2, SECONDS);
fut.cancel();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
index 31f72e7..37ca6bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
@@ -362,14 +362,10 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
- IgniteCache<Object, Object> async = dfltCache.withAsync();
-
boolean failed = false;
try {
- async.put(10002, 10002);
-
- async.future().get();
+ dfltCache.putAsync(10002, 10002).get();
}
catch (CacheException e) {
failed = true;
@@ -379,9 +375,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
assertTrue(failed);
- async.put(10002, 10002);
-
- return async.future().get();
+ return dfltCache.putAsync(10002, 10002).get();
}
},
new C1<Object, Boolean>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
index 49a97bd..489979f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
@@ -22,11 +22,11 @@ import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterGroupEmptyException;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -80,23 +80,15 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
assertEquals(0, empty.nodes().size());
- IgniteCompute comp = ignite(0).compute(empty).withAsync();
+ IgniteCompute comp = ignite(0).compute(empty);
- comp.affinityRun((String)null, 1, new FailRunnable());
+ checkFutureFails(comp.affinityRunAsync((String)null, 1, new FailRunnable()));
- checkFutureFails(comp);
+ checkFutureFails(comp.applyAsync(new FailClosure(), new Object()));
- comp.apply(new FailClosure(), new Object());
+ checkFutureFails(comp.affinityCallAsync((String)null, 1, new FailCallable()));
- checkFutureFails(comp);
-
- comp.affinityCall((String)null, 1, new FailCallable());
-
- checkFutureFails(comp);
-
- comp.broadcast(new FailCallable());
-
- checkFutureFails(comp);
+ checkFutureFails(comp.broadcastAsync(new FailCallable()));
}
/**
@@ -145,11 +137,9 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
}
/**
- * @param comp Compute.
+ * @param fut Future.
*/
- private void checkFutureFails(IgniteCompute comp) {
- final ComputeTaskFuture fut = comp.future();
-
+ private void checkFutureFails(final IgniteFuture fut) {
assertNotNull(fut);
GridTestUtils.assertThrows(log, new Callable<Void>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
index 87baa49..0551ec6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
@@ -86,8 +86,6 @@ public class CacheConcurrentReadThroughTest extends GridCommonAbstractTest {
assertTrue(client.configuration().isClientMode());
- IgniteCompute compute = client.compute().withAsync();
-
for (int iter = 0; iter < 10; iter++) {
CacheConfiguration ccfg = new CacheConfiguration();
@@ -107,7 +105,7 @@ public class CacheConcurrentReadThroughTest extends GridCommonAbstractTest {
Collection<IgniteFuture<?>> futs = new ArrayList<>();
for (int i = 0; i < SYS_THREADS * 3; i++) {
- compute.run(new IgniteRunnable() {
+ futs.add(client.compute().runAsync(new IgniteRunnable() {
@IgniteInstanceResource
private transient Ignite ignite;
@@ -119,9 +117,7 @@ public class CacheConcurrentReadThroughTest extends GridCommonAbstractTest {
if (v == null)
throw new IgniteException("Failed to get value");
}
- });
-
- futs.add(compute.future());
+ }));
}
for (IgniteFuture<?> fut : futs)
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
index 78145d2..1b93623 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
@@ -114,15 +114,11 @@ public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
IgniteCache<Object, Object> clientCache = nearCache ? client.createNearCache(cacheName,
new NearCacheConfiguration<>()) : client.cache(cacheName);
- IgniteCache<Object, Object> asyncCache = clientCache.withAsync();
-
fail = true;
- asyncCache.get("key");
-
final CountDownLatch futLatch = new CountDownLatch(1);
- asyncCache.future().listen(new IgniteInClosure<IgniteFuture<Object>>() {
+ clientCache.getAsync("key").listen(new IgniteInClosure<IgniteFuture<Object>>() {
@Override public void apply(IgniteFuture<Object> fut) {
assertTrue(fut.isDone());
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
index 25b7404..bd43956 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -165,12 +166,12 @@ public class CachePutEventListenerErrorSelfTest extends GridCommonAbstractTest {
cfg.setAtomicityMode(atomicityMode);
cfg.setMemoryMode(memMode);
- IgniteCache<Integer, Integer> cache = ignite.createCache(cfg).withAsync();
+ IgniteCache<Integer, Integer> cache = ignite.createCache(cfg);
- cache.put(0, 0);
+ IgniteFuture f = cache.putAsync(0, 0);
try {
- cache.future().get(2000);
+ f.get(2000);
assert false : "Exception was not thrown";
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 09a0d9a..850561f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -203,14 +203,12 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
try {
final Ignite g = startGrid(name);
- IgniteCache<String, Object> cache = g.<String, Object>cache(null).withAsync();
+ IgniteCache<String, Object> cache = g.cache(null);
for (int k = half; k < ENTRY_CNT; k++) {
String key = "key" + k;
- cache.get(key);
-
- assertNotNull("Failed to get key: 'key" + k + "'", cache.future().get(30_000));
+ assertNotNull("Failed to get key: 'key" + k + "'", cache.getAsync(key).get(30_000));
}
}
finally {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java
index 9908b87..140efb0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java
@@ -189,7 +189,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
- public void testGetAsync() throws Exception {
+ public void testGetAsyncOld() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
int rnd = random();
@@ -210,6 +210,21 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
+ public void testGetAsync() throws Exception {
+ runTest(new CIX1<IgniteCache<String, Integer>>() {
+ @Override public void applyx(IgniteCache<String, Integer> cache) {
+ int rnd = random();
+
+ assert cache.getAsync("key" + rnd).get() == rnd;
+
+ assert cache.getAsync("wrongKey").get() == null;
+ }
+ });
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testGetAll() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
@@ -228,7 +243,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
- public void testGetAllAsync() throws Exception {
+ public void testGetAllAsyncOld() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
int rnd1 = random();
@@ -250,6 +265,24 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
+ public void testGetAllAsync() throws Exception {
+ runTest(new CIX1<IgniteCache<String, Integer>>() {
+ @Override public void applyx(IgniteCache<String, Integer> cache) {
+ int rnd1 = random();
+ int rnd2 = random();
+
+ Map<String, Integer> map = cache.getAllAsync(ImmutableSet.of("key" + rnd1, "key" + rnd2)).get();
+
+ assert map.size() == (rnd1 != rnd2 ? 2 : 1);
+ assert map.get("key" + rnd1) == rnd1;
+ assert map.get("key" + rnd2) == rnd2;
+ }
+ });
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testRemove() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
@@ -281,7 +314,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
- public void testRemoveAsync() throws Exception {
+ public void testRemoveAsyncOld() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
int rnd1 = random();
@@ -319,6 +352,38 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
+ public void testRemoveAsync() throws Exception {
+ runTest(new CIX1<IgniteCache<String, Integer>>() {
+ @Override public void applyx(IgniteCache<String, Integer> cache) {
+ int rnd1 = random();
+ int rnd2 = random();
+
+ assert cache.getAndRemoveAsync("wrongKey").get() == null;
+
+ assert !cache.removeAsync("key" + rnd1, -1).get();
+
+ Integer v1 = cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP);
+ Integer v2 = cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP);
+
+ assert v1 == null || v1 == rnd1;
+ assert v2 == null || v2 == rnd2;
+
+ v1 = removeAsync(cache, "key" + rnd1);
+
+ assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null && (v1 == null || v1 == rnd1);
+
+ assert cache.getAndRemove("key" + rnd1) == null;
+
+ removeAsync(cache, "key" + rnd2, rnd2);
+
+ assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null;
+ }
+ });
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testRemoveAll() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
@@ -339,7 +404,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
/**
* @throws Exception In case of error.
*/
- public void testRemoveAllAsync() throws Exception {
+ public void testRemoveAllAsyncOld() throws Exception {
runTest(new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> cache) {
int rnd = random();
@@ -361,16 +426,32 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
}
/**
+ * @throws Exception In case of error.
+ */
+ public void testRemoveAllAsync() throws Exception {
+ runTest(new CIX1<IgniteCache<String, Integer>>() {
+ @Override public void applyx(IgniteCache<String, Integer> cache) {
+ int rnd = random();
+
+ Set<Integer> ids = new HashSet<>(set);
+
+ cache.removeAllAsync(rangeKeys(0, rnd)).get();
+
+ for (int i = 0; i < rnd; i++) {
+ if (ids.contains(i))
+ assertNull(cache.localPeek("key" + i));
+ }
+ }
+ });
+ }
+
+ /**
* @param cache Cache.
* @param key Key.
* @return Removed value.
*/
private <K, V> V removeAsync(IgniteCache<K, V> cache, K key) {
- IgniteCache<K, V> cacheAsync = cache.withAsync();
-
- cacheAsync.getAndRemove(key);
-
- return cacheAsync.<V>future().get();
+ return cache.getAndRemoveAsync(key).get();
}
/**
@@ -380,10 +461,6 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid
* @return Remove result.
*/
private <K, V> boolean removeAsync(IgniteCache<K, V> cache, K key, V val) {
- IgniteCache<K, V> cacheAsync = cache.withAsync();
-
- cacheAsync.remove(key, val);
-
- return cacheAsync.<Boolean>future().get();
+ return cache.removeAsync(key, val).get();
}
}
\ No newline at end of file
[33/50] [abbrv] ignite git commit: .NET: Fix CacheLinqTest failures
caused by relying on result order
Posted by ag...@apache.org.
.NET: Fix CacheLinqTest failures caused by relying on result order
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a979eae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a979eae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a979eae
Branch: refs/heads/ignite-4003
Commit: 6a979eaee0b2f855841851818b1fdb0a43c427fe
Parents: 858ed3a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 28 10:42:24 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 28 10:42:24 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a979eae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index 8730e37..7897ea7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -420,6 +420,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var roles = GetRoleCache().AsCacheQueryable();
var res = persons.Join(roles, person => person.Key, role => role.Key.Foo, (person, role) => role)
+ .OrderBy(x => x.Key.Bar)
.ToArray();
Assert.AreEqual(RoleCount, res.Length);
@@ -433,7 +434,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
public void TestCrossCacheJoinInline()
{
var res = GetPersonCache().AsCacheQueryable().Join(GetRoleCache().AsCacheQueryable(),
- person => person.Key, role => role.Key.Foo, (person, role) => role).ToArray();
+ person => person.Key, role => role.Key.Foo, (person, role) => role)
+ .OrderBy(x => x.Key.Bar).ToArray();
Assert.AreEqual(RoleCount, res.Length);
Assert.AreEqual(101, res[0].Key.Bar);
@@ -1026,6 +1028,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
(int a, int b, string sep) =>
roles
.Where(x => x.Key.Bar > a)
+ .OrderBy(x => x.Key.Bar)
.Join(persons.Where(x => x.Key < b && x.Key > 0),
r => r.Key.Foo,
p => p.Value.Address.Zip,
[42/50] [abbrv] ignite git commit: IGNITE-4617: CPP: Added
Field-access methods for BinaryObject
Posted by ag...@apache.org.
IGNITE-4617: CPP: Added Field-access methods for BinaryObject
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d44de994
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d44de994
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d44de994
Branch: refs/heads/ignite-4003
Commit: d44de994e33973a7423f24df52ef50e2af9a1355
Parents: 8ae3d5b
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Mar 28 18:03:58 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Tue Mar 28 18:03:58 2017 +0300
----------------------------------------------------------------------
.../internal/binary/BinaryClassDescriptor.java | 10 +-
.../ignite/internal/binary/BinaryContext.java | 2 +-
.../internal/binary/BinaryFieldMetadata.java | 127 +++++++++++
.../ignite/internal/binary/BinaryMetadata.java | 20 +-
.../binary/BinaryMetadataCollector.java | 17 +-
.../ignite/internal/binary/BinaryUtils.java | 14 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 14 +-
.../binary/CacheObjectBinaryProcessor.java | 3 +-
.../binary/CacheObjectBinaryProcessorImpl.java | 3 +-
.../platform/PlatformContextImpl.java | 82 +++----
modules/platforms/cpp/binary/Makefile.am | 2 +-
.../platforms/cpp/binary/include/Makefile.am | 1 +
.../include/ignite/binary/binary_object.h | 75 ++++++-
.../ignite/impl/binary/binary_field_meta.h | 110 ++++++++++
.../ignite/impl/binary/binary_id_resolver.h | 96 +++++++-
.../ignite/impl/binary/binary_object_header.h | 13 ++
.../ignite/impl/binary/binary_object_impl.h | 124 +++++++++--
.../include/ignite/impl/binary/binary_schema.h | 10 +-
.../ignite/impl/binary/binary_type_handler.h | 47 ++--
.../ignite/impl/binary/binary_type_manager.h | 48 ++--
.../ignite/impl/binary/binary_type_snapshot.h | 82 +++++--
.../ignite/impl/binary/binary_type_updater.h | 19 +-
.../ignite/impl/binary/binary_writer_impl.h | 17 +-
.../cpp/binary/project/vs/binary.vcxproj | 3 +-
.../binary/project/vs/binary.vcxproj.filters | 9 +-
.../src/impl/binary/binary_field_meta.cpp | 42 ++++
.../src/impl/binary/binary_object_impl.cpp | 139 +++++++++++-
.../src/impl/binary/binary_type_handler.cpp | 45 +---
.../src/impl/binary/binary_type_manager.cpp | 187 +++++++---------
.../src/impl/binary/binary_type_snapshot.cpp | 50 ++---
.../src/impl/binary/binary_type_updater.cpp | 32 ---
.../cpp/core-test/config/cache-identity.xml | 33 +++
.../core-test/include/ignite/binary_test_defs.h | 5 +
.../src/binary_identity_resolver_test.cpp | 91 +++++++-
.../cpp/core-test/src/binary_object_test.cpp | 220 ++++++++++++++++++-
.../cpp/core-test/src/cache_invoke_test.cpp | 2 +
.../cpp/core-test/src/cluster_test.cpp | 5 +-
.../impl/binary/binary_type_updater_impl.h | 6 +-
.../cpp/core/include/ignite/impl/ignite_impl.h | 11 +
.../ignite/impl/interop/interop_target.h | 2 +-
.../impl/binary/binary_type_updater_impl.cpp | 101 +++++++--
.../cpp/core/src/impl/ignite_environment.cpp | 4 +-
.../core/src/impl/interop/interop_target.cpp | 2 +-
.../Apache.Ignite.Core.csproj | 1 +
.../Impl/Binary/BinaryObjectBuilder.cs | 2 +-
.../Impl/Binary/BinaryProcessor.cs | 3 +-
.../Impl/Binary/BinaryWriter.cs | 2 +-
.../Impl/Binary/Marshaller.cs | 6 +-
.../Impl/Binary/Metadata/BinaryField.cs | 72 ++++++
.../Impl/Binary/Metadata/BinaryType.cs | 38 +++-
.../Binary/Metadata/BinaryTypeHashsetHandler.cs | 10 +-
.../Impl/Binary/Metadata/BinaryTypeHolder.cs | 9 +-
.../Impl/Binary/Metadata/IBinaryTypeHandler.cs | 2 +-
53 files changed, 1586 insertions(+), 484 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 7eaf6c6..92e4874 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -101,7 +101,7 @@ public class BinaryClassDescriptor {
private final Method readResolveMtd;
/** */
- private final Map<String, Integer> stableFieldsMeta;
+ private final Map<String, BinaryFieldMetadata> stableFieldsMeta;
/** Object schemas. Initialized only for serializable classes and contains only 1 entry. */
private final BinarySchema stableSchema;
@@ -279,12 +279,12 @@ public class BinaryClassDescriptor {
if (BinaryUtils.FIELDS_SORTED_ORDER) {
fields0 = new TreeMap<>();
- stableFieldsMeta = metaDataEnabled ? new TreeMap<String, Integer>() : null;
+ stableFieldsMeta = metaDataEnabled ? new TreeMap<String, BinaryFieldMetadata>() : null;
}
else {
fields0 = new LinkedHashMap<>();
- stableFieldsMeta = metaDataEnabled ? new LinkedHashMap<String, Integer>() : null;
+ stableFieldsMeta = metaDataEnabled ? new LinkedHashMap<String, BinaryFieldMetadata>() : null;
}
Set<String> duplicates = duplicateFields(cls);
@@ -316,7 +316,7 @@ public class BinaryClassDescriptor {
fields0.put(name, fieldInfo);
if (metaDataEnabled)
- stableFieldsMeta.put(name, fieldInfo.mode().typeId());
+ stableFieldsMeta.put(name, new BinaryFieldMetadata(fieldInfo));
}
}
}
@@ -462,7 +462,7 @@ public class BinaryClassDescriptor {
/**
* @return Fields meta data.
*/
- Map<String, Integer> fieldsMeta() {
+ Map<String, BinaryFieldMetadata> fieldsMeta() {
return stableFieldsMeta;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 5f9e4ba..e5b6bda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -1140,7 +1140,7 @@ public class BinaryContext {
cls2Mappers.put(clsName, mapper);
- Map<String, Integer> fieldsMeta = null;
+ Map<String, BinaryFieldMetadata> fieldsMeta = null;
if (cls != null) {
if (serializer == null) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldMetadata.java
new file mode 100644
index 0000000..e1aef86
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldMetadata.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.binary;
+
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * Binary field metadata.
+ */
+public class BinaryFieldMetadata implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Field id in schema. */
+ @GridToStringInclude(sensitive = true)
+ private int fieldId;
+
+ /** Field type ID. */
+ @GridToStringInclude(sensitive = true)
+ private int typeId;
+
+ /**
+ * For {@link Externalizable}.
+ */
+ public BinaryFieldMetadata() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ * @param typeId Field type ID.
+ * @param fieldId Field id in schema.
+ */
+ public BinaryFieldMetadata(int typeId, int fieldId) {
+ this.typeId = typeId;
+ this.fieldId = fieldId;
+ }
+
+ /**
+ * Constructor.
+ * @param accessor Field accessor.
+ */
+ public BinaryFieldMetadata(BinaryFieldAccessor accessor) {
+ this.typeId = accessor.mode().typeId();
+ this.fieldId = accessor.id;
+ }
+
+ /**
+ * @return Field ID in binary schema.
+ */
+ public int fieldId() {
+ return fieldId;
+ }
+
+ /**
+ * @return ID of the type of the field.
+ */
+ public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ writeTo(out);
+ }
+
+ /**
+ * The object implements the writeTo method to save its contents
+ * by calling the methods of DataOutput for its primitive values and strings or
+ * calling the writeTo method for other objects.
+ *
+ * @param out the stream to write the object to.
+ * @exception IOException Includes any I/O exceptions that may occur.
+ */
+ public void writeTo(DataOutput out) throws IOException {
+ out.writeInt(typeId);
+ out.writeInt(fieldId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ readFrom(in);
+ }
+
+ /**
+ * The object implements the readFrom method to restore its
+ * contents by calling the methods of DataInput for primitive
+ * types and strings or calling readExternal for other objects. The
+ * readFrom method must read the values in the same sequence
+ * and with the same types as were written by writeTo.
+ *
+ * @param in the stream to read data from in order to restore the object.
+ * @exception IOException if I/O errors occur.
+ */
+ public void readFrom(DataInput in) throws IOException {
+ typeId = in.readInt();
+ fieldId = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(BinaryFieldMetadata.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
index ec92b08..a2589bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
@@ -51,7 +51,7 @@ public class BinaryMetadata implements Externalizable {
/** Recorded object fields. */
@GridToStringInclude(sensitive = true)
- private Map<String, Integer> fields;
+ private Map<String, BinaryFieldMetadata> fields;
/** Affinity key field name. */
@GridToStringInclude(sensitive = true)
@@ -80,7 +80,7 @@ public class BinaryMetadata implements Externalizable {
* @param schemas Schemas.
* @param isEnum Enum flag.
*/
- public BinaryMetadata(int typeId, String typeName, @Nullable Map<String, Integer> fields,
+ public BinaryMetadata(int typeId, String typeName, @Nullable Map<String, BinaryFieldMetadata> fields,
@Nullable String affKeyFieldName, @Nullable Collection<BinarySchema> schemas, boolean isEnum) {
assert typeName != null;
@@ -116,8 +116,8 @@ public class BinaryMetadata implements Externalizable {
/**
* @return Fields.
*/
- public Map<String, Integer> fieldsMap() {
- return fields != null ? fields : Collections.<String, Integer>emptyMap();
+ public Map<String, BinaryFieldMetadata> fieldsMap() {
+ return fields != null ? fields : Collections.<String, BinaryFieldMetadata>emptyMap();
}
/**
@@ -125,7 +125,7 @@ public class BinaryMetadata implements Externalizable {
* @return Field type name.
*/
@Nullable public String fieldTypeName(String fieldName) {
- Integer typeId = fields != null ? fields.get(fieldName) : null;
+ Integer typeId = fields != null ? fields.get(fieldName).typeId() : null;
return typeId != null ? BinaryUtils.fieldTypeName(typeId) : null;
}
@@ -184,9 +184,9 @@ public class BinaryMetadata implements Externalizable {
else {
out.writeInt(fields.size());
- for (Map.Entry<String, Integer> fieldEntry : fields.entrySet()) {
+ for (Map.Entry<String, BinaryFieldMetadata> fieldEntry : fields.entrySet()) {
U.writeString(out, fieldEntry.getKey());
- out.writeInt(fieldEntry.getValue());
+ fieldEntry.getValue().writeTo(out);
}
}
@@ -232,9 +232,11 @@ public class BinaryMetadata implements Externalizable {
for (int i = 0; i < fieldsSize; i++) {
String fieldName = U.readString(in);
- int fieldId = in.readInt();
- fields.put(fieldName, fieldId);
+ BinaryFieldMetadata fieldMeta = new BinaryFieldMetadata();
+ fieldMeta.readFrom(in);
+
+ fields.put(fieldName, fieldMeta);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
index 2585b3b..22d2001 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
@@ -47,7 +47,7 @@ class BinaryMetadataCollector implements BinaryWriter {
private final BinaryInternalMapper mapper;
/** Collected metadata. */
- private final Map<String, Integer> meta = new HashMap<>();
+ private final Map<String, BinaryFieldMetadata> meta = new HashMap<>();
/** Schema builder. */
private BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
@@ -68,7 +68,7 @@ class BinaryMetadataCollector implements BinaryWriter {
/**
* @return Field meta data.
*/
- Map<String, Integer> meta() {
+ Map<String, BinaryFieldMetadata> meta() {
return meta;
}
@@ -269,18 +269,19 @@ class BinaryMetadataCollector implements BinaryWriter {
private void add(String name, BinaryWriteMode mode) throws BinaryObjectException {
assert name != null;
- int fieldTypeId = mode.typeId();
+ int typeId = mode.typeId();
+ int fieldId = mapper.fieldId(typeId, name);
- Integer oldFieldTypeId = meta.put(name, fieldTypeId);
+ BinaryFieldMetadata oldFieldMeta = meta.put(name, new BinaryFieldMetadata(typeId, fieldId));
- if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) {
+ if (oldFieldMeta != null && oldFieldMeta.typeId() != typeId) {
throw new BinaryObjectException(
"Field is written twice with different types [" + "typeName=" + typeName + ", fieldName=" + name +
- ", fieldTypeName1=" + BinaryUtils.fieldTypeName(oldFieldTypeId) +
- ", fieldTypeName2=" + BinaryUtils.fieldTypeName(fieldTypeId) + ']'
+ ", fieldTypeName1=" + BinaryUtils.fieldTypeName(oldFieldMeta.typeId()) +
+ ", fieldTypeName2=" + BinaryUtils.fieldTypeName(typeId) + ']'
);
}
- schemaBuilder.addField(mapper.fieldId(typeId, name));
+ schemaBuilder.addField(fieldId);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index d3ff2ac..41ec078 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -960,25 +960,25 @@ public class BinaryUtils {
}
// Check and merge fields.
- Map<String, Integer> mergedFields;
+ Map<String, BinaryFieldMetadata> mergedFields;
if (FIELDS_SORTED_ORDER)
mergedFields = new TreeMap<>(oldMeta.fieldsMap());
else
mergedFields = new LinkedHashMap<>(oldMeta.fieldsMap());
- Map<String, Integer> newFields = newMeta.fieldsMap();
+ Map<String, BinaryFieldMetadata> newFields = newMeta.fieldsMap();
boolean changed = false;
- for (Map.Entry<String, Integer> newField : newFields.entrySet()) {
- Integer oldFieldType = mergedFields.put(newField.getKey(), newField.getValue());
+ for (Map.Entry<String, BinaryFieldMetadata> newField : newFields.entrySet()) {
+ BinaryFieldMetadata oldFieldMeta = mergedFields.put(newField.getKey(), newField.getValue());
- if (oldFieldType == null)
+ if (oldFieldMeta == null)
changed = true;
else {
- String oldFieldTypeName = fieldTypeName(oldFieldType);
- String newFieldTypeName = fieldTypeName(newField.getValue());
+ String oldFieldTypeName = fieldTypeName(oldFieldMeta.typeId());
+ String newFieldTypeName = fieldTypeName(newField.getValue().typeId());
if (!F.eq(oldFieldTypeName, newFieldTypeName)) {
throw new BinaryObjectException(
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 4ab9df8..6827c96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.binary.BinaryObjectImpl;
import org.apache.ignite.internal.binary.BinaryWriterExImpl;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryFieldMetadata;
import org.apache.ignite.internal.binary.BinarySchema;
import org.apache.ignite.internal.binary.BinarySchemaRegistry;
import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
@@ -197,7 +198,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
BinaryType meta = ctx.metadata(typeId);
- Map<String, Integer> fieldsMeta = null;
+ Map<String, BinaryFieldMetadata> fieldsMeta = null;
if (reader != null && BinaryUtils.hasSchema(flags)) {
BinarySchema schema = reader.schema();
@@ -216,7 +217,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
assignedFldsById.put(fieldId, val);
if (val != REMOVED_FIELD_MARKER)
- fieldsMeta = checkMetadata(meta, fieldsMeta, val, name);
+ fieldsMeta = checkMetadata(meta, fieldsMeta, val, name, fieldId);
}
remainsFlds = assignedFldsById.keySet();
@@ -310,7 +311,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
if (reader == null)
// Metadata has already been checked.
- fieldsMeta = checkMetadata(meta, fieldsMeta, val, name);
+ fieldsMeta = checkMetadata(meta, fieldsMeta, val, name, fieldId);
}
}
@@ -369,9 +370,10 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
* @param fieldsMeta Map holding metadata information that has to be updated.
* @param newVal Field value being serialized.
* @param name Field name.
+ * @param fieldId Field ID.
*/
- private Map<String, Integer> checkMetadata(BinaryType meta, Map<String, Integer> fieldsMeta, Object newVal,
- String name) {
+ private Map<String, BinaryFieldMetadata> checkMetadata(BinaryType meta, Map<String, BinaryFieldMetadata> fieldsMeta,
+ Object newVal, String name, int fieldId) {
String oldFldTypeName = meta == null ? null : meta.fieldTypeName(name);
boolean nullFieldVal = false;
@@ -405,7 +407,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
fieldsMeta = new LinkedHashMap<>();
}
- fieldsMeta.put(name, newFldTypeId);
+ fieldsMeta.put(name, new BinaryFieldMetadata(newFldTypeId, fieldId));
}
else if (!nullFieldVal) {
String newFldTypeName = BinaryUtils.fieldTypeName(newFldTypeId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessor.java
index 3578f7a..7cc7a29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessor.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import java.util.Map;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.internal.binary.BinaryFieldMetadata;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryType;
@@ -61,7 +62,7 @@ public interface CacheObjectBinaryProcessor extends IgniteCacheObjectProcessor {
* @throws IgniteException In case of error.
*/
public void updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName,
- Map<String, Integer> fieldTypeIds, boolean isEnum) throws IgniteException;
+ Map<String, BinaryFieldMetadata> fieldTypeIds, boolean isEnum) throws IgniteException;
/**
* @param typeId Type ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 656e70a..6e5940f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -55,6 +55,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.binary.BinaryContext;
import org.apache.ignite.internal.binary.BinaryEnumObjectImpl;
+import org.apache.ignite.internal.binary.BinaryFieldMetadata;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryMetadataHandler;
@@ -522,7 +523,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public void updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName,
- Map<String, Integer> fieldTypeIds, boolean isEnum) throws BinaryObjectException {
+ Map<String, BinaryFieldMetadata> fieldTypeIds, boolean isEnum) throws BinaryObjectException {
BinaryMetadata meta = new BinaryMetadata(typeId, typeName, fieldTypeIds, affKeyFieldName, null, isEnum);
binaryCtx.updateMetadata(typeId, meta);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 8f7d5de..10a8f74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -35,6 +35,7 @@ import org.apache.ignite.events.SwapSpaceEvent;
import org.apache.ignite.events.TaskEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryFieldMetadata;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
@@ -354,17 +355,22 @@ public class PlatformContextImpl implements PlatformContext {
/** {@inheritDoc} */
@SuppressWarnings("ConstantConditions")
@Override public void processMetadata(BinaryRawReaderEx reader) {
- Collection<Metadata> metas = PlatformUtils.readCollection(reader,
- new PlatformReaderClosure<Metadata>() {
- @Override public Metadata read(BinaryRawReaderEx reader) {
+ Collection<BinaryMetadata> metas = PlatformUtils.readCollection(reader,
+ new PlatformReaderClosure<BinaryMetadata>() {
+ @Override public BinaryMetadata read(BinaryRawReaderEx reader) {
int typeId = reader.readInt();
String typeName = reader.readString();
String affKey = reader.readString();
- Map<String, Integer> fields = PlatformUtils.readLinkedMap(reader,
- new PlatformReaderBiClosure<String, Integer>() {
- @Override public IgniteBiTuple<String, Integer> read(BinaryRawReaderEx reader) {
- return F.t(reader.readString(), reader.readInt());
+ Map<String, BinaryFieldMetadata> fields = PlatformUtils.readLinkedMap(reader,
+ new PlatformReaderBiClosure<String, BinaryFieldMetadata>() {
+ @Override public IgniteBiTuple<String, BinaryFieldMetadata> read(BinaryRawReaderEx reader) {
+ String name = reader.readString();
+ int typeId = reader.readInt();
+ int fieldId = reader.readInt();
+
+ return new IgniteBiTuple<String, BinaryFieldMetadata>(name,
+ new BinaryFieldMetadata(typeId, fieldId));
}
});
@@ -390,16 +396,15 @@ public class PlatformContextImpl implements PlatformContext {
}
}
- return new Metadata(typeId, typeName, affKey, fields, isEnum, schemas);
+ return new BinaryMetadata(typeId, typeName, fields, affKey, schemas, isEnum);
}
}
);
BinaryContext binCtx = cacheObjProc.binaryContext();
- for (Metadata meta : metas)
- binCtx.updateMetadata(meta.typeId, new BinaryMetadata(meta.typeId,
- meta.typeName, meta.fields, meta.affKey, meta.schemas, meta.isEnum));
+ for (BinaryMetadata meta : metas)
+ binCtx.updateMetadata(meta.typeId(), meta);
}
/** {@inheritDoc} */
@@ -455,12 +460,21 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeBoolean(true);
BinaryMetadata meta0 = ((BinaryTypeImpl) meta).metadata();
- Map<String, Integer> fields = meta0.fieldsMap();
+ Map<String, BinaryFieldMetadata> fields = meta0.fieldsMap();
writer.writeInt(typeId);
writer.writeString(meta.typeName());
writer.writeString(meta.affinityKeyFieldName());
- writer.writeMap(fields);
+
+ writer.writeInt(fields.size());
+
+ for (Map.Entry<String, BinaryFieldMetadata> e : fields.entrySet()) {
+ writer.writeString(e.getKey());
+
+ writer.writeInt(e.getValue().typeId());
+ writer.writeInt(e.getValue().fieldId());
+ }
+
writer.writeBoolean(meta.isEnum());
}
}
@@ -683,46 +697,4 @@ public class PlatformContextImpl implements PlatformContext {
@Override public String platform() {
return platform;
}
-
- /**
- * Metadata holder.
- */
- private static class Metadata {
- /** Type ID. */
- private final int typeId;
-
- /** Type name. */
- private final String typeName;
-
- /** Affinity key. */
- private final String affKey;
-
- /** Fields map. */
- private final Map<String, Integer> fields;
-
- /** Enum flag. */
- private final boolean isEnum;
-
- /** Schemas. */
- private final List<BinarySchema> schemas;
-
- /**
- * Constructor.
- * @param typeId Type ID.
- * @param typeName Type name.
- * @param affKey Affinity key.
- * @param fields Fields.
- * @param isEnum Enum flag.
- * @param schemas Schemas.
- */
- private Metadata(int typeId, String typeName, String affKey, Map<String, Integer> fields, boolean isEnum,
- List<BinarySchema> schemas) {
- this.typeId = typeId;
- this.typeName = typeName;
- this.affKey = affKey;
- this.fields = fields;
- this.isEnum = isEnum;
- this.schemas = schemas;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/Makefile.am b/modules/platforms/cpp/binary/Makefile.am
index c13a1bb..d310f33 100644
--- a/modules/platforms/cpp/binary/Makefile.am
+++ b/modules/platforms/cpp/binary/Makefile.am
@@ -58,11 +58,11 @@ libignite_binary_la_SOURCES = \
src/impl/binary/binary_reader_impl.cpp \
src/impl/binary/binary_type_handler.cpp \
src/impl/binary/binary_writer_impl.cpp \
- src/impl/binary/binary_type_updater.cpp \
src/impl/binary/binary_schema.cpp \
src/impl/binary/binary_type_snapshot.cpp \
src/impl/binary/binary_object_header.cpp \
src/impl/binary/binary_object_impl.cpp \
+ src/impl/binary/binary_field_meta.cpp \
src/impl/interop/interop_memory.cpp \
src/impl/interop/interop_output_stream.cpp \
src/impl/interop/interop_input_stream.cpp
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/Makefile.am b/modules/platforms/cpp/binary/include/Makefile.am
index a25a753..9c51326 100644
--- a/modules/platforms/cpp/binary/include/Makefile.am
+++ b/modules/platforms/cpp/binary/include/Makefile.am
@@ -35,6 +35,7 @@ nobase_include_HEADERS = \
ignite/impl/binary/binary_type_updater.h \
ignite/impl/binary/binary_common.h \
ignite/impl/binary/binary_writer_impl.h \
+ ignite/impl/binary/binary_field_meta.h \
ignite/impl/binary/binary_type_snapshot.h \
ignite/impl/binary/binary_reader_impl.h \
ignite/impl/binary/binary_schema.h \
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
index 12ac938..ff4bd10 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
@@ -53,24 +53,52 @@ namespace ignite
impl(impl)
{
// No-op.
- };
+ }
/**
- * Constructor.
+ * Direct constructor.
+ * Constructs binary object without any safety checks.
*
* @param mem Binary object memory.
* @param start Object starting position in memory.
+ * @param idRslvr ID resolver.
*/
- BinaryObject(impl::interop::InteropMemory& mem, int32_t start) :
- impl(mem, start)
+ BinaryObject(impl::interop::InteropMemory& mem, int32_t start,
+ impl::binary::BinaryIdResolver* idRslvr, impl::binary::BinaryTypeManager* metaMgr) :
+ impl(mem, start, idRslvr, metaMgr)
{
// No-op.
- };
+ }
/// @endcond
/**
+ * Copy constructor.
+ *
+ * @param other Another instance.
+ */
+ BinaryObject(const BinaryObject& other) :
+ impl(other.impl)
+ {
+ // No-op.
+ }
+
+ /**
+ * Assignment operator.
+ *
+ * @param other Another instance.
+ * @return *this.
+ */
+ BinaryObject& operator=(const BinaryObject& other)
+ {
+ impl = other.impl;
+
+ return *this;
+ }
+
+ /**
* Deserialize object.
- * @throw IgniteError if the object can not be deserialized to specified type.
+ * @throw IgniteError if the object can not be deserialized to
+ * specified type.
*
* @return Deserialized value.
*/
@@ -80,12 +108,43 @@ namespace ignite
return impl.Deserialize<T>();
}
+ /**
+ * Get field.
+ * @throw IgniteError if the there is no specified field or if it
+ * is not of the specified type.
+ *
+ * @param name Field name.
+ * @return Field value.
+ */
+ template<typename T>
+ T GetField(const char* name) const
+ {
+ return impl.GetField<T>(name);
+ }
+
+ /**
+ * Check if the binary object has the specified field.
+ *
+ * @param name Field name.
+ * @return True if the binary object has the specified field and
+ * false otherwise.
+ */
+ bool HasField(const char* name) const
+ {
+ return impl.HasField(name);
+ }
+
private:
/** Implementation. */
impl::binary::BinaryObjectImpl impl;
-
- IGNITE_NO_COPY_ASSIGNMENT(BinaryObject)
};
+
+ /* Specialization */
+ template<>
+ inline BinaryObject BinaryObject::GetField(const char* name) const
+ {
+ return BinaryObject(impl.GetField<impl::binary::BinaryObjectImpl>(name));
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h
new file mode 100644
index 0000000..73864eb
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_BINARY_BINARY_FIELD_META
+#define _IGNITE_IMPL_BINARY_BINARY_FIELD_META
+
+#include <stdint.h>
+
+namespace ignite
+{
+ namespace binary
+ {
+ /* Forward declarations. */
+ class BinaryRawWriter;
+ class BinaryRawReader;
+ }
+
+ namespace impl
+ {
+ namespace binary
+ {
+ /**
+ * Field metadata.
+ */
+ class BinaryFieldMeta
+ {
+ public:
+ /**
+ * Default constructor.
+ */
+ BinaryFieldMeta() :
+ typeId(0),
+ fieldId(0)
+ {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param typeId Type ID.
+ * @param fieldId Field IDs.
+ */
+ BinaryFieldMeta(int32_t typeId, int32_t fieldId) :
+ typeId(typeId),
+ fieldId(fieldId)
+ {
+ // No-op.
+ }
+
+ /**
+ * Get type ID.
+ *
+ * @return Type ID.
+ */
+ int32_t GetTypeId() const
+ {
+ return typeId;
+ }
+
+ /**
+ * Get field ID.
+ *
+ * @return Field ID.
+ */
+ int32_t GetFieldId() const
+ {
+ return fieldId;
+ }
+
+ /**
+ * Write to data stream.
+ *
+ * @param writer Writer.
+ */
+ void Write(ignite::binary::BinaryRawWriter& writer) const;
+
+ /**
+ * Read from data stream.
+ *
+ * @param reader reader.
+ */
+ void Read(ignite::binary::BinaryRawReader& reader);
+
+ private:
+ /** Type ID. */
+ int32_t typeId;
+
+ /** Field ID. */
+ int32_t fieldId;
+ };
+ }
+ }
+}
+
+#endif //_IGNITE_IMPL_BINARY_BINARY_FIELD_META
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_id_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_id_resolver.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_id_resolver.h
index 41ae628..7d6b12b 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_id_resolver.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_id_resolver.h
@@ -18,7 +18,11 @@
#ifndef _IGNITE_IMPL_BINARY_BINARY_ID_RESOLVER
#define _IGNITE_IMPL_BINARY_BINARY_ID_RESOLVER
+#include <map>
+
+#include "ignite/common/concurrent.h"
#include "ignite/binary/binary_type.h"
+#include "ignite/impl/binary/binary_type_handler.h"
namespace ignite
{
@@ -55,10 +59,17 @@ namespace ignite
* @return Field ID.
*/
virtual int32_t GetFieldId(const int32_t typeId, const char* name) = 0;
+
+ /**
+ * Get copy of the instance.
+ *
+ * @return Copy of the instance.
+ */
+ virtual BinaryIdResolver* Clone() const = 0;
};
/**
- * Templated binary type descriptor.
+ * Templated binary type resolver.
*/
template<typename T>
class TemplatedBinaryIdResolver : public BinaryIdResolver
@@ -67,9 +78,10 @@ namespace ignite
/**
* Constructor.
*/
- TemplatedBinaryIdResolver()
+ TemplatedBinaryIdResolver() :
+ type()
{
- type = ignite::binary::BinaryType<T>();
+ // No-op.
}
/**
@@ -77,7 +89,8 @@ namespace ignite
*
* @param type Binary type.
*/
- TemplatedBinaryIdResolver(ignite::binary::BinaryType<T> type) : type(type)
+ TemplatedBinaryIdResolver(ignite::binary::BinaryType<T> type) :
+ type(type)
{
// No-op.
}
@@ -91,12 +104,85 @@ namespace ignite
if (name)
return type.GetFieldId(name);
else
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Field name cannot be NULL.");
+ {
+ IGNITE_ERROR_FORMATTED_1(IgniteError::IGNITE_ERR_BINARY,
+ "Field name cannot be NULL.", "typeId", typeId);
+ }
}
+
+ virtual BinaryIdResolver* Clone() const
+ {
+ return new TemplatedBinaryIdResolver<T>(*this);
+ }
+
private:
/** Actual type. */
ignite::binary::BinaryType<T> type;
};
+
+ /**
+ * Metadata binary type resolver.
+ */
+ class MetadataBinaryIdResolver : public BinaryIdResolver
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ MetadataBinaryIdResolver() :
+ meta()
+ {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param meta Binary type metadata snapshot.
+ */
+ MetadataBinaryIdResolver(SPSnap meta) :
+ meta(meta)
+ {
+ // No-op.
+ }
+
+ virtual int32_t GetTypeId()
+ {
+ return meta.Get()->GetTypeId();
+ }
+
+ virtual int32_t GetFieldId(const int32_t typeId, const char* name)
+ {
+ if (!name)
+ {
+ IGNITE_ERROR_FORMATTED_1(IgniteError::IGNITE_ERR_BINARY,
+ "Field name cannot be NULL.", "typeId", typeId);
+ }
+
+ int32_t res = meta.Get()->GetFieldId(name);
+
+ if (res == 0)
+ res = ignite::binary::GetBinaryStringHashCode(name);
+
+ if (res == 0)
+ {
+ IGNITE_ERROR_FORMATTED_2(IgniteError::IGNITE_ERR_BINARY,
+ "Field ID for the field name is zero. Please, redefine GetFieldId()"
+ " method for the type or change field name", "typeId", typeId, "fieldName", name);
+ }
+
+ return res;
+ }
+
+ virtual BinaryIdResolver* Clone() const
+ {
+ return new MetadataBinaryIdResolver(*this);
+ }
+
+ private:
+ /** Metadata snapshot. */
+ SPSnap meta;
+ };
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_header.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_header.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_header.h
index 8e74de6..cc31fbe 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_header.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_header.h
@@ -230,6 +230,19 @@ namespace ignite
}
/**
+ * Get footer length.
+ *
+ * @return Footer length.
+ */
+ int32_t GetFooterLength() const
+ {
+ if (!HasSchema())
+ return 0;
+
+ return GetLength() - GetSchemaOffset();
+ }
+
+ /**
* Get size of data without header and footer.
*
* @return Data length.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
index 0eb0dd6..880fff2 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
@@ -25,8 +25,11 @@
#include <stdint.h>
-#include <ignite/impl/interop/interop.h>
+#include <ignite/binary/binary_type.h>
+
+#include <ignite/impl/interop/interop_input_stream.h>
#include <ignite/impl/binary/binary_reader_impl.h>
+#include <ignite/impl/binary/binary_type_manager.h>
namespace ignite
{
@@ -50,8 +53,17 @@ namespace ignite
*
* @param mem Binary object memory.
* @param start Object starting position in memory.
+ * @param idRslvr ID resolver. If null metaMgr is going to be
+ * used to extract meta for the type.
+ * @param metaMgr Metadata manager. Can be null if you are not
+ * going to access fields by name.
+ */
+ BinaryObjectImpl(interop::InteropMemory& mem, int32_t start, BinaryIdResolver* idRslvr, BinaryTypeManager* metaMgr);
+
+ /**
+ * Destructor.
*/
- BinaryObjectImpl(interop::InteropMemory& mem, int32_t start);
+ ~BinaryObjectImpl();
/**
* Copy constructor.
@@ -69,25 +81,24 @@ namespace ignite
BinaryObjectImpl& operator=(const BinaryObjectImpl& other);
/**
- * Create from InteropMemory instance.
- * @throw IgniteError if the memory at the specified offset
- * is not a valid BinaryObject.
+ * Swap contents with another instance.
*
- * @param mem Memory.
- * @param offset Offset in memory.
- * @return BinaryObjectImpl instance.
+ * @param other Another instance.
*/
- static BinaryObjectImpl FromMemory(interop::InteropMemory& mem, int32_t offset);
+ void Swap(BinaryObjectImpl& other);
/**
* Create from InteropMemory instance.
- * @warning Does not check memory for validity.
+ * @throw IgniteError if the memory at the specified offset
+ * is not a valid BinaryObject.
*
* @param mem Memory.
* @param offset Offset in memory.
+ * @param metaMgr Metadata manager. Can be null if you are not
+ * going to access fields by name.
* @return BinaryObjectImpl instance.
*/
- static BinaryObjectImpl FromMemoryUnsafe(interop::InteropMemory& mem, int32_t offset);
+ static BinaryObjectImpl FromMemory(interop::InteropMemory& mem, int32_t offset, BinaryTypeManager* metaMgr);
/**
* Deserialize object.
@@ -98,15 +109,69 @@ namespace ignite
template<typename T>
T Deserialize() const
{
+ ignite::binary::BinaryType<T> bt;
+ int32_t actualTypeId = GetTypeId();
+ int32_t requestedTypeId = bt.GetTypeId();
+
+ if (requestedTypeId != actualTypeId)
+ {
+ IGNITE_ERROR_FORMATTED_3(ignite::IgniteError::IGNITE_ERR_BINARY,
+ "Trying to deserialize binary object to a different type", "memPtr", mem->PointerLong(),
+ "actualTypeId", actualTypeId, "requestedTypeId", requestedTypeId);
+ }
+
interop::InteropInputStream stream(mem);
stream.Position(start);
BinaryReaderImpl reader(&stream);
- return reader.ReadObject<T>();
+ return reader.ReadTopObject<T>();
+ }
+
+ /**
+ * Get field.
+ * @throw IgniteError if the there is no specified field or if it
+ * is not of the specified type.
+ *
+ * @param name Field name.
+ * @return Field value.
+ */
+ template<typename T>
+ T GetField(const char* name) const
+ {
+ CheckIdResolver();
+
+ int32_t fieldId = idRslvr->GetFieldId(GetTypeId(), name);
+ int32_t pos = FindField(fieldId);
+
+ if (pos == -1)
+ return T();
+
+ interop::InteropInputStream stream(mem);
+
+ stream.Position(pos);
+ BinaryReaderImpl reader(&stream);
+
+ return reader.ReadTopObject<T>();
}
/**
+ * Check if the binary object has the specified field.
+ *
+ * @param name Field name.
+ * @return True if the binary object has the specified field and
+ * false otherwise.
+ */
+ bool HasField(const char* name) const;
+
+ /**
+ * Gets the value of underlying enum in int form.
+ *
+ * @return The value of underlying enum in int form.
+ */
+ int32_t GetEnumValue() const;
+
+ /**
* Get binary object field.
*
* @warning Works only if all object fields are objects.
@@ -133,6 +198,14 @@ namespace ignite
int32_t GetLength() const;
/**
+ * Get object hash code.
+ * @throw IgniteError if the object is not in a valid state.
+ *
+ * @return Object hash code.
+ */
+ int32_t GetHashCode() const;
+
+ /**
* Get type ID.
* @throw IgniteError if the object is not in a valid state.
*
@@ -140,21 +213,38 @@ namespace ignite
*/
int32_t GetTypeId() const;
+ private:
/**
- * Get object hash code.
- * @throw IgniteError if the object is not in a valid state.
+ * Find field position in memory.
*
- * @return Object hash code.
+ * @param fieldId Field Identifier.
+ * @return Field position on success and negative value on failure.
*/
- int32_t GetHashCode() const;
+ int32_t FindField(const int32_t fieldId) const;
+
+ /**
+ * Checks that id resolver is set.
+ *
+ * @throw IgniteError if idRslvr is not set.
+ */
+ void CheckIdResolver() const;
- private:
/** Underlying object memory. */
interop::InteropMemory* mem;
/** Object starting position in memory. */
int32_t start;
+
+ /** ID resolver. */
+ mutable BinaryIdResolver* idRslvr;
+
+ /** Type manager. */
+ BinaryTypeManager* metaMgr;
};
+
+ /* Specialization */
+ template<>
+ BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h
index cf97f8d..c42adef 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h
@@ -22,17 +22,19 @@
#include <stdint.h>
#include <ignite/common/common.h>
-#include <ignite/impl/interop/interop_output_stream.h>
namespace ignite
{
namespace impl
{
- namespace binary
+ namespace interop
{
- /** Binary writer implementation forward declaration. */
- class BinaryWriterImpl;
+ /* Forward declaration */
+ class InteropOutputStream;
+ }
+ namespace binary
+ {
/**
* Schema size variants.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_handler.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_handler.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_handler.h
index d06e5d4..bb0e11c 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_handler.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_handler.h
@@ -31,20 +31,16 @@ namespace ignite
/**
* Type handler. Tracks all type updates during write session.
*/
- class BinaryTypeHandler
+ class BinaryTypeHandler
{
public:
+
/**
* Constructor.
*
* @param snap Snapshot.
*/
BinaryTypeHandler(SPSnap snap);
-
- /**
- * Destructor.
- */
- ~BinaryTypeHandler();
/**
* Callback invoked when field is being written.
@@ -56,42 +52,31 @@ namespace ignite
void OnFieldWritten(int32_t fieldId, std::string fieldName, int32_t fieldTypeId);
/**
- * Get initial snapshot.
- *
- * @param Snapshot.
- */
- SPSnap GetSnapshot();
-
- /**
* Whether any difference exists.
*
- * @param True if difference exists.
- */
- bool HasDifference();
-
- /**
- * Get recorded field IDs difference.
- *
- * @param Recorded field IDs difference.
+ * @return True if difference exists.
*/
- std::set<int32_t>* GetFieldIds();
+ bool HasUpdate() const
+ {
+ return updated.Get() != 0;
+ }
/**
- * Get recorded fields difference.
+ * Get updated snapshot.
*
- * @param Recorded fields difference.
+ * @return Updated snapshot.
*/
- std::map<std::string, int32_t>* GetFields();
+ SPSnap GetUpdated()
+ {
+ return updated;
+ }
private:
/** Snapshot. */
- SPSnap snap;
+ SPSnap origin;
- /** Recorded field IDs difference. */
- std::set<int32_t>* fieldIds;
-
- /** Recorded fields difference. */
- std::map<std::string, int32_t>* fields;
+ /** Snapshot. */
+ SPSnap updated;
IGNITE_NO_COPY_ASSIGNMENT(BinaryTypeHandler)
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_manager.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_manager.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_manager.h
index 63853f8..01538b8 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_manager.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_manager.h
@@ -49,25 +49,24 @@ namespace ignite
/**
* Get handler.
*
+ * @param typeName Type name.
* @param typeId Type ID.
*/
- ignite::common::concurrent::SharedPointer<BinaryTypeHandler> GetHandler(int32_t typeId);
+ ignite::common::concurrent::SharedPointer<BinaryTypeHandler> GetHandler(const std::string& typeName, int32_t typeId);
/**
* Submit handler for processing.
- *
- * @param typeName Type name.
- * @param typeId Type ID.
+ *
* @param hnd Handler.
*/
- void SubmitHandler(std::string typeName, int32_t typeId, BinaryTypeHandler* hnd);
+ void SubmitHandler(BinaryTypeHandler& hnd);
/**
* Get current type manager version.
*
* @return Version.
*/
- int32_t GetVersion();
+ int32_t GetVersion() const;
/**
* Check whether something is updated since the given version.
@@ -75,16 +74,33 @@ namespace ignite
* @param oldVer Old version.
* @return True if updated and it is very likely that pending type exists.
*/
- bool IsUpdatedSince(int32_t oldVer);
+ bool IsUpdatedSince(int32_t oldVer) const;
/**
* Process pending updates.
*
- * @param updater Updater.
* @param err Error.
* @return In case of success.
*/
- bool ProcessPendingUpdates(BinaryTypeUpdater* updater, IgniteError* err);
+ bool ProcessPendingUpdates(IgniteError& err);
+
+ /**
+ * Set updater.
+ *
+ * @param updater Updater.
+ */
+ void SetUpdater(BinaryTypeUpdater* updater)
+ {
+ this->updater = updater;
+ }
+
+ /**
+ * Get metadata snapshop for the type.
+ *
+ * @param typeId Type ID.
+ * @return Metadata snapshot.
+ */
+ SPSnap GetMeta(int32_t typeId);
private:
/** Current snapshots. */
@@ -94,7 +110,10 @@ namespace ignite
std::vector<SPSnap>* pending;
/** Critical section. */
- ignite::common::concurrent::CriticalSection* cs;
+ ignite::common::concurrent::CriticalSection cs;
+
+ /** Type updater */
+ BinaryTypeUpdater* updater;
/** Version of pending changes. */
int32_t pendingVer;
@@ -103,15 +122,6 @@ namespace ignite
int32_t ver;
IGNITE_NO_COPY_ASSIGNMENT(BinaryTypeManager);
-
- /**
- * Copy fields from a snapshot into relevant collections.
- *
- * @param snap Target snapshot.
- * @param fieldIds Field IDs.
- * @param fields Fields.
- */
- void CopyFields(Snap* snap, std::set<int32_t>* fieldIds, std::map<std::string, int32_t>* fields);
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
index f1959fc..186bb84 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
@@ -25,6 +25,7 @@
#include <ignite/common/common.h>
#include <ignite/common/concurrent.h>
+#include <ignite/impl/binary/binary_field_meta.h>
namespace ignite
{
@@ -38,21 +39,23 @@ namespace ignite
class BinaryTypeSnapshot
{
public:
+ typedef std::map<std::string, BinaryFieldMeta> FieldMap;
+ typedef std::set<int32_t> FieldIdSet;
+
/**
* Constructor.
*
* @param typeName Type name.
* @param typeId Type ID.
- * @param fieldIds Field IDs.
- * @param fields Fields.
*/
- BinaryTypeSnapshot(std::string typeName, int32_t typeId, std::set<int32_t>* fieldIds,
- std::map<std::string, int32_t>* fields);
+ BinaryTypeSnapshot(std::string typeName, int32_t typeId);
/**
- * Destructor.
+ * Copy constructor.
+ *
+ * @param another Another instance.
*/
- ~BinaryTypeSnapshot();
+ BinaryTypeSnapshot(const BinaryTypeSnapshot& another);
/**
* Check whether snapshot contains a field with the given ID.
@@ -60,42 +63,79 @@ namespace ignite
* @param fieldId Field ID.
* @return True if contains, false otherwise.
*/
- bool ContainsFieldId(int32_t fieldId);
+ bool ContainsFieldId(int32_t fieldId) const
+ {
+ return fieldIds.count(fieldId) == 1;
+ }
/**
* Get type name.
*
* @return Type name.
*/
- std::string GetTypeName();
+ const std::string& GetTypeName() const
+ {
+ return typeName;
+ }
/**
* Get type ID.
*
* @return Type ID.
*/
- int32_t GetTypeId();
+ int32_t GetTypeId() const
+ {
+ return typeId;
+ }
/**
* Whether snapshot contains any fields.
*
* @return True if fields exist.
*/
- bool HasFields();
+ bool HasFields() const
+ {
+ return !fieldIds.empty();
+ }
- /**
- * Get field IDs.
+ /**
+ * Get field map.
*
- * @return Field IDs.
+ * @return Fields.
*/
- std::set<int32_t>* GetFieldIds();
+ const FieldMap& GetFieldMap() const
+ {
+ return fields;
+ }
/**
- * Get fields.
+ * Add field meta.
*
- * @return Fields.
+ * @param fieldId Field ID.
+ * @param fieldName Field name.
+ * @param fieldTypeId Field type ID.
+ */
+ void AddField(int32_t fieldId, const std::string& fieldName, int32_t fieldTypeId);
+
+ /**
+ * Copy fields from another snapshot.
+ *
+ * @param another Another instance.
+ */
+ void CopyFieldsFrom(const BinaryTypeSnapshot* another);
+
+ /**
+ * Get field ID.
+ *
+ * @param fieldName Field name.
+ * @return Field ID on success and 0 on fail.
*/
- std::map<std::string, int32_t>* GetFields();
+ int32_t GetFieldId(const std::string& fieldName)
+ {
+ const FieldMap::const_iterator it = fields.find(fieldName);
+
+ return it == fields.end() ? 0 : it->second.GetFieldId();
+ }
private:
/** Type name. */
@@ -105,12 +145,10 @@ namespace ignite
int32_t typeId;
/** Known field IDs. */
- std::set<int32_t>* fieldIds;
-
- /** Field name-type mappings. */
- std::map<std::string, int32_t>* fields;
+ FieldIdSet fieldIds;
- IGNITE_NO_COPY_ASSIGNMENT(BinaryTypeSnapshot)
+ /** Fields metadata. */
+ FieldMap fields;
};
typedef BinaryTypeSnapshot Snap;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_updater.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_updater.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_updater.h
index 6bded74..7a2c301 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_updater.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_updater.h
@@ -19,7 +19,7 @@
#define _IGNITE_IMPL_BINARY_BINARY_TYPE_UPDATER
#include <ignite/ignite_error.h>
-#include "ignite/impl/binary/binary_type_snapshot.h"
+#include <ignite/impl/binary/binary_type_snapshot.h>
namespace ignite
{
@@ -36,15 +36,28 @@ namespace ignite
/**
* Destructor.
*/
- virtual ~BinaryTypeUpdater();
+ virtual ~BinaryTypeUpdater()
+ {
+ // No-op.
+ }
/**
* Update type using provided snapshot.
*
* @param snapshot Snapshot.
* @param err Error.
+ * @return True on success.
*/
- virtual bool Update(Snap* snapshot, IgniteError& err) = 0;
+ virtual bool Update(const Snap& snapshot, IgniteError& err) = 0;
+
+ /**
+ * Get schema for type.
+ *
+ * @param typeId Type ID.
+ * @param err Error.
+ * @return Result.
+ */
+ virtual SPSnap GetMeta(int32_t typeId, IgniteError& err) = 0;
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
index ea5f81f..2cc86e1 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
@@ -32,12 +32,12 @@
#include "ignite/impl/binary/binary_utils.h"
#include "ignite/impl/binary/binary_schema.h"
#include "ignite/impl/binary/binary_type_impl.h"
+#include "ignite/impl/binary/binary_type_manager.h"
#include "ignite/binary/binary_consts.h"
#include "ignite/binary/binary_type.h"
#include "ignite/guid.h"
#include "ignite/date.h"
#include "ignite/timestamp.h"
-#include "binary_type_manager.h"
namespace ignite
{
@@ -632,7 +632,7 @@ namespace ignite
*
* @param id Session ID.
*/
- void CommitContainer(int32_t id);
+ void CommitContainer(int32_t id);
/**
* Write object.
@@ -691,7 +691,7 @@ namespace ignite
ignite::common::concurrent::SharedPointer<BinaryTypeHandler> metaHnd;
if (metaMgr)
- metaHnd = metaMgr->GetHandler(idRslvr.GetTypeId());
+ metaHnd = metaMgr->GetHandler(type.GetTypeName(), idRslvr.GetTypeId());
int32_t pos = stream->Position();
@@ -714,11 +714,14 @@ namespace ignite
stream->Synchronize();
- ignite::binary::BinaryObject binObj(*stream->GetMemory(), pos);
- stream->WriteInt32(hashPos, impl::binary::GetHashCode<T>(obj, binObj));
-
if (metaMgr)
- metaMgr->SubmitHandler(type.GetTypeName(), idRslvr.GetTypeId(), metaHnd.Get());
+ metaMgr->SubmitHandler(*metaHnd.Get());
+
+ // We are using direct constructor here to avoid check-overhead, as we know
+ // at this point that underlying memory contains valid binary object.
+ ignite::binary::BinaryObject binObj(*stream->GetMemory(), pos, &idRslvr, metaMgr);
+
+ stream->WriteInt32(hashPos, impl::binary::GetHashCode<T>(obj, binObj));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/project/vs/binary.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
index 6c1c433..5a01465 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
@@ -189,6 +189,7 @@
<ClInclude Include="..\..\include\ignite\binary\binary_type.h" />
<ClInclude Include="..\..\include\ignite\binary\binary_writer.h" />
<ClInclude Include="..\..\include\ignite\impl\binary\binary_common.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_field_meta.h" />
<ClInclude Include="..\..\include\ignite\impl\binary\binary_id_resolver.h" />
<ClInclude Include="..\..\include\ignite\impl\binary\binary_object_header.h" />
<ClInclude Include="..\..\include\ignite\impl\binary\binary_object_impl.h" />
@@ -215,6 +216,7 @@
<ClCompile Include="..\..\src\binary\binary_reader.cpp" />
<ClCompile Include="..\..\src\binary\binary_type.cpp" />
<ClCompile Include="..\..\src\binary\binary_writer.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_field_meta.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_object_header.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_object_impl.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_reader_impl.cpp" />
@@ -222,7 +224,6 @@
<ClCompile Include="..\..\src\impl\binary\binary_type_handler.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_type_manager.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_type_snapshot.cpp" />
- <ClCompile Include="..\..\src\impl\binary\binary_type_updater.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_utils.cpp" />
<ClCompile Include="..\..\src\impl\binary\binary_writer_impl.cpp" />
<ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
index c649c4d..05a21aa 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
@@ -106,6 +106,9 @@
<ClInclude Include="..\..\include\ignite\impl\binary\binary_type_impl.h">
<Filter>Code\impl\binary</Filter>
</ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_field_meta.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\binary\binary_containers.cpp">
@@ -141,9 +144,6 @@
<ClCompile Include="..\..\src\impl\binary\binary_type_snapshot.cpp">
<Filter>Code\impl\binary</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\impl\binary\binary_type_updater.cpp">
- <Filter>Code\impl\binary</Filter>
- </ClCompile>
<ClCompile Include="..\..\src\impl\binary\binary_utils.cpp">
<Filter>Code\impl\binary</Filter>
</ClCompile>
@@ -168,5 +168,8 @@
<ClCompile Include="..\..\src\binary\binary_array_identity_resolver.cpp">
<Filter>Code\binary</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_field_meta.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp
new file mode 100644
index 0000000..3d0b065
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ #include <ignite/binary/binary_raw_reader.h>
+ #include <ignite/binary/binary_raw_writer.h>
+
+#include <ignite/impl/binary/binary_field_meta.h>
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace binary
+ {
+ void BinaryFieldMeta::Write(ignite::binary::BinaryRawWriter& writer) const
+ {
+ writer.WriteInt32(typeId);
+ writer.WriteInt32(fieldId);
+ }
+
+ void BinaryFieldMeta::Read(ignite::binary::BinaryRawReader& reader)
+ {
+ typeId = reader.ReadInt32();
+ fieldId = reader.ReadInt32();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44de994/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
index 0b397b1..38e7670 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
@@ -15,8 +15,12 @@
* limitations under the License.
*/
+#include <ignite/impl/interop/interop_stream_position_guard.h>
+#include <ignite/impl/interop/interop_input_stream.h>
+
#include <ignite/impl/binary/binary_object_header.h>
#include <ignite/impl/binary/binary_object_impl.h>
+#include <ignite/impl/binary/binary_utils.h>
using namespace ignite::impl::binary;
@@ -26,28 +30,54 @@ namespace ignite
{
namespace binary
{
- BinaryObjectImpl::BinaryObjectImpl(interop::InteropMemory& mem, int32_t start) :
+ BinaryObjectImpl::BinaryObjectImpl(interop::InteropMemory& mem,
+ int32_t start, BinaryIdResolver* idRslvr, BinaryTypeManager* metaMgr) :
mem(&mem),
- start(start)
+ start(start),
+ idRslvr(0),
+ metaMgr(metaMgr)
+ {
+ if (idRslvr)
+ this->idRslvr = idRslvr->Clone();
+ }
+
+ BinaryObjectImpl::~BinaryObjectImpl()
{
- // No-op.
+ delete idRslvr;
}
BinaryObjectImpl::BinaryObjectImpl(const BinaryObjectImpl& other) :
mem(other.mem),
- start(other.start)
+ start(other.start),
+ idRslvr(0),
+ metaMgr(other.metaMgr)
{
- // No-op.
+ if (other.idRslvr)
+ this->idRslvr = other.idRslvr->Clone();
}
BinaryObjectImpl& BinaryObjectImpl::operator=(const BinaryObjectImpl& other)
{
- mem = other.mem;
+ if (this != &other)
+ {
+ BinaryObjectImpl tmp(other);
+
+ Swap(tmp);
+ }
return *this;
}
- BinaryObjectImpl BinaryObjectImpl::FromMemory(interop::InteropMemory& mem, int32_t offset)
+ void BinaryObjectImpl::Swap(BinaryObjectImpl& other)
+ {
+ std::swap(mem, other.mem);
+ std::swap(start, other.start);
+ std::swap(idRslvr, other.idRslvr);
+ std::swap(metaMgr, other.metaMgr);
+ }
+
+ BinaryObjectImpl BinaryObjectImpl::FromMemory(interop::InteropMemory& mem, int32_t offset,
+ BinaryTypeManager* metaMgr)
{
BinaryObjectHeader header = BinaryObjectHeader::FromMemory(mem, offset);
@@ -55,12 +85,34 @@ namespace ignite
assert(adjustedStart >= 0);
- return BinaryObjectImpl(mem, adjustedStart);
+ return BinaryObjectImpl(mem, adjustedStart, 0, metaMgr);
}
- BinaryObjectImpl BinaryObjectImpl::FromMemoryUnsafe(interop::InteropMemory& mem, int32_t offset)
+ template<>
+ BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const
{
- return BinaryObjectImpl(mem, offset);
+ CheckIdResolver();
+
+ int32_t fieldId = idRslvr->GetFieldId(GetTypeId(), name);
+ int32_t pos = FindField(fieldId);
+
+ return FromMemory(*mem, pos, metaMgr);
+ }
+
+ bool BinaryObjectImpl::HasField(const char* name) const
+ {
+ CheckIdResolver();
+
+ int32_t fieldId = idRslvr->GetFieldId(GetTypeId(), name);
+
+ int32_t fieldPos = FindField(fieldId);
+
+ return fieldPos >= 0;
+ }
+
+ int32_t BinaryObjectImpl::GetEnumValue() const
+ {
+ throw IgniteError(IgniteError::IGNITE_ERR_BINARY, "GetEnumValue is only supported for enums.");
}
BinaryObjectImpl BinaryObjectImpl::GetField(int32_t idx)
@@ -74,7 +126,7 @@ namespace ignite
offset += fieldHeader.GetLength();
}
- return BinaryObjectImpl::FromMemory(*mem, offset);
+ return FromMemory(*mem, offset, 0);
}
const int8_t* BinaryObjectImpl::GetData() const
@@ -102,6 +154,71 @@ namespace ignite
return header.GetHashCode();
}
+
+ int32_t BinaryObjectImpl::FindField(const int32_t fieldId) const
+ {
+ BinaryObjectHeader header(mem->Data() + start);
+ int32_t flags = header.GetFlags();
+
+ int32_t footerBegin = header.GetFooterOffset() + start;
+ int32_t footerEnd = footerBegin + header.GetFooterLength();
+
+ if ((mem->Length() - start) < footerEnd)
+ {
+ IGNITE_ERROR_FORMATTED_3(ignite::IgniteError::IGNITE_ERR_MEMORY,
+ "Not enough data in the binary object", "memPtr", mem->PointerLong(),
+ "len", (mem->Length() - start), "footerEnd", footerEnd);
+ }
+
+ if (flags & IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE)
+ {
+ for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 5)
+ {
+ int32_t currentFieldId = BinaryUtils::UnsafeReadInt32(*mem, schemaPos);
+
+ if (fieldId == currentFieldId)
+ return (BinaryUtils::UnsafeReadInt8(*mem, schemaPos + 4) & 0xFF) + start;
+ }
+ }
+ else if (flags & IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES)
+ {
+ for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 6)
+ {
+ int32_t currentFieldId = BinaryUtils::UnsafeReadInt32(*mem, schemaPos);
+
+ if (fieldId == currentFieldId)
+ return (BinaryUtils::UnsafeReadInt16(*mem, schemaPos + 4) & 0xFFFF) + start;
+ }
+ }
+ else
+ {
+ for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 8)
+ {
+ int32_t currentFieldId = BinaryUtils::UnsafeReadInt32(*mem, schemaPos);
+
+ if (fieldId == currentFieldId)
+ return BinaryUtils::UnsafeReadInt32(*mem, schemaPos + 4) + start;
+ }
+ }
+
+ return -1;
+ }
+
+ void BinaryObjectImpl::CheckIdResolver() const
+ {
+ if (idRslvr)
+ return;
+
+ assert(metaMgr != 0);
+
+ BinaryObjectHeader header(mem->Data() + start);
+
+ int32_t typeId = header.GetTypeId();
+
+ SPSnap meta = metaMgr->GetMeta(typeId);
+
+ idRslvr = new MetadataBinaryIdResolver(meta);
+ }
}
}
}
\ No newline at end of file
[40/50] [abbrv] ignite git commit: IGNITE-4870 .NET:
QueryEntity.TableName - update config schema
Posted by ag...@apache.org.
IGNITE-4870 .NET: QueryEntity.TableName - update config schema
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8ae3d5b2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8ae3d5b2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8ae3d5b2
Branch: refs/heads/ignite-4003
Commit: 8ae3d5b209c383faa8e0068d0dcb2ff4533cf3d7
Parents: 90506c4
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 28 17:26:45 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 28 17:26:45 2017 +0300
----------------------------------------------------------------------
.../IgniteConfigurationSerializerTest.cs | 6 ++++--
.../dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd | 7 +++++++
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8ae3d5b2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 4335d11..6015f80 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -95,7 +95,7 @@ namespace Apache.Ignite.Core.Tests
<cacheConfiguration>
<cacheConfiguration cacheMode='Replicated' readThrough='true' writeThrough='true' enableStatistics='true'>
<queryEntities>
- <queryEntity keyType='System.Int32' valueType='System.String'>
+ <queryEntity keyType='System.Int32' valueType='System.String' tableName='myTable'>
<fields>
<queryField name='length' fieldType='System.Int32' isKeyField='true' />
</fields>
@@ -175,6 +175,7 @@ namespace Apache.Ignite.Core.Tests
var queryEntity = cacheCfg.QueryEntities.Single();
Assert.AreEqual(typeof(int), queryEntity.KeyType);
Assert.AreEqual(typeof(string), queryEntity.ValueType);
+ Assert.AreEqual("myTable", queryEntity.TableName);
Assert.AreEqual("length", queryEntity.Fields.Single().Name);
Assert.AreEqual(typeof(int), queryEntity.Fields.Single().FieldType);
Assert.IsTrue(queryEntity.Fields.Single().IsKeyField);
@@ -655,7 +656,8 @@ namespace Apache.Ignite.Core.Tests
new QueryAlias("field.field", "fld")
},
KeyType = typeof (string),
- ValueType = typeof (long)
+ ValueType = typeof (long),
+ TableName = "table-1"
},
},
ReadFromBackup = false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/8ae3d5b2/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 629a41b..375d128 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -421,6 +421,13 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="tableName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ SQL table name. When not set, value type name is used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
[31/50] [abbrv] ignite git commit: IGNITE-4869: Removed unnecessary
benchmarks for legacy binary identity. This closes #1677.
Posted by ag...@apache.org.
IGNITE-4869: Removed unnecessary benchmarks for legacy binary identity. This closes #1677.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/87477e08
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/87477e08
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/87477e08
Branch: refs/heads/ignite-4003
Commit: 87477e08c0b4c07af501f288bd26d8efde7e2274
Parents: 3f8cdea
Author: Evgenii Zhuravlev <ez...@gridgain.com>
Authored: Tue Mar 28 10:16:07 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 28 10:16:07 2017 +0300
----------------------------------------------------------------------
.../cache/IgniteBinaryIdentityBenchmark.java | 21 --------------
.../IgniteLegacyBinaryIdentityGetBenchmark.java | 30 --------------------
.../IgniteLegacyBinaryIdentityPutBenchmark.java | 30 --------------------
3 files changed, 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/87477e08/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteBinaryIdentityBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteBinaryIdentityBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteBinaryIdentityBenchmark.java
index a2e29dd..c55fc63 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteBinaryIdentityBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteBinaryIdentityBenchmark.java
@@ -74,27 +74,6 @@ abstract class IgniteBinaryIdentityBenchmark extends IgniteCacheAbstractBenchmar
}
/**
- * @param key Key field value.
- * @return Binary object with hash code explicitly set at build time.
- */
- @SuppressWarnings("ResultOfMethodCallIgnored")
- BinaryObject createLegacyIdentityBinaryKey(int key) {
- BinaryObjectBuilder bldr = ignite().binary().builder("BinaryKeyWithLegacyIdentity");
-
- setBuilderFields(bldr, key);
-
- int hash = 0;
-
- hash = 31 * hash + 1;
- hash = 31 * hash + ("SomeString".hashCode());
- hash = 31 * hash + Long.valueOf(key).hashCode();
-
- bldr.hashCode(hash);
-
- return bldr.build();
- }
-
- /**
* @param builder Builder.
* @param key Key field value.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/87477e08/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityGetBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityGetBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityGetBenchmark.java
deleted file mode 100644
index 1b36b24..0000000
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityGetBenchmark.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.yardstick.cache;
-
-import org.apache.ignite.binary.BinaryObject;
-
-/**
- * Test GETs with binary hashed key.
- */
-public class IgniteLegacyBinaryIdentityGetBenchmark extends IgniteBinaryIdentityGetBenchmark {
- /** {@inheritDoc} */
- @Override BinaryObject createKey(int key) {
- return createLegacyIdentityBinaryKey(key);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/87477e08/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityPutBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityPutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityPutBenchmark.java
deleted file mode 100644
index 246fc28..0000000
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteLegacyBinaryIdentityPutBenchmark.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.yardstick.cache;
-
-import org.apache.ignite.binary.BinaryObject;
-
-/**
- * Test PUTs with binary hashed key.
- */
-public class IgniteLegacyBinaryIdentityPutBenchmark extends IgniteBinaryIdentityPutBenchmark {
- /** {@inheritDoc} */
- @Override BinaryObject createKey(int key) {
- return createLegacyIdentityBinaryKey(key);
- }
-}
[08/50] [abbrv] ignite git commit: IGNITE-3579: Changed communication
message type to short. This closes #1501.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index bf08f0a..d65e405 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -327,7 +327,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 47;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
index 850b6d8..b162790 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
@@ -75,7 +75,7 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstractMes
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 48;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
index 186ffc1..9670f8a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
@@ -161,7 +161,7 @@ public class CacheVersionedValue implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 102;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 79c71b3..48ac543 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -522,7 +522,7 @@ public class GridNearGetRequest extends GridCacheMessage implements GridCacheDep
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 49;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
index 049431e..50af754 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
@@ -348,7 +348,7 @@ public class GridNearGetResponse extends GridCacheMessage implements GridCacheDe
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 50;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 48b508b..4815fcf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -500,7 +500,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 51;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
index b10591d..e88f0a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
@@ -314,7 +314,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 52;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
index 994172b..02d2148 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
@@ -412,7 +412,7 @@ public class GridNearSingleGetRequest extends GridCacheMessage implements GridCa
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 116;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
index bbc968d..554fca1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
@@ -303,7 +303,7 @@ public class GridNearSingleGetResponse extends GridCacheMessage implements GridC
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 117;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
index 05c1f3e..dc32263 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
@@ -207,7 +207,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 53;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
index 310e90d..e3dcbf8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
@@ -197,7 +197,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishResponse {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 54;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index 5b0807f..41e6d70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@ -393,7 +393,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 55;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 66fe902..ceab1f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -506,7 +506,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 56;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
index c32a844..2b49889 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
@@ -79,7 +79,7 @@ public class GridNearUnlockRequest extends GridDistributedUnlockRequest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 57;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index 3baafec..bc32c60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@ -805,7 +805,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 58;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index 8492c38..4036a10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -346,7 +346,7 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 59;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index c4bb205..ea07fb7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -301,7 +301,7 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 112;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
index 26e2b05..4dd7978 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
@@ -151,7 +151,7 @@ public class CacheContinuousQueryBatchAck extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 118;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
index 366a1e0..2cc6678 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
@@ -334,7 +334,7 @@ public class CacheContinuousQueryEntry implements GridCacheDeployable, Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 96;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index e1d12af..35eab18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -1211,7 +1211,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 100;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
index 2c07854..efcb48b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
@@ -178,7 +178,7 @@ public class IgniteTxKey implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 94;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index 916e4af..a0d9058 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -238,7 +238,7 @@ public class TxEntryValueHolder implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 101;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLock.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLock.java
index af85735..c0e229f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLock.java
@@ -209,7 +209,7 @@ public class TxLock implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -25;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLockList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLockList.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLockList.java
index 8b1c2dd..566f341 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLockList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLockList.java
@@ -118,7 +118,7 @@ public class TxLockList implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -26;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
index 20afcc6..d1d6afd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
@@ -189,7 +189,7 @@ public class TxLocksRequest extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -24;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
index fa6afdd..b7ca832 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
@@ -302,7 +302,7 @@ public class TxLocksResponse extends GridCacheMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -23;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
index b7c96b4..57b69d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
@@ -261,7 +261,7 @@ public class GridCacheRawVersionedEntry<K, V> extends DataStreamerEntry implemen
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 103;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
index ccc17e5..d84e4da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
@@ -338,7 +338,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 86;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
index c89b941..f15a545 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
@@ -84,7 +84,7 @@ public class GridCacheVersionEx extends GridCacheVersion {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 104;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
index 11a0ed7..4306d7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
@@ -138,7 +138,7 @@ public class GridClockDeltaSnapshotMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 60;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
index 310fd50..19c75e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
@@ -178,7 +178,7 @@ public class GridClockDeltaVersion implements Message, Comparable<GridClockDelta
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 83;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
index 91918c3..ec04ac3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
@@ -261,7 +261,7 @@ public class GridContinuousMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 61;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
index c66e08f..27a4520 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerEntry.java
@@ -162,7 +162,7 @@ public class DataStreamerEntry implements Map.Entry<KeyCacheObject, CacheObject>
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 95;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
index bd26d58..b4cbf66 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
@@ -508,7 +508,7 @@ public class DataStreamerRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 62;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerResponse.java
index 7d1307a..4cb46e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerResponse.java
@@ -161,7 +161,7 @@ public class DataStreamerResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 63;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobId.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobId.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobId.java
index 761b904..2a83f0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobId.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobId.java
@@ -125,7 +125,7 @@ public class HadoopJobId implements Message, GridCacheInternal, Externalizable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -39;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
index f596100..561966d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
@@ -226,7 +226,7 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -42;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleAck.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleAck.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleAck.java
index 9a03f99..f2891af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleAck.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleAck.java
@@ -135,7 +135,7 @@ public class HadoopShuffleAck implements HadoopMessage, Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -38;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishRequest.java
index f568c2e..d482cba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishRequest.java
@@ -135,7 +135,7 @@ public class HadoopShuffleFinishRequest implements Message, HadoopMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -40;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishResponse.java
index 4b7c93b..ea2a012 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleFinishResponse.java
@@ -109,7 +109,7 @@ public class HadoopShuffleFinishResponse implements Message, HadoopMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -41;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleMessage.java
index af54dcc..0ffea01 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleMessage.java
@@ -301,7 +301,7 @@ public class HadoopShuffleMessage implements Message, HadoopMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -37;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAckMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAckMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAckMessage.java
index 275e7eb..5ae3fed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAckMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAckMessage.java
@@ -187,7 +187,7 @@ public class IgfsAckMessage extends IgfsCommunicationMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 64;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
index 414f6b0..736525d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
@@ -30,7 +30,6 @@ import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.binary.BinaryUtils;
-import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -285,7 +284,7 @@ public final class IgfsBlockKey implements IgfsBaseBlockKey, Message, Externaliz
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 65;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
index 8b963fd..2ec54b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
@@ -168,7 +168,7 @@ public class IgfsBlocksMessage extends IgfsCommunicationMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 66;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteMessage.java
index 3224c20..b5e9666 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteMessage.java
@@ -177,7 +177,7 @@ public class IgfsDeleteMessage extends IgfsCommunicationMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 67;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
index 194869e..1e1a757 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
@@ -403,7 +403,7 @@ public class IgfsFileAffinityRange implements Message, Externalizable, Binaryliz
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 68;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
index 752c913..bb605b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
@@ -149,7 +149,7 @@ public class IgfsFragmentizerRequest extends IgfsCommunicationMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 69;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerResponse.java
index afb07bf..76793bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerResponse.java
@@ -110,7 +110,7 @@ public class IgfsFragmentizerResponse extends IgfsCommunicationMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 70;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSyncMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSyncMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSyncMessage.java
index ff9660a..2b32084 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSyncMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSyncMessage.java
@@ -141,7 +141,7 @@ public class IgfsSyncMessage extends IgfsCommunicationMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 71;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
index a42072a..75787a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
@@ -115,7 +115,7 @@ public class MissingMappingRequestMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 78;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
index 33f892b..c5513b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
@@ -127,7 +127,7 @@ public class MissingMappingResponseMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 79;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryCancelRequest.java
index 6706ab9..1ced7bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryCancelRequest.java
@@ -109,7 +109,7 @@ public class GridQueryCancelRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 106;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
index 0baf6ea..8bbe149 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
@@ -167,7 +167,7 @@ public class GridQueryFailResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 107;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java
index acea084..10782c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java
@@ -185,7 +185,7 @@ public class GridQueryNextPageRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 108;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
index e85c00b..fe8b34a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
@@ -302,7 +302,7 @@ public class GridQueryNextPageResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 109;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
index 6e42f1c..8314549 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
@@ -357,7 +357,7 @@ public class GridQueryRequest implements Message, GridCacheQueryMarshallable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 110;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
index 19a8597..b8b4edb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
@@ -163,7 +163,7 @@ public class GridTaskResultRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 76;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
index a542432..b9bb27c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
@@ -209,7 +209,7 @@ public class GridTaskResultResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 77;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
index e1469e8..0200d77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
@@ -478,7 +478,7 @@ public class GridByteArrayList implements Message, Externalizable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 84;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
index a8b9bf3..09fb098 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
@@ -576,7 +576,7 @@ public class GridLongList implements Message, Externalizable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 85;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/util/GridMessageCollection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridMessageCollection.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridMessageCollection.java
index 9220037..bb8ddfb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridMessageCollection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridMessageCollection.java
@@ -131,7 +131,7 @@ public final class GridMessageCollection<M extends Message> implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 124;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/util/UUIDCollectionMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/UUIDCollectionMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/util/UUIDCollectionMessage.java
index 7773e7b..5efb072 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/UUIDCollectionMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/UUIDCollectionMessage.java
@@ -125,7 +125,7 @@ public class UUIDCollectionMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 115;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
index 5a02662..9e423bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
@@ -72,12 +72,18 @@ public class GridDirectParser implements GridNioParser {
Message msg = ses.removeMeta(MSG_META_KEY);
try {
- if (msg == null && buf.hasRemaining())
- msg = msgFactory.create(buf.get());
+ if (msg == null && buf.remaining() >= Message.DIRECT_TYPE_SIZE) {
+ byte b0 = buf.get();
+ byte b1 = buf.get();
+
+ short type = (short)((b1 & 0xFF) << 8 | b0 & 0xFF);
+
+ msg = msgFactory.create(type);
+ }
boolean finished = false;
- if (buf.hasRemaining()) {
+ if (msg != null && buf.hasRemaining()) {
if (reader != null)
reader.setCurrentReadClass(msg.getClass());
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/Message.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/Message.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/Message.java
index acf0dbb..eba9e08 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/Message.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/Message.java
@@ -24,6 +24,9 @@ import java.nio.ByteBuffer;
* Base class for all communication messages.
*/
public interface Message extends Serializable {
+ /** Direct type size in bytes. */
+ public int DIRECT_TYPE_SIZE = 2;
+
/**
* Writes this message to provided byte buffer.
*
@@ -47,7 +50,7 @@ public interface Message extends Serializable {
*
* @return Message type.
*/
- public byte directType();
+ public short directType();
/**
* Gets fields count.
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java
index bfae912..1e9998c 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java
@@ -37,5 +37,5 @@ public interface MessageFactory extends Extension {
* @param type Message type.
* @return Message instance.
*/
- @Nullable public Message create(byte type);
+ @Nullable public Message create(short type);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
index bc2478b..982aef5 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
@@ -48,9 +48,10 @@ public interface MessageWriter {
* Writes message header.
*
* @param type Message type.
- * @param fieldCnt Fields count.�
+ * @param fieldCnt Fields count.
+ * @return {@code true} if successfully. Otherwise returns {@code false}.
*/
- public boolean writeHeader(byte type, byte fieldCnt);
+ public boolean writeHeader(short type, byte fieldCnt);
/**
* Writes {@code byte} value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 3e66bcb..ab14a57 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -728,7 +728,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
if (msgFactory0 == null) {
msgFactory0 = new MessageFactory() {
- @Nullable @Override public Message create(byte type) {
+ @Nullable @Override public Message create(short type) {
throw new IgniteException("Failed to read message, node is not started.");
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
index 1c1e5e7..6ecb145 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
@@ -105,7 +105,7 @@ public class JobStealingRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 82;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index fe915e5..2dc7598 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -330,13 +330,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
};
/** Node ID message type. */
- public static final byte NODE_ID_MSG_TYPE = -1;
+ public static final short NODE_ID_MSG_TYPE = -1;
- /** */
- public static final byte RECOVERY_LAST_ID_MSG_TYPE = -2;
+ /** Recovery last received ID message type. */
+ public static final short RECOVERY_LAST_ID_MSG_TYPE = -2;
- /** */
- public static final byte HANDSHAKE_MSG_TYPE = -3;
+ /** Handshake message type. */
+ public static final short HANDSHAKE_MSG_TYPE = -3;
/** */
private ConnectGateway connectGate;
@@ -1956,7 +1956,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
MessageFactory msgFactory = new MessageFactory() {
private MessageFactory impl;
- @Nullable @Override public Message create(byte type) {
+ @Nullable @Override public Message create(short type) {
if (impl == null)
impl = getSpiContext().messageFactory();
@@ -3094,7 +3094,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
ByteBuffer handBuff = sslHnd.applicationBuffer();
- if (handBuff.remaining() < 17) {
+ if (handBuff.remaining() < NodeIdMessage.MESSAGE_FULL_SIZE) {
buf = ByteBuffer.allocate(1000);
int read = ch.read(buf);
@@ -3110,9 +3110,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
buf = handBuff;
}
else {
- buf = ByteBuffer.allocate(17);
+ buf = ByteBuffer.allocate(NodeIdMessage.MESSAGE_FULL_SIZE);
- for (int i = 0; i < 17; ) {
+ for (int i = 0; i < NodeIdMessage.MESSAGE_FULL_SIZE; ) {
int read = ch.read(buf);
if (read == -1)
@@ -3122,7 +3122,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
}
- UUID rmtNodeId0 = U.bytesToUuid(buf.array(), 1);
+ UUID rmtNodeId0 = U.bytesToUuid(buf.array(), Message.DIRECT_TYPE_SIZE);
if (!rmtNodeId.equals(rmtNodeId0))
throw new IgniteCheckedException("Remote node ID is not as expected [expected=" + rmtNodeId +
@@ -3147,7 +3147,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (recovery != null) {
HandshakeMessage msg;
- int msgSize = 33;
+ int msgSize = HandshakeMessage.MESSAGE_FULL_SIZE;
if (handshakeConnIdx != null) {
msg = new HandshakeMessage2(locNode.id(),
@@ -3207,7 +3207,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
buf.order(ByteOrder.nativeOrder());
- for (int i = 0; i < 9; ) {
+ for (int i = 0; i < RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE; ) {
int read = ch.read(buf);
if (read == -1)
@@ -3223,10 +3223,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
buf.clear();
}
- rcvCnt = decode.getLong(1);
+ rcvCnt = decode.getLong(Message.DIRECT_TYPE_SIZE);
- if (decode.limit() > 9) {
- decode.position(9);
+ if (decode.limit() > RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE) {
+ decode.position(RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE);
sslMeta.decodedBuffer(decode);
}
@@ -3237,11 +3237,11 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
sslMeta.encodedBuffer(inBuf);
}
else {
- buf = ByteBuffer.allocate(9);
+ buf = ByteBuffer.allocate(RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE);
buf.order(ByteOrder.nativeOrder());
- for (int i = 0; i < 9; ) {
+ for (int i = 0; i < RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE; ) {
int read = ch.read(buf);
if (read == -1)
@@ -3251,7 +3251,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
i += read;
}
- rcvCnt = buf.getLong(1);
+ rcvCnt = buf.getLong(Message.DIRECT_TYPE_SIZE);
}
if (log.isDebugEnabled())
@@ -3498,6 +3498,29 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
/**
+ * Write message type to output stream.
+ *
+ * @param os Output stream.
+ * @param type Message type.
+ * @throws IOException On error.
+ */
+ private static void writeMessageType(OutputStream os, short type) throws IOException {
+ os.write((byte)(type & 0xFF));
+ os.write((byte)((type >> 8) & 0xFF));
+ }
+
+ /**
+ * Write message type to byte buffer.
+ *
+ * @param buf Byte buffer.
+ * @param type Message type.
+ */
+ private static void writeMessageType(ByteBuffer buf, short type) {
+ buf.put((byte)(type & 0xFF));
+ buf.put((byte)((type >> 8) & 0xFF));
+ }
+
+ /**
*
*/
private class ShmemWorker extends GridWorker {
@@ -3519,7 +3542,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
MessageFactory msgFactory = new MessageFactory() {
private MessageFactory impl;
- @Nullable @Override public Message create(byte type) {
+ @Nullable @Override public Message create(short type) {
if (impl == null)
impl = getSpiContext().messageFactory();
@@ -3933,12 +3956,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
@Override public void applyx(InputStream in, OutputStream out) throws IgniteCheckedException {
try {
// Handshake.
- byte[] b = new byte[17];
+ byte[] b = new byte[NodeIdMessage.MESSAGE_FULL_SIZE];
int n = 0;
- while (n < 17) {
- int cnt = in.read(b, n, 17 - n);
+ while (n < NodeIdMessage.MESSAGE_FULL_SIZE) {
+ int cnt = in.read(b, n, NodeIdMessage.MESSAGE_FULL_SIZE - n);
if (cnt < 0)
throw new IgniteCheckedException("Failed to get remote node ID (end of stream reached)");
@@ -3947,7 +3970,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
// First 4 bytes are for length.
- UUID id = U.bytesToUuid(b, 1);
+ UUID id = U.bytesToUuid(b, Message.DIRECT_TYPE_SIZE);
if (!rmtNodeId.equals(id))
throw new IgniteCheckedException("Remote node ID is not as expected [expected=" + rmtNodeId +
@@ -3975,7 +3998,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
NodeIdMessage msg = new NodeIdMessage(id);
out.write(U.IGNITE_HEADER);
- out.write(NODE_ID_MSG_TYPE);
+ writeMessageType(out, NODE_ID_MSG_TYPE);
out.write(msg.nodeIdBytes);
out.flush();
@@ -3997,6 +4020,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** */
private static final long serialVersionUID = 0L;
+ /** Message body size in bytes. */
+ private static final int MESSAGE_SIZE = 32;
+
+ /** Full message size (with message type) in bytes. */
+ public static final int MESSAGE_FULL_SIZE = MESSAGE_SIZE + DIRECT_TYPE_SIZE;
+
/** */
private UUID nodeId;
@@ -4062,10 +4091,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- if (buf.remaining() < 33)
+ if (buf.remaining() < MESSAGE_FULL_SIZE)
return false;
- buf.put(directType());
+ writeMessageType(buf, directType());
byte[] bytes = U.uuidToBytes(nodeId);
@@ -4082,10 +4111,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- if (buf.remaining() < 32)
+ if (buf.remaining() < MESSAGE_SIZE)
return false;
- byte[] nodeIdBytes = new byte[16];
+ byte[] nodeIdBytes = new byte[NodeIdMessage.MESSAGE_SIZE];
buf.get(nodeIdBytes);
@@ -4099,7 +4128,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return HANDSHAKE_MSG_TYPE;
}
@@ -4145,7 +4174,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -44;
}
@@ -4194,6 +4223,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** */
private static final long serialVersionUID = 0L;
+ /** Message body size in bytes. */
+ private static final int MESSAGE_SIZE = 8;
+
+ /** Full message size (with message type) in bytes. */
+ public static final int MESSAGE_FULL_SIZE = MESSAGE_SIZE + DIRECT_TYPE_SIZE;
+
/** */
private long rcvCnt;
@@ -4225,10 +4260,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- if (buf.remaining() < 9)
+ if (buf.remaining() < MESSAGE_FULL_SIZE)
return false;
- buf.put(RECOVERY_LAST_ID_MSG_TYPE);
+ writeMessageType(buf, directType());
buf.putLong(rcvCnt);
@@ -4237,7 +4272,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- if (buf.remaining() < 8)
+ if (buf.remaining() < MESSAGE_SIZE)
return false;
rcvCnt = buf.getLong();
@@ -4246,7 +4281,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return RECOVERY_LAST_ID_MSG_TYPE;
}
@@ -4269,6 +4304,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** */
private static final long serialVersionUID = 0L;
+ /** Message body size (with message type) in bytes. */
+ private static final int MESSAGE_SIZE = 16;
+
+ /** Full message size (with message type) in bytes. */
+ public static final int MESSAGE_FULL_SIZE = MESSAGE_SIZE + DIRECT_TYPE_SIZE;
+
/** */
private byte[] nodeIdBytes;
@@ -4288,11 +4329,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
nodeIdBytes = U.uuidToBytes(nodeId);
- nodeIdBytesWithType = new byte[nodeIdBytes.length + 1];
+ assert nodeIdBytes.length == MESSAGE_SIZE : "Node ID size must be " + MESSAGE_SIZE;
- nodeIdBytesWithType[0] = NODE_ID_MSG_TYPE;
+ nodeIdBytesWithType = new byte[MESSAGE_FULL_SIZE];
- System.arraycopy(nodeIdBytes, 0, nodeIdBytesWithType, 1, nodeIdBytes.length);
+ nodeIdBytesWithType[0] = (byte)(NODE_ID_MSG_TYPE & 0xFF);
+ nodeIdBytesWithType[1] = (byte)((NODE_ID_MSG_TYPE >> 8) & 0xFF);
+
+ System.arraycopy(nodeIdBytes, 0, nodeIdBytesWithType, 2, nodeIdBytes.length);
}
/** {@inheritDoc} */
@@ -4302,12 +4346,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- assert nodeIdBytes.length == 16;
+ assert nodeIdBytes.length == MESSAGE_SIZE;
- if (buf.remaining() < 17)
+ if (buf.remaining() < MESSAGE_FULL_SIZE)
return false;
- buf.put(NODE_ID_MSG_TYPE);
+ writeMessageType(buf, directType());
+
buf.put(nodeIdBytes);
return true;
@@ -4315,10 +4360,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- if (buf.remaining() < 16)
+ if (buf.remaining() < MESSAGE_SIZE)
return false;
- nodeIdBytes = new byte[16];
+ nodeIdBytes = new byte[MESSAGE_SIZE];
buf.get(nodeIdBytes);
@@ -4326,7 +4371,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return NODE_ID_MSG_TYPE;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
index 9cf14ce..6091d9b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
@@ -287,7 +287,7 @@ public class GridAffinityNoCacheSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2ByteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2ByteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2ByteOrderSelfTest.java
index d96f796..1f4f14f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2ByteOrderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2ByteOrderSelfTest.java
@@ -60,7 +60,7 @@ public class DirectByteBufferStreamImplV2ByteOrderSelfTest extends TestCase {
super.setUp();
stream = new DirectByteBufferStreamImplV2(new MessageFactory() {
- @Nullable @Override public Message create(byte type) {
+ @Nullable @Override public Message create(short type) {
return null;
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
index 418ba6b..5e85b62 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
@@ -50,7 +50,7 @@ public class GridManagerLocalMessageListenerSelfTest extends GridCommonAbstractT
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** */
- private static final byte DIRECT_TYPE = (byte)210;
+ private static final short DIRECT_TYPE = 210;
static {
GridIoMessageFactory.registerCustom(DIRECT_TYPE, new CO<Message>() {
[03/50] [abbrv] ignite git commit: Fixed IgniteIGNITE-4836 Yarn
deployment is ignoring memory limits
Posted by ag...@apache.org.
Fixed IgniteIGNITE-4836 Yarn deployment is ignoring memory limits
Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1f4ed52b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1f4ed52b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1f4ed52b
Branch: refs/heads/ignite-4003
Commit: 1f4ed52b29f7f71cdb5b7ac471b7f45a7f286f4a
Parents: 48e78a9
Author: Tomas Novak <to...@firma.seznam.cz>
Authored: Thu Mar 23 17:47:51 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Mar 23 17:47:51 2017 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/yarn/ClusterProperties.java | 1 +
.../ignite/yarn/IgniteApplicationMasterSelfTest.java | 13 +++++++++++++
2 files changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f4ed52b/modules/yarn/src/main/java/org/apache/ignite/yarn/ClusterProperties.java
----------------------------------------------------------------------
diff --git a/modules/yarn/src/main/java/org/apache/ignite/yarn/ClusterProperties.java b/modules/yarn/src/main/java/org/apache/ignite/yarn/ClusterProperties.java
index 647aef2..75ad27a 100644
--- a/modules/yarn/src/main/java/org/apache/ignite/yarn/ClusterProperties.java
+++ b/modules/yarn/src/main/java/org/apache/ignite/yarn/ClusterProperties.java
@@ -395,6 +395,7 @@ public class ClusterProperties {
envs.put(IGNITE_RUN_CPU_PER_NODE, toEnvVal(cpuPerNode));
envs.put(IGNITE_MEMORY_PER_NODE, toEnvVal(memPerNode));
+ envs.put(IGNITE_MEMORY_OVERHEAD_PER_NODE, toEnvVal(memOverHeadPerNode));
envs.put(IGNITE_NODE_COUNT, toEnvVal(nodeCnt));
envs.put(IGNITE_URL, toEnvVal(igniteUrl));
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f4ed52b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
index 1190313..6e82298 100644
--- a/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
+++ b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
@@ -272,6 +272,19 @@ public class IgniteApplicationMasterSelfTest extends TestCase {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testContainerEnvironment() throws Exception {
+ props.memoryPerNode(1001);
+ props.memoryOverHeadPerNode(2002);
+
+ // Properties are used to initialize AM container environment
+ Map<String, String> result = props.toEnvs();
+ assertEquals(1001, (int) Double.parseDouble(result.get(ClusterProperties.IGNITE_MEMORY_PER_NODE)));
+ assertEquals(2002, (int) Double.parseDouble(result.get(ClusterProperties.IGNITE_MEMORY_OVERHEAD_PER_NODE)));
+ }
+
+ /**
* @param host Host.
* @param cpu Cpu count.
* @param mem Memory.
[12/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index 20b5db8..f3b14b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -471,15 +471,11 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
public void testGetAsync() throws Exception {
IgniteCache<Integer, TestObject> c = jcache(0);
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
for (int i = 0; i < ENTRY_CNT; i++)
c.put(i, new TestObject(i));
for (int i = 0; i < ENTRY_CNT; i++) {
- cacheAsync.get(i);
-
- TestObject obj = cacheAsync.<TestObject>future().get();
+ TestObject obj = c.getAsync(i).get();
assertNotNull(obj);
@@ -488,12 +484,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache();
- IgniteCache<Integer, BinaryObject> cacheBinaryAsync = kpc.withAsync();
-
for (int i = 0; i < ENTRY_CNT; i++) {
- cacheBinaryAsync.get(i);
-
- BinaryObject po = cacheBinaryAsync.<BinaryObject>future().get();
+ BinaryObject po = kpc.getAsync(i).get();
assertEquals(i, (int)po.field("val"));
}
@@ -644,18 +636,15 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
return;
IgniteCache<Integer, TestObject> c = jcache(0);
- IgniteCache<Integer, TestObject> cAsync = c.withAsync();
IgniteCache<Integer, BinaryObject> kbCache = keepBinaryCache();
- IgniteCache<Integer, BinaryObject> kbCacheAsync = kbCache.withAsync();
for (int i = 0; i < ENTRY_CNT; i++)
c.put(i, new TestObject(i));
for (int i = 0; i < ENTRY_CNT; i++) {
try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) {
- cAsync.get(i);
- TestObject obj = (TestObject)cAsync.future().get();
+ TestObject obj = c.getAsync(i).get();
assertEquals(i, obj.val);
@@ -665,17 +654,13 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
for (int i = 0; i < ENTRY_CNT; i++) {
try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) {
- kbCacheAsync.get(i);
-
- BinaryObject val = (BinaryObject)kbCacheAsync.future().get();
+ BinaryObject val = kbCache.getAsync(i).get();
assertFalse("Key=" + i, val instanceof BinaryObjectOffheapImpl);
assertEquals(i, (int)val.field("val"));
- kbCacheAsync.put(i, val);
-
- kbCacheAsync.future().get();
+ kbCache.putAsync(i, val).get();
tx.commit();
}
@@ -691,16 +676,12 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
IgniteCache<Integer, TestObject> c = jcache(0);
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
for (int i = 0; i < ENTRY_CNT; i++)
c.put(i, new TestObject(i));
for (int i = 0; i < ENTRY_CNT; i++) {
try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- cacheAsync.get(i);
-
- TestObject obj = cacheAsync.<TestObject>future().get();
+ TestObject obj = c.getAsync(i).get();
assertEquals(i, obj.val);
@@ -709,13 +690,10 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
}
IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache();
- IgniteCache<Integer, BinaryObject> cacheBinaryAsync = kpc.withAsync();
for (int i = 0; i < ENTRY_CNT; i++) {
try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- cacheBinaryAsync.get(i);
-
- BinaryObject po = cacheBinaryAsync.<BinaryObject>future().get();
+ BinaryObject po = kpc.getAsync(i).get();
assertEquals(i, (int)po.field("val"));
@@ -770,8 +748,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
public void testGetAllAsync() throws Exception {
IgniteCache<Integer, TestObject> c = jcache(0);
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
for (int i = 0; i < ENTRY_CNT; i++)
c.put(i, new TestObject(i));
@@ -781,9 +757,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
for (int j = 0; j < 10; j++)
keys.add(i++);
- cacheAsync.getAll(keys);
-
- Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get();
+ Map<Integer, TestObject> objs = c.getAllAsync(keys).get();
assertEquals(10, objs.size());
@@ -792,7 +766,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
}
IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache();
- IgniteCache<Integer, BinaryObject> cacheBinaryAsync = kpc.withAsync();
for (int i = 0; i < ENTRY_CNT; ) {
Set<Integer> keys = new HashSet<>();
@@ -800,9 +773,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
for (int j = 0; j < 10; j++)
keys.add(i++);
- cacheBinaryAsync.getAll(keys);
-
- Map<Integer, BinaryObject> objs = cacheBinaryAsync.<Map<Integer, BinaryObject>>future().get();
+ Map<Integer, BinaryObject> objs = kpc.getAllAsync(keys).get();
assertEquals(10, objs.size());
@@ -906,7 +877,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
return;
IgniteCache<Integer, TestObject> c = jcache(0);
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
for (int i = 0; i < ENTRY_CNT; i++)
c.put(i, new TestObject(i));
@@ -918,9 +888,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
keys.add(i++);
try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) {
- cacheAsync.getAll(keys);
-
- Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get();
+ Map<Integer, TestObject> objs = c.getAllAsync(keys).get();
assertEquals(10, objs.size());
@@ -939,12 +907,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
for (int j = 0; j < 10; j++)
keys.add(i++);
- IgniteCache<Integer, BinaryObject> asyncCache = cache.withAsync();
-
try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) {
- asyncCache.getAll(keys);
-
- Map<Integer, BinaryObject> objs = asyncCache.<Map<Integer, BinaryObject>>future().get();
+ Map<Integer, BinaryObject> objs = cache.getAllAsync(keys).get();
assertEquals(10, objs.size());
@@ -1160,13 +1124,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
* @throws Exception If failed.
*/
public void testLoadCacheAsync() throws Exception {
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Object, Object> jcache = jcache(i).withAsync();
-
- jcache.loadCache(null);
-
- jcache.future().get();
- }
+ for (int i = 0; i < gridCount(); i++)
+ jcache(i).loadCacheAsync(null).get();
IgniteCache<Integer, TestObject> cache = jcache(0);
@@ -1182,15 +1141,13 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
*/
public void testLoadCacheFilteredAsync() throws Exception {
for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, TestObject> c = this.<Integer, TestObject>jcache(i).withAsync();
+ IgniteCache<Integer, TestObject> c = jcache(i);
- c.loadCache(new P2<Integer, TestObject>() {
+ c.loadCacheAsync(new P2<Integer, TestObject>() {
@Override public boolean apply(Integer key, TestObject val) {
return val.val < 3;
}
- });
-
- c.future().get();
+ }).get();
}
IgniteCache<Integer, TestObject> cache = jcache(0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
index f6465eb..285ea6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
@@ -53,6 +53,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -614,9 +615,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig
IgniteSemaphore semaphore = server.semaphore("sync", 0, true, true);
- IgniteCompute compute = client.compute().withAsync();
-
- compute.apply(new IgniteClosure<Ignite, Object>() {
+ IgniteFuture fut = client.compute().applyAsync(new IgniteClosure<Ignite, Object>() {
@Override public Object apply(Ignite ignite) {
final IgniteLock l = ignite.reentrantLock("lock", true, fair, true);
@@ -662,7 +661,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig
for (int i = 0; i < gridCount(); i++)
stopGrid(i);
- compute.future().get();
+ fut.get();
client.close();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java
index b664db8..eb8c3c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java
@@ -70,11 +70,9 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends IgniteCol
PutJob putJob = new PutJob(queueName);
- IgniteCompute comp = compute(grid(0).cluster().forLocal()).withAsync();
+ IgniteCompute comp = compute(grid(0).cluster().forLocal());
- comp.run(putJob);
-
- IgniteFuture<?> fut = comp.future();
+ IgniteFuture<?> fut = comp.runAsync(putJob);
Collection<IgniteFuture<?>> futs = new ArrayList<>(GRID_CNT - 1);
@@ -89,11 +87,9 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends IgniteCol
jobs.add(job);
- comp = compute(grid(i).cluster().forLocal()).withAsync();
-
- comp.call(job);
+ comp = compute(grid(i).cluster().forLocal());
- futs.add(comp.future());
+ futs.add(comp.callAsync(job));
itemsLeft -= cnt;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
index 88966b0..4714acf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
@@ -30,7 +30,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteCountDownLatch;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterGroup;
@@ -136,9 +135,7 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics
assertEquals(2, latch1.count());
- IgniteCompute comp = grid(0).compute().withAsync();
-
- comp.call(new IgniteCallable<Object>() {
+ IgniteFuture<Object> fut = grid(0).compute().callAsync(new IgniteCallable<Object>() {
@IgniteInstanceResource
private Ignite ignite;
@@ -173,8 +170,6 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics
}
});
- IgniteFuture<Object> fut = comp.future();
-
Thread.sleep(3000);
assert latch1.countDown() == 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
index 27e05b9..cccb8ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
@@ -36,7 +36,6 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteCondition;
import org.apache.ignite.IgniteCountDownLatch;
import org.apache.ignite.IgniteException;
@@ -243,9 +242,7 @@ public abstract class IgniteLockAbstractSelfTest extends IgniteAtomicsAbstractTe
lock1.lock();
- IgniteCompute comp = grid(0).compute().withAsync();
-
- comp.call(new IgniteCallable<Object>() {
+ IgniteFuture<Object> fut = grid(0).compute().callAsync(new IgniteCallable<Object>() {
@IgniteInstanceResource
private Ignite ignite;
@@ -282,8 +279,6 @@ public abstract class IgniteLockAbstractSelfTest extends IgniteAtomicsAbstractTe
}
});
- IgniteFuture<Object> fut = comp.future();
-
Thread.sleep(3000);
assert lock1.isHeldByCurrentThread();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
index 56b260f..c39fdb0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
@@ -28,7 +28,6 @@ import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -225,9 +224,7 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
assertEquals(-2, semaphore1.availablePermits());
- IgniteCompute comp = grid(0).compute().withAsync();
-
- comp.call(new IgniteCallable<Object>() {
+ IgniteFuture<Object> fut = grid(0).compute().callAsync(new IgniteCallable<Object>() {
@IgniteInstanceResource
private Ignite ignite;
@@ -264,8 +261,6 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
}
});
- IgniteFuture<Object> fut = comp.future();
-
Thread.sleep(3000);
semaphore1.release(2);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
index cf49cef..f2ae9ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
@@ -111,7 +111,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
* @throws Exception If failed.
*/
public void testAsyncFailover() throws Exception {
- IgniteCache<TestKey, TestValue> cache = ignite(0).<TestKey, TestValue>cache(null).withAsync();
+ IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
int ops = cache.getConfiguration(CacheConfiguration.class).getMaxConcurrentAsyncOperations();
@@ -178,9 +178,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
for (int k = 0; k < keys; k++)
map.put(new TestKey(rnd.nextInt(10_000)), new TestValue(k));
- cache.putAll(map);
-
- IgniteFuture<?> fut = cache.future();
+ IgniteFuture<?> fut = cache.putAllAsync(map);
assertNotNull(fut);
@@ -227,7 +225,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
});
try {
- final IgniteCache<TestKey, TestValue> cache = ignite(0).<TestKey, TestValue>cache(null).withAsync();
+ final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
GridTestUtils.runMultiThreaded(new Callable<Object>() {
@Override public Object call() throws Exception {
@@ -253,9 +251,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
for (int k = 0; k < keys; k++)
map.put(new TestKey(rnd.nextInt(10_000)), new TestValue(iter));
- cache.putAll(map);
-
- IgniteFuture<?> fut = cache.future();
+ IgniteFuture<?> fut = cache.putAllAsync(map);
assertNotNull(fut);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
index 34cbb5b..06baa09 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
@@ -122,19 +122,11 @@ public class CacheAsyncOperationsTest extends GridCommonAbstractTest {
latch = new CountDownLatch(1);
- IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
+ IgniteFuture<?> fut1 = cache.putAsync(0, 0);
- asyncCache.put(0, 0);
+ IgniteFuture<?> fut2 = cache.getAndPutAsync(1, 2);
- IgniteFuture<?> fut1 = asyncCache.future();
-
- asyncCache.getAndPut(1, 2);
-
- IgniteFuture<?> fut2 = asyncCache.future();
-
- asyncCache.getAndPut(1, 3);
-
- IgniteFuture<?> fut3 = asyncCache.future();
+ IgniteFuture<?> fut3 = cache.getAndPutAsync(1, 3);
assertFalse(fut1.isDone());
assertFalse(fut2.isDone());
@@ -166,23 +158,13 @@ public class CacheAsyncOperationsTest extends GridCommonAbstractTest {
latch = new CountDownLatch(1);
- IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
-
- asyncCache.put(0, 0);
-
- IgniteFuture<?> fut1 = asyncCache.future();
-
- asyncCache.put(0, 0);
-
- IgniteFuture<?> fut2 = asyncCache.future();
-
- asyncCache.getAndPut(1, 2);
+ IgniteFuture<?> fut1 = cache.putAsync(0, 0);
- IgniteFuture<?> fut3 = asyncCache.future();
+ IgniteFuture<?> fut2 = cache.putAsync(0, 0);
- asyncCache.put(0, 0);
+ IgniteFuture<?> fut3 = cache.getAndPutAsync(1, 2);
- IgniteFuture<?> fut4 = asyncCache.future();
+ IgniteFuture<?> fut4 = cache.putAsync(0, 0);
assertFalse(fut1.isDone());
assertFalse(fut2.isDone());
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
index 2d74e21..1e3f081 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
@@ -142,9 +142,7 @@ public abstract class CachePutAllFailoverAbstractTest extends GridCacheAbstractS
});
try {
- IgniteCache<TestKey, TestValue> cache0 = ignite(0).cache(null);
-
- final IgniteCache<TestKey, TestValue> cache = test == Test.PUT_ALL_ASYNC ? cache0.withAsync() : cache0;
+ final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
GridTestUtils.runMultiThreaded(new Callable<Object>() {
@Override public Object call() throws Exception {
@@ -184,9 +182,7 @@ public abstract class CachePutAllFailoverAbstractTest extends GridCacheAbstractS
for (int k = 0; k < 100; k++)
map.put(new TestKey(rnd.nextInt(200)), new TestValue(iter));
- cache.putAll(map);
-
- IgniteFuture<?> fut = cache.future();
+ IgniteFuture<?> fut = cache.putAllAsync(map);
assertNotNull(fut);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
index 1769e14..6a61fbb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
@@ -22,13 +22,12 @@ import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCompute;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.util.typedef.CX1;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -132,16 +131,14 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra
Ignite ignite = grid(0);
- Collection<ComputeTaskFuture<?>> futs = new LinkedList<>();
+ Collection<IgniteFuture<?>> futs = new LinkedList<>();
final String key = "TestKey";
info("Primary node for test key: " + grid(0).affinity(null).mapKeyToNode(key));
- IgniteCompute comp = ignite.compute().withAsync();
-
for (int i = 0; i < jobCnt; i++) {
- comp.apply(new CX1<Integer, Void>() {
+ futs.add(ignite.compute().applyAsync(new CX1<Integer, Void>() {
@IgniteInstanceResource
private Ignite ignite;
@@ -168,12 +165,10 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra
return null;
}
- }, i);
-
- futs.add(comp.future());
+ }, i));
}
- for (ComputeTaskFuture<?> fut : futs)
+ for (IgniteFuture<?> fut : futs)
fut.get(); // Wait for completion.
for (int i = 0; i < GRID_CNT; i++) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
index 6085fca..cd7e513 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
@@ -181,29 +181,20 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
try {
IgniteCache<String, String> cache1 = ignite1.cache(null);
- IgniteCache<String, String> cache1Async = cache1.withAsync();
IgniteCache<String, String> cache2 = ignite2.cache(null);
- IgniteCache<String, String> cache2Async = cache2.withAsync();
IgniteCache<String, String> cache3 = ignite3.cache(null);
- IgniteCache<String, String> cache3Async = cache3.withAsync();
ignite1.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
ignite2.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
ignite3.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
- cache1Async.get("async1");
-
- IgniteFuture<String> f1 = cache1Async.future();
+ IgniteFuture<String> f1 = cache1.getAsync("async1");
assert f1.get() == null;
- cache1Async.put("async1", "asyncval1");
-
- cache1Async.future().get();
+ cache1.putAsync("async1", "asyncval1").get();
- cache1Async.get("async1");
-
- f1 = cache1Async.future();
+ f1 = cache1.getAsync("async1");
String v1 = f1.get();
@@ -212,13 +203,10 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
assert latch.await(5, SECONDS);
- cache2Async.get("async1");
-
- IgniteFuture<String> f2 = cache2Async.future();
+ IgniteFuture<String> f2 = cache2.getAsync("async1");
- cache3Async.get("async1");
+ IgniteFuture<String> f3 = cache3.getAsync("async1");
- IgniteFuture<String> f3 = cache3Async.future();
String v2 = f2.get();
String v3 = f3.get();
@@ -231,25 +219,17 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
lsnr.setLatch(latch = new CountDownLatch(3));
- cache2Async.getAndRemove("async1");
-
- f2 = cache2Async.future();
+ f2 = cache2.getAndRemoveAsync("async1");
assert "asyncval1".equals(f2.get());
assert latch.await(5, SECONDS);
- cache1Async.get("async1");
-
- f1 = cache1Async.future();
-
- cache2Async.get("async1");
-
- f2 = cache2Async.future();
+ f1 = cache1.getAsync("async1");
- cache3Async.get("async1");
+ f2 = cache2.getAsync("async1");
- f3 = cache3Async.future();
+ f3 = cache3.getAsync("async1");
v1 = f1.get();
v2 = f2.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
index ee63ba9..8d916a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -311,8 +311,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
public void testGetPutRemoveAsync() throws Exception {
runTest(new TestCacheRunnable() {
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
Map.Entry<String, Integer> e = F.first(pairs(1).entrySet());
assert e != null;
@@ -320,19 +318,13 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
String key = e.getKey();
Integer val = e.getValue();
- asyncCache.getAndPut(key, val);
-
- assert asyncCache.future().get() == null;
+ assert cache.getAndPutAsync(key, val).get() == null;
assert cache.containsKey(key);
- asyncCache.get(key);
-
- assert val.equals(asyncCache.future().get());
+ assert val.equals(cache.getAsync(key).get());
- asyncCache.getAndRemove(key);
-
- assert val.equals(asyncCache.future().get());
+ assert val.equals(cache.getAndRemoveAsync(key).get());
assert !cache.containsKey(key);
}
@@ -345,8 +337,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
public void testGetPutRemoveAsyncTx1() throws Exception {
runTest(new TestCacheRunnable() {
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
Map.Entry<String, Integer> e = F.first(pairs(1).entrySet());
assert e != null;
@@ -356,19 +346,13 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
Transaction tx = cache.unwrap(Ignite.class).transactions().txStart();
- asyncCache.getAndPut(key, val);
-
- assert asyncCache.future().get() == null;
+ assert cache.getAndPutAsync(key, val).get() == null;
assert cache.containsKey(key);
- asyncCache.get(key);
+ assert val.equals(cache.getAsync(key).get());
- assert val.equals(asyncCache.future().get());
-
- asyncCache.getAndRemove(key);
-
- assert val.equals(asyncCache.future().get());
+ assert val.equals(cache.getAndRemoveAsync(key).get());
assert !cache.containsKey(key);
@@ -385,8 +369,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
public void testGetPutRemoveAsyncTx2() throws Exception {
runTest(new TestCacheRunnable() {
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
Map.Entry<String, Integer> e = F.first(pairs(1).entrySet());
assert e != null;
@@ -396,25 +378,17 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
Transaction tx = cache.unwrap(Ignite.class).transactions().txStart();
- asyncCache.getAndPut(key, val);
-
- assert asyncCache.future().get() == null;
+ assert cache.getAndPutAsync(key, val).get() == null;
assert cache.containsKey(key);
- asyncCache.get(key);
-
- assert val.equals(asyncCache.future().get());
-
- asyncCache.getAndRemove(key);
+ assert val.equals(cache.getAsync(key).get());
- assert val.equals(asyncCache.future().get());
+ assert val.equals(cache.getAndRemoveAsync(key).get());
assert !cache.containsKey(key);
- asyncCache.getAndPut(key, val);
-
- assert asyncCache.future().get() == null;
+ assert cache.getAndPutAsync(key, val).get() == null;
assert cache.containsKey(key);
@@ -588,8 +562,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
public void testPutIfAbsentAsync() throws Exception {
runTest(new TestCacheRunnable() {
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
Iterator<Map.Entry<String, Integer>> iter = pairs(2).entrySet().iterator();
Map.Entry<String, Integer> e = iter.next();
@@ -597,13 +569,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
String key = e.getKey();
Integer val = e.getValue();
- asyncCache.getAndPutIfAbsent(key, val);
-
- assert asyncCache.future().get() == null;
+ assert cache.getAndPutIfAbsentAsync(key, val).get() == null;
- asyncCache.getAndPutIfAbsent(key, val);
-
- assert val.equals(asyncCache.future().get());
+ assert val.equals(cache.getAndPutIfAbsentAsync(key, val).get());
assert cache.containsKey(key);
@@ -612,13 +580,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
key = e.getKey();
val = e.getValue();
- asyncCache.putIfAbsent(key, val);
-
- assert ((Boolean)asyncCache.future().get()).booleanValue();
-
- asyncCache.putIfAbsent(key, val);
+ assert cache.putIfAbsentAsync(key, val).get().booleanValue();
- assert !((Boolean)asyncCache.future().get()).booleanValue();
+ assert !cache.putIfAbsentAsync(key, val).get().booleanValue();
assert cache.containsKey(key);
}
@@ -634,8 +598,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
runTest(new TestCacheRunnable() {
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
Iterator<Map.Entry<String, Integer>> iter = pairs(2).entrySet().iterator();
// Optimistic transaction.
@@ -645,13 +607,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
String key = e.getKey();
Integer val = e.getValue();
- asyncCache.getAndPutIfAbsent(key, val);
-
- assert asyncCache.future().get() == null;
-
- asyncCache.getAndPutIfAbsent(key, val);
+ assert cache.getAndPutIfAbsentAsync(key, val).get() == null;
- assert val.equals(asyncCache.future().get());
+ assert val.equals(cache.getAndPutIfAbsentAsync(key, val).get());
assert cache.containsKey(key);
@@ -660,13 +618,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
key = e.getKey();
val = e.getValue();
- asyncCache.putIfAbsent(key, val);
-
- assert ((Boolean)asyncCache.future().get()).booleanValue();
-
- asyncCache.putIfAbsent(key, val);
+ assert cache.putIfAbsentAsync(key, val).get().booleanValue();
- assert !((Boolean)asyncCache.future().get()).booleanValue();
+ assert !cache.putIfAbsentAsync(key, val).get().booleanValue();
assert cache.containsKey(key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
index 93dabb8..67327be 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
@@ -66,15 +66,6 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
/** Cache 3. */
private static IgniteCache<Integer, String> cache3;
- /** Cache 1. */
- private static IgniteCache<Integer, String> cache1Async;
-
- /** Cache 2. */
- private static IgniteCache<Integer, String> cache2Async;
-
- /** Cache 3. */
- private static IgniteCache<Integer, String> cache3Async;
-
/** */
private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
@@ -103,10 +94,6 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
cache1 = ignite1.cache(null);
cache2 = ignite2.cache(null);
cache3 = ignite3.cache(null);
-
- cache1Async = cache1.withAsync();
- cache2Async = cache2.withAsync();
- cache3Async = cache3.withAsync();
}
/** {@inheritDoc} */
@@ -297,17 +284,11 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
addListener(ignite2, lsnr);
addListener(ignite3, lsnr);
- cache1Async.getAndPut(2, "val1");
-
- IgniteFuture<String> f1 = cache1Async.future();
-
- cache2Async.getAndPut(2, "val2");
-
- IgniteFuture<String> f2 = cache2Async.future();
+ IgniteFuture<String> f1 = cache1.getAndPutAsync(2, "val1");
- cache3Async.getAndPut(2, "val3");
+ IgniteFuture<String> f2 = cache2.getAndPutAsync(2, "val2");
- IgniteFuture<String> f3 = cache3Async.future();
+ IgniteFuture<String> f3 = cache3.getAndPutAsync(2, "val3");
String v1 = f1.get(20000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
index b07c437..68bce5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.resources.LoggerResource;
@@ -104,9 +105,9 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id());
- IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync();
+ IgniteCache<Object, Object> cache = ignite(0).cache("cache");
- cache.putAll(F.asMap(key1, "val1", key2, new TestValue1()));
+ IgniteFuture futPutAll = cache.putAllAsync(F.asMap(key1, "val1", key2, new TestValue1()));
try {
Thread.sleep(500);
@@ -123,7 +124,7 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
spi.stopBlock();
- cache.future().get();
+ futPutAll.get();
fut.get();
}
@@ -143,9 +144,9 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id());
- IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync();
+ IgniteCache<Object, Object> cache = ignite(0).cache("cache");
- cache.invokeAll(F.asSet(key1, key2), new TestEntryProcessor());
+ IgniteFuture futInvokeAll = cache.invokeAllAsync(F.asSet(key1, key2), new TestEntryProcessor());
try {
Thread.sleep(500);
@@ -162,7 +163,7 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
spi.stopBlock();
- cache.future().get();
+ futInvokeAll.get();
fut.get();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
index 450ab9a..7c454e6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
@@ -122,18 +122,16 @@ public class IgniteCacheConnectionRecoveryTest extends GridCommonAbstractTest {
Thread.currentThread().setName("test-thread-" + idx0 + "-" + node.name());
- IgniteCache cache1 = node.cache("cache1").withAsync();
- IgniteCache cache2 = node.cache("cache2").withAsync();
+ IgniteCache cache1 = node.cache("cache1");
+ IgniteCache cache2 = node.cache("cache2");
int iter = 0;
while (U.currentTimeMillis() < stopTime) {
try {
- cache1.putAll(data);
- cache1.future().get(15, SECONDS);
+ cache1.putAllAsync(data).get(15, SECONDS);
- cache2.putAll(data);
- cache2.future().get(15, SECONDS);
+ cache2.putAllAsync(data).get(15, SECONDS);
CyclicBarrier b = barrierRef.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
index c47e1e1..10bb3c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
@@ -113,7 +113,7 @@ public class IgniteCacheMessageRecoveryIdleConnectionTest extends GridCommonAbst
ccfg.setCacheMode(REPLICATED);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
- IgniteCache<Object, Object> cache = ignite(0).createCache(ccfg).withAsync();
+ IgniteCache<Object, Object> cache = ignite(0).createCache(ccfg);
try {
ThreadLocalRandom rnd = ThreadLocalRandom.current();
@@ -126,9 +126,7 @@ public class IgniteCacheMessageRecoveryIdleConnectionTest extends GridCommonAbst
if (iter++ % 50 == 0)
log.info("Iteration: " + iter);
- cache.put(iter, 1);
-
- IgniteFuture<?> fut = cache.future();
+ IgniteFuture<?> fut = cache.putAsync(iter, 1);
try {
fut.get(10_000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
index 4997b20..13772d5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
@@ -204,11 +204,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
info("Before commitAsync");
- tx = (Transaction)tx.withAsync();
-
- tx.commit();
-
- IgniteFuture<Transaction> fut = tx.future();
+ IgniteFuture<?> fut = tx.commitAsync();
info("Got future for commitAsync().");
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java
index aa4f5bd..82823a9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java
@@ -73,21 +73,29 @@ public class GridCacheGlobalLoadTest extends IgniteCacheAbstractTest {
* @throws Exception If failed.
*/
public void testLoadCache() throws Exception {
- loadCache(false);
+ loadCache(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLoadCacheAsyncOld() throws Exception {
+ loadCache(true, true);
}
/**
* @throws Exception If failed.
*/
public void testLoadCacheAsync() throws Exception {
- loadCache(true);
+ loadCache(true, false);
}
/**
* @param async If {@code true} uses asynchronous method.
+ * @param oldAsyncApi Flag to use old async API.
* @throws Exception If failed.
*/
- private void loadCache(boolean async) throws Exception {
+ private void loadCache(boolean async, boolean oldAsyncApi) throws Exception {
IgniteCache<Integer, Integer> cache = jcache();
IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
@@ -97,9 +105,12 @@ public class GridCacheGlobalLoadTest extends IgniteCacheAbstractTest {
map = new ConcurrentHashMap8<>();
if (async) {
- asyncCache.loadCache(null, 1, 2, 3);
+ if (oldAsyncApi) {
+ asyncCache.loadCache(null, 1, 2, 3);
- asyncCache.future().get();
+ asyncCache.future().get();
+ } else
+ cache.loadCacheAsync(null, 1, 2, 3).get();
}
else
cache.loadCache(null, 1, 2, 3);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
index d8120ac..1371612 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -237,15 +237,11 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
try (Transaction tx = ignite.transactions().txStart(conc, REPEATABLE_READ)) {
cache.put(key, key);
- Transaction asyncTx = (Transaction)tx.withAsync();
-
- asyncTx.commit();
+ IgniteFuture<?> fut = tx.commitAsync();
commitLatch.countDown();
try {
- IgniteFuture<Object> fut = asyncTx.future();
-
fut.get();
if (!commit) {
@@ -266,16 +262,14 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
}
}
else {
- IgniteCache<Object, Object> cache0 = cache.withAsync();
-
- cache0.put(key, key);
+ IgniteFuture fut = cache.putAsync(key, key);
Thread.sleep(1000);
commitLatch.countDown();
try {
- cache0.future().get();
+ fut.get();
if (!commit) {
error("Transaction has been committed");
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index 2971f81..e42ddcf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -371,22 +371,14 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
}
case PUT_ASYNC: {
- IgniteCache<Integer, Integer> cache0 = cache.withAsync();
-
while (System.currentTimeMillis() < stopTime) {
Integer val = ++iter;
- for (int i = 0; i < keysCnt; i++) {
- cache0.put(i, val);
-
- cache0.future().get();
- }
-
- for (int i = 0; i < keysCnt; i++) {
- cache0.get(i);
+ for (int i = 0; i < keysCnt; i++)
+ cache.putAsync(i, val).get();
- assertEquals(val, cache0.future().get());
- }
+ for (int i = 0; i < keysCnt; i++)
+ assertEquals(val, cache.getAsync(i).get());
}
break;
@@ -556,19 +548,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
IgniteCache<Object, Object> cache = ignite(0).cache(null).withNoRetries();
- if (async)
- cache = cache.withAsync();
-
long stopTime = System.currentTimeMillis() + 60_000;
while (System.currentTimeMillis() < stopTime) {
for (int i = 0; i < keysCnt; i++) {
try {
- if (async) {
- cache.put(i, i);
-
- cache.future().get();
- }
+ if (async)
+ cache.putAsync(i, i).get();
else
cache.put(i, i);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
index 6d90d0e..eda030c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
@@ -167,7 +167,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite client = startGrid(4);
IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE);
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
if (!blockRebalance)
awaitPartitionMapExchange();
@@ -196,9 +195,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
log.info("Start put [key1=" + key1 + ", key2=" + key2 + ']');
- nearAsyncCache.putAll(map);
-
- IgniteFuture<?> fut = nearAsyncCache.future();
+ IgniteFuture<?> fut = nearCache.putAllAsync(map);
U.sleep(500);
@@ -244,7 +241,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite client = startGrid(4);
IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE);
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
if (!blockRebalance)
awaitPartitionMapExchange();
@@ -264,9 +260,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
log.info("Start put [map=" + map + ']');
- nearAsyncCache.putAll(map);
-
- IgniteFuture<?> fut = nearAsyncCache.future();
+ IgniteFuture<?> fut = nearCache.putAllAsync(map);
U.sleep(500);
@@ -308,7 +302,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite client = startGrid(4);
IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE);
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
if (!blockRebalance)
awaitPartitionMapExchange();
@@ -323,9 +316,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
log.info("Start put [key=" + key + ']');
- nearAsyncCache.put(key, key);
-
- IgniteFuture<?> fut = nearAsyncCache.future();
+ IgniteFuture<?> fut = nearCache.putAsync(key, key);
U.sleep(500);
@@ -438,7 +429,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
client = false;
final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1, PRIMARY_SYNC));
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
awaitPartitionMapExchange();
@@ -449,9 +439,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
testSpi(srv0).blockMessages(GridDhtAtomicSingleUpdateRequest.class, srv1.name());
- nearAsyncCache.put(key, key);
-
- IgniteFuture<?> fut = nearAsyncCache.future();
+ IgniteFuture<?> fut = nearCache.putAsync(key, key);
fut.get(5, TimeUnit.SECONDS);
@@ -481,7 +469,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite clientNode = startGrid(2);
final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1, FULL_SYNC));
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
awaitPartitionMapExchange();
@@ -490,7 +477,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
final Integer key = primaryKey(srv0.cache(TEST_CACHE));
- nearAsyncCache.put(key, key);
+ nearCache.putAsync(key, key);
testSpi(srv1).blockMessages(GridDhtAtomicNearResponse.class, clientNode.name());
@@ -521,7 +508,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite clientNode = startGrid(SRVS);
final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1, FULL_SYNC));
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
awaitPartitionMapExchange();
@@ -533,7 +519,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
for (int i = 0; i < 100; i++)
map.put(i, i);
- nearAsyncCache.putAll(map);
+ nearCache.putAllAsync(map);
boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
@@ -678,7 +664,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite client = startGrid(4);
IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE);
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
testSpi(ignite(0)).blockMessages(new IgnitePredicate<GridIoMessage>() {
@Override public boolean apply(GridIoMessage msg) {
@@ -690,8 +675,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
log.info("Start put [key=" + key + ']');
- nearAsyncCache.put(key, key);
- IgniteFuture<?> fut = nearAsyncCache.future();
+ IgniteFuture<?> fut = nearCache.putAsync(key, key);
U.sleep(500);
@@ -735,7 +719,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
Ignite client = startGrid(4);
IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE);
- IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync();
if (fail0) {
testSpi(ignite(0)).blockMessages(new IgnitePredicate<GridIoMessage>() {
@@ -761,8 +744,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
map.put(key1, 10);
map.put(key2, 20);
- nearAsyncCache.putAll(map);
- IgniteFuture<?> fut = nearAsyncCache.future();
+ IgniteFuture<?> fut = nearCache.putAllAsync(map);
U.sleep(500);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index 23fbf2f..5d2ec39 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -517,7 +517,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
* @param async If {@code true} uses async method.
* @throws Exception If failed.
*/
- @Override protected void globalClearAll(boolean async) throws Exception {
+ @Override protected void globalClearAll(boolean async, boolean oldAsync) throws Exception {
// Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
// because some of them were blocked due to having readers.
for (int i = 0; i < gridCount(); i++) {
@@ -528,11 +528,14 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
}
if (async) {
- IgniteCache<String, Integer> asyncCache = jcache(nearIdx).withAsync();
+ if (oldAsync) {
+ IgniteCache<String, Integer> asyncCache = jcache(nearIdx).withAsync();
- asyncCache.clear();
+ asyncCache.clear();
- asyncCache.future().get();
+ asyncCache.future().get();
+ } else
+ jcache(nearIdx).clearAsync().get();
}
else
jcache(nearIdx).clear();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
index c6bb85e..69310a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
@@ -98,13 +98,8 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes
IgniteCache<Integer, String> cache = jcache(0);
- if (async) {
- IgniteCache<Integer, String> asyncCache = cache.withAsync();
-
- asyncCache.localLoadCache(null, PUT_CNT);
-
- asyncCache.future().get();
- }
+ if (async)
+ cache.localLoadCacheAsync(null, PUT_CNT).get();
else
cache.localLoadCache(null, PUT_CNT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
index e066764..0c14fb0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
@@ -204,17 +204,11 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb
private void checkImplicitTx(IgniteCache<String, String> cache) throws Exception {
assertNull(cache.get("key1"));
- IgniteCache<String, String> asyncCache = cache.withAsync();
-
- asyncCache.get("key2");
-
- assertNull(asyncCache.future().get());
+ assertNull(cache.getAsync("key2").get());
assertTrue(cache.getAll(F.asSet("key3", "key4")).isEmpty());
- asyncCache.getAll(F.asSet("key5", "key6"));
-
- assertTrue(((Map)asyncCache.future().get()).isEmpty());
+ assertTrue(((Map)cache.getAllAsync(F.asSet("key5", "key6")).get()).isEmpty());
cache.put("key7", "key7");
cache.remove("key7", "key7");
@@ -226,12 +220,11 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb
/**
* Checks that gets work for implicit txs.
*
+ * @param ignite Ignite instance.
* @param cache Cache to test.
* @throws Exception If failed.
*/
private void checkExplicitTx(Ignite ignite, IgniteCache<String, String> cache) throws Exception {
- IgniteCache<String, String> asyncCache = cache.withAsync();
-
Transaction tx = ignite.transactions().txStart();
try {
@@ -246,9 +239,7 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb
tx = ignite.transactions().txStart();
try {
- asyncCache.get("key2");
-
- assertNull(asyncCache.future().get());
+ assertNull(cache.getAsync("key2").get());
tx.commit();
}
@@ -270,9 +261,7 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb
tx = ignite.transactions().txStart();
try {
- asyncCache.getAll(F.asSet("key5", "key6"));
-
- assertTrue(((Map)asyncCache.future().get()).isEmpty());
+ assertTrue(((Map)cache.getAllAsync(F.asSet("key5", "key6")).get()).isEmpty());
tx.commit();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
index 586d1595..26574f1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
@@ -345,11 +345,8 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe
// Now must check the cache again, to make sure that we didn't miss the key insert while we
// were busy setting up the cache listener.
// Check asynchronously.
- IgniteCache<Integer, String> asyncCache = cache.withAsync();
- asyncCache.get(key);
-
// Complete the promise if the key was inserted concurrently.
- asyncCache.<String>future().listen(new IgniteInClosure<IgniteFuture<String>>() {
+ cache.getAsync(key).listen(new IgniteInClosure<IgniteFuture<String>>() {
@Override public void apply(IgniteFuture<String> f) {
String value = f.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java
index b6542ab..fec0637 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java
@@ -31,11 +31,11 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.compute.ComputeTaskTimeoutException;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteReducer;
import org.apache.ignite.lang.IgniteRunnable;
@@ -114,7 +114,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
@LoggerResource
private IgniteLogger log;
- /** @{inheritDoc} */
+ /** {@inheritDoc} */
@Override public void run() {
log.info("Runnable job executed on node: " + ignite.cluster().localNode().id());
@@ -198,7 +198,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @param p Optional node predicate.
* @return Future object.
*/
- private ComputeTaskFuture<?> runAsync(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) {
+ private IgniteFuture<?> runAsync(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) {
assert idx >= 0 && idx < NODES_CNT;
assert job != null;
@@ -206,11 +206,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute();
- comp = comp.withAsync();
-
- comp.run(job);
-
- return comp.future();
+ return comp.runAsync(job);
}
/**
@@ -219,7 +215,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @param p Optional node predicate.
* @return Future object.
*/
- private ComputeTaskFuture<?> broadcast(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) {
+ private IgniteFuture<?> broadcast(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) {
assert idx >= 0 && idx < NODES_CNT;
assert job != null;
@@ -230,11 +226,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
if (p != null)
prj = prj.forPredicate(p);
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(job);
-
- return comp.future();
+ return compute(prj).broadcastAsync(job);
}
/**
@@ -243,7 +235,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @param p Optional node predicate.
* @return Future object.
*/
- private ComputeTaskFuture<?> runAsync(int idx,
+ private IgniteFuture<?> runAsync(int idx,
Collection<ClosureTestRunnable> jobs,
@Nullable IgnitePredicate<ClusterNode> p)
{
@@ -254,11 +246,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute();
- comp = comp.withAsync();
-
- comp.run(jobs);
-
- return comp.future();
+ return comp.runAsync(jobs);
}
/**
@@ -267,7 +255,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @param p Optional node predicate.
* @return Future object.
*/
- private ComputeTaskFuture<Integer> callAsync(int idx,
+ private IgniteFuture<Integer> callAsync(int idx,
IgniteCallable<Integer> job, @Nullable
IgnitePredicate<ClusterNode> p) {
assert idx >= 0 && idx < NODES_CNT;
@@ -277,11 +265,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute();
- comp = comp.withAsync();
-
- comp.call(job);
-
- return comp.future();
+ return comp.callAsync(job);
}
/**
@@ -290,7 +274,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @param p Optional node predicate.
* @return Future object.
*/
- private ComputeTaskFuture<Collection<Integer>> broadcast(int idx, IgniteCallable<Integer> job,
+ private IgniteFuture<Collection<Integer>> broadcast(int idx, IgniteCallable<Integer> job,
@Nullable IgnitePredicate<ClusterNode> p) {
assert idx >= 0 && idx < NODES_CNT;
assert job != null;
@@ -299,11 +283,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute();
- comp = comp.withAsync();
-
- comp.broadcast(job);
-
- return comp.future();
+ return comp.broadcastAsync(job);
}
/**
@@ -312,7 +292,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @param p Optional node predicate.
* @return Future object.
*/
- private ComputeTaskFuture<Collection<Integer>> callAsync(int idx, Collection<ClosureTestCallable> jobs,
+ private IgniteFuture<Collection<Integer>> callAsync(int idx, Collection<ClosureTestCallable> jobs,
@Nullable IgnitePredicate<ClusterNode> p) {
assert idx >= 0 && idx < NODES_CNT;
assert !F.isEmpty(jobs);
@@ -321,11 +301,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute();
- comp = comp.withAsync();
-
- comp.call(jobs);
-
- return comp.future();
+ return comp.callAsync(jobs);
}
/**
@@ -346,7 +322,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
public void testRunAsyncSingle() throws Exception {
IgniteRunnable job = new ClosureTestRunnable();
- ComputeTaskFuture<?> fut = broadcast(0, job, null);
+ IgniteFuture<?> fut = broadcast(0, job, null);
assert fut.get() == null;
@@ -372,7 +348,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
public void testRunAsyncMultiple() throws Exception {
Collection<ClosureTestRunnable> jobs = F.asList(new ClosureTestRunnable(), new ClosureTestRunnable());
- ComputeTaskFuture<?> fut = runAsync(0, jobs, null);
+ IgniteFuture<?> fut = runAsync(0, jobs, null);
assert fut.get() == null : "Execution result must be null.";
@@ -386,7 +362,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
public void testCallAsyncSingle() throws Exception {
IgniteCallable<Integer> job = new ClosureTestCallable();
- ComputeTaskFuture<Collection<Integer>> fut1 = broadcast(0, job, null);
+ IgniteFuture<Collection<Integer>> fut1 = broadcast(0, job, null);
assert fut1.get() != null;
@@ -399,7 +375,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
assertEquals(1, execCntr.get());
- ComputeTaskFuture<Integer> fut2 = callAsync(0, job, null);
+ IgniteFuture<Integer> fut2 = callAsync(0, job, null);
assert fut2.get() == 1 :
"Execution result must be equal to 1, actual: " + fut2.get();
@@ -412,11 +388,9 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testCallAsyncErrorNoFailover() throws Exception {
- IgniteCompute comp = compute(grid(0).cluster().forPredicate(F.notEqualTo(grid(0).localNode()))).withAsync();
-
- comp.withNoFailover().call(new ClosureTestCallableError());
+ IgniteCompute comp = compute(grid(0).cluster().forPredicate(F.notEqualTo(grid(0).localNode())));
- ComputeTaskFuture<Integer> fut = comp.future();
+ IgniteFuture<Integer> fut = comp.withNoFailover().callAsync(new ClosureTestCallableError());
try {
fut.get();
@@ -472,7 +446,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
public void testCallAsyncMultiple() throws Exception {
Collection<ClosureTestCallable> jobs = F.asList(new ClosureTestCallable(), new ClosureTestCallable());
- ComputeTaskFuture<Collection<Integer>> fut = callAsync(0, jobs, null);
+ IgniteFuture<Collection<Integer>> fut = callAsync(0, jobs, null);
Collection<Integer> results = fut.get();
@@ -491,11 +465,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest {
public void testReduceAsync() throws Exception {
Collection<ClosureTestCallable> jobs = F.asList(new ClosureTestCallable(), new ClosureTestCallable());
- IgniteCompute comp = grid(0).compute().withAsync();
-
- comp.call(jobs, F.sumIntReducer());
-
- ComputeTaskFuture<Integer> fut = comp.future();
+ IgniteFuture<Integer> fut = grid(0).compute().callAsync(jobs, F.sumIntReducer());
// Sum of arithmetic progression.
int exp = (1 + jobs.size()) * jobs.size() / 2;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
index ce89e81..939101f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.compute;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
@@ -67,8 +66,7 @@ public class GridComputeJobExecutionErrorToLogManualTest extends GridCommonAbstr
public void testRuntimeException() throws Exception {
Ignite ignite = grid(0);
- IgniteCompute async = ignite.compute().withAsync();
- async.run(new IgniteRunnable() {
+ ignite.compute().runAsync(new IgniteRunnable() {
@Override public void run() {
try {
Thread.sleep(500);
@@ -77,10 +75,8 @@ public class GridComputeJobExecutionErrorToLogManualTest extends GridCommonAbstr
// No-op.
}
}
- });
-
- async.future().listen(new IgniteInClosure<IgniteFuture<Object>>() {
- @Override public void apply(IgniteFuture<Object> future) {
+ }).listen(new IgniteInClosure<IgniteFuture<Void>>() {
+ @Override public void apply(IgniteFuture<Void> future) {
throw new RuntimeException();
}
});
[25/50] [abbrv] ignite git commit: IGNITE-4827: Remove compatibility
logic for 1.x versions. This closes #1654.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index e585b56..d5f2246 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -27,12 +27,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.ReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheRebalanceMode;
@@ -54,13 +50,11 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalP
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
-import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
-import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -71,12 +65,10 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.spi.IgniteSpiException;
import org.jetbrains.annotations.Nullable;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_OBJECT_LOADED;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_PART_LOADED;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_STARTED;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_STOPPED;
-import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
import static org.apache.ignite.internal.processors.dr.GridDrType.DR_PRELOAD;
@@ -109,18 +101,6 @@ public class GridDhtPartitionDemander {
/** Last exchange future. */
private volatile GridDhtPartitionsExchangeFuture lastExchangeFut;
- /** Demand lock. */
- @Deprecated//Backward compatibility. To be removed in future.
- private final ReadWriteLock demandLock;
-
- /** DemandWorker index. */
- @Deprecated//Backward compatibility. To be removed in future.
- private final AtomicInteger dmIdx = new AtomicInteger();
-
- /** DemandWorker. */
- @Deprecated//Backward compatibility. To be removed in future.
- private volatile DemandWorker worker;
-
/** Cached rebalance topics. */
private final Map<Integer, Object> rebalanceTopics;
@@ -138,13 +118,11 @@ public class GridDhtPartitionDemander {
/**
* @param cctx Cctx.
- * @param demandLock Demand lock.
*/
- public GridDhtPartitionDemander(GridCacheContext<?, ?> cctx, ReadWriteLock demandLock) {
+ public GridDhtPartitionDemander(GridCacheContext<?, ?> cctx) {
assert cctx != null;
this.cctx = cctx;
- this.demandLock = demandLock;
log = cctx.logger(getClass());
@@ -184,11 +162,6 @@ public class GridDhtPartitionDemander {
rebalanceFut.onDone(false);
}
- DemandWorker dw = worker;
-
- if (dw != null)
- dw.cancel();
-
lastExchangeFut = null;
lastTimeoutObj.set(null);
@@ -466,65 +439,47 @@ public class GridDhtPartitionDemander {
GridDhtPartitionDemandMessage d = e.getValue();
- //Check remote node rebalancing API version.
- if (node.version().compareTo(GridDhtPreloader.REBALANCING_VER_2_SINCE) >= 0) {
- U.log(log, "Starting rebalancing [mode=" + cfg.getRebalanceMode() +
- ", fromNode=" + node.id() + ", partitionsCount=" + parts.size() +
- ", topology=" + fut.topologyVersion() + ", updateSeq=" + fut.updateSeq + "]");
-
- int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
+ U.log(log, "Starting rebalancing [mode=" + cfg.getRebalanceMode() +
+ ", fromNode=" + node.id() + ", partitionsCount=" + parts.size() +
+ ", topology=" + fut.topologyVersion() + ", updateSeq=" + fut.updateSeq + "]");
- List<Set<Integer>> sParts = new ArrayList<>(lsnrCnt);
+ int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
- for (int cnt = 0; cnt < lsnrCnt; cnt++)
- sParts.add(new HashSet<Integer>());
+ List<Set<Integer>> sParts = new ArrayList<>(lsnrCnt);
- Iterator<Integer> it = parts.iterator();
+ for (int cnt = 0; cnt < lsnrCnt; cnt++)
+ sParts.add(new HashSet<Integer>());
- int cnt = 0;
+ Iterator<Integer> it = parts.iterator();
- while (it.hasNext())
- sParts.get(cnt++ % lsnrCnt).add(it.next());
+ int cnt = 0;
- for (cnt = 0; cnt < lsnrCnt; cnt++) {
- if (!sParts.get(cnt).isEmpty()) {
- // Create copy.
- GridDhtPartitionDemandMessage initD = new GridDhtPartitionDemandMessage(d, sParts.get(cnt));
+ while (it.hasNext())
+ sParts.get(cnt++ % lsnrCnt).add(it.next());
- initD.topic(rebalanceTopics.get(cnt));
- initD.updateSequence(fut.updateSeq);
- initD.timeout(cctx.config().getRebalanceTimeout());
-
- synchronized (fut) {
- if (!fut.isDone()) {
- // Future can be already cancelled at this moment and all failovers happened.
- // New requests will not be covered by failovers.
- cctx.io().sendOrderedMessage(node,
- rebalanceTopics.get(cnt), initD, cctx.ioPolicy(), initD.timeout());
- }
+ for (cnt = 0; cnt < lsnrCnt; cnt++) {
+ if (!sParts.get(cnt).isEmpty()) {
+ // Create copy.
+ GridDhtPartitionDemandMessage initD = new GridDhtPartitionDemandMessage(d, sParts.get(cnt));
+
+ initD.topic(rebalanceTopics.get(cnt));
+ initD.updateSequence(fut.updateSeq);
+ initD.timeout(cctx.config().getRebalanceTimeout());
+
+ synchronized (fut) {
+ if (!fut.isDone()) {
+ // Future can be already cancelled at this moment and all failovers happened.
+ // New requests will not be covered by failovers.
+ cctx.io().sendOrderedMessage(node,
+ rebalanceTopics.get(cnt), initD, cctx.ioPolicy(), initD.timeout());
}
-
- if (log.isDebugEnabled())
- log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
- cnt + ", partitions count=" + sParts.get(cnt).size() +
- " (" + partitionsList(sParts.get(cnt)) + ")]");
}
- }
- }
- else {
- U.log(log, "Starting rebalancing (old api) [cache=" + cctx.name() +
- ", mode=" + cfg.getRebalanceMode() +
- ", fromNode=" + node.id() +
- ", partitionsCount=" + parts.size() +
- ", topology=" + fut.topologyVersion() +
- ", updateSeq=" + fut.updateSeq + "]");
- d.timeout(cctx.config().getRebalanceTimeout());
- d.workerId(0);//old api support.
-
- worker = new DemandWorker(dmIdx.incrementAndGet(), fut);
-
- worker.run(node, d);
+ if (log.isDebugEnabled())
+ log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
+ cnt + ", partitions count=" + sParts.get(cnt).size() +
+ " (" + partitionsList(sParts.get(cnt)) + ")]");
+ }
}
}
}
@@ -997,26 +952,23 @@ public class GridDhtPartitionDemander {
if (node == null)
return;
- //Check remote node rebalancing API version.
- if (node.version().compareTo(GridDhtPreloader.REBALANCING_VER_2_SINCE) >= 0) {
- GridDhtPartitionDemandMessage d = new GridDhtPartitionDemandMessage(
- -1/* remove supply context signal */, this.topologyVersion(), cctx.cacheId());
+ GridDhtPartitionDemandMessage d = new GridDhtPartitionDemandMessage(
+ -1/* remove supply context signal */, this.topologyVersion(), cctx.cacheId());
- d.timeout(cctx.config().getRebalanceTimeout());
+ d.timeout(cctx.config().getRebalanceTimeout());
- try {
- for (int idx = 0; idx < cctx.gridConfig().getRebalanceThreadPoolSize(); idx++) {
- d.topic(GridCachePartitionExchangeManager.rebalanceTopic(idx));
+ try {
+ for (int idx = 0; idx < cctx.gridConfig().getRebalanceThreadPoolSize(); idx++) {
+ d.topic(GridCachePartitionExchangeManager.rebalanceTopic(idx));
- cctx.io().sendOrderedMessage(node, GridCachePartitionExchangeManager.rebalanceTopic(idx),
- d, cctx.ioPolicy(), cctx.config().getRebalanceTimeout());
- }
- }
- catch (IgniteCheckedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Failed to send failover context cleanup request to node");
+ cctx.io().sendOrderedMessage(node, GridCachePartitionExchangeManager.rebalanceTopic(idx),
+ d, cctx.ioPolicy(), cctx.config().getRebalanceTimeout());
}
}
+ catch (IgniteCheckedException ignored) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to send failover context cleanup request to node");
+ }
}
/**
@@ -1147,373 +1099,4 @@ public class GridDhtPartitionDemander {
return S.toString(RebalanceFuture.class, this);
}
}
-
- /**
- * Supply message wrapper.
- */
- @Deprecated//Backward compatibility. To be removed in future.
- private static class SupplyMessage {
- /** Sender ID. */
- private UUID sndId;
-
- /** Supply message. */
- private GridDhtPartitionSupplyMessage supply;
-
- /**
- * Dummy constructor.
- */
- private SupplyMessage() {
- // No-op.
- }
-
- /**
- * @param sndId Sender ID.
- * @param supply Supply message.
- */
- SupplyMessage(UUID sndId, GridDhtPartitionSupplyMessage supply) {
- this.sndId = sndId;
- this.supply = supply;
- }
-
- /**
- * @return Sender ID.
- */
- UUID senderId() {
- return sndId;
- }
-
- /**
- * @return Message.
- */
- GridDhtPartitionSupplyMessage supply() {
- return supply;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(SupplyMessage.class, this);
- }
- }
-
- /**
- *
- */
- @Deprecated//Backward compatibility. To be removed in future.
- private class DemandWorker {
- /** Worker ID. */
- private int id;
-
- /** Partition-to-node assignments. */
- private final LinkedBlockingDeque<GridDhtPreloaderAssignments> assignQ = new LinkedBlockingDeque<>();
-
- /** Message queue. */
- private final LinkedBlockingDeque<SupplyMessage> msgQ =
- new LinkedBlockingDeque<>();
-
- /** Counter. */
- private long cntr;
-
- /** Hide worker logger and use cache logger instead. */
- private IgniteLogger log = GridDhtPartitionDemander.this.log;
-
- /** */
- private volatile RebalanceFuture fut;
-
- /**
- * @param id Worker ID.
- * @param fut Rebalance future.
- */
- private DemandWorker(int id, RebalanceFuture fut) {
- assert id >= 0;
-
- this.id = id;
- this.fut = fut;
- }
-
- /**
- * @param msg Message.
- */
- private void addMessage(SupplyMessage msg) {
- msgQ.offer(msg);
- }
-
- /**
- * @param deque Deque to poll from.
- * @param time Time to wait.
- * @return Polled item.
- * @throws InterruptedException If interrupted.
- */
- @Nullable private <T> T poll(BlockingQueue<T> deque, long time) throws InterruptedException {
- return deque.poll(time, MILLISECONDS);
- }
-
- /**
- * @param idx Unique index for this topic.
- * @return Topic for partition.
- */
- public Object topic(long idx) {
- return TOPIC_CACHE.topic(cctx.namexx(), cctx.nodeId(), id, idx);
- }
-
- /** */
- public void cancel() {
- msgQ.clear();
-
- msgQ.offer(new SupplyMessage(null, null));
- }
-
- /**
- * @param node Node to demand from.
- * @param topVer Topology version.
- * @param d Demand message.
- * @param exchFut Exchange future.
- * @throws InterruptedException If interrupted.
- * @throws ClusterTopologyCheckedException If node left.
- * @throws IgniteCheckedException If failed to send message.
- */
- private void demandFromNode(
- ClusterNode node,
- final AffinityTopologyVersion topVer,
- GridDhtPartitionDemandMessage d,
- GridDhtPartitionsExchangeFuture exchFut
- ) throws InterruptedException, IgniteCheckedException {
- GridDhtPartitionTopology top = cctx.dht().topology();
-
- cntr++;
-
- d.topic(topic(cntr));
- d.workerId(id);
-
- if (fut.isDone() || topologyChanged(fut))
- return;
-
- cctx.io().addOrderedHandler(d.topic(), new CI2<UUID, GridDhtPartitionSupplyMessage>() {
- @Override public void apply(UUID nodeId, GridDhtPartitionSupplyMessage msg) {
- addMessage(new SupplyMessage(nodeId, msg));
- }
- });
-
- try {
- boolean retry;
-
- // DoWhile.
- // =======
- do {
- retry = false;
-
- // Create copy.
- d = new GridDhtPartitionDemandMessage(d, fut.remaining.get(node.id()).get2());
-
- long timeout = cctx.config().getRebalanceTimeout();
-
- d.timeout(timeout);
-
- if (log.isDebugEnabled())
- log.debug("Sending demand message [node=" + node.id() + ", demand=" + d + ']');
-
- // Send demand message.
- cctx.io().send(node, d, cctx.ioPolicy());
-
- // While.
- // =====
- while (!fut.isDone() && !topologyChanged(fut)) {
- SupplyMessage s = poll(msgQ, timeout);
-
- // If timed out.
- if (s == null) {
- if (msgQ.isEmpty()) { // Safety check.
- U.warn(log, "Timed out waiting for partitions to load, will retry in " + timeout +
- " ms (you may need to increase 'networkTimeout' or 'rebalanceBatchSize'" +
- " configuration properties).");
-
- // Ordered listener was removed if timeout expired.
- cctx.io().removeOrderedHandler(d.topic());
-
- // Must create copy to be able to work with IO manager thread local caches.
- d = new GridDhtPartitionDemandMessage(d, fut.remaining.get(node.id()).get2());
-
- // Create new topic.
- d.topic(topic(++cntr));
-
- // Create new ordered listener.
- cctx.io().addOrderedHandler(d.topic(),
- new CI2<UUID, GridDhtPartitionSupplyMessage>() {
- @Override public void apply(UUID nodeId,
- GridDhtPartitionSupplyMessage msg) {
- addMessage(new SupplyMessage(nodeId, msg));
- }
- });
-
- // Resend message with larger timeout.
- retry = true;
-
- break; // While.
- }
- else
- continue; // While.
- }
-
- if (s.senderId() == null)
- return; // Stopping now.
-
- // Check that message was received from expected node.
- if (!s.senderId().equals(node.id())) {
- U.warn(log, "Received supply message from unexpected node [expectedId=" + node.id() +
- ", rcvdId=" + s.senderId() + ", msg=" + s + ']');
-
- continue; // While.
- }
-
- if (log.isDebugEnabled())
- log.debug("Received supply message: " + s);
-
- GridDhtPartitionSupplyMessage supply = s.supply();
-
- // Check whether there were class loading errors on unmarshal
- if (supply.classError() != null) {
- if (log.isDebugEnabled())
- log.debug("Class got undeployed during preloading: " + supply.classError());
-
- retry = true;
-
- // Quit preloading.
- break;
- }
-
- // Preload.
- for (Map.Entry<Integer, CacheEntryInfoCollection> e : supply.infos().entrySet()) {
- int p = e.getKey();
-
- if (cctx.affinity().partitionLocalNode(p, topVer)) {
- GridDhtLocalPartition part = top.localPartition(p, topVer, true);
-
- assert part != null;
-
- if (part.state() == MOVING) {
- boolean reserved = part.reserve();
-
- assert reserved : "Failed to reserve partition [igniteInstanceName=" +
- cctx.igniteInstanceName() + ", cacheName=" + cctx.namex() +
- ", part=" + part + ']';
-
- part.lock();
-
- try {
- Collection<Integer> invalidParts = new GridLeanSet<>();
-
- // Loop through all received entries and try to preload them.
- for (GridCacheEntryInfo entry : e.getValue().infos()) {
- if (!invalidParts.contains(p)) {
- if (!part.preloadingPermitted(entry.key(), entry.version())) {
- if (log.isDebugEnabled())
- log.debug("Preloading is not permitted for entry due to " +
- "evictions [key=" + entry.key() +
- ", ver=" + entry.version() + ']');
-
- continue;
- }
-
- if (!preloadEntry(node, p, entry, topVer)) {
- invalidParts.add(p);
-
- if (log.isDebugEnabled())
- log.debug("Got entries for invalid partition during " +
- "preloading (will skip) [p=" + p + ", entry=" + entry + ']');
- }
- }
- }
-
- boolean last = supply.last().contains(p);
-
- // If message was last for this partition,
- // then we take ownership.
- if (last) {
- fut.partitionDone(node.id(), p);
-
- top.own(part);
-
- if (log.isDebugEnabled())
- log.debug("Finished rebalancing partition: " + part);
-
- if (cctx.events().isRecordable(EVT_CACHE_REBALANCE_PART_LOADED))
- preloadEvent(p, EVT_CACHE_REBALANCE_PART_LOADED,
- exchFut.discoveryEvent());
- }
- }
- finally {
- part.unlock();
- part.release();
- }
- }
- else {
- fut.partitionDone(node.id(), p);
-
- if (log.isDebugEnabled())
- log.debug("Skipping rebalancing partition (state is not MOVING): " + part);
- }
- }
- else {
- fut.partitionDone(node.id(), p);
-
- if (log.isDebugEnabled())
- log.debug("Skipping rebalancing partition (it does not belong on current node): " + p);
- }
- }
-
- // Only request partitions based on latest topology version.
- for (Integer miss : s.supply().missed()) {
- if (cctx.affinity().partitionLocalNode(miss, topVer))
- fut.partitionMissed(node.id(), miss);
- }
-
- for (Integer miss : s.supply().missed())
- fut.partitionDone(node.id(), miss);
-
- if (fut.remaining.get(node.id()) == null)
- break; // While.
-
- if (s.supply().ack()) {
- retry = true;
-
- break;
- }
- }
- }
- while (retry && !fut.isDone() && !topologyChanged(fut));
- }
- finally {
- cctx.io().removeOrderedHandler(d.topic());
- }
- }
-
- /**
- * @param node Node.
- * @param d D.
- * @throws IgniteCheckedException If failed.
- */
- public void run(ClusterNode node, GridDhtPartitionDemandMessage d) throws IgniteCheckedException {
- demandLock.readLock().lock();
-
- try {
- GridDhtPartitionsExchangeFuture exchFut = fut.exchFut;
-
- AffinityTopologyVersion topVer = fut.topVer;
-
- try {
- demandFromNode(node, topVer, d, exchFut);
- }
- catch (InterruptedException e) {
- throw new IgniteCheckedException(e);
- }
- }
- finally {
- demandLock.readLock().unlock();
- }
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(DemandWorker.class, this, "assignQ", assignQ, "msgQ", msgQ, "super", super.toString());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
index e8860f2..27e6777 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
@@ -31,7 +31,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Full partition map.
*/
-public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
+public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap>
implements Comparable<GridDhtPartitionFullMap>, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -65,32 +65,9 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
* @param nodeOrder Node order.
* @param updateSeq Update sequence number.
* @param m Map to copy.
- */
- @Deprecated // Backward compatibility.
- public GridDhtPartitionFullMap(UUID nodeId, long nodeOrder, long updateSeq, Map<UUID, GridDhtPartitionMap2> m) {
- assert nodeId != null;
- assert updateSeq > 0;
- assert nodeOrder > 0;
-
- this.nodeId = nodeId;
- this.nodeOrder = nodeOrder;
- this.updateSeq = updateSeq;
-
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : m.entrySet()) {
- GridDhtPartitionMap2 part = e.getValue();
-
- put(e.getKey(), new GridDhtPartitionMap(part.nodeId(), part.updateSequence(), part.map()));
- }
- }
-
- /**
- * @param nodeId Node ID.
- * @param nodeOrder Node order.
- * @param updateSeq Update sequence number.
- * @param m Map to copy.
* @param onlyActive If {@code true}, then only active partitions will be included.
*/
- public GridDhtPartitionFullMap(UUID nodeId, long nodeOrder, long updateSeq, Map<UUID, GridDhtPartitionMap2> m,
+ public GridDhtPartitionFullMap(UUID nodeId, long nodeOrder, long updateSeq, Map<UUID, GridDhtPartitionMap> m,
boolean onlyActive) {
assert nodeId != null;
assert updateSeq > 0;
@@ -100,10 +77,10 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
this.nodeOrder = nodeOrder;
this.updateSeq = updateSeq;
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : m.entrySet()) {
- GridDhtPartitionMap2 part = e.getValue();
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : m.entrySet()) {
+ GridDhtPartitionMap part = e.getValue();
- GridDhtPartitionMap2 cpy = new GridDhtPartitionMap2(part.nodeId(),
+ GridDhtPartitionMap cpy = new GridDhtPartitionMap(part.nodeId(),
part.updateSequence(),
part.topologyVersion(),
part.map(),
@@ -168,8 +145,8 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
if (size() != fullMap.size())
return false;
- for (Map.Entry<UUID, GridDhtPartitionMap2> e : entrySet()) {
- GridDhtPartitionMap2 m = fullMap.get(e.getKey());
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : entrySet()) {
+ GridDhtPartitionMap m = fullMap.get(e.getKey());
if (m == null || !m.map().equals(e.getValue().map()))
return false;
@@ -238,7 +215,7 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
nodeOrder = in.readLong();
updateSeq = in.readLong();
- putAll(U.<UUID, GridDhtPartitionMap2>readMap(in));
+ putAll(U.<UUID, GridDhtPartitionMap>readMap(in));
}
/** {@inheritDoc} */
@@ -260,7 +237,7 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
* @return Map string representation.
*/
public String map2string() {
- Iterator<Map.Entry<UUID, GridDhtPartitionMap2>> it = entrySet().iterator();
+ Iterator<Map.Entry<UUID, GridDhtPartitionMap>> it = entrySet().iterator();
if (!it.hasNext())
return "{}";
@@ -270,11 +247,11 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
buf.append('{');
while(true) {
- Map.Entry<UUID, GridDhtPartitionMap2> e = it.next();
+ Map.Entry<UUID, GridDhtPartitionMap> e = it.next();
UUID nodeId = e.getKey();
- GridDhtPartitionMap2 partMap = e.getValue();
+ GridDhtPartitionMap partMap = e.getValue();
buf.append(nodeId).append('=').append(partMap.toFullString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 3096d63..43087ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -22,46 +22,215 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
+
/**
* Partition map.
*/
-@Deprecated // Backward compatibility, use GridDhtPartitionMap2 instead.
-public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
+public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Externalizable {
/** */
private static final long serialVersionUID = 0L;
+ /** Node ID. */
+ protected UUID nodeId;
+
+ /** Update sequence number. */
+ protected long updateSeq;
+
+ /** Topology version. */
+ protected AffinityTopologyVersion top;
+
+ /** */
+ protected Map<Integer, GridDhtPartitionState> map;
+
+ /** */
+ private volatile int moving;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtPartitionMap() {
+ // No-op.
+ }
+
/**
* @param nodeId Node ID.
* @param updateSeq Update sequence number.
+ * @param top Topology version.
* @param m Map to copy.
+ * @param onlyActive If {@code true}, then only active states will be included.
*/
- public GridDhtPartitionMap(UUID nodeId, long updateSeq,
- Map<Integer, GridDhtPartitionState> m) {
+ public GridDhtPartitionMap(UUID nodeId,
+ long updateSeq,
+ AffinityTopologyVersion top,
+ Map<Integer, GridDhtPartitionState> m,
+ boolean onlyActive) {
assert nodeId != null;
assert updateSeq > 0;
this.nodeId = nodeId;
this.updateSeq = updateSeq;
+ this.top = top;
map = U.newHashMap(m.size());
for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
GridDhtPartitionState state = e.getValue();
- put(e.getKey(), state);
+ if (!onlyActive || state.active())
+ put(e.getKey(), state);
}
}
/**
- * Empty constructor required for {@link Externalizable}.
+ * @param nodeId Node ID.
+ * @param updateSeq Update sequence number.
+ * @param top Topology version.
+ * @param map Map.
+ * @param moving Number of moving partitions.
*/
- public GridDhtPartitionMap() {
- // No-op.
+ private GridDhtPartitionMap(UUID nodeId,
+ long updateSeq,
+ AffinityTopologyVersion top,
+ Map<Integer, GridDhtPartitionState> map,
+ int moving) {
+ this.nodeId = nodeId;
+ this.updateSeq = updateSeq;
+ this.top = top;
+ this.map = map;
+ this.moving = moving;
+ }
+
+ /**
+ * @return Copy with empty partition state map.
+ */
+ public GridDhtPartitionMap emptyCopy() {
+ return new GridDhtPartitionMap(nodeId,
+ updateSeq,
+ top,
+ U.<Integer, GridDhtPartitionState>newHashMap(0),
+ 0);
+ }
+
+ /**
+ * @param part Partition.
+ * @param state Partition state.
+ */
+ public void put(Integer part, GridDhtPartitionState state) {
+ GridDhtPartitionState old = map.put(part, state);
+
+ if (old == MOVING)
+ moving--;
+
+ if (state == MOVING)
+ moving++;
+ }
+
+ /**
+ * @return {@code true} If partition map contains moving partitions.
+ */
+ public boolean hasMovingPartitions() {
+ assert moving >= 0 : moving;
+
+ return moving != 0;
+ }
+
+ /**
+ * @param part Partition.
+ * @return Partition state.
+ */
+ public GridDhtPartitionState get(Integer part) {
+ return map.get(part);
+ }
+
+ /**
+ * @param part Partition.
+ * @return {@code True} if contains given partition.
+ */
+ public boolean containsKey(Integer part) {
+ return map.containsKey(part);
+ }
+
+ /**
+ * @return Entries.
+ */
+ public Set<Map.Entry<Integer, GridDhtPartitionState>> entrySet() {
+ return map.entrySet();
+ }
+
+ /**
+ * @return Map size.
+ */
+ public int size() {
+ return map.size();
+ }
+
+ /**
+ * @return Partitions.
+ */
+ public Set<Integer> keySet() {
+ return map.keySet();
+ }
+
+ /**
+ * @return Underlying map.
+ */
+ public Map<Integer, GridDhtPartitionState> map() {
+ return map;
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Update sequence.
+ */
+ public long updateSequence() {
+ return updateSeq;
+ }
+
+ /**
+ * @param updateSeq New update sequence value.
+ * @param topVer Current topology version.
+ * @return Old update sequence value.
+ */
+ public long updateSequence(long updateSeq, AffinityTopologyVersion topVer) {
+ long old = this.updateSeq;
+
+ assert updateSeq >= old : "Invalid update sequence [cur=" + old + ", new=" + updateSeq + ']';
+
+ this.updateSeq = updateSeq;
+
+ top = topVer;
+
+ return old;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ public AffinityTopologyVersion topologyVersion() {
+ return top;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int compareTo(GridDhtPartitionMap o) {
+ assert nodeId.equals(o.nodeId);
+
+ return Long.compare(updateSeq, o.updateSeq);
}
/** {@inheritDoc} */
@@ -80,7 +249,7 @@ public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
int ordinal = entry.getValue().ordinal();
assert ordinal == (ordinal & 0x3);
- assert entry.getKey() == (entry.getKey() & 0x3FFF);
+ assert entry.getKey() < CacheConfiguration.MAX_PARTITIONS_COUNT : entry.getKey();
int coded = (ordinal << 14) | entry.getKey();
@@ -90,6 +259,15 @@ public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
}
assert i == size;
+
+ if (top != null) {
+ out.writeLong(topologyVersion().topologyVersion());
+ out.writeInt(topologyVersion().minorTopologyVersion());
+ }
+ else {
+ out.writeLong(0);
+ out.writeInt(0);
+ }
}
/** {@inheritDoc} */
@@ -110,6 +288,12 @@ public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
put(part, GridDhtPartitionState.fromOrdinal(ordinal));
}
+
+ long ver = in.readLong();
+ int minorVer = in.readInt();
+
+ if (ver != 0)
+ top = new AffinityTopologyVersion(ver, minorVer);
}
/** {@inheritDoc} */
@@ -117,7 +301,7 @@ public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
if (this == o)
return true;
- GridDhtPartitionMap2 other = (GridDhtPartitionMap2)o;
+ GridDhtPartitionMap other = (GridDhtPartitionMap)o;
return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq;
}
@@ -131,11 +315,11 @@ public class GridDhtPartitionMap extends GridDhtPartitionMap2 {
* @return Full string representation.
*/
public String toFullString() {
- return S.toString(GridDhtPartitionMap2.class, this, "size", size(), "map", map.toString());
+ return S.toString(GridDhtPartitionMap.class, this, "size", size(), "map", map.toString(), "top", top);
}
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(GridDhtPartitionMap2.class, this, "size", size());
+ return S.toString(GridDhtPartitionMap.class, this, "size", size());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
deleted file mode 100644
index 7d6f272..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteProductVersion;
-
-import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
-
-/**
- * Partition map.
- */
-public class GridDhtPartitionMap2 implements Comparable<GridDhtPartitionMap2>, Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Used since. */
- public static final IgniteProductVersion SINCE = IgniteProductVersion.fromString("1.5.0");
-
- /** Node ID. */
- protected UUID nodeId;
-
- /** Update sequence number. */
- protected long updateSeq;
-
- /** Topology version. */
- protected AffinityTopologyVersion top;
-
- /** */
- protected Map<Integer, GridDhtPartitionState> map;
-
- /** */
- private volatile int moving;
-
- /**
- * Empty constructor required for {@link Externalizable}.
- */
- public GridDhtPartitionMap2() {
- // No-op.
- }
-
- /**
- * @param nodeId Node ID.
- * @param updateSeq Update sequence number.
- * @param top Topology version.
- * @param m Map to copy.
- * @param onlyActive If {@code true}, then only active states will be included.
- */
- public GridDhtPartitionMap2(UUID nodeId,
- long updateSeq,
- AffinityTopologyVersion top,
- Map<Integer, GridDhtPartitionState> m,
- boolean onlyActive) {
- assert nodeId != null;
- assert updateSeq > 0;
-
- this.nodeId = nodeId;
- this.updateSeq = updateSeq;
- this.top = top;
-
- map = U.newHashMap(m.size());
-
- for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
- GridDhtPartitionState state = e.getValue();
-
- if (!onlyActive || state.active())
- put(e.getKey(), state);
- }
- }
-
- /**
- * @param nodeId Node ID.
- * @param updateSeq Update sequence number.
- * @param top Topology version.
- * @param map Map.
- * @param moving Number of moving partitions.
- */
- private GridDhtPartitionMap2(UUID nodeId,
- long updateSeq,
- AffinityTopologyVersion top,
- Map<Integer, GridDhtPartitionState> map,
- int moving) {
- this.nodeId = nodeId;
- this.updateSeq = updateSeq;
- this.top = top;
- this.map = map;
- this.moving = moving;
- }
-
- /**
- * @return Copy with empty partition state map.
- */
- public GridDhtPartitionMap2 emptyCopy() {
- return new GridDhtPartitionMap2(nodeId,
- updateSeq,
- top,
- U.<Integer, GridDhtPartitionState>newHashMap(0),
- 0);
- }
-
- /**
- * @param part Partition.
- * @param state Partition state.
- */
- public void put(Integer part, GridDhtPartitionState state) {
- GridDhtPartitionState old = map.put(part, state);
-
- if (old == MOVING)
- moving--;
-
- if (state == MOVING)
- moving++;
- }
-
- /**
- * @return {@code true} If partition map contains moving partitions.
- */
- public boolean hasMovingPartitions() {
- assert moving >= 0 : moving;
-
- return moving != 0;
- }
-
- /**
- * @param part Partition.
- * @return Partition state.
- */
- public GridDhtPartitionState get(Integer part) {
- return map.get(part);
- }
-
- /**
- * @param part Partition.
- * @return {@code True} if contains given partition.
- */
- public boolean containsKey(Integer part) {
- return map.containsKey(part);
- }
-
- /**
- * @return Entries.
- */
- public Set<Map.Entry<Integer, GridDhtPartitionState>> entrySet() {
- return map.entrySet();
- }
-
- /**
- * @return Map size.
- */
- public int size() {
- return map.size();
- }
-
- /**
- * @return Partitions.
- */
- public Set<Integer> keySet() {
- return map.keySet();
- }
-
- /**
- * @return Underlying map.
- */
- public Map<Integer, GridDhtPartitionState> map() {
- return map;
- }
-
- /**
- * @return Node ID.
- */
- public UUID nodeId() {
- return nodeId;
- }
-
- /**
- * @return Update sequence.
- */
- public long updateSequence() {
- return updateSeq;
- }
-
- /**
- * @param updateSeq New update sequence value.
- * @param topVer Current topology version.
- * @return Old update sequence value.
- */
- public long updateSequence(long updateSeq, AffinityTopologyVersion topVer) {
- long old = this.updateSeq;
-
- assert updateSeq >= old : "Invalid update sequence [cur=" + old + ", new=" + updateSeq + ']';
-
- this.updateSeq = updateSeq;
-
- top = topVer;
-
- return old;
- }
-
- /**
- * @return Topology version.
- */
- public AffinityTopologyVersion topologyVersion() {
- return top;
- }
-
- /** {@inheritDoc} */
- @Override public int compareTo(GridDhtPartitionMap2 o) {
- assert nodeId.equals(o.nodeId);
-
- return Long.compare(updateSeq, o.updateSeq);
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeUuid(out, nodeId);
-
- out.writeLong(updateSeq);
-
- int size = map.size();
-
- out.writeInt(size);
-
- int i = 0;
-
- for (Map.Entry<Integer, GridDhtPartitionState> entry : map.entrySet()) {
- int ordinal = entry.getValue().ordinal();
-
- assert ordinal == (ordinal & 0x3);
- assert entry.getKey() < CacheConfiguration.MAX_PARTITIONS_COUNT : entry.getKey();
-
- int coded = (ordinal << 14) | entry.getKey();
-
- out.writeShort((short)coded);
-
- i++;
- }
-
- assert i == size;
-
- if (top != null) {
- out.writeLong(topologyVersion().topologyVersion());
- out.writeInt(topologyVersion().minorTopologyVersion());
- }
- else {
- out.writeLong(0);
- out.writeInt(0);
- }
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- nodeId = U.readUuid(in);
-
- updateSeq = in.readLong();
-
- int size = in.readInt();
-
- map = U.newHashMap(size);
-
- for (int i = 0; i < size; i++) {
- int entry = in.readShort() & 0xFFFF;
-
- int part = entry & 0x3FFF;
- int ordinal = entry >> 14;
-
- put(part, GridDhtPartitionState.fromOrdinal(ordinal));
- }
-
- long ver = in.readLong();
- int minorVer = in.readInt();
-
- if (ver != 0)
- top = new AffinityTopologyVersion(ver, minorVer);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- GridDhtPartitionMap2 other = (GridDhtPartitionMap2)o;
-
- return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return 31 * nodeId.hashCode() + (int)(updateSeq ^ (updateSeq >>> 32));
- }
-
- /**
- * @return Full string representation.
- */
- public String toFullString() {
- return S.toString(GridDhtPartitionMap2.class, this, "size", size(), "map", map.toString(), "top", top);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridDhtPartitionMap2.class, this, "size", size());
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
index 6e69161..1f3dee7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
@@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.Nullable;
@@ -32,9 +31,6 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
/** */
- public static final IgniteProductVersion PART_MAP_COMPRESS_SINCE = IgniteProductVersion.fromString("1.6.11");
-
- /** */
protected static final byte COMPRESSED_FLAG_MASK = 1;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 5eacc36..f41da2b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1476,7 +1476,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
* @param msg Partitions single message.
*/
private void updatePartitionSingleMap(GridDhtPartitionsSingleMessage msg) {
- for (Map.Entry<Integer, GridDhtPartitionMap2> entry : msg.partitions().entrySet()) {
+ for (Map.Entry<Integer, GridDhtPartitionMap> entry : msg.partitions().entrySet()) {
Integer cacheId = entry.getKey();
GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index 8a7adfc..33c23e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -241,13 +241,13 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
assert map2 != null : e.getValue();
assert map1.size() == map2.size();
- for (Map.Entry<UUID, GridDhtPartitionMap2> e0 : map2.entrySet()) {
- GridDhtPartitionMap2 partMap1 = map1.get(e0.getKey());
+ for (Map.Entry<UUID, GridDhtPartitionMap> e0 : map2.entrySet()) {
+ GridDhtPartitionMap partMap1 = map1.get(e0.getKey());
assert partMap1 != null && partMap1.map().isEmpty() : partMap1;
assert !partMap1.hasMovingPartitions() : partMap1;
- GridDhtPartitionMap2 partMap2 = e0.getValue();
+ GridDhtPartitionMap partMap2 = e0.getValue();
assert partMap2 != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index d65e405..da7403e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -47,7 +47,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** Local partitions. */
@GridToStringInclude
@GridDirectTransient
- private Map<Integer, GridDhtPartitionMap2> parts;
+ private Map<Integer, GridDhtPartitionMap> parts;
/** */
@GridDirectMap(keyType = Integer.class, valueType = Integer.class)
@@ -106,7 +106,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
* @param locMap Local partition map.
* @param dupDataCache Optional ID of cache with the same partition state map.
*/
- public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap2 locMap, @Nullable Integer dupDataCache) {
+ public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap locMap, @Nullable Integer dupDataCache) {
if (parts == null)
parts = new HashMap<>();
@@ -152,7 +152,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/**
* @return Local partitions.
*/
- public Map<Integer, GridDhtPartitionMap2> partitions() {
+ public Map<Integer, GridDhtPartitionMap> partitions() {
return parts;
}
@@ -217,13 +217,13 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
assert parts != null;
for (Map.Entry<Integer, Integer> e : dupPartsData.entrySet()) {
- GridDhtPartitionMap2 map1 = parts.get(e.getKey());
+ GridDhtPartitionMap map1 = parts.get(e.getKey());
assert map1 != null : e.getKey();
assert F.isEmpty(map1.map());
assert !map1.hasMovingPartitions();
- GridDhtPartitionMap2 map2 = parts.get(e.getValue());
+ GridDhtPartitionMap map2 = parts.get(e.getValue());
assert map2 != null : e.getValue();
assert map2.map() != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 1d88742..dc988bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -36,7 +36,6 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
@@ -62,7 +61,6 @@ import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentLinkedDeque8;
@@ -80,13 +78,6 @@ import static org.apache.ignite.internal.util.GridConcurrentFactory.newMap;
* DHT cache preloader.
*/
public class GridDhtPreloader extends GridCachePreloaderAdapter {
- /**
- * Rebalancing was refactored at version 1.5.0, but backward compatibility to previous implementation was saved.
- * Node automatically chose communication protocol depends on remote node's version.
- * Backward compatibility may be removed at Ignite 2.x.
- */
- public static final IgniteProductVersion REBALANCING_VER_2_SINCE = IgniteProductVersion.fromString("1.5.0");
-
/** Default preload resend timeout. */
public static final long DFLT_PRELOAD_RESEND_TIMEOUT = 1500;
@@ -194,7 +185,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
cctx.shared().affinity().onCacheCreated(cctx);
supplier = new GridDhtPartitionSupplier(cctx);
- demander = new GridDhtPartitionDemander(cctx, demandLock);
+ demander = new GridDhtPartitionDemander(cctx);
supplier.start();
demander.start();
@@ -619,14 +610,11 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
AffinityAssignment assignment = cctx.affinity().assignment(topVer);
- boolean newAffMode = node.version().compareTo(CacheAffinitySharedManager.LATE_AFF_ASSIGN_SINCE) >= 0;
-
GridDhtAffinityAssignmentResponse res = new GridDhtAffinityAssignmentResponse(cctx.cacheId(),
topVer,
- assignment.assignment(),
- newAffMode);
+ assignment.assignment());
- if (newAffMode && cctx.affinity().affinityCache().centralizedAffinityFunction()) {
+ if (cctx.affinity().affinityCache().centralizedAffinityFunction()) {
assert assignment.idealAssignment() != null;
res.idealAffinityAssignment(assignment.idealAssignment());
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
index 4dd7978..76147ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.GridDirectMap;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -34,9 +33,6 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
*/
public class CacheContinuousQueryBatchAck extends GridCacheMessage {
/** */
- public static final IgniteProductVersion SINCE_VER = IgniteProductVersion.fromString("1.5.0");
-
- /** */
private static final long serialVersionUID = 0L;
/** Routine ID. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 485059f..6c8df14 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -1324,7 +1324,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
for (AffinityTopologyVersion topVer : t.get2()) {
for (ClusterNode node : ctx.discovery().cacheAffinityNodes(cctx.name(), topVer)) {
- if (!node.isLocal() && node.version().compareTo(CacheContinuousQueryBatchAck.SINCE_VER) >= 0) {
+ if (!node.isLocal()) {
try {
cctx.io().send(node, msg, GridIoPolicy.SYSTEM_POOL);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 6887a50..745bbde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -58,14 +58,13 @@ import org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
-import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteAsyncCallback;
-import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.resources.LoggerResource;
@@ -78,7 +77,6 @@ import static javax.cache.event.EventType.REMOVED;
import static javax.cache.event.EventType.UPDATED;
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_OBJECT_READ;
import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
-import static org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.QUERY_MSG_VER_2_SINCE;
/**
* Continuous queries manager.
@@ -424,49 +422,30 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
final boolean keepBinary,
final boolean includeExpired) throws IgniteCheckedException
{
- IgniteClosure<Boolean, CacheContinuousQueryHandler> clsr;
+ IgniteOutClosure<CacheContinuousQueryHandler> clsr;
if (rmtFilterFactory != null)
- clsr = new IgniteClosure<Boolean, CacheContinuousQueryHandler>() {
- @Override public CacheContinuousQueryHandler apply(Boolean v2) {
+ clsr = new IgniteOutClosure<CacheContinuousQueryHandler>() {
+ @Override public CacheContinuousQueryHandler apply() {
CacheContinuousQueryHandler hnd;
- if (v2)
- hnd = new CacheContinuousQueryHandlerV2(
- cctx.name(),
- TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
- locLsnr,
- rmtFilterFactory,
- true,
- false,
- !includeExpired,
- false,
- null);
- else {
- CacheEntryEventFilter fltr = rmtFilterFactory.create();
-
- if (!(fltr instanceof CacheEntryEventSerializableFilter))
- throw new IgniteException("Topology has nodes of the old versions. In this case " +
- "EntryEventFilter should implement " +
- "org.apache.ignite.cache.CacheEntryEventSerializableFilter interface. Filter: " + fltr);
-
- hnd = new CacheContinuousQueryHandler(
- cctx.name(),
- TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
- locLsnr,
- (CacheEntryEventSerializableFilter)fltr,
- true,
- false,
- !includeExpired,
- false);
- }
+ hnd = new CacheContinuousQueryHandlerV2(
+ cctx.name(),
+ TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
+ locLsnr,
+ rmtFilterFactory,
+ true,
+ false,
+ !includeExpired,
+ false,
+ null);
return hnd;
}
};
else
- clsr = new IgniteClosure<Boolean, CacheContinuousQueryHandler>() {
- @Override public CacheContinuousQueryHandler apply(Boolean ignore) {
+ clsr = new IgniteOutClosure<CacheContinuousQueryHandler>() {
+ @Override public CacheContinuousQueryHandler apply() {
return new CacheContinuousQueryHandler(
cctx.name(),
TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
@@ -509,8 +488,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
{
return executeQuery0(
locLsnr,
- new IgniteClosure<Boolean, CacheContinuousQueryHandler>() {
- @Override public CacheContinuousQueryHandler apply(Boolean v2) {
+ new IgniteOutClosure<CacheContinuousQueryHandler>() {
+ @Override public CacheContinuousQueryHandler apply() {
return new CacheContinuousQueryHandler(
cctx.name(),
TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
@@ -603,18 +582,20 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
/**
* @param locLsnr Local listener.
+ * @param clsr Closure to create CacheContinuousQueryHandler.
* @param bufSize Buffer size.
* @param timeInterval Time interval.
* @param autoUnsubscribe Auto unsubscribe flag.
* @param internal Internal flag.
* @param notifyExisting Notify existing flag.
* @param loc Local flag.
+ * @param keepBinary Keep binary flag.
* @param onStart Waiting topology exchange.
* @return Continuous routine ID.
* @throws IgniteCheckedException In case of error.
*/
private UUID executeQuery0(CacheEntryUpdatedListener locLsnr,
- IgniteClosure<Boolean, CacheContinuousQueryHandler> clsr,
+ IgniteOutClosure<CacheContinuousQueryHandler> clsr,
int bufSize,
long timeInterval,
boolean autoUnsubscribe,
@@ -631,9 +612,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean skipPrimaryCheck = loc && cctx.config().getCacheMode() == CacheMode.REPLICATED && cctx.affinityNode();
- boolean v2 = useV2Protocol(cctx.discovery().allNodes());
-
- final CacheContinuousQueryHandler hnd = clsr.apply(v2);
+ final CacheContinuousQueryHandler hnd = clsr.apply();
hnd.taskNameHash(taskNameHash);
hnd.skipPrimaryCheck(skipPrimaryCheck);
@@ -799,20 +778,6 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
}
/**
- * @param nodes Nodes.
- * @return {@code True} if all nodes greater than {@link GridContinuousProcessor#QUERY_MSG_VER_2_SINCE},
- * otherwise {@code false}.
- */
- private boolean useV2Protocol(Collection<ClusterNode> nodes) {
- for (ClusterNode node : nodes) {
- if (QUERY_MSG_VER_2_SINCE.compareTo(node.version()) > 0)
- return false;
- }
-
- return true;
- }
-
- /**
* @param lsnrId Listener ID.
* @param lsnr Listener.
* @param internal Internal flag.
@@ -922,14 +887,12 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
routineId = executeQuery0(
locLsnr,
- new IgniteClosure<Boolean, CacheContinuousQueryHandler>() {
- @Override public CacheContinuousQueryHandler apply(Boolean v2) {
+ new IgniteOutClosure<CacheContinuousQueryHandler>() {
+ @Override public CacheContinuousQueryHandler apply() {
CacheContinuousQueryHandler hnd;
Factory<CacheEntryEventFilter> rmtFilterFactory = cfg.getCacheEntryEventFilterFactory();
- v2 = rmtFilterFactory != null && v2;
-
- if (v2)
+ if (rmtFilterFactory != null)
hnd = new CacheContinuousQueryHandlerV2(
cctx.name(),
TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index ca4edb6..3814731 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -37,7 +37,6 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreSession;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
@@ -67,7 +66,6 @@ import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.transactions.Transaction;
@@ -87,13 +85,6 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
/** */
private static final int SES_ATTR = GridMetadataAwareAdapter.EntryKey.CACHE_STORE_MANAGER_KEY.key();
- /**
- * Behavior can be changed by setting {@link IgniteSystemProperties#IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY} property
- * to {@code True}.
- */
- private static final IgniteProductVersion LOCAL_STORE_KEEPS_PRIMARY_AND_BACKUPS_SINCE =
- IgniteProductVersion.fromString("1.5.22");
-
/** */
protected CacheStore<Object, Object> store;
@@ -237,22 +228,6 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
globalSesLsnrs = true;
}
-
- if (isLocal()) {
- for (ClusterNode node : cctx.kernalContext().cluster().get().forRemotes().nodes()) {
- if (LOCAL_STORE_KEEPS_PRIMARY_AND_BACKUPS_SINCE.compareTo(node.version()) > 0 &&
- !IgniteSystemProperties.getBoolean(IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY)) {
- IgniteProductVersion v = LOCAL_STORE_KEEPS_PRIMARY_AND_BACKUPS_SINCE;
-
- log.warning("Since Ignite " + v.major() + "." + v.minor() + "." + v.maintenance() +
- " Local Store keeps primary and backup partitions. " +
- "To keep primary partitions only please set system property " +
- IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY + " to 'true'.");
-
- break;
- }
- }
- }
}
/** {@inheritDoc} */
[23/50] [abbrv] ignite git commit: IGNITE-4827: Remove compatibility
logic for 1.x versions. This closes #1654.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
index 843dfce..00587b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
@@ -32,8 +32,14 @@ public class VisorQueryArg implements Serializable {
/** Query text. */
private final String qryTxt;
+ /** Distributed joins enabled flag. */
+ private final boolean distributedJoins;
+
+ /** Enforce join order flag. */
+ private final boolean enforceJoinOrder;
+
/** Flag whether to execute query locally. */
- private final boolean local;
+ private final boolean loc;
/** Result batch size. */
private final int pageSize;
@@ -41,13 +47,18 @@ public class VisorQueryArg implements Serializable {
/**
* @param cacheName Cache name for query.
* @param qryTxt Query text.
- * @param local Flag whether to execute query locally.
+ * @param distributedJoins If {@code true} then distributed joins enabled.
+ * @param enforceJoinOrder If {@code true} then enforce join order.
+ * @param loc Flag whether to execute query locally.
* @param pageSize Result batch size.
*/
- public VisorQueryArg(String cacheName, String qryTxt, boolean local, int pageSize) {
+ public VisorQueryArg(String cacheName, String qryTxt,
+ boolean distributedJoins, boolean enforceJoinOrder, boolean loc, int pageSize) {
this.cacheName = cacheName;
this.qryTxt = qryTxt;
- this.local = local;
+ this.distributedJoins = distributedJoins;
+ this.enforceJoinOrder = enforceJoinOrder;
+ this.loc = loc;
this.pageSize = pageSize;
}
@@ -61,15 +72,29 @@ public class VisorQueryArg implements Serializable {
/**
* @return Query txt.
*/
- public String queryTxt() {
+ public String queryText() {
return qryTxt;
}
/**
+ * @return Distributed joins enabled flag.
+ */
+ public boolean distributedJoins() {
+ return distributedJoins;
+ }
+
+ /**
+ * @return Enforce join order flag.
+ */
+ public boolean enforceJoinOrder() {
+ return enforceJoinOrder;
+ }
+
+ /**
* @return {@code true} if query should be executed locally.
*/
public boolean local() {
- return local;
+ return loc;
}
/**
@@ -78,4 +103,4 @@ public class VisorQueryArg implements Serializable {
public int pageSize() {
return pageSize;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV2.java
deleted file mode 100644
index 8ed3976..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV2.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-/**
- * Arguments for {@link VisorQueryTask}.
- */
-public class VisorQueryArgV2 extends VisorQueryArg {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Distributed joins enabled flag. */
- private final boolean distributedJoins;
-
- /**
- * @param cacheName Cache name for query.
- * @param qryTxt Query text.
- * @param distributedJoins If {@code true} then distributed joins enabled.
- * @param loc Flag whether to execute query locally.
- * @param pageSize Result batch size.
- */
- public VisorQueryArgV2(String cacheName, String qryTxt, boolean distributedJoins, boolean loc, int pageSize) {
- super(cacheName, qryTxt, loc, pageSize);
-
- this.distributedJoins = distributedJoins;
- }
-
- /**
- * @return Distributed joins enabled flag.
- */
- public boolean distributedJoins() {
- return distributedJoins;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java
deleted file mode 100644
index f32c00a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-/**
- * Arguments for {@link VisorQueryTask}.
- */
-public class VisorQueryArgV3 extends VisorQueryArgV2 {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Enforce join order flag. */
- private final boolean enforceJoinOrder;
-
- /**
- * @param cacheName Cache name for query.
- * @param qryTxt Query text.
- * @param distributedJoins If {@code true} then distributed joins enabled.
- * @param enforceJoinOrder If {@code true} then enforce join order.
- * @param loc Flag whether to execute query locally.
- * @param pageSize Result batch size.
- */
- public VisorQueryArgV3(String cacheName, String qryTxt,
- boolean distributedJoins, boolean enforceJoinOrder, boolean loc, int pageSize) {
- super(cacheName, qryTxt, distributedJoins, loc, pageSize);
-
- this.enforceJoinOrder = enforceJoinOrder;
- }
-
- /**
- * @return Enforce join order flag.
- */
- public boolean enforceJoinOrder() {
- return enforceJoinOrder;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index 1ac90ad..2a5905e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -108,7 +108,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
try {
UUID nid = ignite.localNode().id();
- String qryTxt = arg.queryTxt();
+ String qryTxt = arg.queryText();
boolean scan = qryTxt == null;
@@ -157,11 +157,11 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
duration));
}
else {
- SqlFieldsQuery qry = new SqlFieldsQuery(arg.queryTxt());
+ SqlFieldsQuery qry = new SqlFieldsQuery(arg.queryText());
qry.setPageSize(arg.pageSize());
+ qry.setDistributedJoins(arg.distributedJoins());
+ qry.setEnforceJoinOrder(arg.enforceJoinOrder());
qry.setLocal(arg.local());
- qry.setDistributedJoins(arg instanceof VisorQueryArgV2 && ((VisorQueryArgV2)arg).distributedJoins());
- qry.setEnforceJoinOrder(arg instanceof VisorQueryArgV3 && ((VisorQueryArgV3)arg).enforceJoinOrder());
long start = U.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java
index 829adb3..ca319db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java
@@ -136,7 +136,7 @@ public class VisorEventMapper implements IgniteClosure<Event, VisorGridEvent> {
ClusterNode node = de.eventNode();
return new VisorGridDiscoveryEvent(type, id, name, nid, ts, msg, shortDisplay, node.id(),
- F.first(node.addresses()), node.isDaemon());
+ F.first(node.addresses()), node.isDaemon(), de.topologyVersion());
}
/** {@inheritDoc} */
@@ -144,4 +144,4 @@ public class VisorEventMapper implements IgniteClosure<Event, VisorGridEvent> {
return map(evt, evt.type(), evt.id(), evt.name(), evt.node().id(), evt.timestamp(), evt.message(),
evt.shortDisplay());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 8e4590e..9805950 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -41,7 +41,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
-import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.zip.ZipEntry;
@@ -55,21 +54,18 @@ import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyMBean;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicyMBean;
import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyMBean;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.visor.event.VisorGridDiscoveryEventV2;
import org.apache.ignite.internal.visor.event.VisorGridEvent;
import org.apache.ignite.internal.visor.event.VisorGridEventsLost;
import org.apache.ignite.internal.visor.file.VisorFileBlock;
import org.apache.ignite.internal.visor.log.VisorLogFile;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import static java.lang.System.getProperty;
@@ -390,17 +386,6 @@ public class VisorTaskUtils {
/** Mapper from grid event to Visor data transfer object. */
public static final VisorEventMapper EVT_MAPPER = new VisorEventMapper();
- /** Mapper from grid event to Visor data transfer object. */
- public static final VisorEventMapper EVT_MAPPER_V2 = new VisorEventMapper() {
- @Override protected VisorGridEvent discoveryEvent(DiscoveryEvent de, int type, IgniteUuid id, String name,
- UUID nid, long ts, String msg, String shortDisplay) {
- ClusterNode node = de.eventNode();
-
- return new VisorGridDiscoveryEventV2(type, id, name, nid, ts, msg, shortDisplay, node.id(),
- F.first(node.addresses()), node.isDaemon(), de.topologyVersion());
- }
- };
-
/**
* Grabs local events and detects if events was lost since last poll.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 2dc7598..42879b7 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -243,9 +243,6 @@ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.SSL_META
@IgniteSpiConsistencyChecked(optional = false)
public class TcpCommunicationSpi extends IgniteSpiAdapter
implements CommunicationSpi<Message>, TcpCommunicationSpiMBean {
- /** */
- private static final IgniteProductVersion MULTIPLE_CONN_SINCE_VER = IgniteProductVersion.fromString("1.8.2");
-
/** IPC error message. */
public static final String OUT_OF_RESOURCES_TCP_MSG = "Failed to allocate shared memory segment " +
"(switching to TCP, may be slower).";
@@ -2340,7 +2337,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
else {
GridCommunicationClient client = null;
- int connIdx = useMultipleConnections(node) ? connPlc.connectionIndex() : 0;
+ int connIdx = connPlc.connectionIndex();
try {
boolean retry;
@@ -2430,7 +2427,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
GridCommunicationClient[] newClients;
if (curClients == null) {
- newClients = new GridCommunicationClient[useMultipleConnections(node) ? connectionsPerNode : 1];
+ newClients = new GridCommunicationClient[connectionsPerNode];
newClients[connIdx] = addClient;
if (clients.putIfAbsent(node.id(), newClients) == null)
@@ -2865,7 +2862,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
sslMeta.sslEngine(sslEngine);
}
- Integer handshakeConnIdx = useMultipleConnections(node) ? connIdx : null;
+ Integer handshakeConnIdx = connIdx;
rcvCnt = safeHandshake(ch,
recoveryDesc,
@@ -3357,14 +3354,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/**
* @param node Node.
- * @return {@code True} if given node supports multiple connections per-node for communication.
- */
- private boolean useMultipleConnections(ClusterNode node) {
- return node.version().compareToIgnoreTimestamp(MULTIPLE_CONN_SINCE_VER) >= 0;
- }
-
- /**
- * @param node Node.
* @return {@code True} if can use in/out connection pair for communication.
*/
private boolean usePairedConnections(ClusterNode node) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 35dcdba..3e7d815 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -69,9 +69,7 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
-import org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager;
import org.apache.ignite.internal.processors.security.SecurityContext;
-import org.apache.ignite.internal.processors.service.GridServiceProcessor;
import org.apache.ignite.internal.util.GridBoundedLinkedHashSet;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -171,10 +169,6 @@ class ServerImpl extends TcpDiscoveryImpl {
private static final int ENSURED_MSG_HIST_SIZE = getInteger(IGNITE_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE, 512);
/** */
- private static final IgniteProductVersion CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE =
- IgniteProductVersion.fromString("1.5.0");
-
- /** */
private IgniteThreadPoolExecutor utilityPool;
/** Nodes ring. */
@@ -2942,14 +2936,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- if (msg instanceof TcpDiscoveryConnectionCheckMessage) {
- if (!next.version().greaterThanEqual(TcpDiscoverySpi.FAILURE_DETECTION_MAJOR_VER,
- TcpDiscoverySpi.FAILURE_DETECTION_MINOR_VER,
- TcpDiscoverySpi.FAILURE_DETECTION_MAINT_VER))
- // Preserve backward compatibility with nodes of older versions.
- msg = new TcpDiscoveryStatusCheckMessage(locNode, null);
- }
- else
+ if (!(msg instanceof TcpDiscoveryConnectionCheckMessage))
prepareNodeAddedMessage(msg, next.id(), pendingMsgs.msgs, pendingMsgs.discardId,
pendingMsgs.customDiscardId);
@@ -3625,15 +3612,9 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
- boolean rmtLateAssignBool;
-
- if (node.version().compareToIgnoreTimestamp(CacheAffinitySharedManager.LATE_AFF_ASSIGN_SINCE) >= 0) {
- Boolean rmtLateAssign = node.attribute(ATTR_LATE_AFFINITY_ASSIGNMENT);
- // Can be null only in tests.
- rmtLateAssignBool = rmtLateAssign != null ? rmtLateAssign : false;
- }
- else
- rmtLateAssignBool = false;
+ Boolean rmtLateAssign = node.attribute(ATTR_LATE_AFFINITY_ASSIGNMENT);
+ // Can be null only in tests.
+ boolean rmtLateAssignBool = rmtLateAssign != null ? rmtLateAssign : false;
if (locLateAssignBool != rmtLateAssignBool) {
String errMsg = "Local node's cache affinity assignment mode differs from " +
@@ -3660,61 +3641,31 @@ class ServerImpl extends TcpDiscoveryImpl {
final Boolean locSrvcCompatibilityEnabled = locNode.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
- if (node.version().compareToIgnoreTimestamp(GridServiceProcessor.LAZY_SERVICES_CFG_SINCE) >= 0) {
- final Boolean rmtSrvcCompatibilityEnabled = node.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
-
- if (!F.eq(locSrvcCompatibilityEnabled, rmtSrvcCompatibilityEnabled)) {
- utilityPool.execute(
- new Runnable() {
- @Override public void run() {
- String errMsg = "Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
- " property value differs from remote node's value " +
- "(to make sure all nodes in topology have identical IgniteServices compatibility mode, " +
- "configure system property explicitly) " +
- "[locSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
- ", rmtSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
- ", locNodeAddrs=" + U.addressesAsString(locNode) +
- ", rmtNodeAddrs=" + U.addressesAsString(node) +
- ", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId() + ']';
-
- String sndMsg = "Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
- " property value differs from remote node's value " +
- "(to make sure all nodes in topology have identical IgniteServices compatibility mode, " +
- "configure system property explicitly) " +
- "[locSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
- ", rmtSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
- ", locNodeAddrs=" + U.addressesAsString(node) + ", locPort=" + node.discoveryPort() +
- ", rmtNodeAddr=" + U.addressesAsString(locNode) + ", locNodeId=" + node.id() +
- ", rmtNodeId=" + locNode.id() + ']';
+ final Boolean rmtSrvcCompatibilityEnabled = node.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
- nodeCheckError(
- node,
- errMsg,
- sndMsg);
- }
- });
-
- // Ignore join request.
- return;
- }
- }
- else if (Boolean.FALSE.equals(locSrvcCompatibilityEnabled)) {
+ if (!F.eq(locSrvcCompatibilityEnabled, rmtSrvcCompatibilityEnabled)) {
utilityPool.execute(
new Runnable() {
@Override public void run() {
- String errMsg = "Remote node doesn't support lazy services configuration and " +
- "cannot be joined to local node because local node's "
- + IGNITE_SERVICES_COMPATIBILITY_MODE + " property value explicitly set to 'false'" +
- "[locNodeAddrs=" + U.addressesAsString(locNode) +
+ String errMsg = "Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
+ " property value differs from remote node's value " +
+ "(to make sure all nodes in topology have identical IgniteServices compatibility mode, " +
+ "configure system property explicitly) " +
+ "[locSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
+ ", rmtSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
+ ", locNodeAddrs=" + U.addressesAsString(locNode) +
", rmtNodeAddrs=" + U.addressesAsString(node) +
- ", locNodeId=" + locNode.id() + ", rmtNodeId=" + node.id() + ']';
+ ", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId() + ']';
- String sndMsg = "Local node doesn't support lazy services configuration and " +
- "cannot be joined to local node because remote node's "
- + IGNITE_SERVICES_COMPATIBILITY_MODE + " property value explicitly set to 'false'" +
- "[locNodeAddrs=" + U.addressesAsString(node) +
- ", rmtNodeAddrs=" + U.addressesAsString(locNode) +
- ", locNodeId=" + node.id() + ", rmtNodeId=" + locNode.id() + ']';
+ String sndMsg = "Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
+ " property value differs from remote node's value " +
+ "(to make sure all nodes in topology have identical IgniteServices compatibility mode, " +
+ "configure system property explicitly) " +
+ "[locSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
+ ", rmtSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
+ ", locNodeAddrs=" + U.addressesAsString(node) + ", locPort=" + node.discoveryPort() +
+ ", rmtNodeAddr=" + U.addressesAsString(locNode) + ", locNodeId=" + node.id() +
+ ", rmtNodeId=" + locNode.id() + ']';
nodeCheckError(
node,
@@ -5113,10 +5064,7 @@ class ServerImpl extends TcpDiscoveryImpl {
joiningEmpty = joiningNodes.isEmpty();
}
- if (ring.minimumNodeVersion().compareTo(CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE) >= 0)
- delayMsg = msg.topologyVersion() == 0L && !joiningEmpty;
- else
- delayMsg = !joiningEmpty;
+ delayMsg = msg.topologyVersion() == 0L && !joiningEmpty;
if (delayMsg) {
if (log.isDebugEnabled()) {
@@ -6279,9 +6227,7 @@ class ServerImpl extends TcpDiscoveryImpl {
"[sock=" + sock + ", locNodeId=" + getLocalNodeId() +
", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
}
-
- if (clientVer != null &&
- clientVer.compareTo(TcpDiscoveryClientAckResponse.CLIENT_ACK_SINCE_VERSION) >= 0) {
+ else {
if (msgLog.isDebugEnabled())
msgLog.debug("Sending message ack to client [sock=" + sock + ", locNodeId="
+ getLocalNodeId() + ", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 4516f75..e8b937a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -218,15 +218,6 @@ import org.jetbrains.annotations.Nullable;
@DiscoverySpiOrderSupport(true)
@DiscoverySpiHistorySupport(true)
public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, TcpDiscoverySpiMBean {
- /** Failure detection timeout feature major version. */
- final static byte FAILURE_DETECTION_MAJOR_VER = 1;
-
- /** Failure detection timeout feature minor version. */
- final static byte FAILURE_DETECTION_MINOR_VER = 4;
-
- /** Failure detection timeout feature maintainance version. */
- final static byte FAILURE_DETECTION_MAINT_VER = 1;
-
/** Node attribute that is mapped to node's external addresses (value is <tt>disc.tcp.ext-addrs</tt>). */
public static final String ATTR_EXT_ADDRS = "disc.tcp.ext-addrs";
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
index 0a656d5..b75d60b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import java.util.UUID;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteUuid;
/**
@@ -30,9 +29,6 @@ public class TcpDiscoveryClientAckResponse extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/** */
- public static final IgniteProductVersion CLIENT_ACK_SINCE_VERSION = IgniteProductVersion.fromString("1.4.0");
-
- /** */
private final IgniteUuid msgId;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index dfbdb4d..698d358 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -24,6 +24,7 @@ org.apache.ignite.IgniteException
org.apache.ignite.IgniteIllegalStateException
org.apache.ignite.IgniteInterruptedException
org.apache.ignite.IgniteState
+org.apache.ignite.IgniteSystemProperties$1
org.apache.ignite.binary.BinaryInvalidTypeException
org.apache.ignite.binary.BinaryObject
org.apache.ignite.binary.BinaryObjectException
@@ -159,6 +160,8 @@ org.apache.ignite.events.IgfsEvent
org.apache.ignite.events.JobEvent
org.apache.ignite.events.SwapSpaceEvent
org.apache.ignite.events.TaskEvent
+org.apache.ignite.hadoop.HadoopInputSplit
+org.apache.ignite.hadoop.HadoopMapReducePlan
org.apache.ignite.igfs.IgfsConcurrentModificationException
org.apache.ignite.igfs.IgfsCorruptedFileException
org.apache.ignite.igfs.IgfsDirectoryNotEmptyException
@@ -261,6 +264,10 @@ org.apache.ignite.internal.client.impl.GridClientNodeMetricsAdapter
org.apache.ignite.internal.client.impl.connection.GridClientConnectionCloseReason
org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException
org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$2
+org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$3
+org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$5
+org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$6
+org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$7
org.apache.ignite.internal.client.impl.connection.GridClientTopology$1
org.apache.ignite.internal.client.impl.connection.GridConnectionIdleClosedException
org.apache.ignite.internal.cluster.ClusterGroupAdapter
@@ -301,6 +308,7 @@ org.apache.ignite.internal.jdbc2.JdbcSqlFieldsQuery
org.apache.ignite.internal.managers.GridManagerAdapter$1$1
org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet
org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
+org.apache.ignite.internal.managers.communication.GridIoManager$1
org.apache.ignite.internal.managers.communication.GridIoManager$ConcurrentHashMap0
org.apache.ignite.internal.managers.communication.GridIoMessage
org.apache.ignite.internal.managers.communication.GridIoUserMessage
@@ -310,13 +318,13 @@ org.apache.ignite.internal.managers.deployment.GridDeploymentPerVersionStore$2
org.apache.ignite.internal.managers.deployment.GridDeploymentRequest
org.apache.ignite.internal.managers.deployment.GridDeploymentResponse
org.apache.ignite.internal.managers.discovery.CustomMessageWrapper
+org.apache.ignite.internal.managers.discovery.DiscoCache$1
+org.apache.ignite.internal.managers.discovery.DiscoCache$2
org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$1
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$2
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$4$1
-org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$4$2
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$6
-org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$DiscoCache$1
org.apache.ignite.internal.managers.discovery.GridLocalMetrics
org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage
org.apache.ignite.internal.managers.indexing.GridIndexingManager$1
@@ -381,9 +389,9 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$18$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
@@ -396,16 +404,12 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$48
org.apache.ignite.internal.processors.cache.GridCacheAdapter$49
org.apache.ignite.internal.processors.cache.GridCacheAdapter$50
org.apache.ignite.internal.processors.cache.GridCacheAdapter$51
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$52
org.apache.ignite.internal.processors.cache.GridCacheAdapter$53
org.apache.ignite.internal.processors.cache.GridCacheAdapter$54
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$54$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$55
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$57
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$58
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$58$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$59
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$56
org.apache.ignite.internal.processors.cache.GridCacheAdapter$6
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$60
org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1$1
@@ -420,7 +424,6 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallable
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallableV2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$PartitionSizeLongJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$PartitionSizeLongTask
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeJob
@@ -542,12 +545,12 @@ org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender$DeferredAckMessageBuffer
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
-org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$3
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$4
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$5
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$7
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
@@ -582,7 +585,6 @@ org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockReque
org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockResponse
org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest
org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishResponse
-org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping
org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest
org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest$1
org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest$2
@@ -608,7 +610,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetSingleFutu
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetSingleFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetSingleFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$3
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$3
@@ -657,6 +659,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFu
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture$3
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$10
@@ -669,7 +672,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$17
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$18
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$19
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$20
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$21
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$22
@@ -680,6 +682,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$27
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$28
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$29
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$30
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$31
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$4
@@ -688,13 +691,17 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$7
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$8
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$9
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$UpdateReplyClosure
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicNearResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractSingleUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture$1
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture$DhtLeftResult
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicCheckUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$1
@@ -705,6 +712,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomi
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.UpdateErrors
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$2
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$3
@@ -727,15 +735,11 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPar
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$4$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$5$1
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$1
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplier$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplier$SupplyContextPhase
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage
@@ -844,13 +848,13 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQuer
org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$14
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$16
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$17
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$18$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$17$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
@@ -860,14 +864,17 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CompoundIterator
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$FieldsResult
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$3
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$OffheapIteratorClosure
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$PeekValueExpiryAwareIterator
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$QueryResult
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$RequestFutureMap
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$RequestFutureMap$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsAdapter
@@ -909,6 +916,7 @@ org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Stor
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$ValueStatus
org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx$FinalizationStatus
org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter$1
org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$1
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$10
@@ -979,18 +987,12 @@ org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl
org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserKeyCacheObjectImpl
org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage
org.apache.ignite.internal.processors.clock.GridClockDeltaVersion
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLA
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLAV2
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1V2
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2MLA
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2MLAV2
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4MLA
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4MLAV2
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4V2
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T1
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T10
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T11
@@ -1033,7 +1035,6 @@ org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$2
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$3
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$DataStreamerPda
-org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$DefaultIoPolicyResolver
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$IsolatedUpdater
org.apache.ignite.internal.processors.datastreamer.DataStreamerRequest
org.apache.ignite.internal.processors.datastreamer.DataStreamerResponse
@@ -1087,6 +1088,7 @@ org.apache.ignite.internal.processors.datastructures.GridCacheCountDownLatchImpl
org.apache.ignite.internal.processors.datastructures.GridCacheCountDownLatchValue
org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl
org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl
+org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl$Sync
org.apache.ignite.internal.processors.datastructures.GridCacheLockState
org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$AddProcessor
org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$ClearProcessor
@@ -1098,6 +1100,7 @@ org.apache.ignite.internal.processors.datastructures.GridCacheQueueHeaderKey
org.apache.ignite.internal.processors.datastructures.GridCacheQueueItemKey
org.apache.ignite.internal.processors.datastructures.GridCacheQueueProxy
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl
+org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl$Sync
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreState
org.apache.ignite.internal.processors.datastructures.GridCacheSetHeader
org.apache.ignite.internal.processors.datastructures.GridCacheSetHeaderKey
@@ -1110,13 +1113,10 @@ org.apache.ignite.internal.processors.dr.GridDrType
org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater
org.apache.ignite.internal.processors.hadoop.HadoopDefaultJobInfo
org.apache.ignite.internal.processors.hadoop.HadoopFileBlock
-org.apache.ignite.hadoop.HadoopInputSplit
org.apache.ignite.internal.processors.hadoop.HadoopJobId
-org.apache.ignite.internal.processors.hadoop.HadoopJobInfo
org.apache.ignite.internal.processors.hadoop.HadoopJobPhase
org.apache.ignite.internal.processors.hadoop.HadoopJobProperty
org.apache.ignite.internal.processors.hadoop.HadoopJobStatus
-org.apache.ignite.hadoop.HadoopMapReducePlan
org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo
org.apache.ignite.internal.processors.hadoop.HadoopTaskType
org.apache.ignite.internal.processors.hadoop.message.HadoopMessage
@@ -1203,6 +1203,14 @@ org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor
org.apache.ignite.internal.processors.job.GridJobProcessor$5
org.apache.ignite.internal.processors.job.GridJobWorker$3
org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer
+org.apache.ignite.internal.processors.marshaller.MappedName
+org.apache.ignite.internal.processors.marshaller.MappingAcceptedMessage
+org.apache.ignite.internal.processors.marshaller.MappingExchangeResult$ResultType
+org.apache.ignite.internal.processors.marshaller.MappingProposedMessage
+org.apache.ignite.internal.processors.marshaller.MappingProposedMessage$ProposalStatus
+org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem
+org.apache.ignite.internal.processors.marshaller.MissingMappingRequestMessage
+org.apache.ignite.internal.processors.marshaller.MissingMappingResponseMessage
org.apache.ignite.internal.processors.odbc.OdbcProtocolVersion
org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
@@ -1266,6 +1274,7 @@ org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListene
org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter
org.apache.ignite.internal.processors.platform.messaging.PlatformMessageFilterImpl
org.apache.ignite.internal.processors.platform.messaging.PlatformMessageLocalFilter
+org.apache.ignite.internal.processors.platform.plugin.cache.PlatformCachePluginConfiguration
org.apache.ignite.internal.processors.platform.services.PlatformAbstractService
org.apache.ignite.internal.processors.platform.services.PlatformService
org.apache.ignite.internal.processors.platform.services.PlatformServices$2
@@ -1276,19 +1285,18 @@ org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$Interna
org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockProcessor
org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
+org.apache.ignite.internal.processors.query.GridQueryProcessor$2
org.apache.ignite.internal.processors.query.GridQueryProcessor$3
org.apache.ignite.internal.processors.query.GridQueryProcessor$4
org.apache.ignite.internal.processors.query.GridQueryProcessor$5
org.apache.ignite.internal.processors.query.GridQueryProcessor$6
org.apache.ignite.internal.processors.query.GridQueryProcessor$7
-org.apache.ignite.internal.processors.query.GridQueryProcessor$8
-org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
org.apache.ignite.internal.processors.query.IgniteSQLException
+org.apache.ignite.internal.processors.query.QueryUtils$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse
-org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest
org.apache.ignite.internal.processors.resource.GridResourceIoc$AnnotationSet
org.apache.ignite.internal.processors.resource.GridResourceIoc$ResourceAnnotation
org.apache.ignite.internal.processors.rest.GridRestCommand
@@ -1451,6 +1459,7 @@ org.apache.ignite.internal.util.GridSerializableList
org.apache.ignite.internal.util.GridSerializableMap
org.apache.ignite.internal.util.GridSerializableSet
org.apache.ignite.internal.util.GridSetWrapper
+org.apache.ignite.internal.util.GridSnapshotLock$Sync
org.apache.ignite.internal.util.GridSpiCloseableIteratorWrapper
org.apache.ignite.internal.util.GridStringBuilder
org.apache.ignite.internal.util.GridSynchronizedMap
@@ -1613,6 +1622,7 @@ org.apache.ignite.internal.util.lang.IgniteReducerX
org.apache.ignite.internal.util.lang.IgniteSingletonIterator
org.apache.ignite.internal.util.nio.GridNioEmbeddedFuture$1
org.apache.ignite.internal.util.nio.GridNioException
+org.apache.ignite.internal.util.nio.GridNioFutureImpl
org.apache.ignite.internal.util.nio.GridNioMessageTracker
org.apache.ignite.internal.util.nio.GridNioServer$NioOperation
org.apache.ignite.internal.util.nio.GridNioServer$RandomBalancer
@@ -1630,6 +1640,7 @@ org.apache.ignite.internal.util.offheap.unsafe.GridUnsafePartitionedMap$2
org.apache.ignite.internal.util.offheap.unsafe.GridUnsafePartitionedMap$3
org.apache.ignite.internal.util.offheap.unsafe.GridUnsafePartitionedMap$PartitionedMapCloseableIterator
org.apache.ignite.internal.util.snaptree.CopyOnWriteManager$COWEpoch
+org.apache.ignite.internal.util.snaptree.CopyOnWriteManager$Latch
org.apache.ignite.internal.util.snaptree.Epoch$Root
org.apache.ignite.internal.util.snaptree.EpochNode
org.apache.ignite.internal.util.snaptree.EpochNode$Child
@@ -1694,7 +1705,6 @@ org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask$VisorCacheMetadata
org.apache.ignite.internal.visor.cache.VisorCacheMetrics
org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask
org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask$VisorCacheMetricsCollectorJob
-org.apache.ignite.internal.visor.cache.VisorCacheMetricsV2
org.apache.ignite.internal.visor.cache.VisorCacheNearConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob
@@ -1703,7 +1713,6 @@ org.apache.ignite.internal.visor.cache.VisorCachePartitions
org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
-org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetrics
org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask
org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
@@ -1723,14 +1732,10 @@ org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
org.apache.ignite.internal.visor.cache.VisorCacheStopTask
org.apache.ignite.internal.visor.cache.VisorCacheStopTask$VisorCacheStopJob
org.apache.ignite.internal.visor.cache.VisorCacheStoreConfiguration
-org.apache.ignite.internal.visor.cache.VisorCacheStoreConfigurationV2
org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask
org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask$VisorCachesSwapBackupsJob
org.apache.ignite.internal.visor.cache.VisorCacheTypeFieldMetadata
org.apache.ignite.internal.visor.cache.VisorCacheTypeMetadata
-org.apache.ignite.internal.visor.cache.VisorCacheV2
-org.apache.ignite.internal.visor.cache.VisorCacheV3
-org.apache.ignite.internal.visor.cache.VisorCacheV4
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob
org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask
@@ -1739,6 +1744,7 @@ org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask
org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask$VisorComputeToggleMonitoringJob
org.apache.ignite.internal.visor.compute.VisorGatewayTask
org.apache.ignite.internal.visor.compute.VisorGatewayTask$VisorGatewayJob
+org.apache.ignite.internal.visor.compute.VisorGatewayTask$VisorGatewayJob$1
org.apache.ignite.internal.visor.debug.VisorThreadDumpTask
org.apache.ignite.internal.visor.debug.VisorThreadDumpTask$VisorDumpThreadJob
org.apache.ignite.internal.visor.debug.VisorThreadInfo
@@ -1746,7 +1752,6 @@ org.apache.ignite.internal.visor.debug.VisorThreadLockInfo
org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo
org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent
org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
-org.apache.ignite.internal.visor.event.VisorGridDiscoveryEventV2
org.apache.ignite.internal.visor.event.VisorGridEvent
org.apache.ignite.internal.visor.event.VisorGridEventsLost
org.apache.ignite.internal.visor.event.VisorGridJobEvent
@@ -1818,9 +1823,11 @@ org.apache.ignite.internal.visor.node.VisorRestConfiguration
org.apache.ignite.internal.visor.node.VisorSegmentationConfiguration
org.apache.ignite.internal.visor.node.VisorSpisConfiguration
org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
+org.apache.ignite.internal.visor.query.VisorCancelQueriesTask
+org.apache.ignite.internal.visor.query.VisorCancelQueriesTask$VisorCancelQueriesJob
+org.apache.ignite.internal.visor.query.VisorCollectRunningQueriesTask
+org.apache.ignite.internal.visor.query.VisorCollectRunningQueriesTask$VisorCollectRunningQueriesJob
org.apache.ignite.internal.visor.query.VisorQueryArg
-org.apache.ignite.internal.visor.query.VisorQueryArgV2
-org.apache.ignite.internal.visor.query.VisorQueryArgV3
org.apache.ignite.internal.visor.query.VisorQueryCleanupTask
org.apache.ignite.internal.visor.query.VisorQueryCleanupTask$VisorQueryCleanupJob
org.apache.ignite.internal.visor.query.VisorQueryField
@@ -1831,6 +1838,7 @@ org.apache.ignite.internal.visor.query.VisorQueryResult
org.apache.ignite.internal.visor.query.VisorQueryResultEx
org.apache.ignite.internal.visor.query.VisorQueryScanSubstringFilter
org.apache.ignite.internal.visor.query.VisorQueryTask
+org.apache.ignite.internal.visor.query.VisorRunningQuery
org.apache.ignite.internal.visor.service.VisorCancelServiceTask
org.apache.ignite.internal.visor.service.VisorCancelServiceTask$VisorCancelServiceJob
org.apache.ignite.internal.visor.service.VisorServiceDescriptor
@@ -1840,7 +1848,6 @@ org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
org.apache.ignite.internal.visor.util.VisorTaskUtils$4
-org.apache.ignite.internal.visor.util.VisorTaskUtils$5
org.apache.ignite.internal.websession.WebSessionAttributeProcessor
org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
@@ -1870,6 +1877,8 @@ org.apache.ignite.plugin.PluginNotFoundException
org.apache.ignite.plugin.PluginValidationException
org.apache.ignite.plugin.extensions.communication.Message
org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType
+org.apache.ignite.plugin.platform.PlatformCachePluginConfigurationClosure
+org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosure
org.apache.ignite.plugin.security.SecurityBasicPermissionSet
org.apache.ignite.plugin.security.SecurityCredentials
org.apache.ignite.plugin.security.SecurityException
@@ -1909,6 +1918,7 @@ org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage
org.apache.ignite.spi.discovery.tcp.ClientImpl$State
org.apache.ignite.spi.discovery.tcp.ServerImpl$IpFinderCleaner$1
org.apache.ignite.spi.discovery.tcp.ServerImpl$IpFinderCleaner$2
+org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket
org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode
org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode$1
org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodesRing$1
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
index 76655c8..257f385 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -333,12 +333,12 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
GridDhtPartitionFullMap emptyFullMap = parts.get(cacheId);
- for (GridDhtPartitionMap2 map : emptyFullMap.values())
+ for (GridDhtPartitionMap map : emptyFullMap.values())
assertEquals(0, map.map().size());
GridDhtPartitionFullMap fullMap = parts.get(dupCacheId);
- for (GridDhtPartitionMap2 map : fullMap.values())
+ for (GridDhtPartitionMap map : fullMap.values())
assertFalse(map.map().isEmpty());
}
@@ -369,13 +369,13 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
assertEquals(dupCacheId, dupPartsData.get(cacheId));
assertFalse(dupPartsData.containsKey(dupCacheId));
- Map<Integer, GridDhtPartitionMap2> parts = msg.partitions();
+ Map<Integer, GridDhtPartitionMap> parts = msg.partitions();
- GridDhtPartitionMap2 emptyMap = parts.get(cacheId);
+ GridDhtPartitionMap emptyMap = parts.get(cacheId);
assertEquals(0, emptyMap.map().size());
- GridDhtPartitionMap2 map = parts.get(dupCacheId);
+ GridDhtPartitionMap map = parts.get(dupCacheId);
assertFalse(map.map().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
index 18a9f38..d42d391 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
@@ -36,7 +36,7 @@ import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.util.typedef.CAX;
@@ -312,10 +312,10 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
GridDhtPartitionFullMap fullMap = top.partitionMap(true);
- for (Map.Entry<UUID, GridDhtPartitionMap2> fe : fullMap.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> fe : fullMap.entrySet()) {
UUID nodeId = fe.getKey();
- GridDhtPartitionMap2 m = fe.getValue();
+ GridDhtPartitionMap m = fe.getValue();
for (Map.Entry<Integer, GridDhtPartitionState> e : m.entrySet()) {
int p = e.getKey();
@@ -453,12 +453,12 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
assert orig.keySet().equals(cmp.keySet());
- for (Map.Entry<UUID, GridDhtPartitionMap2> entry : orig.entrySet()) {
+ for (Map.Entry<UUID, GridDhtPartitionMap> entry : orig.entrySet()) {
UUID nodeId = entry.getKey();
- GridDhtPartitionMap2 nodeMap = entry.getValue();
+ GridDhtPartitionMap nodeMap = entry.getValue();
- GridDhtPartitionMap2 cmpMap = cmp.get(nodeId);
+ GridDhtPartitionMap cmpMap = cmp.get(nodeId);
assert cmpMap != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
index 744623a..3549fc0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
@@ -38,7 +38,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.CacheRebalancingEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
@@ -361,7 +361,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
GridDhtPartitionFullMap allParts = dht.topology().partitionMap(false);
- for (GridDhtPartitionMap2 parts : allParts.values()) {
+ for (GridDhtPartitionMap parts : allParts.values()) {
if (!parts.nodeId().equals(g.cluster().localNode().id())) {
for (Map.Entry<Integer, GridDhtPartitionState> e : parts.entrySet()) {
int p = e.getKey();
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index d57ae57..5cc3ac2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -24,7 +24,6 @@ import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheRebalanceMode;
@@ -34,15 +33,13 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
import org.apache.ignite.internal.util.typedef.G;
@@ -415,7 +412,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
GridDhtPartitionTopology remoteTop = remoteDht.topology();
- GridDhtPartitionMap2 pMap = remoteTop.partitionMap(true).get(((IgniteKernal)g).getLocalNodeId());
+ GridDhtPartitionMap pMap = remoteTop.partitionMap(true).get(((IgniteKernal)g).getLocalNodeId());
assertEquals(pMap.size(), locs.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
index a496f30..a218bcb 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
@@ -201,66 +201,6 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
}
/**
- * @throws Exception In case of error.
- */
- public void testConnectionCheckMessageBackwardCompatibility() throws Exception {
- TestTcpDiscoverySpi nextSpi = null;
- TcpDiscoveryNode nextNode = null;
-
- IgniteProductVersion nextNodeVer = null;
-
- try {
- assert firstSpi().connCheckStatusMsgCntSent == 0;
-
- nextNode = ((ServerImpl)(firstSpi().impl)).ring().nextNode();
-
- assertNotNull(nextNode);
-
- nextSpi = null;
-
- for (int i = 1; i < spis.size(); i++)
- if (spis.get(i).getLocalNode().id().equals(nextNode.id())) {
- nextSpi = (TestTcpDiscoverySpi)spis.get(i);
- break;
- }
-
- assertNotNull(nextSpi);
-
- assert nextSpi.connCheckStatusMsgCntReceived == 0;
-
- nextNodeVer = nextNode.version();
-
- // Overriding the version of the next node. Connection check message must not been sent to it.
- nextNode.version(new IgniteProductVersion(TcpDiscoverySpi.FAILURE_DETECTION_MAJOR_VER,
- (byte)(TcpDiscoverySpi.FAILURE_DETECTION_MINOR_VER - 1), TcpDiscoverySpi.FAILURE_DETECTION_MAINT_VER,
- 0l, null));
-
- firstSpi().countConnCheckMsg = true;
- nextSpi.countConnCheckMsg = true;
-
- Thread.sleep(firstSpi().failureDetectionTimeout() / 2);
-
- firstSpi().countConnCheckMsg = false;
- nextSpi.countConnCheckMsg = false;
-
- int sent = firstSpi().connCheckStatusMsgCntSent;
- int received = nextSpi.connCheckStatusMsgCntReceived;
-
- assert sent == 0 : "messages sent: " + sent;
- assert received == 0 : "messages received: " + received;
- }
- finally {
- firstSpi().resetState();
-
- if (nextSpi != null)
- nextSpi.resetState();
-
- if (nextNode != null && nextNodeVer != null)
- nextNode.version(nextNodeVer);
- }
- }
-
- /**
* Returns the first spi with failure detection timeout enabled.
*
* @return SPI.
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index ec31e59..20117bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -73,7 +73,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
@@ -576,7 +576,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
while (failed) {
failed = false;
- for (GridDhtPartitionMap2 pMap : top.partitionMap(true).values()) {
+ for (GridDhtPartitionMap pMap : top.partitionMap(true).values()) {
if (failed)
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 8fadfeb..7cd9f17 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -66,7 +66,6 @@ import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQuery
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse;
-import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest;
import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -74,7 +73,6 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.h2.jdbc.JdbcResultSet;
@@ -209,8 +207,6 @@ public class GridMapQueryExecutor {
onNextPageRequest(node, (GridQueryNextPageRequest)msg);
else if (msg instanceof GridQueryCancelRequest)
onCancel(node, (GridQueryCancelRequest)msg);
- else if (msg instanceof GridQueryRequest)
- onQueryRequest(node, (GridQueryRequest)msg);
else
processed = false;
@@ -405,41 +401,6 @@ public class GridMapQueryExecutor {
}
/**
- * Executing queries locally.
- *
- * @param node Node.
- * @param req Query request.
- */
- private void onQueryRequest(ClusterNode node, GridQueryRequest req) {
- List<Integer> cacheIds;
-
- if (req.extraSpaces() != null) {
- cacheIds = new ArrayList<>(req.extraSpaces().size() + 1);
-
- cacheIds.add(CU.cacheId(req.space()));
-
- for (String extraSpace : req.extraSpaces())
- cacheIds.add(CU.cacheId(extraSpace));
- }
- else
- cacheIds = Collections.singletonList(CU.cacheId(req.space()));
-
- onQueryRequest0(node,
- req.requestId(),
- 0,
- req.queries(),
- cacheIds,
- req.topologyVersion(),
- null,
- req.partitions(),
- null,
- req.pageSize(),
- OFF,
- true,
- req.timeout());
- }
-
- /**
* @param node Node.
* @param req Query request.
*/
[34/50] [abbrv] ignite git commit: IGNITE-3510 .NET: Fix namespaces
and access modifiers
Posted by ag...@apache.org.
IGNITE-3510 .NET: Fix namespaces and access modifiers
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58b31b9a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58b31b9a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58b31b9a
Branch: refs/heads/ignite-4003
Commit: 58b31b9abcbe046ac4303501a951af9f0570e8c8
Parents: 6a979ea
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 28 11:02:14 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 28 11:02:14 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.csproj | 3 +-
.../Cache/Affinity/AffinityFunctionBase.cs | 139 ++++++++++++++++++
.../Impl/Binary/Metadata/IBinaryTypeHandler.cs | 2 +-
.../Impl/Cache/Affinity/AffinityFunctionBase.cs | 140 -------------------
.../Impl/Collections/MultiValueDictionary.cs | 2 +-
.../Apache.Ignite.Core/Impl/Common/Future.cs | 3 +-
.../Impl/Common/IFutureConverter.cs | 4 +-
.../Impl/Common/IFutureInternal.cs | 3 +-
.../Impl/Common/LoadedAssembliesResolver.cs | 2 +-
.../Apache.Ignite.Core/Impl/Handle/Handle.cs | 2 +-
.../Impl/Handle/HandleRegistry.cs | 2 +-
.../Apache.Ignite.Core/Impl/Handle/IHandle.cs | 2 +-
.../Impl/Memory/IPlatformMemory.cs | 5 +-
.../Impl/Memory/PlatformMemory.cs | 3 +-
.../Impl/Memory/PlatformMemoryManager.cs | 4 +-
.../Impl/Memory/PlatformMemoryPool.cs | 3 +-
.../Impl/Memory/PlatformMemoryStream.cs | 3 +-
.../Impl/Memory/PlatformRawMemory.cs | 96 -------------
18 files changed, 154 insertions(+), 264 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index eab0bb5..f3757b4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -190,7 +190,7 @@
<Compile Include="Impl\Binary\IO\IBinaryStreamProcessor.cs" />
<Compile Include="Impl\Binary\SerializableSerializer.cs" />
<Compile Include="Impl\Binary\BinaryWriterExtensions.cs" />
- <Compile Include="Impl\Cache\Affinity\AffinityFunctionBase.cs" />
+ <Compile Include="Cache\Affinity\AffinityFunctionBase.cs" />
<Compile Include="Impl\Cache\Store\CacheStore.cs" />
<Compile Include="Impl\Cache\Store\ICacheStoreInternal.cs" />
<Compile Include="Impl\Transactions\CacheTransactionManager.cs" />
@@ -380,7 +380,6 @@
<Compile Include="Impl\Memory\PlatformMemoryStream.cs" />
<Compile Include="Impl\Memory\PlatformMemoryUtils.cs" />
<Compile Include="Impl\Memory\PlatformPooledMemory.cs" />
- <Compile Include="Impl\Memory\PlatformRawMemory.cs" />
<Compile Include="Impl\Memory\PlatformUnpooledMemory.cs" />
<Compile Include="Impl\Messaging\MessageListenerHolder.cs" />
<Compile Include="Impl\Messaging\Messaging.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
new file mode 100644
index 0000000..4b78c41
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Cache.Affinity
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel;
+ using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Common;
+
+ /// <summary>
+ /// Base class for predefined affinity functions.
+ /// </summary>
+ [Serializable]
+ public abstract class AffinityFunctionBase : IAffinityFunction
+ {
+ /// <summary> The default value for <see cref="Partitions"/> property. </summary>
+ public const int DefaultPartitions = 1024;
+
+ /** */
+ private int _partitions = DefaultPartitions;
+
+ /** */
+ private IAffinityFunction _baseFunction;
+
+
+ /// <summary>
+ /// Gets or sets the total number of partitions.
+ /// </summary>
+ [DefaultValue(DefaultPartitions)]
+ public virtual int Partitions
+ {
+ get { return _partitions; }
+ set { _partitions = value; }
+ }
+
+ /// <summary>
+ /// Gets partition number for a given key starting from 0. Partitioned caches
+ /// should make sure that keys are about evenly distributed across all partitions
+ /// from 0 to <see cref="Partitions" /> for best performance.
+ /// <para />
+ /// Note that for fully replicated caches it is possible to segment key sets among different
+ /// grid node groups. In that case each node group should return a unique partition
+ /// number. However, unlike partitioned cache, mappings of keys to nodes in
+ /// replicated caches are constant and a node cannot migrate from one partition
+ /// to another.
+ /// </summary>
+ /// <param name="key">Key to get partition for.</param>
+ /// <returns>
+ /// Partition number for a given key.
+ /// </returns>
+ public virtual int GetPartition(object key)
+ {
+ ThrowIfUninitialized();
+
+ return _baseFunction.GetPartition(key);
+ }
+
+ /// <summary>
+ /// Removes node from affinity. This method is called when it is safe to remove
+ /// disconnected node from affinity mapping.
+ /// </summary>
+ /// <param name="nodeId">The node identifier.</param>
+ public virtual void RemoveNode(Guid nodeId)
+ {
+ ThrowIfUninitialized();
+
+ _baseFunction.RemoveNode(nodeId);
+ }
+
+ /// <summary>
+ /// Gets affinity nodes for a partition. In case of replicated cache, all returned
+ /// nodes are updated in the same manner. In case of partitioned cache, the returned
+ /// list should contain only the primary and back up nodes with primary node being
+ /// always first.
+ /// <pare />
+ /// Note that partitioned affinity must obey the following contract: given that node
+ /// <code>N</code> is primary for some key <code>K</code>, if any other node(s) leave
+ /// grid and no node joins grid, node <code>N</code> will remain primary for key <code>K</code>.
+ /// </summary>
+ /// <param name="context">The affinity function context.</param>
+ /// <returns>
+ /// A collection of partitions, where each partition is a collection of nodes,
+ /// where first node is a primary node, and other nodes are backup nodes.
+ /// </returns>
+ public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ {
+ ThrowIfUninitialized();
+
+ return _baseFunction.AssignPartitions(context);
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other.
+ /// </summary>
+ public virtual bool ExcludeNeighbors { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AffinityFunctionBase"/> class.
+ /// </summary>
+ internal AffinityFunctionBase()
+ {
+ // No-op.
+ }
+
+ /// <summary>
+ /// Sets the base function.
+ /// </summary>
+ /// <param name="baseFunc">The base function.</param>
+ internal void SetBaseFunction(IAffinityFunction baseFunc)
+ {
+ _baseFunction = baseFunc;
+ }
+
+ /// <summary>
+ /// Gets the direct usage error.
+ /// </summary>
+ private void ThrowIfUninitialized()
+ {
+ if (_baseFunction == null)
+ throw new IgniteException(GetType() + " has not yet been initialized.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
index 848a775..a02764e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/IBinaryTypeHandler.cs
@@ -22,7 +22,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <summary>
/// Binary type metadata handler.
/// </summary>
- public interface IBinaryTypeHandler
+ internal interface IBinaryTypeHandler
{
/// <summary>
/// Callback invoked when named field is written.
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs
deleted file mode 100644
index 8536e4c..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Affinity
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using Apache.Ignite.Core.Cache.Affinity;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Base class for predefined affinity functions.
- /// </summary>
- [Serializable]
- public abstract class AffinityFunctionBase : IAffinityFunction
- {
- /// <summary> The default value for <see cref="Partitions"/> property. </summary>
- public const int DefaultPartitions = 1024;
-
- /** */
- private int _partitions = DefaultPartitions;
-
- /** */
- private IAffinityFunction _baseFunction;
-
-
- /// <summary>
- /// Gets or sets the total number of partitions.
- /// </summary>
- [DefaultValue(DefaultPartitions)]
- public virtual int Partitions
- {
- get { return _partitions; }
- set { _partitions = value; }
- }
-
- /// <summary>
- /// Gets partition number for a given key starting from 0. Partitioned caches
- /// should make sure that keys are about evenly distributed across all partitions
- /// from 0 to <see cref="Partitions" /> for best performance.
- /// <para />
- /// Note that for fully replicated caches it is possible to segment key sets among different
- /// grid node groups. In that case each node group should return a unique partition
- /// number. However, unlike partitioned cache, mappings of keys to nodes in
- /// replicated caches are constant and a node cannot migrate from one partition
- /// to another.
- /// </summary>
- /// <param name="key">Key to get partition for.</param>
- /// <returns>
- /// Partition number for a given key.
- /// </returns>
- public virtual int GetPartition(object key)
- {
- ThrowIfUninitialized();
-
- return _baseFunction.GetPartition(key);
- }
-
- /// <summary>
- /// Removes node from affinity. This method is called when it is safe to remove
- /// disconnected node from affinity mapping.
- /// </summary>
- /// <param name="nodeId">The node identifier.</param>
- public virtual void RemoveNode(Guid nodeId)
- {
- ThrowIfUninitialized();
-
- _baseFunction.RemoveNode(nodeId);
- }
-
- /// <summary>
- /// Gets affinity nodes for a partition. In case of replicated cache, all returned
- /// nodes are updated in the same manner. In case of partitioned cache, the returned
- /// list should contain only the primary and back up nodes with primary node being
- /// always first.
- /// <pare />
- /// Note that partitioned affinity must obey the following contract: given that node
- /// <code>N</code> is primary for some key <code>K</code>, if any other node(s) leave
- /// grid and no node joins grid, node <code>N</code> will remain primary for key <code>K</code>.
- /// </summary>
- /// <param name="context">The affinity function context.</param>
- /// <returns>
- /// A collection of partitions, where each partition is a collection of nodes,
- /// where first node is a primary node, and other nodes are backup nodes.
- /// </returns>
- public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
- {
- ThrowIfUninitialized();
-
- return _baseFunction.AssignPartitions(context);
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other.
- /// </summary>
- public virtual bool ExcludeNeighbors { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AffinityFunctionBase"/> class.
- /// </summary>
- internal AffinityFunctionBase()
- {
- // No-op.
- }
-
- /// <summary>
- /// Sets the base function.
- /// </summary>
- /// <param name="baseFunc">The base function.</param>
- internal void SetBaseFunction(IAffinityFunction baseFunc)
- {
- _baseFunction = baseFunc;
- }
-
- /// <summary>
- /// Gets the direct usage error.
- /// </summary>
- private void ThrowIfUninitialized()
- {
- if (_baseFunction == null)
- throw new IgniteException(GetType() + " has not yet been initialized.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
index a4e9c93..662456c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
@@ -24,7 +24,7 @@ namespace Apache.Ignite.Core.Impl.Collections
/// Multiple-values-per-key dictionary.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
- public class MultiValueDictionary<TKey, TValue>
+ internal class MultiValueDictionary<TKey, TValue>
{
/** Inner dictionary */
private readonly Dictionary<TKey, object> _dict = new Dictionary<TKey, object>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
index 50102a7..bfdf5cb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
@@ -29,8 +29,7 @@ namespace Apache.Ignite.Core.Impl.Common
/// Grid future implementation.
/// </summary>
[SuppressMessage("ReSharper", "ParameterHidesMember")]
- [CLSCompliant(false)]
- public sealed class Future<T> : IFutureInternal
+ internal sealed class Future<T> : IFutureInternal
{
/** Converter. */
private readonly IFutureConverter<T> _converter;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
index 12fb922..8c35dac 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
@@ -17,14 +17,12 @@
namespace Apache.Ignite.Core.Impl.Common
{
- using System;
using Apache.Ignite.Core.Impl.Binary.IO;
/// <summary>
/// Marshals and converts future value.
/// </summary>
- [CLSCompliant(false)]
- public interface IFutureConverter<out T>
+ internal interface IFutureConverter<out T>
{
/// <summary>
/// Reads and converts a value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
index 5197fa8..677c311 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
@@ -23,8 +23,7 @@ namespace Apache.Ignite.Core.Impl.Common
/// <summary>
/// Internal future interface.
/// </summary>
- [CLSCompliant(false)]
- public interface IFutureInternal
+ internal interface IFutureInternal
{
/// <summary>
/// Set result from stream.
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
index 83d4f96..9628478 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
@@ -26,7 +26,7 @@ namespace Apache.Ignite.Core.Impl.Common
/// Resolves loaded assemblies by name.
/// </summary>
// ReSharper disable once ClassNeverInstantiated.Global
- public class LoadedAssembliesResolver
+ internal class LoadedAssembliesResolver
{
// The lazy singleton instance.
private static readonly Lazy<LoadedAssembliesResolver> LazyInstance = new Lazy<LoadedAssembliesResolver>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
index 7791c91..544e89d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
@@ -23,7 +23,7 @@ namespace Apache.Ignite.Core.Impl.Handle
/// <summary>
/// Wrapper over some resource ensuring it's release.
/// </summary>
- public class Handle<T> : IHandle
+ internal class Handle<T> : IHandle
{
/** Target.*/
private readonly T _target;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
index 588d608..fee7d79 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
@@ -30,7 +30,7 @@ namespace Apache.Ignite.Core.Impl.Handle
public class HandleRegistry
{
/** Default critical resources capacity. */
- internal const int DfltFastCap = 1024;
+ private const int DfltFastCap = 1024;
/** Array for fast-path. */
private readonly object[] _fast;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
index 700ab5f..10d913c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Core.Impl.Handle
/// <summary>
/// Wrapper over some resource ensuring it's release.
/// </summary>
- public interface IHandle
+ internal interface IHandle
{
/// <summary>
/// Release the resource.
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
index 6c5ae54..fe8a111 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
@@ -17,13 +17,10 @@
namespace Apache.Ignite.Core.Impl.Memory
{
- using System;
-
/// <summary>
/// Platform memory chunk.
/// </summary>
- [CLSCompliant(false)]
- public interface IPlatformMemory
+ internal interface IPlatformMemory
{
/// <summary>
/// Gets stream for read/write operations on the given memory chunk.
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
index cb30051..d0ebf67 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
@@ -23,8 +23,7 @@ namespace Apache.Ignite.Core.Impl.Memory
/// <summary>
/// Abstract memory chunk.
/// </summary>
- [CLSCompliant(false)]
- public abstract class PlatformMemory : IPlatformMemory
+ internal abstract class PlatformMemory : IPlatformMemory
{
/** Memory pointer. */
private readonly long _memPtr;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
index f934081..29099c3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
@@ -17,7 +17,6 @@
namespace Apache.Ignite.Core.Impl.Memory
{
- using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
@@ -26,9 +25,8 @@ namespace Apache.Ignite.Core.Impl.Memory
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
Justification = "This class instance usually lives as long as the app runs.")]
- [CLSCompliant(false)]
// ReSharper disable once ClassWithVirtualMembersNeverInherited.Global
- public class PlatformMemoryManager
+ internal class PlatformMemoryManager
{
/** Default capacity. */
private readonly int _dfltCap;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
index 18b44b6..bcd8f73 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
@@ -23,8 +23,7 @@ namespace Apache.Ignite.Core.Impl.Memory
/// <summary>
/// Platform memory pool.
/// </summary>
- [CLSCompliant(false)]
- public class PlatformMemoryPool : SafeHandleMinusOneIsInvalid
+ internal class PlatformMemoryPool : SafeHandleMinusOneIsInvalid
{
/** First pooled memory chunk. */
private PlatformPooledMemory _mem1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
index 190bda9..f8ff85c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
@@ -29,9 +29,8 @@ namespace Apache.Ignite.Core.Impl.Memory
/// <summary>
/// Platform memory stream.
/// </summary>
- [CLSCompliant(false)]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
- public unsafe class PlatformMemoryStream : IBinaryStream
+ internal unsafe class PlatformMemoryStream : IBinaryStream
{
/** Length: 1 byte. */
protected const int Len1 = 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b31b9a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
deleted file mode 100644
index c3cbee2..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-\ufeff/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// Non-resizeable raw memory chunk without metadata header.
- /// </summary>
- [CLSCompliant(false)]
- [ExcludeFromCodeCoverage]
- public class PlatformRawMemory : IPlatformMemory
- {
- /** */
- private readonly long _memPtr;
-
- /** */
- private readonly int _size;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PlatformRawMemory"/> class.
- /// </summary>
- /// <param name="memPtr">Heap pointer.</param>
- /// <param name="size">Size.</param>
- public unsafe PlatformRawMemory(void* memPtr, int size)
- {
- _memPtr = (long) memPtr;
- _size = size;
- }
-
- /** <inheritdoc /> */
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- public PlatformMemoryStream GetStream()
- {
- return BitConverter.IsLittleEndian ? new PlatformMemoryStream(this) :
- new PlatformBigEndianMemoryStream(this);
- }
-
- /** <inheritdoc /> */
- [ExcludeFromCodeCoverage]
- public long Pointer
- {
- get { throw new NotSupportedException(); }
- }
-
- /** <inheritdoc /> */
- public long Data
- {
- get { return _memPtr; }
- }
-
- /** <inheritdoc /> */
- public int Capacity
- {
- get { return _size; }
- }
-
- /** <inheritdoc /> */
- public int Length
- {
- get { return _size; }
-
- [ExcludeFromCodeCoverage]
- set { throw new NotSupportedException(); }
- }
-
- /** <inheritdoc /> */
- [ExcludeFromCodeCoverage]
- public void Reallocate(int cap)
- {
- throw new NotSupportedException();
- }
-
- /** <inheritdoc /> */
- public void Release()
- {
- // Memory can only be released by native platform.
- }
- }
-}
\ No newline at end of file
[50/50] [abbrv] ignite git commit: ignite-4003 Async outgoing
connections for communication SPI
Posted by ag...@apache.org.
ignite-4003 Async outgoing connections for communication SPI
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ffa5f826
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ffa5f826
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ffa5f826
Branch: refs/heads/ignite-4003
Commit: ffa5f8266fcb5eae20a732ad0471bb079d129adf
Parents: 348b9ef
Author: agura <ag...@apache.org>
Authored: Tue Feb 7 14:45:57 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Wed Mar 29 16:25:23 2017 +0300
----------------------------------------------------------------------
.../GridClientConnectionManagerAdapter.java | 1 -
.../connection/GridClientNioTcpConnection.java | 2 +-
.../managers/communication/GridIoManager.java | 4 +
.../internal/util/GridSpinReadWriteLock.java | 2 +-
.../util/nio/GridNioRecoveryDescriptor.java | 2 +-
.../ignite/internal/util/nio/GridNioServer.java | 218 +-
.../util/nio/GridSelectorNioSessionImpl.java | 2 -
.../internal/util/nio/ssl/GridNioSslFilter.java | 12 +-
.../communication/tcp/TcpCommunicationSpi.java | 1902 ++++++++++++------
.../IgniteCacheMessageWriteTimeoutTest.java | 4 +-
.../internal/util/nio/GridNioSelfTest.java | 2 +-
.../spi/GridTcpSpiForwardingSelfTest.java | 3 +-
.../GridAbstractCommunicationSelfTest.java | 27 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 28 +-
...dTcpCommunicationSpiRecoveryAckSelfTest.java | 51 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 49 +-
...CommunicationRecoveryAckClosureSelfTest.java | 36 +-
.../tcp/TcpCommunicationSpiDropNodesTest.java | 12 +-
.../TcpCommunicationSpiFaultyClientTest.java | 5 +-
.../HadoopExternalCommunication.java | 5 +-
20 files changed, 1659 insertions(+), 708 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
index e325897..aa06322 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
@@ -183,7 +183,6 @@ public abstract class GridClientConnectionManagerAdapter implements GridClientCo
GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, true, ByteOrder.nativeOrder(), gridLog);
sslFilter.directMode(false);
- sslFilter.clientMode(true);
filters = new GridNioFilter[]{codecFilter, sslFilter};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index d3a30fb..73487db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -234,7 +234,7 @@ public class GridClientNioTcpConnection extends GridClientConnection {
meta.put(GridNioSslFilter.HANDSHAKE_FUT_META_KEY, sslHandshakeFut);
}
- ses = (GridNioSession)srv.createSession(ch, meta).get();
+ ses = (GridNioSession)srv.createSession(ch, meta, false, null).get();
if (sslHandshakeFut != null)
sslHandshakeFut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 23738d7..40905f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteDeploymentCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.direct.DirectMessageReader;
import org.apache.ignite.internal.direct.DirectMessageWriter;
import org.apache.ignite.internal.managers.GridManagerAdapter;
@@ -1298,6 +1299,9 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
((TcpCommunicationSpi)(CommunicationSpi)getSpi()).sendMessage(node, ioMsg, ackC);
else
getSpi().sendMessage(node, ioMsg);
+
+ if (ctx.discovery().node(node.id()) == null)
+ throw new ClusterTopologyCheckedException("Failed to send message to node, node left: " + node);
}
catch (IgniteSpiException e) {
throw new IgniteCheckedException("Failed to send message (node may have left the grid or " +
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinReadWriteLock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinReadWriteLock.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinReadWriteLock.java
index 4f23979..8fef887 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinReadWriteLock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinReadWriteLock.java
@@ -70,7 +70,7 @@ public class GridSpinReadWriteLock {
private int writeLockEntryCnt;
/**
- * Acquires write lock.
+ * Acquires read lock.
*/
@SuppressWarnings("BusyWait")
public void readLock() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
index 6258c13..af7b757 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
@@ -259,7 +259,7 @@ public class GridNioRecoveryDescriptor {
/**
* @param node Node.
- * @return {@code True} if node is not null and has the same order as initial remtoe node.
+ * @return {@code True} if node is not null and has the same order as initial remote node.
*/
public boolean nodeAlive(@Nullable ClusterNode node) {
return node != null && node.order() == this.node.order();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 7f25e40..0848a8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -110,6 +110,12 @@ public class GridNioServer<T> {
/** SSL write buf limit. */
private static final int WRITE_BUF_LIMIT = GridNioSessionMetaKey.nextUniqueKey();
+ /** Session future meta key. */
+ private static final int SESSION_FUT_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
+ /** Selection key meta key. */
+ private static final int WORKER_IDX_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
/** */
private static final boolean DISABLE_KEYSET_OPTIMIZATION =
IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_NO_SELECTOR_OPTS);
@@ -462,7 +468,7 @@ public class GridNioServer<T> {
* @return Future for operation.
*/
public GridNioFuture<Boolean> close(GridNioSession ses) {
- assert ses instanceof GridSelectorNioSessionImpl;
+ assert ses instanceof GridSelectorNioSessionImpl : ses;
GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
@@ -706,6 +712,7 @@ public class GridNioServer<T> {
/**
*
*/
+ @SuppressWarnings("ForLoopReplaceableByForEach")
public void dumpStats() {
U.warn(log, "NIO server statistics [readerSesBalanceCnt=" + readerMoveCnt.get() +
", writerSesBalanceCnt=" + writerMoveCnt.get() + ']');
@@ -719,17 +726,34 @@ public class GridNioServer<T> {
*
* @param ch Channel to register within the server and create session for.
* @param meta Optional meta for new session.
+ * @param async Async connection.
+ * @param lsnr Listener that should be invoked in NIO thread.
* @return Future to get session.
*/
- public GridNioFuture<GridNioSession> createSession(final SocketChannel ch,
- @Nullable Map<Integer, ?> meta) {
+ public GridNioFuture<GridNioSession> createSession(
+ final SocketChannel ch,
+ @Nullable Map<Integer, Object> meta,
+ boolean async,
+ @Nullable IgniteInClosure<? super IgniteInternalFuture<GridNioSession>> lsnr
+ ) {
try {
if (!closed) {
ch.configureBlocking(false);
NioOperationFuture<GridNioSession> req = new NioOperationFuture<>(ch, false, meta);
- offerBalanced(req);
+ if (async) {
+ assert meta != null;
+
+ req.op = NioOperation.CONNECT;
+
+ meta.put(SESSION_FUT_META_KEY, req);
+ }
+
+ if (lsnr != null)
+ req.listen(lsnr);
+
+ offerBalanced(req, meta);
return req;
}
@@ -743,6 +767,29 @@ public class GridNioServer<T> {
}
/**
+ * @param ch Channel.
+ * @param meta Session meta.
+ */
+ public GridNioFuture<GridNioSession> cancelConnect(final SocketChannel ch, Map<Integer, ?> meta) {
+ if (!closed) {
+ NioOperationFuture<GridNioSession> req = new NioOperationFuture<>(ch, false, meta);
+
+ req.op = NioOperation.CANCEL_CONNECT;
+
+ Integer idx = (Integer)meta.get(WORKER_IDX_META_KEY);
+
+ assert idx != null : meta;
+
+ clientWorkers.get(idx).offer(req);
+
+ return req;
+ }
+ else
+ return new GridNioFinishedFuture<>(
+ new IgniteCheckedException("Failed to cancel connection, server is stopped."));
+ }
+
+ /**
* Gets configurable write timeout for this session. If not set, default value is {@link #DFLT_SES_WRITE_TIMEOUT}.
*
* @return Write timeout in milliseconds.
@@ -828,9 +875,11 @@ public class GridNioServer<T> {
/**
* @param req Request to balance.
+ * @param meta Session metadata.
+ * @return Worker index.
*/
- private synchronized void offerBalanced(NioOperationFuture req) {
- assert req.operation() == NioOperation.REGISTER : req;
+ private synchronized int offerBalanced(NioOperationFuture req, @Nullable Map<Integer, Object> meta) {
+ assert req.operation() == NioOperation.REGISTER || req.operation() == NioOperation.CONNECT: req;
assert req.socketChannel() != null : req;
int workers = clientWorkers.size();
@@ -868,7 +917,12 @@ public class GridNioServer<T> {
else
balanceIdx = 0;
+ if (meta != null)
+ meta.put(WORKER_IDX_META_KEY, balanceIdx);
+
clientWorkers.get(balanceIdx).offer(req);
+
+ return balanceIdx;
}
/** {@inheritDoc} */
@@ -1692,6 +1746,38 @@ public class GridNioServer<T> {
while ((req0 = changeReqs.poll()) != null) {
switch (req0.operation()) {
+ case CONNECT: {
+ NioOperationFuture req = (NioOperationFuture)req0;
+
+ SocketChannel ch = req.socketChannel();
+
+ try {
+ ch.register(selector, SelectionKey.OP_CONNECT, req.meta());
+ }
+ catch (IOException e) {
+ req.onDone(new IgniteCheckedException("Failed to register channel on selector", e));
+ }
+
+ break;
+ }
+
+ case CANCEL_CONNECT: {
+ NioOperationFuture req = (NioOperationFuture)req0;
+
+ SocketChannel ch = req.socketChannel();
+
+ SelectionKey key = ch.keyFor(selector);
+
+ if (key != null)
+ key.cancel();
+
+ U.closeQuiet(ch);
+
+ req.onDone();
+
+ break;
+ }
+
case REGISTER: {
register((NioOperationFuture)req0);
@@ -1898,8 +1984,12 @@ public class GridNioServer<T> {
log.debug("Closing all connected client sockets.");
// Close all channels registered with selector.
- for (SelectionKey key : selector.keys())
- close((GridSelectorNioSessionImpl)key.attachment(), null);
+ for (SelectionKey key : selector.keys()) {
+ Object attach = key.attachment();
+
+ if (attach instanceof GridSelectorNioSessionImpl)
+ close((GridSelectorNioSessionImpl)attach, null);
+ }
if (log.isDebugEnabled())
log.debug("Closing NIO selector.");
@@ -2022,11 +2112,19 @@ public class GridNioServer<T> {
if (!key.isValid())
continue;
- GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
-
- assert ses != null;
+ GridSelectorNioSessionImpl ses = null;
try {
+ if (key.isConnectable()) {
+ processConnect(key);
+
+ continue;
+ }
+
+ ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ assert ses != null;
+
if (key.isReadable())
processRead(key);
@@ -2038,9 +2136,11 @@ public class GridNioServer<T> {
throw e;
}
catch (Exception e) {
- U.warn(log, "Failed to process selector key (will close): " + ses, e);
+ if (!closed)
+ U.error(log, "Failed to process selector key [ses=" + ses + ']', e);
- close(ses, new GridNioException(e));
+ if (ses != null)
+ close(ses, new GridNioException(e));
}
}
}
@@ -2067,11 +2167,19 @@ public class GridNioServer<T> {
if (!key.isValid())
continue;
- GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
-
- assert ses != null;
+ GridSelectorNioSessionImpl ses = null;
try {
+ if (key.isConnectable()) {
+ processConnect(key);
+
+ continue;
+ }
+
+ ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ assert ses != null;
+
if (key.isReadable())
processRead(key);
@@ -2084,9 +2192,10 @@ public class GridNioServer<T> {
}
catch (Exception e) {
if (!closed)
- U.warn(log, "Failed to process selector key (will close): " + ses, e);
+ U.error(log, "Failed to process selector key [ses=" + ses + ']', e);
- close(ses, new GridNioException(e));
+ if (ses != null)
+ close(ses, new GridNioException(e));
}
}
}
@@ -2100,7 +2209,12 @@ public class GridNioServer<T> {
long now = U.currentTimeMillis();
for (SelectionKey key : keys) {
- GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+ Object obj = key.attachment();
+
+ if (!(obj instanceof GridSelectorNioSessionImpl))
+ continue;
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)obj;
try {
long writeTimeout0 = writeTimeout;
@@ -2181,12 +2295,32 @@ public class GridNioServer<T> {
ses.addMeta(e.getKey(), e.getValue());
}
- SelectionKey key = sockCh.register(selector, SelectionKey.OP_READ, ses);
+ SelectionKey key;
- ses.key(key);
+ if (!sockCh.isRegistered())
+ key = sockCh.register(selector, SelectionKey.OP_READ, ses);
+ else {
+ key = sockCh.keyFor(selector);
+
+ Map<Integer, Object> m = (Map<Integer, Object>)key.attachment();
+
+ NioOperationFuture<GridNioSession> fut =
+ (NioOperationFuture<GridNioSession>)m.remove(SESSION_FUT_META_KEY);
+
+ assert fut != null;
+
+ for (Entry<Integer, Object> e : m.entrySet())
+ ses.addMeta(e.getKey(), e.getValue());
+
+ key.attach(ses);
+
+ key.interestOps(key.interestOps() & (~SelectionKey.OP_CONNECT));
+ key.interestOps(key.interestOps() | SelectionKey.OP_READ);
- if (!ses.accepted())
- resend(ses);
+ fut.onDone(ses);
+ }
+
+ ses.key(key);
sessions.add(ses);
workerSessions.add(ses);
@@ -2321,6 +2455,34 @@ public class GridNioServer<T> {
}
/**
+ * @param key Key.
+ * @throws IOException If failed.
+ */
+ @SuppressWarnings("unchecked")
+ private void processConnect(SelectionKey key) throws IOException {
+ SocketChannel ch = (SocketChannel)key.channel();
+
+ Map<Integer, Object> meta = (Map<Integer, Object>)key.attachment();
+
+ try {
+ if (ch.finishConnect())
+ register(new NioOperationFuture<GridNioSession>(ch, false, meta));
+ }
+ catch (IOException e) {
+ NioOperationFuture<GridNioSession> sesFut =
+ (NioOperationFuture<GridNioSession>)meta.get(SESSION_FUT_META_KEY);
+
+ assert sesFut != null;
+
+ U.closeQuiet(ch);
+
+ sesFut.onDone(new GridNioException("Failed to connect to node", e));
+
+ throw e;
+ }
+ }
+
+ /**
* Processes read-available event on the key.
*
* @param key Key that is ready to be read.
@@ -2537,14 +2699,20 @@ public class GridNioServer<T> {
* @param sockCh Socket channel to be registered on one of the selectors.
*/
private void addRegistrationReq(SocketChannel sockCh) {
- offerBalanced(new NioOperationFuture(sockCh));
+ offerBalanced(new NioOperationFuture(sockCh), null);
}
}
/**
* Asynchronous operation that may be requested on selector.
*/
- enum NioOperation {
+ private enum NioOperation {
+ /** Register connect key selection. */
+ CONNECT,
+
+ /** Cancel connect. */
+ CANCEL_CONNECT,
+
/** Register read key selection. */
REGISTER,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
index 66f9176..2280321 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
@@ -393,8 +393,6 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
if (!outRecovery.pairedConnections())
inRecovery = outRecovery;
- outRecovery.onConnected();
-
return null;
}
else
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
index b4bd34a..f8a0dce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
@@ -69,9 +69,6 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
/** Allocate direct buffer or heap buffer. */
private boolean directBuf;
- /** Whether SSLEngine should use client mode. */
- private boolean clientMode;
-
/** Whether direct mode is used. */
private boolean directMode;
@@ -93,13 +90,6 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
}
/**
- * @param clientMode Flag indicating whether SSLEngine should use client mode..
- */
- public void clientMode(boolean clientMode) {
- this.clientMode = clientMode;
- }
-
- /**
*
* @param directMode Flag indicating whether direct mode is used.
*/
@@ -164,6 +154,8 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
if (sslMeta == null) {
engine = sslCtx.createSSLEngine();
+ boolean clientMode = !ses.accepted();
+
engine.setUseClientMode(clientMode);
if (!clientMode) {
[21/50] [abbrv] ignite git commit: IGNITE-4351 .NET: Use
BinaryArrayIdentityResolver by default. This closes #1668.
Posted by ag...@apache.org.
IGNITE-4351 .NET: Use BinaryArrayIdentityResolver by default. This closes #1668.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/12e240a2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/12e240a2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/12e240a2
Branch: refs/heads/ignite-4003
Commit: 12e240a2d127f32b6883a8ee1b7422d9e59f3f16
Parents: 24f90d6
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Mar 27 14:00:08 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 14:00:08 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 1 -
.../Binary/BinaryBuilderSelfTest.cs | 151 +++++--------------
.../BinaryBuilderSelfTestArrayIdentity.cs | 34 -----
.../Binary/BinarySelfTest.cs | 8 -
.../Cache/Query/CacheDmlQueriesTest.cs | 5 +-
.../Binary/BinaryArrayEqualityComparer.cs | 5 +
.../Binary/IBinaryObjectBuilder.cs | 10 --
.../Impl/Binary/BinaryObject.cs | 72 +--------
.../Impl/Binary/BinaryObjectBuilder.cs | 65 +++-----
.../Impl/Binary/BinaryUtils.cs | 10 ++
.../Impl/Binary/BinaryWriter.cs | 8 +-
.../Impl/Binary/IBinaryEqualityComparer.cs | 10 ++
12 files changed, 94 insertions(+), 285 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 0eb3e39..1540243 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -68,7 +68,6 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Binary\BinaryBuilderSelfTestArrayIdentity.cs" />
<Compile Include="Binary\BinaryEqualityComparerTest.cs" />
<Compile Include="Binary\BinaryReaderWriterTest.cs" />
<Compile Include="Binary\IO\BinaryStreamsTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
index e9ca852..e59611b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -58,57 +58,33 @@ namespace Apache.Ignite.Core.Tests.Binary
{
TypeConfigurations = new List<BinaryTypeConfiguration>
{
- new BinaryTypeConfiguration(typeof(Empty)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(Primitives)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(PrimitiveArrays)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(StringDateGuidEnum))
- {
- EqualityComparer = GetIdentityResolver()
- },
- new BinaryTypeConfiguration(typeof(WithRaw)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(MetaOverwrite)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(NestedOuter)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(NestedInner)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(MigrationOuter)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(MigrationInner)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(InversionOuter)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(InversionInner)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(CompositeOuter)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(CompositeInner)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(CompositeArray)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(CompositeContainer))
- {
- EqualityComparer = GetIdentityResolver()
- },
- new BinaryTypeConfiguration(typeof(ToBinary)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(Remove)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(RemoveInner)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(BuilderInBuilderOuter))
- {
- EqualityComparer = GetIdentityResolver()
- },
- new BinaryTypeConfiguration(typeof(BuilderInBuilderInner))
- {
- EqualityComparer = GetIdentityResolver()
- },
- new BinaryTypeConfiguration(typeof(BuilderCollection))
- {
- EqualityComparer = GetIdentityResolver()
- },
- new BinaryTypeConfiguration(typeof(BuilderCollectionItem))
- {
- EqualityComparer = GetIdentityResolver()
- },
- new BinaryTypeConfiguration(typeof(DecimalHolder)) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(TypeEmpty) {EqualityComparer = GetIdentityResolver()},
- new BinaryTypeConfiguration(typeof(TestEnumRegistered))
- {
- EqualityComparer = GetIdentityResolver()
- },
+ new BinaryTypeConfiguration(typeof(Empty)),
+ new BinaryTypeConfiguration(typeof(Primitives)),
+ new BinaryTypeConfiguration(typeof(PrimitiveArrays)),
+ new BinaryTypeConfiguration(typeof(StringDateGuidEnum)),
+ new BinaryTypeConfiguration(typeof(WithRaw)),
+ new BinaryTypeConfiguration(typeof(MetaOverwrite)),
+ new BinaryTypeConfiguration(typeof(NestedOuter)),
+ new BinaryTypeConfiguration(typeof(NestedInner)),
+ new BinaryTypeConfiguration(typeof(MigrationOuter)),
+ new BinaryTypeConfiguration(typeof(MigrationInner)),
+ new BinaryTypeConfiguration(typeof(InversionOuter)),
+ new BinaryTypeConfiguration(typeof(InversionInner)),
+ new BinaryTypeConfiguration(typeof(CompositeOuter)),
+ new BinaryTypeConfiguration(typeof(CompositeInner)),
+ new BinaryTypeConfiguration(typeof(CompositeArray)),
+ new BinaryTypeConfiguration(typeof(CompositeContainer)),
+ new BinaryTypeConfiguration(typeof(ToBinary)),
+ new BinaryTypeConfiguration(typeof(Remove)),
+ new BinaryTypeConfiguration(typeof(RemoveInner)),
+ new BinaryTypeConfiguration(typeof(BuilderInBuilderOuter)),
+ new BinaryTypeConfiguration(typeof(BuilderInBuilderInner)),
+ new BinaryTypeConfiguration(typeof(BuilderCollection)),
+ new BinaryTypeConfiguration(typeof(BuilderCollectionItem)),
+ new BinaryTypeConfiguration(typeof(DecimalHolder)),
+ new BinaryTypeConfiguration(TypeEmpty),
+ new BinaryTypeConfiguration(typeof(TestEnumRegistered)),
new BinaryTypeConfiguration(typeof(NameMapperTestType))
- {
- EqualityComparer = GetIdentityResolver()
- }
},
DefaultIdMapper = new IdMapper(),
DefaultNameMapper = new NameMapper(),
@@ -130,14 +106,6 @@ namespace Apache.Ignite.Core.Tests.Binary
}
/// <summary>
- /// Gets the identity resolver.
- /// </summary>
- protected virtual IEqualityComparer<IBinaryObject> GetIdentityResolver()
- {
- return null;
- }
-
- /// <summary>
/// Tear down routine.
/// </summary>
[TestFixtureTearDown]
@@ -567,7 +535,7 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(Empty)).Build();
Assert.IsNotNull(binObj);
- Assert.AreEqual(GetIdentityResolver() == null ? 0 : 1, binObj.GetHashCode());
+ Assert.AreEqual(1, binObj.GetHashCode());
IBinaryType meta = binObj.GetBinaryType();
@@ -589,7 +557,7 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject binObj = _grid.GetBinary().GetBuilder(TypeEmpty).Build();
Assert.IsNotNull(binObj);
- Assert.AreEqual(GetIdentityResolver() == null ? 0 : 1, binObj.GetHashCode());
+ Assert.AreEqual(1, binObj.GetHashCode());
IBinaryType meta = binObj.GetBinaryType();
@@ -612,17 +580,6 @@ namespace Apache.Ignite.Core.Tests.Binary
}
/// <summary>
- /// Test hash code alteration.
- /// </summary>
- [Test]
- public void TestHashCodeChange()
- {
- IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(Empty)).SetHashCode(100).Build();
-
- Assert.AreEqual(100, binObj.GetHashCode());
- }
-
- /// <summary>
/// Tests equality and formatting members.
/// </summary>
[Test]
@@ -635,8 +592,8 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(obj1, obj2);
- Assert.AreEqual(0, obj1.GetHashCode());
- Assert.AreEqual(0, obj2.GetHashCode());
+ Assert.AreEqual(1823354401, obj1.GetHashCode());
+ Assert.AreEqual(1823354401, obj2.GetHashCode());
Assert.IsTrue(Regex.IsMatch(obj1.ToString(), @"myType \[idHash=[0-9]+, str=foo, int=1\]"));
}
@@ -658,7 +615,6 @@ namespace Apache.Ignite.Core.Tests.Binary
.SetField<float>("fFloat", 5)
.SetField<double>("fDouble", 6)
.SetField("fDecimal", 7.7m)
- .SetHashCode(100)
.Build();
CheckPrimitiveFields1(binObj);
@@ -674,7 +630,6 @@ namespace Apache.Ignite.Core.Tests.Binary
.SetFloatField("fFloat", 5)
.SetDoubleField("fDouble", 6)
.SetDecimalField("fDecimal", 7.7m)
- .SetHashCode(100)
.Build();
CheckPrimitiveFields1(binObj2);
@@ -723,8 +678,6 @@ namespace Apache.Ignite.Core.Tests.Binary
/// </summary>
private static void CheckPrimitiveFields1(IBinaryObject binObj)
{
- Assert.AreEqual(100, binObj.GetHashCode());
-
IBinaryType meta = binObj.GetBinaryType();
Assert.AreEqual(typeof(Primitives).Name, meta.TypeName);
@@ -809,7 +762,6 @@ namespace Apache.Ignite.Core.Tests.Binary
.SetField("fFloat", new float[] { 5 })
.SetField("fDouble", new double[] { 6 })
.SetField("fDecimal", new decimal?[] { 7.7m })
- .SetHashCode(100)
.Build();
CheckPrimitiveArrayFields1(binObj);
@@ -825,7 +777,6 @@ namespace Apache.Ignite.Core.Tests.Binary
.SetFloatArrayField("fFloat", new float[] {5})
.SetDoubleArrayField("fDouble", new double[] {6})
.SetDecimalArrayField("fDecimal", new decimal?[] {7.7m})
- .SetHashCode(100)
.Build();
CheckPrimitiveArrayFields1(binObj2);
@@ -874,8 +825,6 @@ namespace Apache.Ignite.Core.Tests.Binary
/// </summary>
private static void CheckPrimitiveArrayFields1(IBinaryObject binObj)
{
- Assert.AreEqual(100, binObj.GetHashCode());
-
IBinaryType meta = binObj.GetBinaryType();
Assert.AreEqual(typeof(PrimitiveArrays).Name, meta.TypeName);
@@ -965,7 +914,6 @@ namespace Apache.Ignite.Core.Tests.Binary
.SetTimestampArrayField("fTimestampArr", new[] { nDate })
.SetGuidArrayField("fGuidArr", new[] { nGuid })
.SetEnumArrayField("fEnumArr", new[] { TestEnum.One })
- .SetHashCode(100)
.Build();
CheckStringDateGuidEnum1(binObj, nDate, nGuid);
@@ -982,7 +930,6 @@ namespace Apache.Ignite.Core.Tests.Binary
.SetTimestampArrayField("fTimestampArr", new[] { nDate })
.SetGuidArrayField("fGuidArr", new[] { nGuid })
.SetEnumArrayField("fEnumArr", new[] { TestEnum.One })
- .SetHashCode(100)
.Build();
CheckStringDateGuidEnum1(binObj2, nDate, nGuid);
@@ -1036,8 +983,6 @@ namespace Apache.Ignite.Core.Tests.Binary
/// </summary>
private void CheckStringDateGuidEnum1(IBinaryObject binObj, DateTime? nDate, Guid? nGuid)
{
- Assert.AreEqual(100, binObj.GetHashCode());
-
IBinaryType meta = binObj.GetBinaryType();
Assert.AreEqual(typeof(StringDateGuidEnum).Name, meta.TypeName);
@@ -1179,7 +1124,7 @@ namespace Apache.Ignite.Core.Tests.Binary
// 1. Test simple array.
object[] inArr = { new CompositeInner(1) };
- IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray))
.SetField("inArr", inArr).Build();
IBinaryType meta = binObj.GetBinaryType();
@@ -1188,8 +1133,6 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(1, meta.Fields.Count);
Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
- Assert.AreEqual(100, binObj.GetHashCode());
-
var binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(1, binInArr.Length);
@@ -1202,11 +1145,9 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(1, ((CompositeInner) arr.InArr[0]).Val);
// 2. Test addition to array.
- binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
+ binObj = _grid.GetBinary().GetBuilder(binObj)
.SetField("inArr", new[] { binInArr[0], null }).Build();
- Assert.AreEqual(200, binObj.GetHashCode());
-
binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
@@ -1222,11 +1163,9 @@ namespace Apache.Ignite.Core.Tests.Binary
binInArr[1] = _grid.GetBinary().GetBuilder(typeof(CompositeInner)).SetField("val", 2).Build();
- binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(300)
+ binObj = _grid.GetBinary().GetBuilder(binObj)
.SetField("inArr", binInArr.OfType<object>().ToArray()).Build();
- Assert.AreEqual(300, binObj.GetHashCode());
-
binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
@@ -1245,11 +1184,9 @@ namespace Apache.Ignite.Core.Tests.Binary
inArr = new object[] { inner, inner };
- binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
+ binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray))
.SetField("inArr", inArr).Build();
- Assert.AreEqual(100, binObj.GetHashCode());
-
binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
@@ -1265,11 +1202,9 @@ namespace Apache.Ignite.Core.Tests.Binary
binInArr[0] = _grid.GetBinary().GetBuilder(typeof(CompositeInner)).SetField("val", 2).Build();
- binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
+ binObj = _grid.GetBinary().GetBuilder(binObj)
.SetField("inArr", binInArr.ToArray<object>()).Build();
- Assert.AreEqual(200, binObj.GetHashCode());
-
binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
@@ -1286,7 +1221,7 @@ namespace Apache.Ignite.Core.Tests.Binary
// 4. Test nested object handle inversion.
CompositeOuter[] outArr = { new CompositeOuter(inner), new CompositeOuter(inner) };
- binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
+ binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray))
.SetField("outArr", outArr.ToArray<object>()).Build();
meta = binObj.GetBinaryType();
@@ -1296,8 +1231,6 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("outArr"));
- Assert.AreEqual(100, binObj.GetHashCode());
-
var binOutArr = binObj.GetField<IBinaryObject[]>("outArr").ToArray();
Assert.AreEqual(2, binOutArr.Length);
@@ -1314,11 +1247,9 @@ namespace Apache.Ignite.Core.Tests.Binary
binOutArr[0] = _grid.GetBinary().GetBuilder(typeof(CompositeOuter))
.SetField("inner", new CompositeInner(2)).Build();
- binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
+ binObj = _grid.GetBinary().GetBuilder(binObj)
.SetField("outArr", binOutArr.ToArray<object>()).Build();
- Assert.AreEqual(200, binObj.GetHashCode());
-
binInArr = binObj.GetField<IBinaryObject[]>("outArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
@@ -1345,7 +1276,7 @@ namespace Apache.Ignite.Core.Tests.Binary
col.Add(new CompositeInner(1));
dict[3] = new CompositeInner(3);
- IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(CompositeContainer)).SetHashCode(100)
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(CompositeContainer))
.SetCollectionField("col", col)
.SetDictionaryField("dict", dict).Build();
@@ -1484,9 +1415,6 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(MigrationOuter));
- if (GetIdentityResolver() == null)
- builder.SetHashCode(outer.GetHashCode());
-
builder.SetField<object>("inner1", inner);
builder.SetField<object>("inner2", inner);
@@ -1713,9 +1641,6 @@ namespace Apache.Ignite.Core.Tests.Binary
[Test]
public void TestRemoteBinaryMode()
{
- if (GetIdentityResolver() != null)
- return; // When identity resolver is set, it is required to have the same config on all nodes.
-
var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
IgniteInstanceName = "grid2",
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestArrayIdentity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestArrayIdentity.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestArrayIdentity.cs
deleted file mode 100644
index b5e767c..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestArrayIdentity.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Tests.Binary
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Binary;
-
- /// <summary>
- /// Tests with array equality comparer (identity resolver).
- /// </summary>
- public class BinaryBuilderSelfTestArrayIdentity : BinaryBuilderSelfTest
- {
- /** <inheritdoc /> */
- protected override IEqualityComparer<IBinaryObject> GetIdentityResolver()
- {
- return new BinaryArrayEqualityComparer();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index f859b01..70226e6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -947,8 +947,6 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
- Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
-
PrimitiveFieldType newObj = portObj.Deserialize<PrimitiveFieldType>();
Assert.AreEqual(obj, newObj);
@@ -986,8 +984,6 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
- Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
-
if (!raw)
{
// Test enum field in binary form
@@ -1070,8 +1066,6 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
- Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
-
CollectionsType newObj = portObj.Deserialize<CollectionsType>();
Assert.AreEqual(obj, newObj);
@@ -1587,8 +1581,6 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject portOutObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
- Assert.AreEqual(outObj.GetHashCode(), portOutObj.GetHashCode());
-
OuterObjectType newOutObj = portOutObj.Deserialize<OuterObjectType>();
Assert.AreEqual(outObj, newOutObj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
index c460252..a6a295b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
@@ -43,10 +43,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
{
TypeConfigurations =
{
- new BinaryTypeConfiguration(typeof(Key))
- {
- EqualityComparer = new BinaryArrayEqualityComparer()
- },
+ new BinaryTypeConfiguration(typeof(Key)),
new BinaryTypeConfiguration(typeof(Key2))
{
EqualityComparer = new BinaryFieldEqualityComparer("Hi", "Lo")
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
index e4e3451..ccc0808 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
@@ -30,6 +30,11 @@ namespace Apache.Ignite.Core.Binary
IBinaryStreamProcessor<KeyValuePair<int,int>, int>
{
/// <summary>
+ /// Singleton instance.
+ /// </summary>
+ public static readonly BinaryArrayEqualityComparer Instance = new BinaryArrayEqualityComparer();
+
+ /// <summary>
/// Determines whether the specified objects are equal.
/// </summary>
/// <param name="x">The first object to compare.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObjectBuilder.cs
index 740706a..851926f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObjectBuilder.cs
@@ -60,16 +60,6 @@ namespace Apache.Ignite.Core.Binary
IBinaryObjectBuilder RemoveField(string fieldName);
/// <summary>
- /// Set explicit hash code. If builder creating object from scratch,
- /// then hash code initially set to 0. If builder is created from
- /// existing binary object, then hash code of that object is used
- /// as initial value.
- /// </summary>
- /// <param name="hashCode">Hash code.</param>
- /// <returns>Current builder instance.</returns>
- IBinaryObjectBuilder SetHashCode(int hashCode);
-
- /// <summary>
/// Build the object.
/// </summary>
/// <returns>Resulting binary object.</returns>
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
index 0a14bd2..21a5323 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
@@ -247,74 +247,18 @@ namespace Apache.Ignite.Core.Impl.Binary
BinaryObject that = obj as BinaryObject;
- if (that != null)
- {
- if (_data == that._data && _offset == that._offset)
- return true;
-
- if (TypeId != that.TypeId)
- return false;
-
- var desc = _marsh.GetDescriptor(true, TypeId);
-
- if (desc != null && desc.EqualityComparer != null)
- return desc.EqualityComparer.Equals(this, that);
-
- // 1. Check headers
- if (_header == that._header)
- {
- // 2. Check if objects have the same field sets.
- InitializeFields();
- that.InitializeFields();
-
- if (_fields.Keys.Count != that._fields.Keys.Count)
- return false;
-
- foreach (int id in _fields.Keys)
- {
- if (!that._fields.ContainsKey(id))
- return false;
- }
-
- // 3. Check if objects have the same field values.
- foreach (KeyValuePair<int, int> field in _fields)
- {
- object fieldVal = GetField<object>(field.Value, null);
- object thatFieldVal = that.GetField<object>(that._fields[field.Key], null);
-
- var arr = fieldVal as Array;
- var thatArr = thatFieldVal as Array;
+ if (that == null)
+ return false;
- if (arr != null && thatArr != null && arr.Length == thatArr.Length)
- {
- for (var i = 0; i < arr.Length; i++)
- {
- if (!Equals(arr.GetValue(i), thatArr.GetValue(i)))
- return false;
- }
- }
- else if (!Equals(fieldVal, thatFieldVal))
- {
- return false;
- }
- }
+ if (_data == that._data && _offset == that._offset)
+ return true;
- // 4. Check if objects have the same raw data.
- // ReSharper disable ImpureMethodCallOnReadonlyValueField (method is not impure)
- using (var stream = new BinaryHeapStream(_data))
- using (var thatStream = new BinaryHeapStream(that._data))
- {
- var rawOffset = _header.GetRawOffset(stream, _offset);
- var thatRawOffset = that._header.GetRawOffset(thatStream, that._offset);
+ if (TypeId != that.TypeId)
+ return false;
- return BinaryUtils.CompareArrays(_data, _offset + rawOffset, _header.Length - rawOffset,
- that._data, that._offset + thatRawOffset, that._header.Length - thatRawOffset);
- }
- // ReSharper restore ImpureMethodCallOnReadonlyValueField
- }
- }
+ var desc = _marsh.GetDescriptor(true, TypeId);
- return false;
+ return BinaryUtils.GetEqualityComparer(desc).Equals(this, that);
}
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index 40f1862..6e8df0b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -54,9 +54,6 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Contextual fields. */
private IDictionary<int, BinaryBuilderField> _cache;
- /** Hash code. */
- private int? _hashCode;
-
/** Current context. */
private Context _ctx;
@@ -93,23 +90,7 @@ namespace Apache.Ignite.Core.Impl.Binary
_parent = parent ?? this;
_desc = desc;
- if (obj != null)
- {
- _obj = obj;
- _hashCode = obj.GetHashCode();
- }
- else
- {
- _obj = BinaryFromDescriptor(desc);
- }
- }
-
- /** <inheritDoc /> */
- public IBinaryObjectBuilder SetHashCode(int hashCode)
- {
- _hashCode = hashCode;
-
- return this;
+ _obj = obj ?? BinaryFromDescriptor(desc);
}
/** <inheritDoc /> */
@@ -508,13 +489,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="inStream">Input stream with initial object.</param>
/// <param name="outStream">Output stream.</param>
/// <param name="desc">Type descriptor.</param>
- /// <param name="hashCode">Hash code.</param>
/// <param name="vals">Values.</param>
private void Mutate(
BinaryHeapStream inStream,
BinaryHeapStream outStream,
IBinaryTypeDescriptor desc,
- int? hashCode,
IDictionary<string, BinaryBuilderField> vals)
{
// Set correct builder to writer frame.
@@ -553,7 +532,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
// Actual processing.
- Mutate0(_parent._ctx, inStream, outStream, true, hashCode, vals0);
+ Mutate0(_parent._ctx, inStream, outStream, true, vals0);
// 3. Handle metadata.
if (metaHnd != null)
@@ -580,11 +559,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="outStream">Output stream.</param>
/// <param name="ctx">Context.</param>
/// <param name="changeHash">WHether hash should be changed.</param>
- /// <param name="hash">New hash.</param>
/// <param name="vals">Values to be replaced.</param>
/// <returns>Mutated object.</returns>
private void Mutate0(Context ctx, BinaryHeapStream inStream, IBinaryStream outStream,
- bool changeHash, int? hash, IDictionary<int, BinaryBuilderField> vals)
+ bool changeHash, IDictionary<int, BinaryBuilderField> vals)
{
int inStartPos = inStream.Position;
int outStartPos = outStream.Position;
@@ -613,7 +591,7 @@ namespace Apache.Ignite.Core.Impl.Binary
inStream.Seek(oldPos, SeekOrigin.Begin);
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
+ Mutate0(ctx, inStream, outStream, false, EmptyVals);
inStream.Seek(inRetPos, SeekOrigin.Begin);
}
@@ -678,7 +656,7 @@ namespace Apache.Ignite.Core.Impl.Binary
// Field is not tracked, re-write as is.
inStream.Seek(inField.Offset + inStartPos, SeekOrigin.Begin);
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
+ Mutate0(ctx, inStream, outStream, false, EmptyVals);
}
}
}
@@ -740,20 +718,13 @@ namespace Apache.Ignite.Core.Impl.Binary
if (changeHash)
{
- if (hash != null)
- {
- outHash = hash.Value;
- }
- else
- {
- // Get from identity resolver.
- outHash = _desc.EqualityComparer != null
- ? _desc.EqualityComparer.GetHashCode(outStream,
- outStartPos + BinaryObjectHeader.Size,
- schemaPos - outStartPos - BinaryObjectHeader.Size,
- outSchema, outSchemaId, _binary.Marshaller, _desc)
- : 0;
- }
+ // Get from identity resolver.
+ var comparer = BinaryUtils.GetEqualityComparer(_desc);
+
+ outHash = comparer.GetHashCode(outStream,
+ outStartPos + BinaryObjectHeader.Size,
+ schemaPos - outStartPos - BinaryObjectHeader.Size,
+ outSchema, outSchemaId, _binary.Marshaller, _desc);
}
var outHeader = new BinaryObjectHeader(inHeader.TypeId, outHash, outLen,
@@ -816,7 +787,7 @@ namespace Apache.Ignite.Core.Impl.Binary
inStream.Seek(port.Offset, SeekOrigin.Begin);
// Use fresh context to ensure correct binary inversion.
- Mutate0(new Context(), inStream, outStream, false, 0, EmptyVals);
+ Mutate0(new Context(), inStream, outStream, false, EmptyVals);
}
}
@@ -838,7 +809,7 @@ namespace Apache.Ignite.Core.Impl.Binary
builder._parent._ctx = new Context(_parent._ctx);
builder.Mutate(inStream, (BinaryHeapStream) outStream, builder._desc,
- builder._hashCode, builder._vals);
+ builder._vals);
}
}
@@ -972,7 +943,7 @@ namespace Apache.Ignite.Core.Impl.Binary
outStream.WriteInt(arrLen);
for (int i = 0; i < arrLen; i++)
- Mutate0(ctx, inStream, outStream, false, 0, null);
+ Mutate0(ctx, inStream, outStream, false, null);
break;
@@ -984,7 +955,7 @@ namespace Apache.Ignite.Core.Impl.Binary
outStream.WriteByte(inStream.ReadByte());
for (int i = 0; i < colLen; i++)
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
+ Mutate0(ctx, inStream, outStream, false, EmptyVals);
break;
@@ -997,8 +968,8 @@ namespace Apache.Ignite.Core.Impl.Binary
for (int i = 0; i < dictLen; i++)
{
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
+ Mutate0(ctx, inStream, outStream, false, EmptyVals);
+ Mutate0(ctx, inStream, outStream, false, EmptyVals);
}
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index f00b8f9..2050f67 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1988,6 +1988,16 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
+ /// Gets the equality comparer.
+ /// </summary>
+ public static IBinaryEqualityComparer GetEqualityComparer(IBinaryTypeDescriptor descriptor)
+ {
+ var res = descriptor != null ? descriptor.EqualityComparer : null;
+
+ return res ?? BinaryArrayEqualityComparer.Instance;
+ }
+
+ /// <summary>
/// Creates and instance from the type name in reader.
/// </summary>
private static T CreateInstance<T>(BinaryReader reader)
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index a943937..5ec649a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -1233,10 +1233,10 @@ namespace Apache.Ignite.Core.Impl.Binary
var len = _stream.Position - pos;
- var hashCode = desc.EqualityComparer != null
- ? desc.EqualityComparer.GetHashCode(Stream, pos + BinaryObjectHeader.Size,
- dataEnd - pos - BinaryObjectHeader.Size, _schema, schemaIdx, _marsh, desc)
- : obj.GetHashCode();
+ var comparer = BinaryUtils.GetEqualityComparer(desc);
+
+ var hashCode = comparer.GetHashCode(Stream, pos + BinaryObjectHeader.Size,
+ dataEnd - pos - BinaryObjectHeader.Size, _schema, schemaIdx, _marsh, desc);
var header = new BinaryObjectHeader(desc.TypeId, hashCode, len, schemaId, schemaOffset, flags);
http://git-wip-us.apache.org/repos/asf/ignite/blob/12e240a2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryEqualityComparer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryEqualityComparer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryEqualityComparer.cs
index 9628688..bd2db95 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryEqualityComparer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryEqualityComparer.cs
@@ -43,6 +43,16 @@ namespace Apache.Ignite.Core.Impl.Binary
Marshaller marshaller, IBinaryTypeDescriptor desc);
/// <summary>
+ /// Returns a hash code for this instance.
+ /// </summary>
+ /// <param name="obj">The object.</param>
+ /// <returns>
+ /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
+ /// </returns>
+ int GetHashCode(IBinaryObject obj);
+
+
+ /// <summary>
/// Returns a value indicating that two binary object are equal.
/// </summary>
/// <param name="x">First object.</param>
[19/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
IGNITE-4475: New async API: now all async methods are defined explicitly, IgniteAsyncSupport is deprecated. This closes #1648.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/282b334f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/282b334f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/282b334f
Branch: refs/heads/ignite-4003
Commit: 282b334f76479460613f28347d8cea97ba23f795
Parents: 906b692
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Mar 27 13:19:47 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 13:19:49 2017 +0300
----------------------------------------------------------------------
.../computegrid/ComputeAsyncExample.java | 8 +-
.../ComputeFibonacciContinuationExample.java | 13 +-
.../examples/datagrid/CacheAsyncApiExample.java | 17 +-
.../datastructures/IgniteLockExample.java | 4 +-
.../datastructures/IgniteSemaphoreExample.java | 4 +-
.../examples/ScalarContinuationExample.scala | 10 +-
.../singlesplit/SingleSplitsLoadTest.java | 8 +-
.../ignite/tests/utils/TestTransaction.java | 11 +
.../internal/client/ClientStartNodeTask.java | 10 +-
.../java/org/apache/ignite/IgniteCache.java | 611 +++++++++++-
.../java/org/apache/ignite/IgniteCluster.java | 126 +++
.../java/org/apache/ignite/IgniteCompute.java | 262 ++++-
.../java/org/apache/ignite/IgniteEvents.java | 128 ++-
.../org/apache/ignite/IgniteFileSystem.java | 76 ++
.../java/org/apache/ignite/IgniteMessaging.java | 27 +
.../java/org/apache/ignite/IgniteServices.java | 221 ++++-
.../ignite/internal/IgniteComputeImpl.java | 546 +++++++++--
.../ignite/internal/IgniteEventsImpl.java | 79 ++
.../ignite/internal/IgniteMessagingImpl.java | 65 +-
.../ignite/internal/IgniteServicesImpl.java | 108 +++
.../internal/cluster/ClusterGroupAdapter.java | 2 +-
.../cluster/IgniteClusterAsyncImpl.java | 28 +-
.../internal/cluster/IgniteClusterImpl.java | 24 +-
.../ignite/internal/jdbc2/JdbcConnection.java | 6 +-
.../processors/cache/IgniteCacheProxy.java | 574 ++++++++++-
.../store/GridCacheStoreManagerAdapter.java | 10 +
.../transactions/TransactionProxyImpl.java | 39 +-
.../internal/processors/igfs/IgfsAsyncImpl.java | 43 +-
.../internal/processors/igfs/IgfsImpl.java | 62 +-
.../platform/PlatformAbstractTarget.java | 24 +-
.../platform/PlatformAsyncTarget.java | 44 -
.../platform/PlatformTargetProxy.java | 22 -
.../platform/PlatformTargetProxyImpl.java | 36 +-
.../platform/cache/PlatformCache.java | 218 +++--
.../platform/compute/PlatformCompute.java | 14 +-
...formDotNetEntityFrameworkCacheExtension.java | 8 +-
.../platform/events/PlatformEvents.java | 70 +-
.../platform/messaging/PlatformMessaging.java | 35 +-
.../platform/services/PlatformServices.java | 95 +-
.../transactions/PlatformTransactions.java | 9 +-
.../visor/cache/VisorCacheClearTask.java | 14 +-
.../visor/compute/VisorGatewayTask.java | 6 +-
.../apache/ignite/lang/IgniteAsyncSupport.java | 52 +-
.../ignite/lang/IgniteAsyncSupported.java | 4 +-
.../apache/ignite/transactions/Transaction.java | 22 +
.../IgniteCacheExpiryStoreLoadSelfTest.java | 18 +-
.../internal/ClusterGroupAbstractTest.java | 73 +-
.../ComputeJobCancelWithServiceSelfTest.java | 7 +-
.../internal/GridCancelOnGridStopSelfTest.java | 2 +-
.../GridCancelledJobsMetricsSelfTest.java | 11 +-
.../internal/GridContinuousTaskSelfTest.java | 21 +-
.../GridEventStorageCheckAllEventsSelfTest.java | 12 +-
.../GridFailoverCustomTopologySelfTest.java | 7 +-
.../GridJobMasterLeaveAwareSelfTest.java | 93 +-
.../internal/GridMultipleJobsSelfTest.java | 8 +-
.../ignite/internal/GridReduceSelfTest.java | 9 +-
.../GridTaskCancelSingleNodeSelfTest.java | 7 +-
.../internal/GridTaskExecutionSelfTest.java | 22 +-
.../GridTaskFailoverAffinityRunTest.java | 7 +-
.../GridTaskInstanceExecutionSelfTest.java | 7 +-
.../internal/GridTaskJobRejectSelfTest.java | 7 +-
.../IgniteClientReconnectApiExceptionTest.java | 10 +-
.../IgniteComputeEmptyClusterGroupTest.java | 26 +-
.../cache/CacheConcurrentReadThroughTest.java | 8 +-
.../cache/CacheFutureExceptionSelfTest.java | 6 +-
.../CachePutEventListenerErrorSelfTest.java | 7 +-
.../GridCacheAbstractFailoverSelfTest.java | 6 +-
...cheAbstractFullApiMultithreadedSelfTest.java | 105 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 876 ++++++++++++++---
.../cache/GridCacheAbstractMetricsSelfTest.java | 52 +-
.../GridCacheAsyncOperationsLimitSelfTest.java | 9 +-
.../GridCacheConcurrentTxMultiNodeTest.java | 10 +-
.../GridCacheInterceptorAbstractSelfTest.java | 31 +-
.../GridCacheMissingCommitVersionSelfTest.java | 6 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 16 +-
.../GridCacheReferenceCleanupSelfTest.java | 15 +-
.../IgniteCacheAbstractStopBusySelfTest.java | 7 +-
.../IgniteCacheConfigVariationsFullApiTest.java | 965 +++++++++++++++++--
.../cache/IgniteCacheInvokeAbstractTest.java | 20 +-
.../IgniteCacheManyAsyncOperationsTest.java | 6 +-
.../cache/IgniteCachePeekModesAbstractTest.java | 35 +-
.../cache/WithKeepBinaryCacheFullApiTest.java | 228 ++---
.../CacheKeepBinaryWithInterceptorTest.java | 16 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 75 +-
...eAbstractDataStructuresFailoverSelfTest.java | 7 +-
...ridCacheQueueJoinedNodeSelfAbstractTest.java | 12 +-
.../IgniteCountDownLatchAbstractSelfTest.java | 7 +-
.../IgniteLockAbstractSelfTest.java | 7 +-
.../IgniteSemaphoreAbstractSelfTest.java | 7 +-
...acheAsyncOperationsFailoverAbstractTest.java | 12 +-
.../distributed/CacheAsyncOperationsTest.java | 32 +-
.../CachePutAllFailoverAbstractTest.java | 8 +-
.../GridCacheAbstractJobExecutionTest.java | 15 +-
.../GridCacheBasicOpAbstractTest.java | 38 +-
.../distributed/GridCacheEventAbstractTest.java | 82 +-
.../GridCacheMultiNodeAbstractTest.java | 25 +-
...yMetadataUpdateChangingTopologySelfTest.java | 13 +-
.../IgniteCacheConnectionRecoveryTest.java | 10 +-
...eCacheMessageRecoveryIdleConnectionTest.java | 6 +-
...cOriginatingNodeFailureAbstractSelfTest.java | 6 +-
.../dht/GridCacheGlobalLoadTest.java | 21 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 12 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 26 +-
.../atomic/IgniteCacheAtomicProtocolTest.java | 34 +-
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 11 +-
.../GridCachePartitionedLoadCacheSelfTest.java | 9 +-
.../GridCacheEmptyEntriesAbstractSelfTest.java | 21 +-
.../GridCacheContinuousQueryConcurrentTest.java | 5 +-
.../closure/GridClosureProcessorSelfTest.java | 74 +-
...ComputeJobExecutionErrorToLogManualTest.java | 10 +-
...gniteComputeConfigVariationsFullApiTest.java | 533 +++++++++-
.../continuous/GridEventConsumeSelfTest.java | 196 +++-
.../internal/processors/igfs/IgfsMock.java | 41 +
.../processors/igfs/IgfsTaskSelfTest.java | 19 +
...niteMessagingConfigVariationFullApiTest.java | 93 +-
.../GridServiceProcessorAbstractSelfTest.java | 291 +++++-
.../GridServiceProcessorMultiNodeSelfTest.java | 18 +-
.../GridServiceProcessorStopSelfTest.java | 7 +-
.../loadtest/GridSingleExecutionTest.java | 10 +-
.../loadtests/colocation/GridTestMain.java | 7 +-
.../multisplit/GridMultiSplitsLoadTest.java | 7 +-
...ridSingleSplitsNewNodesAbstractLoadTest.java | 8 +-
.../ignite/loadtests/dsi/GridDsiClient.java | 12 +-
...GridJobExecutionLoadTestClientSemaphore.java | 9 +-
...JobExecutionSingleNodeSemaphoreLoadTest.java | 10 +-
.../loadtests/job/GridJobLoadTestSubmitter.java | 7 +-
.../mergesort/GridMergeSortLoadTask.java | 7 +-
.../ignite/messaging/GridMessagingSelfTest.java | 73 +-
.../messaging/IgniteMessagingSendAsyncTest.java | 83 +-
...idSessionFutureWaitJobAttributeSelfTest.java | 7 +-
...GridSessionSetJobAttributeOrderSelfTest.java | 8 +-
...sionSetJobAttributeWaitListenerSelfTest.java | 7 +-
.../GridSessionSetTaskAttributeSelfTest.java | 7 +-
...GridSessionTaskWaitJobAttributeSelfTest.java | 7 +-
.../GridSessionWaitAttributeSelfTest.java | 9 +-
.../cache/GridAbstractCacheStoreSelfTest.java | 11 +
.../junits/common/GridCommonAbstractTest.java | 26 +-
.../multijvm/IgniteCacheProcessProxy.java | 172 ++++
.../multijvm/IgniteClusterProcessProxy.java | 13 +
.../multijvm/IgniteEventsProcessProxy.java | 31 +
...niteCacheLockPartitionOnAffinityRunTest.java | 6 +-
.../cache/IgniteCacheQueryLoadSelfTest.java | 20 +-
.../cpp/jni/include/ignite/jni/exports.h | 2 -
.../platforms/cpp/jni/include/ignite/jni/java.h | 4 -
modules/platforms/cpp/jni/project/vs/module.def | 2 -
modules/platforms/cpp/jni/src/exports.cpp | 8 -
modules/platforms/cpp/jni/src/java.cpp | 20 -
.../scalar/pimps/ScalarProjectionPimp.scala | 24 +-
...gniteProjectionStartStopRestartSelfTest.java | 6 +-
.../commands/tasks/VisorTasksCommandSpec.scala | 22 +-
.../IgniteAtomicInvokeRetryBenchmark.java | 12 +-
.../failover/IgniteAtomicRetriesBenchmark.java | 12 +-
.../IgniteFailoverAbstractBenchmark.java | 18 +-
...IgniteTransactionalInvokeRetryBenchmark.java | 10 +-
...IgniteTransactionalWriteInvokeBenchmark.java | 16 +-
.../IgniteTransactionalWriteReadBenchmark.java | 12 +-
156 files changed, 6806 insertions(+), 2268 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeAsyncExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeAsyncExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeAsyncExample.java
index e8321a5..8064ace 100644
--- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeAsyncExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeAsyncExample.java
@@ -49,21 +49,19 @@ public class ComputeAsyncExample {
System.out.println("Compute asynchronous example started.");
// Enable asynchronous mode.
- IgniteCompute compute = ignite.compute().withAsync();
+ IgniteCompute compute = ignite.compute();
Collection<IgniteFuture<?>> futs = new ArrayList<>();
// Iterate through all words in the sentence and create runnable jobs.
for (final String word : "Print words using runnable".split(" ")) {
// Execute runnable on some node.
- compute.run(new IgniteRunnable() {
+ futs.add(compute.runAsync(new IgniteRunnable() {
@Override public void run() {
System.out.println();
System.out.println(">>> Printing '" + word + "' on this node from ignite job.");
}
- });
-
- futs.add(compute.future());
+ }));
}
// Wait for completion of all futures.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
index 6642e9d..0fe12f1 100644
--- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
@@ -27,7 +27,6 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJobContext;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteFuture;
@@ -142,13 +141,12 @@ public final class ComputeFibonacciContinuationExample {
ClusterGroup p = ignite.cluster().forPredicate(nodeFilter);
- IgniteCompute compute = ignite.compute(p).withAsync();
+ IgniteCompute compute = ignite.compute(p);
// If future is not cached in node-local-map, cache it.
if (fut1 == null) {
- compute.apply(new ContinuationFibonacciClosure(nodeFilter), n - 1);
-
- ComputeTaskFuture<BigInteger> futVal = compute.future();
+ IgniteFuture<BigInteger> futVal = compute.applyAsync(
+ new ContinuationFibonacciClosure(nodeFilter), n - 1);
fut1 = locMap.putIfAbsent(n - 1, futVal);
@@ -158,9 +156,8 @@ public final class ComputeFibonacciContinuationExample {
// If future is not cached in node-local-map, cache it.
if (fut2 == null) {
- compute.apply(new ContinuationFibonacciClosure(nodeFilter), n - 2);
-
- ComputeTaskFuture<BigInteger> futVal = compute.<BigInteger>future();
+ IgniteFuture<BigInteger> futVal = compute.applyAsync(
+ new ContinuationFibonacciClosure(nodeFilter), n - 2);
fut2 = locMap.putIfAbsent(n - 2, futVal);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
index 3699361..69b23e7 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
@@ -53,27 +53,18 @@ public class CacheAsyncApiExample {
// Auto-close cache at the end of the example.
try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME)) {
- // Enable asynchronous mode.
- IgniteCache<Integer, String> asyncCache = cache.withAsync();
-
Collection<IgniteFuture<?>> futs = new ArrayList<>();
// Execute several puts asynchronously.
- for (int i = 0; i < 10; i++) {
- asyncCache.put(i, String.valueOf(i));
-
- futs.add(asyncCache.future());
- }
+ for (int i = 0; i < 10; i++)
+ futs.add(cache.putAsync(i, String.valueOf(i)));
// Wait for completion of all futures.
for (IgniteFuture<?> fut : futs)
fut.get();
- // Execute get operation asynchronously.
- asyncCache.get(1);
-
- // Asynchronously wait for result.
- asyncCache.<String>future().listen(new IgniteInClosure<IgniteFuture<String>>() {
+ // Execute get operation asynchronously and wait for result.
+ cache.getAsync(1).listen(new IgniteInClosure<IgniteFuture<String>>() {
@Override public void apply(IgniteFuture<String> fut) {
System.out.println("Get operation completed [value=" + fut.get() + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteLockExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteLockExample.java b/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteLockExample.java
index 1f84787..ba035ae 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteLockExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteLockExample.java
@@ -87,11 +87,11 @@ public class IgniteLockExample {
// Start consumers on all cluster nodes.
for (int i = 0; i < NUM_CONSUMERS; i++)
- ignite.compute().withAsync().run(new Consumer(reentrantLockName));
+ ignite.compute().runAsync(new Consumer(reentrantLockName));
// Start producers on all cluster nodes.
for (int i = 0; i < NUM_PRODUCERS; i++)
- ignite.compute().withAsync().run(new Producer(reentrantLockName));
+ ignite.compute().runAsync(new Producer(reentrantLockName));
System.out.println("Master node is waiting for all other nodes to finish...");
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteSemaphoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteSemaphoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteSemaphoreExample.java
index 1c078b0..12d1eab 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteSemaphoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteSemaphoreExample.java
@@ -67,11 +67,11 @@ public class IgniteSemaphoreExample {
// Start consumers on all cluster nodes.
for (int i = 0; i < NUM_CONSUMERS; i++)
- ignite.compute().withAsync().run(new Consumer(semaphoreName));
+ ignite.compute().runAsync(new Consumer(semaphoreName));
// Start producers on all cluster nodes.
for (int i = 0; i < NUM_PRODUCERS; i++)
- ignite.compute().withAsync().run(new Producer(semaphoreName));
+ ignite.compute().runAsync(new Producer(semaphoreName));
System.out.println("Master node is waiting for all other nodes to finish...");
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarContinuationExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarContinuationExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarContinuationExample.scala
index 203f0b7..62b3a13 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarContinuationExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarContinuationExample.scala
@@ -117,14 +117,12 @@ class FibonacciClosure (
// Group that excludes node with id passed in constructor if others exists.
val prj = if (ignite$.cluster().nodes().size() > 1) ignite$.cluster().forOthers(excludeNode) else ignite$.cluster().forNode(excludeNode)
- val comp = ignite$.compute(prj).withAsync()
+ val comp = ignite$.compute(prj)
// If future is not cached in node-local store, cache it.
// Note recursive execution!
if (fut1 == null) {
- comp.apply(new FibonacciClosure(excludeNodeId), n - 1)
-
- val futVal = comp.future[BigInteger]()
+ val futVal = comp.applyAsync(new FibonacciClosure(excludeNodeId), n - 1)
fut1 = store.putIfAbsent(n - 1, futVal)
@@ -134,9 +132,7 @@ class FibonacciClosure (
// If future is not cached in node-local store, cache it.
if (fut2 == null) {
- comp.apply(new FibonacciClosure(excludeNodeId), n - 2)
-
- val futVal = comp.future[BigInteger]()
+ val futVal = comp.applyAsync(new FibonacciClosure(excludeNodeId), n - 2)
fut2 = store.putIfAbsent(n - 2, futVal)
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/aop/src/test/java/org/apache/loadtests/direct/singlesplit/SingleSplitsLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/aop/src/test/java/org/apache/loadtests/direct/singlesplit/SingleSplitsLoadTest.java b/modules/aop/src/test/java/org/apache/loadtests/direct/singlesplit/SingleSplitsLoadTest.java
index 402bdf4..b42ff71 100644
--- a/modules/aop/src/test/java/org/apache/loadtests/direct/singlesplit/SingleSplitsLoadTest.java
+++ b/modules/aop/src/test/java/org/apache/loadtests/direct/singlesplit/SingleSplitsLoadTest.java
@@ -18,7 +18,6 @@
package org.apache.loadtests.direct.singlesplit;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -104,11 +103,8 @@ public class SingleSplitsLoadTest extends GridCommonAbstractTest {
try {
int levels = 20;
- IgniteCompute comp = ignite.compute().withAsync();
-
- comp.execute(new SingleSplitTestTask(), levels);
-
- ComputeTaskFuture<Integer> fut = comp.future();
+ ComputeTaskFuture<Integer> fut = ignite.compute().executeAsync(
+ new SingleSplitTestTask(), levels);
int res = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestTransaction.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestTransaction.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestTransaction.java
index 5f3ec69..4a03d25 100644
--- a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestTransaction.java
+++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestTransaction.java
@@ -17,6 +17,7 @@
package org.apache.ignite.tests.utils;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
@@ -106,6 +107,11 @@ public class TestTransaction implements Transaction {
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> commitAsync() throws IgniteException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public void close() {
// No-op.
}
@@ -129,4 +135,9 @@ public class TestTransaction implements Transaction {
@Override public void rollback() {
// No-op.
}
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> rollbackAsync() throws IgniteException {
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStartNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStartNodeTask.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStartNodeTask.java
index 48275e7..b3f69a3 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStartNodeTask.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStartNodeTask.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeJobResultPolicy;
@@ -159,14 +158,9 @@ public class ClientStartNodeTask extends TaskSingleJobSplitAdapter<String, Integ
private static void changeTopology(Ignite parent, int add, int rmv, String type) {
Collection<ComputeTaskFuture<?>> tasks = new ArrayList<>();
- IgniteCompute comp = parent.compute().withAsync();
-
// Start nodes in parallel.
- while (add-- > 0) {
- comp.execute(ClientStartNodeTask.class, type);
-
- tasks.add(comp.future());
- }
+ while (add-- > 0)
+ tasks.add(parent.compute().executeAsync(ClientStartNodeTask.class, type));
for (ComputeTaskFuture<?> task : tasks)
task.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index d7bccf5..33e0e8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -89,17 +89,13 @@ import org.jetbrains.annotations.Nullable;
* <h1 class="header">Transactions</h1>
* Cache API supports transactions. You can group and set of cache methods within a transaction
* to provide ACID-compliant behavior. See {@link IgniteTransactions} for more information.
- * <h1 class="header">Asynchronous Mode</h1>
- * Cache API supports asynchronous mode via {@link IgniteAsyncSupport} functionality. To turn on
- * asynchronous mode invoke {@link #withAsync()} method. Once asynchronous mode is enabled,
- * all methods with {@link IgniteAsyncSupported @IgniteAsyncSupported} annotation will be executed
- * asynchronously.
*
* @param <K> Cache key type.
* @param <V> Cache value type.
*/
public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncSupport {
/** {@inheritDoc} */
+ @Deprecated
@Override public IgniteCache<K, V> withAsync();
/** {@inheritDoc} */
@@ -191,6 +187,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void loadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) throws CacheException;
/**
+ * Asynchronously executes {@link #localLoadCache(IgniteBiPredicate, Object...)} on all cache nodes.
+ *
+ * @param p Optional predicate (may be {@code null}). If provided, will be used to
+ * filter values loaded from storage before they are put into cache.
+ * @param args Optional user arguments to be passed into
+ * {@link CacheStore#loadCache(IgniteBiInClosure, Object...)} method.
+ * @return a Future representing pending completion of the cache loading.
+ * @throws CacheException If loading failed.
+ */
+ public IgniteFuture<Void> loadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args)
+ throws CacheException;
+
+ /**
* Delegates to {@link CacheStore#loadCache(IgniteBiInClosure,Object...)} method
* to load state from the underlying persistent storage. The loaded values
* will then be given to the optionally passed in predicate, and, if the predicate returns
@@ -215,6 +224,31 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void localLoadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) throws CacheException;
/**
+ * Asynchronously loads state from the underlying persistent storage by delegating
+ * to {@link CacheStore#loadCache(IgniteBiInClosure,Object...)} method. The loaded values
+ * will then be given to the optionally passed in predicate, and, if the predicate returns
+ * {@code true}, will be stored in cache. If predicate is {@code null}, then
+ * all loaded values will be stored in cache.
+ * <p>
+ * Note that this method does not receive keys as a parameter, so it is up to
+ * {@link CacheStore} implementation to provide all the data to be loaded.
+ * <p>
+ * This method is not transactional and may end up loading a stale value into
+ * cache if another thread has updated the value immediately after it has been
+ * loaded. It is mostly useful when pre-loading the cache from underlying
+ * data store before start, or for read-only caches.
+ *
+ * @param p Optional predicate (may be {@code null}). If provided, will be used to
+ * filter values to be put into cache.
+ * @param args Optional user arguments to be passed into
+ * {@link CacheStore#loadCache(IgniteBiInClosure, Object...)} method.
+ * @return a Future representing pending completion of the cache loading.
+ * @throws CacheException If loading failed.
+ */
+ public IgniteFuture<Void> localLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args)
+ throws CacheException;
+
+ /**
* Stores given key-value pair in cache only if cache had no previous mapping for it. If cache
* previously contained value for the given key, then this value is returned.
* In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches,
@@ -247,6 +281,36 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public V getAndPutIfAbsent(K key, V val) throws CacheException;
/**
+ * Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it. If cache
+ * previously contained value for the given key, then this value is returned.
+ * In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches,
+ * the value will be loaded from the primary node, which in its turn may load the value
+ * from the swap storage, and consecutively, if it's not in swap,
+ * from the underlying persistent storage. If value has to be loaded from persistent
+ * storage, {@link CacheStore#load(Object)} method will be used.
+ * <p>
+ * If the returned value is not needed, method {@link #putIfAbsentAsync(Object, Object)} should
+ * always be used instead of this one to avoid the overhead associated with returning of the
+ * previous value.
+ * <p>
+ * If write-through is enabled, the stored value will be persisted to {@link CacheStore}
+ * via {@link CacheStore#write(javax.cache.Cache.Entry)} method.
+ * <h2 class="header">Transactions</h2>
+ * This method is transactional and will enlist the entry into ongoing transaction
+ * if there is one.
+ *
+ * @param key Key to store in cache.
+ * @param val Value to be associated with the given key.
+ * @return a Future representing pending completion of the operation.
+ * @throws NullPointerException If either key or value are {@code null}.
+ * @throws CacheException If put operation failed.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws CacheException;
+
+ /**
* Creates a {@link Lock} instance associated with passed key.
* This method does not acquire lock immediately, you have to call appropriate method on returned instance.
* Returned lock does not support {@link Lock#newCondition()} method,
@@ -363,6 +427,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
* This method does not participate in any transactions.
*
* @param key Entry key.
+ * @param peekModes Peek modes.
* @return Peeked value, or {@code null} if not found.
* @throws NullPointerException If key is {@code null}.
*/
@@ -388,11 +453,25 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
*
* @param peekModes Optional peek modes. If not provided, then total cache size is returned.
* @return Cache size across all nodes.
+ * @throws CacheException On error.
*/
@IgniteAsyncSupported
public int size(CachePeekMode... peekModes) throws CacheException;
/**
+ * Asynchronously gets the number of all entries cached across all nodes. By default,
+ * if {@code peekModes} value isn't defined, only size of primary copies across all nodes will be returned.
+ * This behavior is identical to calling this method with {@link CachePeekMode#PRIMARY} peek mode.
+ * <p>
+ * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
+ *
+ * @param peekModes Optional peek modes. If not provided, then total cache size is returned.
+ * @return a Future representing pending completion of the operation.
+ * @throws CacheException On error.
+ */
+ public IgniteFuture<Integer> sizeAsync(CachePeekMode... peekModes) throws CacheException;
+
+ /**
* Gets the number of all entries cached across all nodes as a long value. By default, if {@code peekModes} value
* isn't defined, only size of primary copies across all nodes will be returned. This behavior is identical to
* calling this method with {@link CachePeekMode#PRIMARY} peek mode.
@@ -401,11 +480,25 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
*
* @param peekModes Optional peek modes. If not provided, then total cache size is returned.
* @return Cache size across all nodes.
+ * @throws CacheException On error.
*/
@IgniteAsyncSupported
public long sizeLong(CachePeekMode... peekModes) throws CacheException;
/**
+ * Asynchronously gets the number of all entries cached across all nodes as a long value. By default,
+ * if {@code peekModes} value isn't defined, only size of primary copies across all nodes will be returned.
+ * This behavior is identical to calling this method with {@link CachePeekMode#PRIMARY} peek mode.
+ * <p>
+ * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
+ *
+ * @param peekModes Optional peek modes. If not provided, then total cache size is returned.
+ * @return a Future representing pending completion of the operation.
+ * @throws CacheException On error.
+ */
+ public IgniteFuture<Long> sizeLongAsync(CachePeekMode... peekModes) throws CacheException;
+
+ /**
* Gets the number of all entries cached in a partition as a long value. By default, if {@code peekModes} value
* isn't defined, only size of primary copies across all nodes will be returned. This behavior is identical to
* calling this method with {@link CachePeekMode#PRIMARY} peek mode.
@@ -414,12 +507,27 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
*
* @param partition partition.
* @param peekModes Optional peek modes. If not provided, then total partition cache size is returned.
- * @return Partion cache size across all nodes.
+ * @return Partition cache size across all nodes.
+ * @throws CacheException On error.
*/
@IgniteAsyncSupported
public long sizeLong(int partition, CachePeekMode... peekModes) throws CacheException;
/**
+ * Asynchronously gets the number of all entries cached in a partition as a long value. By default, if {@code peekModes} value
+ * isn't defined, only size of primary copies across all nodes will be returned. This behavior is identical to
+ * calling this method with {@link CachePeekMode#PRIMARY} peek mode.
+ * <p>
+ * NOTE: this operation is distributed and will query all participating nodes for their partition cache sizes.
+ *
+ * @param partition partition.
+ * @param peekModes Optional peek modes. If not provided, then total partition cache size is returned.
+ * @return a Future representing pending completion of the operation.
+ * @throws CacheException On error.
+ */
+ public IgniteFuture<Long> sizeLongAsync(int partition, CachePeekMode... peekModes) throws CacheException;
+
+ /**
* Gets the number of all entries cached on this node. By default, if {@code peekModes} value isn't defined,
* only size of primary copies will be returned. This behavior is identical to calling this method with
* {@link CachePeekMode#PRIMARY} peek mode.
@@ -466,6 +574,20 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
Object... args);
/**
+ * Asynchronously version of the {@link #invokeAll(Set, EntryProcessor, Object...)} method.
+ *
+ * @param map Map containing keys and entry processors to be applied to values.
+ * @param args Additional arguments to pass to the {@link EntryProcessor}.
+ * @return a Future representing pending completion of the operation. See more about future result
+ * at the {@link #invokeAll(Map, Object...)}.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
+ Map<? extends K, ? extends EntryProcessor<K, V, T>> map, Object... args);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -475,6 +597,18 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public V get(K key);
/**
+ * Asynchronously gets an entry from the cache.
+ * <p>
+ * If the cache is configured to use read-through, and a future result would be null
+ * because the entry is missing from the cache, the Cache's {@link CacheLoader}
+ * is called in an attempt to load the entry.
+ *
+ * @param key Key.
+ * @return a Future representing pending completion of the operation.
+ */
+ public IgniteFuture<V> getAsync(K key);
+
+ /**
* Gets an entry from the cache.
* <p>
* If the cache is configured to use read-through, and get would return null
@@ -497,6 +631,27 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public CacheEntry<K, V> getEntry(K key);
/**
+ * Asynchronously gets an entry from the cache.
+ * <p>
+ * If the cache is configured to use read-through, and a future result would be null
+ * because the entry is missing from the cache, the Cache's {@link CacheLoader}
+ * is called in an attempt to load the entry.
+ *
+ * @param key The key whose associated value is to be returned.
+ * @return a Future representing pending completion of the operation.
+ * @throws IllegalStateException If the cache is {@link #isClosed()}.
+ * @throws NullPointerException If the key is {@code null}.
+ * @throws CacheException If there is a problem fetching the value.
+ * @throws ClassCastException If the implementation is configured to perform
+ * runtime-type-checking, and the key or value types are incompatible with those that have been
+ * configured for the {@link Cache}.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<CacheEntry<K, V>> getEntryAsync(K key);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -506,6 +661,24 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public Map<K, V> getAll(Set<? extends K> keys);
/**
+ * Asynchronously gets a collection of entries from the {@link Cache}, returning them as
+ * {@link Map} of the values associated with the set of keys requested.
+ * <p>
+ * If the cache is configured read-through, and a future result for a key would
+ * be null because an entry is missing from the cache, the Cache's
+ * {@link CacheLoader} is called in an attempt to load the entry. If an
+ * entry cannot be loaded for a given key, the key will not be present in
+ * the returned Map.
+ *
+ * @param keys Keys set.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Map<K, V>> getAllAsync(Set<? extends K> keys);
+
+ /**
* Gets a collection of entries from the {@link Cache}.
* <p>
* If the cache is configured read-through, and a get for a key would
@@ -531,6 +704,29 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public Collection<CacheEntry<K, V>> getEntries(Set<? extends K> keys);
/**
+ * Asynchronously gets a collection of entries from the {@link Cache}.
+ * <p>
+ * If the cache is configured read-through, and a future result for a key would
+ * be null because an entry is missing from the cache, the Cache's
+ * {@link CacheLoader} is called in an attempt to load the entry. If an
+ * entry cannot be loaded for a given key, the key will not be present in
+ * the returned Collection.
+ *
+ * @param keys The keys whose associated values are to be returned.
+ * @return a Future representing pending completion of the operation.
+ * @throws NullPointerException If keys is null or if keys contains a {@code null}.
+ * @throws IllegalStateException If the cache is {@link #isClosed()}.
+ * @throws CacheException If there is a problem fetching the values.
+ * @throws ClassCastException If the implementation is configured to perform
+ * runtime-type-checking, and the key or value types are incompatible with those that have been
+ * configured for the {@link Cache}.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Collection<CacheEntry<K, V>>> getEntriesAsync(Set<? extends K> keys);
+
+ /**
* Gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries
* and will not lock any keys if pessimistic transaction is started by thread.
*
@@ -541,6 +737,15 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public Map<K, V> getAllOutTx(Set<? extends K> keys);
/**
+ * Asynchronously gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries
+ * and will not lock any keys if pessimistic transaction is started by thread.
+ *
+ * @param keys The keys whose associated values are to be returned.
+ * @return a Future representing pending completion of the operation.
+ */
+ public IgniteFuture<Map<K, V>> getAllOutTxAsync(Set<? extends K> keys);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -550,6 +755,21 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public boolean containsKey(K key);
/**
+ * Asynchronously determines if the {@link Cache} contains an entry for the specified key.
+ * <p>
+ * More formally, future result is <tt>true</tt> if and only if this cache contains a
+ * mapping for a key <tt>k</tt> such that <tt>key.equals(k)</tt>.
+ * (There can be at most one such mapping.)
+ *
+ * @param key Key.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> containsKeyAsync(K key);
+
+ /**
* Determines if the {@link Cache} contains entries for the specified keys.
*
* @param keys Key whose presence in this cache is to be tested.
@@ -562,6 +782,17 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public boolean containsKeys(Set<? extends K> keys);
/**
+ * Asynchronously determines if the {@link Cache} contains entries for the specified keys.
+ *
+ * @param keys Key whose presence in this cache is to be tested.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -571,6 +802,23 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public void put(K key, V val);
/**
+ * Asynchronously associates the specified value with the specified key in the cache.
+ * <p>
+ * If the {@link Cache} previously contained a mapping for the key, the old
+ * value is replaced by the specified value. (A cache <tt>c</tt> is said to
+ * contain a mapping for a key <tt>k</tt> if and only if {@link
+ * #containsKey(Object) c.containsKey(k)} would return <tt>true</tt>.)
+ *
+ * @param key Key.
+ * @param val Value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Void> putAsync(K key, V val);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -580,6 +828,28 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public V getAndPut(K key, V val);
/**
+ * Asynchronously associates the specified value with the specified key in this cache,
+ * returning an existing value if one existed as the future result.
+ * <p>
+ * If the cache previously contained a mapping for
+ * the key, the old value is replaced by the specified value. (A cache
+ * <tt>c</tt> is said to contain a mapping for a key <tt>k</tt> if and only
+ * if {@link #containsKey(Object) c.containsKey(k)} would return
+ * <tt>true</tt>.)
+ * <p>
+ * The previous value is returned as the future result, or future result is null if there was no value associated
+ * with the key previously.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<V> getAndPutAsync(K key, V val);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -589,6 +859,31 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public void putAll(Map<? extends K, ? extends V> map);
/**
+ * Asynchronously copies all of the entries from the specified map to the {@link Cache}.
+ * <p>
+ * The effect of this call is equivalent to that of calling
+ * {@link #putAsync(Object, Object)} putAsync(k, v)} on this cache once for each mapping
+ * from key <tt>k</tt> to value <tt>v</tt> in the specified map.
+ * <p>
+ * The order in which the individual puts occur is undefined.
+ * <p>
+ * The behavior of this operation is undefined if entries in the cache
+ * corresponding to entries in the map are modified or removed while this
+ * operation is in progress. or if map is modified while the operation is in
+ * progress.
+ * <p>
+ * In Default Consistency mode, individual puts occur atomically but not
+ * the entire putAll. Listeners may observe individual updates.
+ *
+ * @param map Map containing keys and values to put into the cache.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Void> putAllAsync(Map<? extends K, ? extends V> map);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -598,6 +893,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public boolean putIfAbsent(K key, V val);
/**
+ * Asynchronously associates the specified key with the given value if it is
+ * not already associated with a value.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> putIfAbsentAsync(K key, V val);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -607,6 +915,28 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public boolean remove(K key);
/**
+ * Asynchronously removes the mapping for a key from this cache if it is present.
+ * <p>
+ * More formally, if this cache contains a mapping from key <tt>k</tt> to
+ * value <tt>v</tt> such that
+ * <code>(key==null ? k==null : key.equals(k))</code>, that mapping is removed.
+ * (The cache can contain at most one such mapping.)
+ *
+ * <p>A future result is <tt>true</tt> if this cache previously associated the key,
+ * or <tt>false</tt> if the cache contained no mapping for the key.
+ * <p>
+ * The cache will not contain a mapping for the specified key once the
+ * returned future is completed.
+ *
+ * @param key Key.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> removeAsync(K key);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -616,6 +946,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public boolean remove(K key, V oldVal);
/**
+ * Asynchronously removes the mapping for a key only if currently mapped to the
+ * given value.
+ *
+ * @param key Key.
+ * @param oldVal Old value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> removeAsync(K key, V oldVal);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -625,6 +968,18 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public V getAndRemove(K key);
/**
+ * Asynchronously removes the entry for a key only if currently mapped to some
+ * value.
+ *
+ * @param key Key.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<V> getAndRemoveAsync(K key);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -634,6 +989,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public boolean replace(K key, V oldVal, V newVal);
/**
+ * Asynchronous version of the {@link #replace(Object, Object, Object)}.
+ *
+ * @param key Key.
+ * @param oldVal Old value.
+ * @param newVal New value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -643,6 +1011,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public boolean replace(K key, V val);
/**
+ * Asynchronously replaces the entry for a key only if currently mapped to a
+ * given value.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Boolean> replaceAsync(K key, V val);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -652,6 +1033,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public V getAndReplace(K key, V val);
/**
+ * Asynchronously replaces the value for a given key if and only if there is a
+ * value currently mapped by the key.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<V> getAndReplaceAsync(K key, V val);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -661,6 +1055,26 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public void removeAll(Set<? extends K> keys);
/**
+ * Asynchronously removes entries for the specified keys.
+ * <p>
+ * The order in which the individual entries are removed is undefined.
+ * <p>
+ * For every entry in the key set, the following are called:
+ * <ul>
+ * <li>any registered {@link CacheEntryRemovedListener}s</li>
+ * <li>if the cache is a write-through cache, the {@link CacheWriter}</li>
+ * </ul>
+ * If the key set is empty, the {@link CacheWriter} is not called.
+ *
+ * @param keys Keys set.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public IgniteFuture<Void> removeAllAsync(Set<? extends K> keys);
+
+ /**
* Removes all of the mappings from this cache.
* <p>
* The order that the individual entries are removed is undefined.
@@ -686,12 +1100,43 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@IgniteAsyncSupported
@Override public void removeAll();
+ /**
+ * Asynchronously removes all of the mappings from this cache.
+ * <p>
+ * The order that the individual entries are removed is undefined.
+ * <p>
+ * For every mapping that exists the following are called:
+ * <ul>
+ * <li>any registered {@link CacheEntryRemovedListener}s</li>
+ * <li>if the cache is a write-through cache, the {@link CacheWriter}</li>
+ * </ul>
+ * If the cache is empty, the {@link CacheWriter} is not called.
+ * <p>
+ * This is potentially an expensive operation as listeners are invoked.
+ * Use {@link #clearAsync()} to avoid this.
+ *
+ * @return a Future representing pending completion of the operation.
+ * @throws IllegalStateException if the cache is {@link #isClosed()}
+ * @throws CacheException if there is a problem during the remove
+ * @see #clearAsync()
+ * @see CacheWriter#deleteAll
+ */
+ public IgniteFuture<Void> removeAllAsync();
+
/** {@inheritDoc} */
@IgniteAsyncSupported
@Override public void clear();
/**
- * Clear entry from the cache and swap storage, without notifying listeners or
+ * Asynchronously clears the contents of the cache, without notifying listeners or
+ * {@link CacheWriter}s.
+ *
+ * @return a Future representing pending completion of the operation.
+ */
+ public IgniteFuture<Void> clearAsync();
+
+ /**
+ * Clears entry from the cache and swap storage, without notifying listeners or
* {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
* and is not participating in a transaction.
*
@@ -703,7 +1148,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void clear(K key);
/**
- * Clear entries from the cache and swap storage, without notifying listeners or
+ * Asynchronously clears entry from the cache and swap storage, without notifying listeners or
+ * {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
+ * and is not participating in a transaction.
+ *
+ * @param key Key to clear.
+ * @return a Future representing pending completion of the operation.
+ * @throws IllegalStateException if the cache is {@link #isClosed()}
+ * @throws CacheException if there is a problem during the clear
+ */
+ public IgniteFuture<Void> clearAsync(K key);
+
+ /**
+ * Clears entries from the cache and swap storage, without notifying listeners or
* {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
* and is not participating in a transaction.
*
@@ -715,7 +1172,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void clearAll(Set<? extends K> keys);
/**
- * Clear entry from the cache and swap storage, without notifying listeners or
+ * Asynchronously clears entries from the cache and swap storage, without notifying listeners or
+ * {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
+ * and is not participating in a transaction.
+ *
+ * @param keys Keys to clear.
+ * @return a Future representing pending completion of the operation.
+ * @throws IllegalStateException if the cache is {@link #isClosed()}
+ * @throws CacheException if there is a problem during the clear
+ */
+ public IgniteFuture<Void> clearAllAsync(Set<? extends K> keys);
+
+ /**
+ * Clears entry from the cache and swap storage, without notifying listeners or
* {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
* and is not participating in a transaction.
* <p/>
@@ -728,7 +1197,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void localClear(K key);
/**
- * Clear entries from the cache and swap storage, without notifying listeners or
+ * Clears entries from the cache and swap storage, without notifying listeners or
* {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
* and is not participating in a transaction.
* <p/>
@@ -750,6 +1219,22 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments);
/**
+ * Asynchronously invokes an {@link EntryProcessor} against the {@link Entry} specified by
+ * the provided key. If an {@link Entry} does not exist for the specified key,
+ * an attempt is made to load it (if a loader is configured) or a surrogate
+ * {@link Entry}, consisting of the key with a null value is used instead.
+ *
+ * @param key The key to the entry.
+ * @param entryProcessor The {@link EntryProcessor} to invoke.
+ * @param arguments Additional arguments to pass to the {@link EntryProcessor}.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public <T> IgniteFuture<T> invokeAsync(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments);
+
+ /**
* Invokes an {@link CacheEntryProcessor} against the {@link javax.cache.Cache.Entry} specified by
* the provided key. If an {@link javax.cache.Cache.Entry} does not exist for the specified key,
* an attempt is made to load it (if a loader is configured) or a surrogate
@@ -782,6 +1267,37 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public <T> T invoke(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... arguments);
/**
+ * Asynchronously invokes an {@link CacheEntryProcessor} against the {@link javax.cache.Cache.Entry} specified by
+ * the provided key. If an {@link javax.cache.Cache.Entry} does not exist for the specified key,
+ * an attempt is made to load it (if a loader is configured) or a surrogate
+ * {@link javax.cache.Cache.Entry}, consisting of the key with a null value is used instead.
+ * <p>
+ * An instance of entry processor must be stateless as it may be invoked multiple times on primary and
+ * backup nodes in the cache. It is guaranteed that the value passed to the entry processor will be always
+ * the same.
+ *
+ * @param key The key to the entry.
+ * @param entryProcessor The {@link CacheEntryProcessor} to invoke.
+ * @param arguments Additional arguments to pass to the {@link CacheEntryProcessor}.
+ * @return a Future representing pending completion of the operation.
+ * @throws NullPointerException If key or {@link CacheEntryProcessor} is null
+ * @throws IllegalStateException If the cache is {@link #isClosed()}
+ * @throws ClassCastException If the implementation is configured to perform
+ * runtime-type-checking, and the key or value
+ * types are incompatible with those that have been
+ * configured for the {@link Cache}.
+ * @throws EntryProcessorException If an exception is thrown by the {@link
+ * CacheEntryProcessor}, a Caching Implementation
+ * must wrap any {@link Exception} thrown
+ * wrapped in an {@link EntryProcessorException}.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ * @see CacheEntryProcessor
+ */
+ public <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... arguments);
+
+ /**
* {@inheritDoc}
* @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
* @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
@@ -792,6 +1308,39 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
EntryProcessor<K, V, T> entryProcessor, Object... args);
/**
+ * Asynchronously invokes an {@link EntryProcessor} against the set of {@link Entry}s
+ * specified by the set of keys.
+ * <p>
+ * If an {@link Entry} does not exist for the specified key, an attempt is made
+ * to load it (if a loader is configured) or a surrogate {@link Entry},
+ * consisting of the key and a value of null is provided.
+ * <p>
+ * The order that the entries for the keys are processed is undefined.
+ * Implementations may choose to process the entries in any order, including
+ * concurrently. Furthermore there is no guarantee implementations will
+ * use the same {@link EntryProcessor} instance to process each entry, as
+ * the case may be in a non-local cache topology.
+ * <p>
+ * The result of executing the {@link EntryProcessor} is returned in the future as a
+ * {@link Map} of {@link EntryProcessorResult}s, one result per key. Should the
+ * {@link EntryProcessor} or Caching implementation throw an exception, the
+ * exception is wrapped and re-thrown when a call to
+ * {@link javax.cache.processor.EntryProcessorResult#get()} is made.
+
+ *
+ * @param keys The set of keys.
+ * @param entryProcessor The {@link EntryProcessor} to invoke.
+ * @param args Additional arguments to pass to the {@link EntryProcessor}.
+ * @return a Future representing pending completion of the operation.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ */
+ public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
+ EntryProcessor<K, V, T> entryProcessor, Object... args);
+
+
+ /**
* Invokes an {@link CacheEntryProcessor} against the set of {@link javax.cache.Cache.Entry}s
* specified by the set of keys.
* <p>
@@ -838,6 +1387,48 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
/**
+ * Asynchronously invokes an {@link CacheEntryProcessor} against the set of {@link javax.cache.Cache.Entry}s
+ * specified by the set of keys.
+ * <p>
+ * If an {@link javax.cache.Cache.Entry} does not exist for the specified key, an attempt is made
+ * to load it (if a loader is configured) or a surrogate {@link javax.cache.Cache.Entry},
+ * consisting of the key and a value of null is provided.
+ * <p>
+ * The order that the entries for the keys are processed is undefined.
+ * Implementations may choose to process the entries in any order, including
+ * concurrently. Furthermore there is no guarantee implementations will
+ * use the same {@link CacheEntryProcessor} instance to process each entry, as
+ * the case may be in a non-local cache topology.
+ * <p>
+ * The result of executing the {@link CacheEntryProcessor} is returned in the future as a
+ * {@link Map} of {@link EntryProcessorResult}s, one result per key. Should the
+ * {@link CacheEntryProcessor} or Caching implementation throw an exception, the
+ * exception is wrapped and re-thrown when a call to
+ * {@link javax.cache.processor.EntryProcessorResult#get()} is made.
+ * <p>
+ * An instance of entry processor must be stateless as it may be invoked multiple times on primary and
+ * backup nodes in the cache. It is guaranteed that the value passed to the entry processor will be always
+ * the same.
+ *
+ * @param keys The set of keys for entries to process.
+ * @param entryProcessor The {@link CacheEntryProcessor} to invoke.
+ * @param args Additional arguments to pass to the {@link CacheEntryProcessor}.
+ * @return a Future representing pending completion of the operation.
+ * @throws NullPointerException If keys or {@link CacheEntryProcessor} are {#code null}.
+ * @throws IllegalStateException If the cache is {@link #isClosed()}.
+ * @throws ClassCastException If the implementation is configured to perform
+ * runtime-type-checking, and the key or value
+ * types are incompatible with those that have been
+ * configured for the {@link Cache}.
+ * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
+ * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
+ * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+ * @see CacheEntryProcessor
+ */
+ public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
+ CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
+
+ /**
* Closes this cache instance.
* <p>
* For local cache equivalent to {@link #destroy()}.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
index 23b03df..dc7b687 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
@@ -188,6 +188,33 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport {
int maxConn) throws IgniteException;
/**
+ * Starts one or more nodes on remote host(s) asynchronously.
+ * <p>
+ * This method takes INI file which defines all startup parameters. It can contain one or
+ * more sections, each for a host or for range of hosts (note that they must have different
+ * names) and a special '{@code defaults}' section with default values. They are applied to
+ * undefined parameters in host's sections.
+ * <p>
+ * Completed future contains collection of tuples. Each tuple corresponds to one node start attempt and
+ * contains hostname, success flag and error message if attempt was not successful. Note that
+ * successful attempt doesn't mean that node was actually started and joined topology. For large
+ * topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual
+ * node logs for details.
+ *
+ * @param file Configuration file.
+ * @param restart Whether to stop existing nodes. If {@code true}, all existing
+ * nodes on the host will be stopped before starting new ones. If
+ * {@code false}, nodes will be started only if there are less
+ * nodes on the host than expected.
+ * @param timeout Connection timeout.
+ * @param maxConn Number of parallel SSH connections to one host.
+ * @return a Future representing pending completion of the starting nodes.
+ * @throws IgniteException In case of error.
+ */
+ public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file, boolean restart, int timeout,
+ int maxConn) throws IgniteException;
+
+ /**
* Starts one or more nodes on remote host(s).
* <p>
* Each map in {@code hosts} collection
@@ -290,6 +317,104 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport {
@Nullable Map<String, Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException;
/**
+ * Starts one or more nodes on remote host(s) asynchronously.
+ * <p>
+ * Each map in {@code hosts} collection
+ * defines startup parameters for one host or for a range of hosts. The following
+ * parameters are supported:
+ * <table class="doctable">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><b>host</b></td>
+ * <td>String</td>
+ * <td>
+ * Hostname (required). Can define several hosts if their IPs are sequential.
+ * E.g., {@code 10.0.0.1~5} defines range of five IP addresses. Other
+ * parameters are applied to all hosts equally.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td><b>port</b></td>
+ * <td>Integer</td>
+ * <td>Port number (default is {@code 22}).</td>
+ * </tr>
+ * <tr>
+ * <td><b>uname</b></td>
+ * <td>String</td>
+ * <td>Username (if not defined, current local username will be used).</td>
+ * </tr>
+ * <tr>
+ * <td><b>passwd</b></td>
+ * <td>String</td>
+ * <td>Password (if not defined, private key file must be defined).</td>
+ * </tr>
+ * <tr>
+ * <td><b>key</b></td>
+ * <td>File</td>
+ * <td>Private key file (if not defined, password must be defined).</td>
+ * </tr>
+ * <tr>
+ * <td><b>nodes</b></td>
+ * <td>Integer</td>
+ * <td>
+ * Expected number of nodes on the host. If some nodes are started
+ * already, then only remaining nodes will be started. If current count of
+ * nodes is equal to this number, and {@code restart} flag is {@code false},
+ * then nothing will happen.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td><b>igniteHome</b></td>
+ * <td>String</td>
+ * <td>
+ * Path to Ignite installation folder. If not defined, IGNITE_HOME
+ * environment variable must be set on remote hosts.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td><b>cfg</b></td>
+ * <td>String</td>
+ * <td>Path to configuration file (relative to {@code igniteHome}).</td>
+ * </tr>
+ * <tr>
+ * <td><b>script</b></td>
+ * <td>String</td>
+ * <td>
+ * Custom startup script file name and path (relative to {@code igniteHome}).
+ * You can also specify a space-separated list of parameters in the same
+ * string (for example: {@code "bin/my-custom-script.sh -v"}).
+ * </td>
+ * </tr>
+ * </table>
+ * <p>
+ * {@code dflts} map defines default values. They are applied to undefined parameters in
+ * {@code hosts} collection.
+ * <p>
+ * Completed future contains collection of tuples. Each tuple corresponds to one node start attempt and
+ * contains hostname, success flag and error message if attempt was not successful. Note that
+ * successful attempt doesn't mean that node was actually started and joined topology. For large
+ * topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual
+ * node logs for details.
+ *
+ * @param hosts Startup parameters.
+ * @param dflts Default values.
+ * @param restart Whether to stop existing nodes. If {@code true}, all existing
+ * nodes on the host will be stopped before starting new ones. If
+ * {@code false}, nodes will be started only if there are less
+ * nodes on the host than expected.
+ * @param timeout Connection timeout in milliseconds.
+ * @param maxConn Number of parallel SSH connections to one host.
+ * @return a Future representing pending completion of the starting nodes.
+ * @throws IgniteException In case of error.
+ */
+ public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(Collection<Map<String, Object>> hosts,
+ @Nullable Map<String, Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException;
+
+ /**
* Stops nodes satisfying optional set of predicates.
* <p>
* <b>NOTE:</b> {@code System.exit(Ignition.KILL_EXIT_CODE)} will be executed on each
@@ -347,5 +472,6 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport {
@Nullable public IgniteFuture<?> clientReconnectFuture();
/** {@inheritDoc} */
+ @Deprecated
@Override public IgniteCluster withAsync();
}
[48/50] [abbrv] ignite git commit: ignite-4003 Async outgoing
connections for communication SPI
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageWriteTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageWriteTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageWriteTimeoutTest.java
index b3b5d1a..3ba319b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageWriteTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageWriteTimeoutTest.java
@@ -50,8 +50,8 @@ public class IgniteCacheMessageWriteTimeoutTest extends GridCommonAbstractTest {
// Try provoke connection close on socket writeTimeout.
commSpi.setSharedMemoryPort(-1);
commSpi.setMessageQueueLimit(10);
- commSpi.setSocketReceiveBuffer(40);
- commSpi.setSocketSendBuffer(40);
+ commSpi.setSocketReceiveBuffer(64);
+ commSpi.setSocketSendBuffer(64);
commSpi.setSocketWriteTimeout(100);
commSpi.setUnacknowledgedMessagesBufferSize(1000);
commSpi.setConnectTimeout(10_000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
index 4dbb7ce..e623467 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
@@ -678,7 +678,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
try {
SocketChannel ch = SocketChannel.open(new InetSocketAddress(U.getLocalHost(), srvr2.port()));
- GridNioFuture<GridNioSession> fut = srvr1.createSession(ch, null);
+ GridNioFuture<GridNioSession> fut = srvr1.createSession(ch, null, false, null);
ses = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/GridTcpSpiForwardingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/GridTcpSpiForwardingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/GridTcpSpiForwardingSelfTest.java
index 1e25003..bee63b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/GridTcpSpiForwardingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/GridTcpSpiForwardingSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.AddressResolver;
import org.apache.ignite.configuration.BasicAddressResolver;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.nio.GridCommunicationClient;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteCallable;
@@ -111,7 +112,7 @@ public class GridTcpSpiForwardingSelfTest extends GridCommonAbstractTest {
cfg.setConnectorConfiguration(null);
TcpCommunicationSpi commSpi = new TcpCommunicationSpi() {
- @Override protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx)
+ @Override protected IgniteInternalFuture<GridCommunicationClient> createTcpClient(ClusterNode node, int connIdx)
throws IgniteCheckedException {
Map<String, Object> attrs = new HashMap<>(node.attributes());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
index 88276c2..07edc86 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.typedef.CO;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -39,6 +40,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
import org.apache.ignite.testframework.GridSpiTestContext;
import org.apache.ignite.testframework.GridTestNode;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.testframework.junits.IgniteMock;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
@@ -70,6 +72,9 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
private static final Object mux = new Object();
/** */
+ private static GridTimeoutProcessor timeoutProcessor;
+
+ /** */
protected boolean useSsl = false;
/**
@@ -289,6 +294,12 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
+ timeoutProcessor = new GridTimeoutProcessor(new GridTestKernalContext(log));
+
+ timeoutProcessor.start();
+
+ timeoutProcessor.onKernalStart();
+
for (int i = 0; i < getSpiCount(); i++) {
CommunicationSpi<Message> spi = getSpi(i);
@@ -298,18 +309,20 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
GridTestNode node = new GridTestNode(rsrcs.getNodeId());
- node.order(i);
-
GridSpiTestContext ctx = initSpiContext();
ctx.setLocalNode(node);
+ ctx.timeoutProcessor(timeoutProcessor);
+
info(">>> Initialized context: nodeId=" + ctx.localNode().id());
spiRsrcs.add(rsrcs);
rsrcs.inject(spi);
+ GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
+
if (useSsl) {
IgniteMock ignite = GridTestUtils.getFieldValue(spi, IgniteSpiAdapter.class, "ignite");
@@ -324,6 +337,8 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
node.setAttributes(spi.getNodeAttributes());
node.setAttribute(ATTR_MACS, F.concat(U.allLocalMACs(), ", "));
+ node.order(i + 1);
+
nodes.add(node);
spi.spiStart(getTestIgniteInstanceName() + (i + 1));
@@ -346,6 +361,14 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
+ if (timeoutProcessor != null) {
+ timeoutProcessor.onKernalStop(true);
+
+ timeoutProcessor.stop(true);
+
+ timeoutProcessor = null;
+ }
+
for (CommunicationSpi<Message> spi : spis.values()) {
spi.onContextDestroyed();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
index 78bf869..39ecd8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
@@ -36,7 +36,9 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.nio.GridCommunicationClient;
import org.apache.ignite.internal.util.nio.GridNioServer;
@@ -51,6 +53,7 @@ import org.apache.ignite.spi.communication.GridTestMessage;
import org.apache.ignite.testframework.GridSpiTestContext;
import org.apache.ignite.testframework.GridTestNode;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.testframework.junits.IgniteMock;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
@@ -79,6 +82,9 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends Communic
protected static final List<ClusterNode> nodes = new ArrayList<>();
/** */
+ private static GridTimeoutProcessor timeoutProcessor;
+
+ /** */
private static int port = 60_000;
/** Use ssl. */
@@ -407,27 +413,37 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends Communic
Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
+ timeoutProcessor = new GridTimeoutProcessor(new GridTestKernalContext(log));
+
+ timeoutProcessor.start();
+
+ timeoutProcessor.onKernalStart();
+
for (int i = 0; i < SPI_CNT; i++) {
CommunicationSpi<Message> spi = createSpi();
- GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
-
IgniteTestResources rsrcs = new IgniteTestResources();
GridTestNode node = new GridTestNode(rsrcs.getNodeId());
+ node.setAttribute(IgniteNodeAttributes.ATTR_CLIENT_MODE, false);
+
node.order(i + 1);
GridSpiTestContext ctx = initSpiContext();
ctx.setLocalNode(node);
+ ctx.timeoutProcessor(timeoutProcessor);
+
info(">>> Initialized context: nodeId=" + ctx.localNode().id());
spiRsrcs.add(rsrcs);
rsrcs.inject(spi);
+ GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
+
if (useSsl) {
IgniteMock ignite = GridTestUtils.getFieldValue(spi, IgniteSpiAdapter.class, "ignite");
@@ -494,6 +510,14 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends Communic
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
+ if (timeoutProcessor != null) {
+ timeoutProcessor.onKernalStop(true);
+
+ timeoutProcessor.stop(true);
+
+ timeoutProcessor = null;
+ }
+
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
index feaae11..f87ff09 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor;
import org.apache.ignite.internal.util.nio.GridNioServer;
@@ -44,6 +45,7 @@ import org.apache.ignite.spi.communication.GridTestMessage;
import org.apache.ignite.testframework.GridSpiTestContext;
import org.apache.ignite.testframework.GridTestNode;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.apache.ignite.testframework.junits.spi.GridSpiTest;
@@ -64,11 +66,11 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
protected static final List<ClusterNode> nodes = new ArrayList<>();
/** */
+ private static GridTimeoutProcessor timeoutProcessor;
+
+ /** */
private static final int SPI_CNT = 2;
- /**
- *
- */
static {
GridIoMessageFactory.registerCustom(GridTestMessage.DIRECT_TYPE, new CO<Message>() {
@Override public Message apply() {
@@ -159,6 +161,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
spi1.sendMessage(node0, new GridTestMessage(node1.id(), ++msgId, 0));
}
+ U.sleep(500);
+
expMsgs += msgPerIter;
final long totAcked0 = totAcked;
@@ -166,9 +170,14 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
for (TcpCommunicationSpi spi : spis) {
GridNioServer srv = U.field(spi, "nioSrvr");
- Collection<? extends GridNioSession> sessions = GridTestUtils.getFieldValue(srv, "sessions");
+ final Collection<? extends GridNioSession> sessions = GridTestUtils.getFieldValue(srv, "sessions");
+
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return !sessions.isEmpty();
+ }
+ }, 5_000);
- assertFalse(sessions.isEmpty());
boolean found = false;
@@ -268,21 +277,21 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
ClusterNode node0 = nodes.get(0);
ClusterNode node1 = nodes.get(1);
- final GridNioServer srv1 = U.field(spi1, "nioSrvr");
-
int msgId = 0;
// Send message to establish connection.
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0));
+ U.sleep(1000);
+
// Prevent node1 from send
- GridTestUtils.setFieldValue(srv1, "skipWrite", true);
+ GridTestUtils.setFieldValue(spi1, "skipAck", true);
final GridNioSession ses0 = communicationSession(spi0);
int sentMsgs = 1;
- for (int i = 0; i < 150; i++) {
+ for (int i = 0; i < 1280; i++) {
try {
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0));
@@ -304,7 +313,7 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
assertTrue("Failed to wait for session close", ses0.closeTime() != 0);
- GridTestUtils.setFieldValue(srv1, "skipWrite", false);
+ GridTestUtils.setFieldValue(spi1, "skipAck", false);
for (int i = 0; i < 100; i++)
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0));
@@ -379,11 +388,15 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
+ timeoutProcessor = new GridTimeoutProcessor(new GridTestKernalContext(log));
+
+ timeoutProcessor.start();
+
+ timeoutProcessor.onKernalStart();
+
for (int i = 0; i < SPI_CNT; i++) {
TcpCommunicationSpi spi = getSpi(ackCnt, idleTimeout, queueLimit);
- GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
-
IgniteTestResources rsrcs = new IgniteTestResources();
GridTestNode node = new GridTestNode(rsrcs.getNodeId());
@@ -392,14 +405,20 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
ctx.setLocalNode(node);
+ ctx.timeoutProcessor(timeoutProcessor);
+
spiRsrcs.add(rsrcs);
rsrcs.inject(spi);
+ GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
+
spi.setListener(new TestListener());
node.setAttributes(spi.getNodeAttributes());
+ node.order(i);
+
nodes.add(node);
spi.spiStart(getTestIgniteInstanceName() + (i + 1));
@@ -455,6 +474,14 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
+ if (timeoutProcessor != null) {
+ timeoutProcessor.onKernalStop(true);
+
+ timeoutProcessor.stop(true);
+
+ timeoutProcessor = null;
+ }
+
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
index 2a043ee..46d2d1d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.nio.GridNioServer;
import org.apache.ignite.internal.util.nio.GridNioSession;
@@ -47,6 +48,7 @@ import org.apache.ignite.spi.communication.GridTestMessage;
import org.apache.ignite.testframework.GridSpiTestContext;
import org.apache.ignite.testframework.GridTestNode;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.testframework.junits.IgniteMock;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
@@ -80,6 +82,9 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
/** Use ssl. */
protected boolean useSsl;
+ /** */
+ private static GridTimeoutProcessor timeoutProcessor;
+
/**
*
*/
@@ -115,7 +120,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
/** {@inheritDoc} */
@Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) {
- // info("Test listener received message: " + msg);
+ //info("Test listener received message: " + msg);
assertTrue("Unexpected message: " + msg, msg instanceof GridTestMessage);
@@ -186,7 +191,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
* @return Timeout.
*/
protected long awaitForSocketWriteTimeout() {
- return 8000;
+ return 20000;
}
/**
@@ -298,6 +303,12 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
// Send message to establish connection.
spi0.sendMessage(node1, new GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return lsnr1.rcvCnt.get() >= 1;
+ }
+ }, 1000);
+
final AtomicInteger sentCnt = new AtomicInteger(1);
int errCnt = 0;
@@ -413,6 +424,12 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
// Send message to establish connection.
spi0.sendMessage(node1, new GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return lsnr1.rcvCnt.get() >= 1;
+ }
+ }, 1000);
+
expCnt1.incrementAndGet();
int errCnt = 0;
@@ -451,7 +468,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
ses1.resumeReads().get();
}
catch (IgniteCheckedException ignore) {
- // Can fail is ses1 was closed.
+ // Can fail if ses1 was closed.
}
// Wait when session is closed, then try to open new connection from node1.
@@ -534,6 +551,12 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
// Send message to establish connection.
spi0.sendMessage(node1, new GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return lsnr1.rcvCnt.get() >= 1;
+ }
+ }, 1000);
+
final AtomicInteger sentCnt = new AtomicInteger(1);
int errCnt = 0;
@@ -686,11 +709,15 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
+ timeoutProcessor = new GridTimeoutProcessor(new GridTestKernalContext(log));
+
+ timeoutProcessor.start();
+
+ timeoutProcessor.onKernalStart();
+
for (int i = 0; i < SPI_CNT; i++) {
TcpCommunicationSpi spi = getSpi(i);
- GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
-
IgniteTestResources rsrcs = new IgniteTestResources();
GridTestNode node = new GridTestNode(rsrcs.getNodeId());
@@ -701,10 +728,14 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
ctx.setLocalNode(node);
+ ctx.timeoutProcessor(timeoutProcessor);
+
spiRsrcs.add(rsrcs);
rsrcs.inject(spi);
+ GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
+
if (useSsl) {
IgniteMock ignite = GridTestUtils.getFieldValue(spi, IgniteSpiAdapter.class, "ignite");
@@ -770,6 +801,14 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
+ if (timeoutProcessor != null) {
+ timeoutProcessor.onKernalStop(true);
+
+ timeoutProcessor.stop(true);
+
+ timeoutProcessor = null;
+ }
+
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
index 3f58055..7b59da3 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor;
import org.apache.ignite.internal.util.nio.GridNioServer;
@@ -47,6 +48,7 @@ import org.apache.ignite.spi.communication.GridTestMessage;
import org.apache.ignite.testframework.GridSpiTestContext;
import org.apache.ignite.testframework.GridTestNode;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
import org.apache.ignite.testframework.junits.spi.GridSpiTest;
@@ -70,6 +72,9 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
/** */
private static final int SPI_CNT = 2;
+ /** */
+ private static GridTimeoutProcessor timeoutProcessor;
+
/**
*
*/
@@ -98,8 +103,6 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
/** {@inheritDoc} */
@Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) {
- info("Test listener received message: " + msg);
-
assertTrue("Unexpected message: " + msg, msg instanceof GridTestMessage);
GridTestMessage msg0 = (GridTestMessage)msg;
@@ -171,6 +174,17 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0), ackC);
spi1.sendMessage(node0, new GridTestMessage(node1.id(), ++msgId, 0), ackC);
+
+ if (j == 0) {
+ final TestListener lsnr0 = (TestListener)spi0.getListener();
+ final TestListener lsnr1 = (TestListener)spi1.getListener();
+
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return lsnr0.rcvCnt.get() >= 1 && lsnr1.rcvCnt.get() >= 1;
+ }
+ }, 1000);
+ }
}
expMsgs += msgPerIter;
@@ -415,6 +429,12 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
+ timeoutProcessor = new GridTimeoutProcessor(new GridTestKernalContext(log));
+
+ timeoutProcessor.start();
+
+ timeoutProcessor.onKernalStart();
+
for (int i = 0; i < SPI_CNT; i++) {
TcpCommunicationSpi spi = getSpi(ackCnt, idleTimeout, queueLimit);
@@ -428,6 +448,8 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
ctx.setLocalNode(node);
+ ctx.timeoutProcessor(timeoutProcessor);
+
spiRsrcs.add(rsrcs);
rsrcs.inject(spi);
@@ -436,6 +458,8 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
node.setAttributes(spi.getNodeAttributes());
+ node.order(i);
+
nodes.add(node);
spi.spiStart(getTestIgniteInstanceName() + (i + 1));
@@ -491,6 +515,14 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
+ if (timeoutProcessor != null) {
+ timeoutProcessor.onKernalStop(true);
+
+ timeoutProcessor.stop(true);
+
+ timeoutProcessor = null;
+ }
+
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
index 2b49d53..9c59cb2 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
@@ -188,8 +188,7 @@ public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
final CountDownLatch latch = new CountDownLatch(1);
grid(0).events().localListen(new IgnitePredicate<Event>() {
- @Override
- public boolean apply(Event event) {
+ @Override public boolean apply(Event evt) {
latch.countDown();
return true;
@@ -239,14 +238,14 @@ public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
}, 5000);
try {
- fut1.get();
+ fut1.get(1000);
}
catch (IgniteCheckedException e) {
// No-op.
}
try {
- fut2.get();
+ fut2.get(1000);
}
catch (IgniteCheckedException e) {
// No-op.
@@ -297,8 +296,9 @@ public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
*/
private static class TestCommunicationSpi extends TcpCommunicationSpi {
/** {@inheritDoc} */
- @Override protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx)
- throws IgniteCheckedException {
+ @Override protected IgniteInternalFuture<GridCommunicationClient> createTcpClient(ClusterNode node, int connIdx)
+ throws IgniteCheckedException
+ {
if (pred.apply(getLocalNode(), node)) {
Map<String, Object> attrs = new HashMap<>(node.attributes());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
index 4fe67c1..baa1270 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
@@ -240,8 +240,9 @@ public class TcpCommunicationSpiFaultyClientTest extends GridCommonAbstractTest
*/
private static class TestCommunicationSpi extends TcpCommunicationSpi {
/** {@inheritDoc} */
- @Override protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx)
- throws IgniteCheckedException {
+ @Override protected IgniteInternalFuture<GridCommunicationClient> createTcpClient(ClusterNode node, int connIdx)
+ throws IgniteCheckedException
+ {
if (PRED.apply(node)) {
Map<String, Object> attrs = new HashMap<>(node.attributes());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
index 8a20eec..a241a04 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
@@ -1004,7 +1004,10 @@ public class HadoopExternalCommunication {
HandshakeFinish fin = new HandshakeFinish();
- GridNioSession ses = nioSrvr.createSession(ch, F.asMap(HANDSHAKE_FINISH_META, fin)).get();
+ GridNioFuture<GridNioSession> sesFut =
+ nioSrvr.createSession(ch, F.<Integer, Object>asMap(HANDSHAKE_FINISH_META, fin), false, null);
+
+ GridNioSession ses = sesFut.get();
client = new HadoopTcpNioCommunicationClient(ses);
[02/50] [abbrv] ignite git commit: IGNITE-4830 Fixed error ui.
Posted by ag...@apache.org.
IGNITE-4830 Fixed error ui.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/48e78a99
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/48e78a99
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/48e78a99
Branch: refs/heads/ignite-4003
Commit: 48e78a99b9f7daad079fc8663acb31a5d6610012
Parents: 6a148e2
Author: Andrey Novikov <an...@gridgain.com>
Authored: Thu Mar 23 10:57:03 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Mar 23 10:57:03 2017 +0700
----------------------------------------------------------------------
.../frontend/public/stylesheets/style.scss | 3 +--
modules/web-console/frontend/views/sql/sql.tpl.pug | 17 +++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/48e78a99/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 2f4966f..8dbf123 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -752,8 +752,7 @@ button.form-control {
.error {
padding: 10px 10px;
- text-align: center;
- color: $brand-primary;
+ text-align: left;
}
.empty {
http://git-wip-us.apache.org/repos/asf/ignite/blob/48e78a99/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index 701ee14..dcfc531 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -110,10 +110,9 @@ mixin query-settings
span Allow non-collocated joins
.row(ng-if='enforceJoinOrderAvailable(paragraph)')
label.tipLabel(bs-tooltip data-placement='bottom' data-title='Enforce join order of tables in the query.<br/>\
- If <b>set</b> then query optimizer will not reorder tables in join.<br/>\
- <b>NOTE:</b> It is not recommended to enable this property until you are sure that\
- your indexes and the query itself are correct and tuned as much as possible but\
- query optimizer still produces wrong join order.' data-trigger='hover')
+ If <b>set</b>, then query optimizer will not reorder tables within join.<br/>\
+ <b>NOTE:</b> It is not recommended to enable this property unless you have verified that\
+ indexes are not selected in optimal order.' data-trigger='hover')
input(type='checkbox' ng-model='paragraph.enforceJoinOrder')
span Enforce join order
@@ -247,16 +246,18 @@ mixin paragraph-query
.pull-right
+query-settings
.col-sm-12.sql-result(ng-if='paragraph.queryExecuted()' ng-switch='paragraph.resultType()')
- .error(ng-switch-when='error') Error: {{paragraph.error.message}}
+ .error(ng-switch-when='error')
+ label Error: {{paragraph.error.message}}
+ br
+ a(ng-show='paragraph.resultType() === "error"' ng-click='showStackTrace(paragraph)') Show more
.empty(ng-switch-when='empty') Result set is empty
.table(ng-switch-when='table')
+table-result-heading-query
+table-result-body
.chart(ng-switch-when='chart')
+chart-result
- .footer.clearfix
- a.pull-left(ng-show='paragraph.resultType() === "error"' ng-click='showStackTrace(paragraph)') Show error details
- a.pull-left(ng-show='paragraph.resultType() !== "error"' ng-click='showResultQuery(paragraph)') Show query
+ .footer.clearfix(ng-show='paragraph.resultType() !== "error"')
+ a.pull-left(ng-click='showResultQuery(paragraph)') Show query
-var nextVisibleCondition = 'paragraph.resultType() !== "error" && paragraph.queryId && paragraph.nonRefresh() && (paragraph.table() || paragraph.chart() && !paragraph.scanExplain())'
[27/50] [abbrv] ignite git commit: Minor compilation fixes in
IgniteCacheProxy for Java 8.
Posted by ag...@apache.org.
Minor compilation fixes in IgniteCacheProxy for Java 8.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cb5e9ebc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cb5e9ebc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cb5e9ebc
Branch: refs/heads/ignite-4003
Commit: cb5e9ebc004102792dbeba9ddb43713ecf4074e2
Parents: 488b25e
Author: devozerov <vo...@gridgain.com>
Authored: Mon Mar 27 15:33:53 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 15:33:53 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheProxy.java | 23 +++++++-------------
1 file changed, 8 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cb5e9ebc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 28cf0db..d36b58c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -99,16 +99,6 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** */
- private static final IgniteBiPredicate ACCEPT_ALL = new IgniteBiPredicate() {
- /** */
- private static final long serialVersionUID = -1640538788290240617L;
-
- @Override public boolean apply(Object k, Object v) {
- return true;
- }
- };
-
/** Context. */
private GridCacheContext<K, V> ctx;
@@ -379,9 +369,10 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
try {
if (isAsync()) {
- setFuture(ctx.cache().isLocal() ?
- ctx.cache().localLoadCacheAsync(p, args)
- : ctx.cache().globalLoadCacheAsync(p, args));
+ if (ctx.cache().isLocal())
+ setFuture(ctx.cache().localLoadCacheAsync(p, args));
+ else
+ setFuture(ctx.cache().globalLoadCacheAsync(p, args));
}
else {
if (ctx.cache().isLocal())
@@ -408,8 +399,10 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
CacheOperationContext prev = onEnter(gate, opCtx);
try {
- return (IgniteFuture<Void>)createFuture(ctx.cache().isLocal() ?
- ctx.cache().localLoadCacheAsync(p, args) : ctx.cache().globalLoadCacheAsync(p, args));
+ if (ctx.cache().isLocal())
+ return (IgniteFuture<Void>)createFuture(ctx.cache().localLoadCacheAsync(p, args));
+ else
+ return (IgniteFuture<Void>)createFuture(ctx.cache().globalLoadCacheAsync(p, args));
}
finally {
onLeave(gate, prev);
[05/50] [abbrv] ignite git commit: IGNITE-4858:
TcpDiscoveryS3IpFinder.setAwsCredentials should not be be overloaded
Posted by ag...@apache.org.
IGNITE-4858: TcpDiscoveryS3IpFinder.setAwsCredentials should not be be overloaded
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/746ed2b0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/746ed2b0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/746ed2b0
Branch: refs/heads/ignite-4003
Commit: 746ed2b07552fbac7d0e849eefff4073764e8044
Parents: 927ead1
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Mar 23 10:12:54 2017 -0700
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Mar 23 10:12:54 2017 -0700
----------------------------------------------------------------------
.../spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java | 6 +++---
.../TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/746ed2b0/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
index 53d6532..d9f50c2 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
@@ -53,7 +53,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
* <h2 class="header">Mandatory</h2>
* <ul>
* <li>AWS credentials (see {@link #setAwsCredentials(AWSCredentials)} and
- * {@link #setAwsCredentials(AWSCredentialsProvider)})</li>
+ * {@link #setAwsCredentialsProvider(AWSCredentialsProvider)}</li>
* <li>Bucket name (see {@link #setBucketName(String)})</li>
* </ul>
* <h2 class="header">Optional</h2>
@@ -327,7 +327,7 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
}
/**
- * Sets AWS credentials. Either use {@link #setAwsCredentials(AWSCredentialsProvider)} or this one.
+ * Sets AWS credentials. Either use {@link #setAwsCredentialsProvider(AWSCredentialsProvider)} or this one.
* <p>
* For details refer to Amazon S3 API reference.
*
@@ -346,7 +346,7 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
* @param credProvider AWS credentials provider.
*/
@IgniteSpiConfiguration(optional = false)
- public void setAwsCredentials(AWSCredentialsProvider credProvider) {
+ public void setAwsCredentialsProvider(AWSCredentialsProvider credProvider) {
this.credProvider = credProvider;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/746ed2b0/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
index 6952b54..ea316c4 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
@@ -36,7 +36,7 @@ public class TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest extends TcpDis
/** {@inheritDoc} */
@Override protected void setAwsCredentials(TcpDiscoveryS3IpFinder finder) {
- finder.setAwsCredentials(new AWSStaticCredentialsProvider(
+ finder.setAwsCredentialsProvider(new AWSStaticCredentialsProvider(
new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey())));
}
[38/50] [abbrv] ignite git commit: IGNITE-4475: Fixed JavaDoc. This
closes #1684.
Posted by ag...@apache.org.
IGNITE-4475: Fixed JavaDoc. This closes #1684.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/831b272c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/831b272c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/831b272c
Branch: refs/heads/ignite-4003
Commit: 831b272c73c0a34cf23124bffcb43a78f32edfe9
Parents: ab516da
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Mar 28 15:46:28 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 28 15:46:28 2017 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/IgniteCache.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/831b272c/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 33e0e8c..f6801b9 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -1219,10 +1219,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments);
/**
- * Asynchronously invokes an {@link EntryProcessor} against the {@link Entry} specified by
- * the provided key. If an {@link Entry} does not exist for the specified key,
+ * Asynchronously invokes an {@link EntryProcessor} against the {@link javax.cache.Cache.Entry} specified by
+ * the provided key. If an {@link javax.cache.Cache.Entry} does not exist for the specified key,
* an attempt is made to load it (if a loader is configured) or a surrogate
- * {@link Entry}, consisting of the key with a null value is used instead.
+ * {@link javax.cache.Cache.Entry}, consisting of the key with a null value is used instead.
*
* @param key The key to the entry.
* @param entryProcessor The {@link EntryProcessor} to invoke.
@@ -1308,11 +1308,11 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
EntryProcessor<K, V, T> entryProcessor, Object... args);
/**
- * Asynchronously invokes an {@link EntryProcessor} against the set of {@link Entry}s
+ * Asynchronously invokes an {@link EntryProcessor} against the set of {@link javax.cache.Cache.Entry}s
* specified by the set of keys.
* <p>
- * If an {@link Entry} does not exist for the specified key, an attempt is made
- * to load it (if a loader is configured) or a surrogate {@link Entry},
+ * If an {@link javax.cache.Cache.Entry} does not exist for the specified key, an attempt is made
+ * to load it (if a loader is configured) or a surrogate {@link javax.cache.Cache.Entry},
* consisting of the key and a value of null is provided.
* <p>
* The order that the entries for the keys are processed is undefined.
[10/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java b/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
index 75e7d22..03e7210 100644
--- a/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
@@ -83,7 +83,7 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
Assert.assertEquals(Thread.currentThread(), thread);
Assert.assertEquals(msgStr, msg);
}
- });
+ }, false);
}
/**
@@ -94,12 +94,12 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
public void testSendAsyncMode() throws Exception {
Ignite ignite1 = startGrid(1);
- send(ignite1.message().withAsync(), msgStr, new IgniteBiInClosure<String, Thread> () {
+ send(ignite1.message(), msgStr, new IgniteBiInClosure<String, Thread> () {
@Override public void apply(String msg, Thread thread) {
Assert.assertTrue(!Thread.currentThread().equals(thread));
Assert.assertEquals(msgStr, msg);
}
- });
+ }, true);
}
/**
@@ -116,7 +116,7 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
Assert.assertEquals(Thread.currentThread(), thread);
Assert.assertEquals(msgStr, msg);
}
- });
+ }, false);
}
/**
@@ -128,12 +128,12 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
Ignite ignite1 = startGrid(1);
Ignite ignite2 = startGrid(2);
- sendWith2Nodes(ignite2, ignite1.message().withAsync(), msgStr, new IgniteBiInClosure<String, Thread> () {
+ sendWith2Nodes(ignite2, ignite1.message(), msgStr, new IgniteBiInClosure<String, Thread> () {
@Override public void apply(String msg, Thread thread) {
Assert.assertTrue(!Thread.currentThread().equals(thread));
Assert.assertEquals(msgStr, msg);
}
- });
+ }, true);
}
/**
@@ -155,24 +155,6 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
}
/**
- * Checks that sendOrdered work in thread pool, 1 node in topology.
- *
- * @throws Exception If failed.
- */
- public void testSendOrderedAsyncMode() throws Exception {
- Ignite ignite1 = startGrid(1);
-
- final List<String> msgs = orderedMessages();
-
- sendOrdered(ignite1.message().withAsync(), msgs, new IgniteBiInClosure< List<String>, List<Thread>> () {
- @Override public void apply(List<String> received, List<Thread> threads) {
- assertFalse(threads.contains(Thread.currentThread()));
- assertTrue(msgs.equals(received));
- }
- });
- }
-
- /**
* Checks that sendOrdered work in thread pool, 2 nodes in topology.
*
* @throws Exception If failed.
@@ -192,25 +174,6 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
}
/**
- * Checks that sendOrdered work in thread pool, 2 nodes in topology.
- *
- * @throws Exception If failed.
- */
- public void testSendOrderedAsyncMode2Node() throws Exception {
- Ignite ignite1 = startGrid(1);
- Ignite ignite2 = startGrid(2);
-
- final List<String> msgs = orderedMessages();
-
- sendOrderedWith2Node(ignite2, ignite1.message().withAsync(), msgs, new IgniteBiInClosure<List<String>, List<Thread>>() {
- @Override public void apply(List<String> received, List<Thread> threads) {
- assertFalse(threads.contains(Thread.currentThread()));
- assertTrue(msgs.equals(received));
- }
- });
- }
-
- /**
* @throws Exception If failed.
*/
public void testSendOrderedDefaultModeMultiThreads() throws Exception {
@@ -222,15 +185,6 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
/**
* @throws Exception If failed.
*/
- public void testSendOrderedAsyncModeMultiThreads() throws Exception {
- Ignite ignite = startGrid(1);
-
- sendOrderedMultiThreads(ignite.message().withAsync());
- }
-
- /**
- * @throws Exception If failed.
- */
public void testSendOrderedDefaultModeMultiThreadsWith2Node() throws Exception {
Ignite ignite1 = startGrid(1);
Ignite ignite2 = startGrid(2);
@@ -239,16 +193,6 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
}
/**
- * @throws Exception If failed.
- */
- public void testSendOrderedAsyncModeMultiThreadsWith2Node() throws Exception {
- Ignite ignite1 = startGrid(1);
- Ignite ignite2 = startGrid(2);
-
- sendOrderedMultiThreadsWith2Node(ignite2, ignite1.message().withAsync());
- }
-
- /**
* @param ignite2 Second node.
* @param ignMsg IgniteMessage.
* @throws Exception If failed.
@@ -380,13 +324,15 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
* @param igniteMsg Ignite message.
* @param msgStr Message string.
* @param cls Callback for compare result.
+ * @param async Use sendAsync flag.
* @throws Exception If failed.
*/
private void sendWith2Nodes(
final Ignite ignite2,
final IgniteMessaging igniteMsg,
final String msgStr,
- final IgniteBiInClosure<String, Thread> cls
+ final IgniteBiInClosure<String, Thread> cls,
+ final boolean async
) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
@@ -400,7 +346,7 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
}
});
- send(igniteMsg, msgStr, cls);
+ send(igniteMsg, msgStr, cls, async);
latch.await();
}
@@ -409,12 +355,14 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
* @param igniteMsg Ignite messaging.
* @param msgStr Message string.
* @param cls Callback for compare result.
+ * @param async Use sendAsync flag.
* @throws Exception If failed.
*/
private void send(
final IgniteMessaging igniteMsg,
final String msgStr,
- final IgniteBiInClosure<String, Thread> cls
+ final IgniteBiInClosure<String, Thread> cls,
+ final boolean async
) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
@@ -433,7 +381,10 @@ public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest impleme
}
});
- igniteMsg.send(TOPIC, msgStr);
+ if (async)
+ igniteMsg.withAsync().send(TOPIC, msgStr);
+ else
+ igniteMsg.send(TOPIC, msgStr);
latch.await();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/session/GridSessionFutureWaitJobAttributeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionFutureWaitJobAttributeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionFutureWaitJobAttributeSelfTest.java
index 36c3027..bc601db 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionFutureWaitJobAttributeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionFutureWaitJobAttributeSelfTest.java
@@ -25,7 +25,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
@@ -122,11 +121,7 @@ public class GridSessionFutureWaitJobAttributeSelfTest extends GridCommonAbstrac
private void checkTask(int num) throws InterruptedException {
Ignite ignite = G.ignite(getTestIgniteInstanceName());
- IgniteCompute comp = ignite.compute().withAsync();
-
- comp.execute(GridTaskSessionTestTask.class.getName(), num);
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite.compute().executeAsync(GridTaskSessionTestTask.class.getName(), num);
assert fut != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeOrderSelfTest.java
index 7711733..0c28e7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeOrderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeOrderSelfTest.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
@@ -63,12 +62,9 @@ public class GridSessionSetJobAttributeOrderSelfTest extends GridCommonAbstractT
ignite1.compute().localDeployTask(SessionTestTask.class, SessionTestTask.class.getClassLoader());
- IgniteCompute comp = ignite1.compute().withAsync();
-
for (int i = 0; i < TESTS_COUNT; i++) {
- comp.withTimeout(100000).execute(SessionTestTask.class.getName(), ignite2.cluster().localNode().id());
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite1.compute().withTimeout(100000).executeAsync(
+ SessionTestTask.class.getName(), ignite2.cluster().localNode().id());
fut.getTaskSession().setAttribute(TEST_ATTR_KEY, SETS_ATTR_COUNT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeWaitListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeWaitListenerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeWaitListenerSelfTest.java
index 6cf642b..5c7e6ec 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeWaitListenerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetJobAttributeWaitListenerSelfTest.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
@@ -92,11 +91,7 @@ public class GridSessionSetJobAttributeWaitListenerSelfTest extends GridCommonAb
for (int i = 0; i < 5; i++) {
refreshInitialData();
- IgniteCompute comp = ignite.compute().withAsync();
-
- comp.execute(GridTaskSessionTestTask.class.getName(), null);
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite.compute().executeAsync(GridTaskSessionTestTask.class.getName(), null);
assert fut != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetTaskAttributeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetTaskAttributeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetTaskAttributeSelfTest.java
index 4092e74..ec8d5a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetTaskAttributeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionSetTaskAttributeSelfTest.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
@@ -107,11 +106,7 @@ public class GridSessionSetTaskAttributeSelfTest extends GridCommonAbstractTest
private void checkTask(int num) {
Ignite ignite = G.ignite(getTestIgniteInstanceName());
- IgniteCompute comp = ignite.compute().withAsync();
-
- comp.execute(GridTaskSessionTestTask.class.getName(), num);
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite.compute().executeAsync(GridTaskSessionTestTask.class.getName(), num);
Object res = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/session/GridSessionTaskWaitJobAttributeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionTaskWaitJobAttributeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionTaskWaitJobAttributeSelfTest.java
index 41f6457..7150a27 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionTaskWaitJobAttributeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionTaskWaitJobAttributeSelfTest.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJob;
@@ -107,11 +106,7 @@ public class GridSessionTaskWaitJobAttributeSelfTest extends GridCommonAbstractT
private void checkTask(int num) {
Ignite ignite = G.ignite(getTestIgniteInstanceName());
- IgniteCompute comp = ignite.compute().withAsync();
-
- comp.execute(GridTaskSessionTestTask.class.getName(), num);
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite.compute().executeAsync(GridTaskSessionTestTask.class.getName(), num);
Object res = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/session/GridSessionWaitAttributeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionWaitAttributeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionWaitAttributeSelfTest.java
index f3f39ef..06f47b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionWaitAttributeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionWaitAttributeSelfTest.java
@@ -24,8 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJobAdapter;
@@ -215,11 +213,7 @@ public class GridSessionWaitAttributeSelfTest extends GridCommonAbstractTest {
ignite1.compute().localDeployTask(TestSessionTask.class, TestSessionTask.class.getClassLoader());
- IgniteCompute comp = ignite1.compute().withAsync();
-
- comp.execute(TestSessionTask.class.getName(), type);
-
- ComputeTaskFuture<?> fut = comp.future();
+ ComputeTaskFuture<?> fut = ignite1.compute().executeAsync(TestSessionTask.class.getName(), type);
fut.getTaskSession().mapFuture().get();
@@ -254,7 +248,6 @@ public class GridSessionWaitAttributeSelfTest extends GridCommonAbstractTest {
* @param ses Session.
* @param prefix Prefix.
* @param type Type.
- * @throws IgniteCheckedException If failed.
*/
private static void checkSessionAttributes(ComputeTaskSession ses, String prefix, WaitAttributeType type) {
assert ses != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
index bb2e046..8aba684 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
@@ -28,6 +28,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingQueue;
import javax.cache.Cache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter;
@@ -547,6 +548,11 @@ public abstract class GridAbstractCacheStoreSelfTest<T extends CacheStore<Object
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> commitAsync() throws IgniteException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public void close() {
// No-op.
}
@@ -570,5 +576,10 @@ public abstract class GridAbstractCacheStoreSelfTest<T extends CacheStore<Object
@Override public void rollback() {
// No-op.
}
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> rollbackAsync() throws IgniteException {
+ return null;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 7b41b6c..ec31e59 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -929,11 +929,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
*/
protected <R> ComputeTaskFuture<R> executeAsync(IgniteCompute comp, ComputeTask task, @Nullable Object arg)
throws IgniteCheckedException {
- comp = comp.withAsync();
-
- assertNull(comp.execute(task, arg));
-
- ComputeTaskFuture<R> fut = comp.future();
+ ComputeTaskFuture<R> fut = comp.executeAsync(task, arg);
assertNotNull(fut);
@@ -949,11 +945,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
*/
protected <R> ComputeTaskFuture<R> executeAsync(IgniteCompute comp, String taskName, @Nullable Object arg)
throws IgniteCheckedException {
- comp = comp.withAsync();
-
- assertNull(comp.execute(taskName, arg));
-
- ComputeTaskFuture<R> fut = comp.future();
+ ComputeTaskFuture<R> fut = comp.executeAsync(taskName, arg);
assertNotNull(fut);
@@ -970,11 +962,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
@SuppressWarnings("unchecked")
protected <R> ComputeTaskFuture<R> executeAsync(IgniteCompute comp, Class taskCls, @Nullable Object arg)
throws IgniteCheckedException {
- comp = comp.withAsync();
-
- assertNull(comp.execute(taskCls, arg));
-
- ComputeTaskFuture<R> fut = comp.future();
+ ComputeTaskFuture<R> fut = comp.executeAsync(taskCls, arg);
assertNotNull(fut);
@@ -990,13 +978,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
*/
protected <T extends Event> IgniteFuture<T> waitForLocalEvent(IgniteEvents evts,
@Nullable IgnitePredicate<T> filter, @Nullable int... types) throws IgniteCheckedException {
- evts = evts.withAsync();
-
- assertTrue(evts.isAsync());
-
- assertNull(evts.waitForLocal(filter, types));
-
- IgniteFuture<T> fut = evts.future();
+ IgniteFuture<T> fut = evts.waitForLocalAsync(filter, types);
assertNotNull(fut);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index 46053b3..01207b6 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -143,17 +143,34 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> loadCacheAsync(@Nullable IgniteBiPredicate<K, V> p,
+ @Nullable Object... args) throws CacheException {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
@Override public void localLoadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args)
throws CacheException {
compute.call(new LocalLoadCacheTask<>(cacheName, isAsync, p, args));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> localLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p,
+ @Nullable Object... args) throws CacheException {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndPutIfAbsent(K key, V val) throws CacheException {
return compute.call(new GetAndPutIfAbsentTask<>(cacheName, isAsync, key, val));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws CacheException {
+ return compute.callAsync(new GetAndPutIfAbsentTask<>(cacheName, isAsync, key, val));
+ }
+
+ /** {@inheritDoc} */
@Override public Lock lock(K key) {
throw new UnsupportedOperationException("Method should be supported.");
}
@@ -224,15 +241,28 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Integer> sizeAsync(CachePeekMode... peekModes) throws CacheException {
+ return compute.callAsync(new SizeTask(cacheName, isAsync, peekModes, false));
+ }
+
+ /** {@inheritDoc} */
@Override public long sizeLong(CachePeekMode... peekModes) throws CacheException {
return compute.call(new SizeLongTask(cacheName, isAsync, peekModes, false));
}
+ @Override public IgniteFuture<Long> sizeLongAsync(CachePeekMode... peekModes) throws CacheException {
+ return compute.callAsync(new SizeLongTask(cacheName, isAsync, peekModes, false));
+ }
+
/** {@inheritDoc} */
@Override public long sizeLong(int partition, CachePeekMode... peekModes) throws CacheException {
return compute.call(new PartitionSizeLongTask(cacheName, isAsync, peekModes, partition, false));
}
+ @Override public IgniteFuture<Long> sizeLongAsync(int partition, CachePeekMode... peekModes) throws CacheException {
+ return compute.callAsync(new PartitionSizeLongTask(cacheName, isAsync, peekModes, partition, false));
+ }
+
/** {@inheritDoc} */
@Override public int localSize(CachePeekMode... peekModes) {
return compute.call(new SizeTask(cacheName, isAsync, peekModes, true));
@@ -257,36 +287,72 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
+ Map<? extends K, ? extends EntryProcessor<K, V, T>> map, Object... args) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
@Override public V get(K key) {
return compute.call(new GetTask<K, V>(cacheName, isAsync, key));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAsync(K key) {
+ return compute.callAsync(new GetTask<K, V>(cacheName, isAsync, key));
+ }
+
+ /** {@inheritDoc} */
@Override public CacheEntry<K, V> getEntry(K key) {
return compute.call(new GetEntryTask<K, V>(cacheName, isAsync, key));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<CacheEntry<K, V>> getEntryAsync(K key) {
+ return compute.callAsync(new GetEntryTask<K, V>(cacheName, isAsync, key));
+ }
+
+ /** {@inheritDoc} */
@Override public Map<K, V> getAll(Set<? extends K> keys) {
return compute.call(new GetAllTask<K, V>(cacheName, isAsync, keys));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Map<K, V>> getAllAsync(Set<? extends K> keys) {
+ return compute.callAsync(new GetAllTask<K, V>(cacheName, isAsync, keys));
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<CacheEntry<K, V>> getEntries(Set<? extends K> keys) {
return compute.call(new GetEntriesTask<K, V>(cacheName, isAsync, keys));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<CacheEntry<K, V>>> getEntriesAsync(Set<? extends K> keys) {
+ return compute.callAsync(new GetEntriesTask<K, V>(cacheName, isAsync, keys));
+ }
+
+ /** {@inheritDoc} */
@Override public Map<K, V> getAllOutTx(Set<? extends K> keys) {
return compute.call(new GetAllOutTxTask<K, V>(cacheName, isAsync, keys));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Map<K, V>> getAllOutTxAsync(Set<? extends K> keys) {
+ return compute.callAsync(new GetAllOutTxTask<K, V>(cacheName, isAsync, keys));
+ }
+
+ /** {@inheritDoc} */
@Override public boolean containsKey(K key) {
return compute.call(new ContainsKeyTask<>(cacheName, isAsync, key));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> containsKeyAsync(K key) {
+ return compute.callAsync(new ContainsKeyTask<>(cacheName, isAsync, key));
+ }
+
+ /** {@inheritDoc} */
@Override public void loadAll(Set<? extends K> keys, boolean replaceExistVals, CompletionListener completionLsnr) {
throw new UnsupportedOperationException("Oparetion can't be supported automatically.");
}
@@ -297,81 +363,161 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys) {
+ return compute.callAsync(new ContainsKeysTask<>(cacheName, isAsync, keys));
+ }
+
+ /** {@inheritDoc} */
@Override public void put(K key, V val) {
compute.call(new PutTask<>(cacheName, isAsync, expiryPlc, key, val));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> putAsync(K key, V val) {
+ return compute.callAsync(new PutTask<>(cacheName, isAsync, expiryPlc, key, val));
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndPut(K key, V val) {
return compute.call(new GetAndPutTask<>(cacheName, isAsync, key, val));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndPutAsync(K key, V val) {
+ return compute.callAsync(new GetAndPutTask<>(cacheName, isAsync, key, val));
+ }
+
+ /** {@inheritDoc} */
@Override public void putAll(Map<? extends K, ? extends V> map) {
compute.call(new PutAllTask<>(cacheName, isAsync, map));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> putAllAsync(Map<? extends K, ? extends V> map) {
+ return compute.callAsync(new PutAllTask<>(cacheName, isAsync, map));
+ }
+
+ /** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) {
return compute.call(new PutIfAbsentTask<>(cacheName, isAsync, key, val));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> putIfAbsentAsync(K key, V val) {
+ return compute.callAsync(new PutIfAbsentTask<>(cacheName, isAsync, key, val));
+ }
+
+ /** {@inheritDoc} */
@Override public boolean remove(K key) {
return compute.call(new RemoveTask<>(cacheName, isAsync, key));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> removeAsync(K key) {
+ return compute.callAsync(new RemoveTask<>(cacheName, isAsync, key));
+ }
+
+ /** {@inheritDoc} */
@Override public boolean remove(K key, V oldVal) {
return compute.call(new RemoveIfExistsTask<>(cacheName, isAsync, key, oldVal));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> removeAsync(K key, V oldVal) {
+ return compute.callAsync(new RemoveIfExistsTask<>(cacheName, isAsync, key, oldVal));
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndRemove(K key) {
return compute.call(new GetAndRemoveTask<K, V>(cacheName, isAsync, key));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndRemoveAsync(K key) {
+ return compute.callAsync(new GetAndRemoveTask<K, V>(cacheName, isAsync, key));
+ }
+
+ /** {@inheritDoc} */
@Override public boolean replace(K key, V oldVal, V newVal) {
return compute.call(new ReplaceIfExistsTask<>(cacheName, isAsync, key, oldVal, newVal));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
+ return compute.callAsync(new ReplaceIfExistsTask<>(cacheName, isAsync, key, oldVal, newVal));
+ }
+
+ /** {@inheritDoc} */
@Override public boolean replace(K key, V val) {
return compute.call(new ReplaceTask<>(cacheName, isAsync, key, val));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> replaceAsync(K key, V val) {
+ return compute.callAsync(new ReplaceTask<>(cacheName, isAsync, key, val));
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndReplace(K key, V val) {
return compute.call(new GetAndReplaceTask<>(cacheName, isAsync, key, val));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndReplaceAsync(K key, V val) {
+ return compute.callAsync(new GetAndReplaceTask<>(cacheName, isAsync, key, val));
+ }
+
+ /** {@inheritDoc} */
@Override public void removeAll(Set<? extends K> keys) {
compute.call(new RemoveAllKeysTask<>(cacheName, isAsync, keys));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> removeAllAsync(Set<? extends K> keys) {
+ return compute.callAsync(new RemoveAllKeysTask<>(cacheName, isAsync, keys));
+ }
+
+ /** {@inheritDoc} */
@Override public void removeAll() {
compute.call(new RemoveAllTask<K, V>(cacheName, isAsync));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> removeAllAsync() {
+ return compute.callAsync(new RemoveAllTask<K, V>(cacheName, isAsync));
+ }
+
+ /** {@inheritDoc} */
@Override public void clear() {
compute.call(new ClearTask(cacheName, isAsync));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> clearAsync() {
+ return compute.callAsync(new ClearTask(cacheName, isAsync));
+ }
+
+ /** {@inheritDoc} */
@Override public void clear(K key) {
compute.call(new ClearKeyTask<>(cacheName, isAsync, false, key));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> clearAsync(K key) {
+ return compute.callAsync(new ClearKeyTask<>(cacheName, isAsync, false, key));
+ }
+
+ /** {@inheritDoc} */
@Override public void clearAll(Set<? extends K> keys) {
compute.call(new ClearAllKeys<>(cacheName, isAsync, false, keys));
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> clearAllAsync(Set<? extends K> keys) {
+ return compute.callAsync(new ClearAllKeys<>(cacheName, isAsync, false, keys));
+ }
+
+ /** {@inheritDoc} */
@Override public void localClear(K key) {
compute.call(new ClearKeyTask<>(cacheName, isAsync, true, key));
}
@@ -387,11 +533,23 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<T> invokeAsync(
+ K key, EntryProcessor<K, V, T> processor, Object... args) {
+ return compute.callAsync(new InvokeTask<>(cacheName, isAsync, key, processor, args));
+ }
+
+ /** {@inheritDoc} */
@Override public <T> T invoke(K key, CacheEntryProcessor<K, V, T> processor, Object... args) {
return compute.call(new InvokeTask<>(cacheName, isAsync, key, processor, args));
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K, V, T> processor,
+ Object... args) {
+ return compute.callAsync(new InvokeTask<>(cacheName, isAsync, key, processor, args));
+ }
+
+ /** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(
Set<? extends K> keys,
EntryProcessor<K, V, T> processor,
@@ -401,6 +559,12 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
+ EntryProcessor<K, V, T> processor, Object... args) {
+ return compute.callAsync(new InvokeAllTask<>(cacheName, isAsync, keys, processor, args));
+ }
+
+ /** {@inheritDoc} */
@Override public String getName() {
return compute.call(new GetNameTask(cacheName, isAsync));
}
@@ -462,6 +626,12 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
+ CacheEntryProcessor<K, V, T> entryProcessor, Object... args) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
@Override public IgniteFuture<?> rebalance() {
throw new UnsupportedOperationException("Method should be supported.");
}
@@ -1335,6 +1505,7 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
/**
* @param cacheName Cache name.
* @param async Async.
+ * @param loc Local flag.
* @param key Key.
*/
public ClearKeyTask(String cacheName, boolean async, boolean loc, K key) {
@@ -1367,6 +1538,7 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
/**
* @param cacheName Cache name.
* @param async Async.
+ * @param loc Local flag.
* @param keys Keys.
*/
public ClearAllKeys(String cacheName, boolean async, boolean loc, Set<? extends K> keys) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
index 76a88d9..a0d10c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
@@ -121,12 +121,25 @@ public class IgniteClusterProcessProxy implements IgniteClusterEx {
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file, boolean restart,
+ int timeout, int maxConn) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<ClusterStartNodeResult> startNodes(Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException {
throw new UnsupportedOperationException("Operation is not supported yet.");
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(
+ Collection<Map<String, Object>> hosts, @Nullable Map<String, Object> dflts,
+ boolean restart, int timeout, int maxConn) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public void stopNodes() throws IgniteException {
throw new UnsupportedOperationException("Operation is not supported yet.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
index d5af81e..a925300 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
@@ -59,12 +59,25 @@ public class IgniteEventsProcessProxy implements IgniteEvents {
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<List<T>> remoteQueryAsync(IgnitePredicate<T> p, long timeout,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> UUID remoteListen(@Nullable IgniteBiPredicate<UUID, T> locLsnr,
@Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types) throws IgniteException {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<UUID> remoteListenAsync(
+ @Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> UUID remoteListen(int bufSize, long interval, boolean autoUnsubscribe,
@Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
@Nullable int... types) throws IgniteException {
@@ -72,17 +85,35 @@ public class IgniteEventsProcessProxy implements IgniteEvents {
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<UUID> remoteListenAsync(int bufSize, long interval,
+ boolean autoUnsubscribe, @Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public void stopRemoteListen(UUID opId) throws IgniteException {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> T waitForLocal(@Nullable IgnitePredicate<T> filter,
@Nullable int... types) throws IgniteException {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<T> waitForLocalAsync(@Nullable IgnitePredicate<T> filter,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> Collection<T> localQuery(IgnitePredicate<T> p, @Nullable int... types) {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
index fbc94ed..a1603d8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
@@ -589,7 +589,7 @@ public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPa
final int orgId = primaryKey(grid(0).cache(Organization.class.getSimpleName()));
try {
- grid(1).compute().withAsync().affinityRun(
+ grid(1).compute().affinityRunAsync(
Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
new Integer(orgId),
new IgniteRunnable() {
@@ -630,7 +630,7 @@ public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPa
try {
- grid(1).compute().withAsync().affinityCall(
+ grid(1).compute().affinityCallAsync(
Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
new Integer(orgId),
new IgniteCallable<Object>() {
@@ -678,7 +678,7 @@ public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPa
final int orgId = primaryKey(grid(0).cache(Organization.class.getSimpleName()));
try {
- grid(1).compute().withAsync().affinityRun(
+ grid(1).compute().affinityRunAsync(
Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
new Integer(orgId),
new RunnableWithMasterLeave() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
index dc4a41f..0338429 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
@@ -138,11 +138,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
public void testLoadCacheAsync() throws Exception {
IgniteCache<Integer, ValueObject> cache = grid().cache(null);
- IgniteCache<Integer, ValueObject> asyncCache = cache.withAsync();
-
- asyncCache.loadCache(null, 0);
-
- asyncCache.future().get();
+ cache.loadCacheAsync(null, 0).get();
assert cache.size() == PUT_CNT;
@@ -183,16 +179,12 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
public void testLoadCacheAsyncFiltered() throws Exception {
IgniteCache<Integer, ValueObject> cache = grid().cache(null);
- IgniteCache<Integer, ValueObject> asyncCache = cache.withAsync();
-
- asyncCache.loadCache(new P2<Integer, ValueObject>() {
+ cache.loadCacheAsync(new P2<Integer, ValueObject>() {
@Override
public boolean apply(Integer key, ValueObject val) {
return key >= 5;
}
- }, 0);
-
- asyncCache.future().get();
+ }, 0).get();
assert cache.localSize() == PUT_CNT - 5;
@@ -212,11 +204,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
IgniteCache<Integer, ValueObject> cache = jcache();
- IgniteCache<Integer, ValueObject> asyncCache = cache.withAsync();
-
- asyncCache.get(1);
-
- assert ((ValueObject)asyncCache.future().get()).value() == 1;
+ assert cache.getAsync(1).get().value() == 1;
assert cache.size() == 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index 06be75d..6fe91c7 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -67,8 +67,6 @@ extern "C" {
void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void* IGNITE_CALL IgniteTargetOutObject(gcj::JniContext* ctx, void* obj, int opType);
void IGNITE_CALL IgniteTargetInStreamAsync(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
- void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ);
- void IGNITE_CALL IgniteTargetListenFutureForOperation(gcj::JniContext* ctx, void* obj, long long futId, int typ, int opId);
void* IGNITE_CALL IgniteAcquire(gcj::JniContext* ctx, void* obj);
void IGNITE_CALL IgniteRelease(void* obj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index 7c5d684..85955b3 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -211,8 +211,6 @@ namespace ignite
jmethodID m_PlatformTarget_inStreamAsync;
jmethodID m_PlatformTarget_inStreamOutStream;
jmethodID m_PlatformTarget_inObjectStreamOutObjectStream;
- jmethodID m_PlatformTarget_listenFuture;
- jmethodID m_PlatformTarget_listenFutureForOperation;
jclass c_PlatformUtils;
jmethodID m_PlatformUtils_reallocate;
@@ -389,8 +387,6 @@ namespace ignite
void TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* errInfo = NULL);
jobject TargetOutObject(jobject obj, int opType, JniErrorInfo* errInfo = NULL);
void TargetInStreamAsync(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
- void TargetListenFuture(jobject obj, long long futId, int typ);
- void TargetListenFutureForOperation(jobject obj, long long futId, int typ, int opId);
jobject CacheOutOpQueryCursor(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
jobject CacheOutOpContinuousQuery(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index 8159f8d..82cc41e 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -20,8 +20,6 @@ IgniteTargetInStreamOutLong @18
IgniteTargetOutStream @19
IgniteTargetInStreamOutStream @20
IgniteTargetInObjectStreamOutObjectStream @21
-IgniteTargetListenFuture @22
-IgniteTargetListenFutureForOperation @23
IgniteTargetInLongOutLong @24
IgniteTargetInStreamAsync @25
IgniteProcessorCompute @64
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index 6c590e4..2aecd59 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -186,14 +186,6 @@ extern "C" {
ctx->TargetInStreamAsync(static_cast<jobject>(obj), opType, memPtr);
}
- void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ) {
- ctx->TargetListenFuture(static_cast<jobject>(obj), futId, typ);
- }
-
- void IGNITE_CALL IgniteTargetListenFutureForOperation(gcj::JniContext* ctx, void* obj, long long futId, int typ, int opId) {
- ctx->TargetListenFutureForOperation(static_cast<jobject>(obj), futId, typ, opId);
- }
-
void* IGNITE_CALL IgniteAcquire(gcj::JniContext* ctx, void* obj) {
return ctx->Acquire(static_cast<jobject>(obj));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 004a99c..809aa17 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -259,8 +259,6 @@ namespace ignite
JniMethod M_PLATFORM_TARGET_OUT_STREAM = JniMethod("outStream", "(IJ)V", false);
JniMethod M_PLATFORM_TARGET_OUT_OBJECT = JniMethod("outObject", "(I)Ljava/lang/Object;", false);
JniMethod M_PLATFORM_TARGET_IN_STREAM_ASYNC = JniMethod("inStreamAsync", "(IJ)V", false);
- JniMethod M_PLATFORM_TARGET_LISTEN_FUTURE = JniMethod("listenFuture", "(JI)V", false);
- JniMethod M_PLATFORM_TARGET_LISTEN_FOR_OPERATION = JniMethod("listenFutureForOperation", "(JII)V", false);
const char* C_PLATFORM_CALLBACK_UTILS = "org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils";
@@ -592,8 +590,6 @@ namespace ignite
m_PlatformTarget_inStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM);
m_PlatformTarget_inObjectStreamOutObjectStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM);
m_PlatformTarget_inStreamAsync = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_ASYNC);
- m_PlatformTarget_listenFuture = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FUTURE);
- m_PlatformTarget_listenFutureForOperation = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FOR_OPERATION);
c_PlatformUtils = FindClass(env, C_PLATFORM_UTILS);
m_PlatformUtils_reallocate = FindMethod(env, c_PlatformUtils, M_PLATFORM_UTILS_REALLOC);
@@ -1396,22 +1392,6 @@ namespace ignite
ExceptionCheck(env, err);
}
- void JniContext::TargetListenFuture(jobject obj, long long futId, int typ) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_listenFuture, futId, typ);
-
- ExceptionCheck(env);
- }
-
- void JniContext::TargetListenFutureForOperation(jobject obj, long long futId, int typ, int opId) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_listenFutureForOperation, futId, typ, opId);
-
- ExceptionCheck(env);
- }
-
jobject JniContext::CacheOutOpQueryCursor(jobject obj, int type, long long memPtr, JniErrorInfo* err) {
JNIEnv* env = Attach();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarProjectionPimp.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarProjectionPimp.scala b/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarProjectionPimp.scala
index 737a798..b1a6b4f 100644
--- a/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarProjectionPimp.scala
+++ b/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarProjectionPimp.scala
@@ -375,11 +375,9 @@ class ScalarProjectionPimp[A <: ClusterGroup] extends PimpedType[A] with Iterabl
*/
def callAsync$[R](@Nullable s: Seq[Call[R]], @Nullable p: NF):
IgniteFuture[java.util.Collection[R]] = {
- val comp = value.ignite().compute(forPredicate(p)).withAsync()
+ val comp = value.ignite().compute(forPredicate(p))
- comp.call[R](toJavaCollection(s, (f: Call[R]) => toCallable(f)))
-
- comp.future()
+ comp.callAsync[R](toJavaCollection(s, (f: Call[R]) => toCallable(f)))
}
/**
@@ -435,11 +433,9 @@ class ScalarProjectionPimp[A <: ClusterGroup] extends PimpedType[A] with Iterabl
* @see `org.apache.ignite.cluster.ClusterGroup.call(...)`
*/
def runAsync$(@Nullable s: Seq[Run], @Nullable p: NF): IgniteFuture[_] = {
- val comp = value.ignite().compute(forPredicate(p)).withAsync()
-
- comp.run(toJavaCollection(s, (f: Run) => toRunnable(f)))
+ val comp = value.ignite().compute(forPredicate(p))
- comp.future()
+ comp.runAsync(toJavaCollection(s, (f: Run) => toRunnable(f)))
}
/**
@@ -494,11 +490,9 @@ class ScalarProjectionPimp[A <: ClusterGroup] extends PimpedType[A] with Iterabl
def reduceAsync$[R1, R2](s: Seq[Call[R1]], r: Seq[R1] => R2, @Nullable p: NF): IgniteFuture[R2] = {
assert(s != null && r != null)
- val comp = value.ignite().compute(forPredicate(p)).withAsync()
+ val comp = value.ignite().compute(forPredicate(p))
- comp.call(toJavaCollection(s, (f: Call[R1]) => toCallable(f)), r)
-
- comp.future()
+ comp.callAsync(toJavaCollection(s, (f: Call[R1]) => toCallable(f)), r)
}
/**
@@ -648,10 +642,8 @@ class ScalarProjectionPimp[A <: ClusterGroup] extends PimpedType[A] with Iterabl
*/
def affinityRunAsync$(cacheName: String, @Nullable affKey: Any, @Nullable r: Run,
@Nullable p: NF): IgniteFuture[_] = {
- val comp = value.ignite().compute(forPredicate(p)).withAsync()
-
- comp.affinityRun(cacheName, affKey, toRunnable(r))
+ val comp = value.ignite().compute(forPredicate(p))
- comp.future()
+ comp.affinityRunAsync(cacheName, affKey, toRunnable(r))
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
index 22c6977..5de7363 100644
--- a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
+++ b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
@@ -1051,10 +1051,6 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
boolean restart,
int timeout,
int maxConn) {
- cluster = cluster.withAsync();
-
- assertNull(cluster.startNodes(hosts, dflts, restart, timeout, maxConn));
-
- return cluster.<Collection<ClusterStartNodeResult>>future().get(WAIT_TIMEOUT);
+ return cluster.startNodesAsync(hosts, dflts, restart, timeout, maxConn).get(WAIT_TIMEOUT);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
index cdc5b47..4291103 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
@@ -47,27 +47,17 @@ class VisorTasksCommandSpec extends FunSpec with Matchers with BeforeAndAfterAll
visor.open(config("visor-demo-node"), "n/a")
try {
- val compute = ignite.compute().withAsync
+ val compute = ignite.compute()
- compute.withName("TestTask1").execute(new TestTask1(), null)
+ val fut1 = compute.withName("TestTask1").executeAsync(new TestTask1(), null)
- val fut1 = compute.future()
+ val fut2 = compute.withName("TestTask1").executeAsync(new TestTask1(), null)
- compute.withName("TestTask1").execute(new TestTask1(), null)
+ val fut3 = compute.withName("TestTask1").executeAsync(new TestTask1(), null)
- val fut2 = compute.future()
+ val fut4 = compute.withName("TestTask2").executeAsync(new TestTask2(), null)
- compute.withName("TestTask1").execute(new TestTask1(), null)
-
- val fut3 = compute.future()
-
- compute.withName("TestTask2").execute(new TestTask2(), null)
-
- val fut4 = compute.future()
-
- compute.withName("Test3").execute(new Test3(), null)
-
- val fut5 = compute.future()
+ val fut5 = compute.withName("Test3").executeAsync(new Test3(), null)
fut1.get
fut2.get
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
index 6e65746..f4e5ed7 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
@@ -77,8 +77,7 @@ public class IgniteAtomicInvokeRetryBenchmark extends IgniteFailoverAbstractBenc
for (Map.Entry<String, AtomicLong> e : nextValMap.entrySet()) {
String key = e.getKey();
- asyncCache.get(key);
- Set set = asyncCache.<Set>future().get(timeout);
+ Set set = cache.getAsync(key).get(timeout);
if (set == null || e.getValue() == null || !Objects.equals(e.getValue().get(), (long)set.size()))
badCacheEntries.put(key, set);
@@ -102,8 +101,7 @@ public class IgniteAtomicInvokeRetryBenchmark extends IgniteFailoverAbstractBenc
for (int k2 = 0; k2 < range; k2++) {
String key2 = "key-" + k2;
- asyncCache.get(key2);
- Object val = asyncCache.future().get(timeout);
+ Object val = cache.getAsync(key2).get(timeout);
if (val != null)
println("Cache Entry [key=" + key2 + ", val=" + val + "]");
@@ -116,8 +114,7 @@ public class IgniteAtomicInvokeRetryBenchmark extends IgniteFailoverAbstractBenc
println("Clearing all data.");
- asyncCache.removeAll();
- asyncCache.future().get(timeout);
+ cache.removeAllAsync().get(timeout);
nextValMap.clear();
@@ -166,8 +163,7 @@ public class IgniteAtomicInvokeRetryBenchmark extends IgniteFailoverAbstractBenc
if (nextAtomicVal != null)
nextVal = nextAtomicVal.incrementAndGet();
- asyncCache.invoke(key, new AddInSetEntryProcessor(), nextVal);
- asyncCache.future().get(args.cacheOperationTimeoutMillis());
+ cache.invokeAsync(key, new AddInSetEntryProcessor(), nextVal).get(args.cacheOperationTimeoutMillis());
}
finally {
rwl.readLock().unlock();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
index 4e60698..0e99bbc 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
@@ -39,26 +39,22 @@ public class IgniteAtomicRetriesBenchmark extends IgniteFailoverAbstractBenchmar
switch (opNum) {
case 0:
- asyncCache.get(key);
- asyncCache.future().get(timeout);
+ cache.getAsync(key).get(timeout);
break;
case 1:
- asyncCache.put(key, String.valueOf(key));
- asyncCache.future().get(timeout);
+ cache.putAsync(key, String.valueOf(key)).get(timeout);
break;
case 2:
- asyncCache.invoke(key, new TestCacheEntryProcessor());
- asyncCache.future().get(timeout);
+ cache.invokeAsync(key, new TestCacheEntryProcessor()).get(timeout);
break;
case 3:
- asyncCache.remove(key);
- asyncCache.future().get(timeout);
+ cache.removeAsync(key).get(timeout);
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
index 1a700c2..a025bb5 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
@@ -57,17 +57,12 @@ public abstract class IgniteFailoverAbstractBenchmark<K, V> extends IgniteCacheA
/** */
private static final AtomicBoolean restarterStarted = new AtomicBoolean();
- /** Async Cache. */
- protected IgniteCache<K, V> asyncCache;
-
/** */
private final AtomicBoolean firtsExProcessed = new AtomicBoolean();
/** {@inheritDoc} */
@Override public void setUp(final BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
-
- asyncCache = cache.withAsync();
}
/** {@inheritDoc} */
@@ -116,11 +111,8 @@ public abstract class IgniteFailoverAbstractBenchmark<K, V> extends IgniteCacheA
println("Waiting for partitioned map exchage of all nodes");
- IgniteCompute asyncCompute = ignite.compute().withAsync();
-
- asyncCompute.broadcast(new AwaitPartitionMapExchangeTask());
-
- asyncCompute.future().get(args.cacheOperationTimeoutMillis());
+ ignite.compute().broadcastAsync(new AwaitPartitionMapExchangeTask())
+ .get(args.cacheOperationTimeoutMillis());
println("Start servers restarting [numNodesToRestart=" + numNodesToRestart
+ ", shuffledIds=" + ids + "]");
@@ -242,10 +234,8 @@ public abstract class IgniteFailoverAbstractBenchmark<K, V> extends IgniteCacheA
ClusterGroup srvs = ignite.cluster().forServers();
- IgniteCompute asyncCompute = ignite.compute(srvs).withAsync();
-
- asyncCompute.broadcast(new ThreadDumpPrinterTask(ignite.cluster().localNode().id(), e));
- asyncCompute.future().get(10_000);
+ ignite.compute(srvs).broadcastAsync(new ThreadDumpPrinterTask(ignite.cluster().localNode().id(), e))
+ .get(10_000);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
index b5a08da..2c4046e 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
@@ -79,8 +79,7 @@ public class IgniteTransactionalInvokeRetryBenchmark extends IgniteFailoverAbstr
for (int i = 0; i < keysCnt; i++) {
String key = "key-" + k + "-" + cfg.memberId() + "-" + i;
- asyncCache.get(key);
- Long cacheVal = asyncCache.<Long>future().get(timeout);
+ Long cacheVal = cache.getAsync(key).get(timeout);
AtomicLong aVal = map.get(key);
Long mapVal = aVal != null ? aVal.get() : null;
@@ -114,8 +113,7 @@ public class IgniteTransactionalInvokeRetryBenchmark extends IgniteFailoverAbstr
for (int i2 = 0; i2 < keysCnt; i2++) {
String key2 = "key-" + k2 + "-" + cfg.memberId() + "-" + i2;
- asyncCache.get(key2);
- Long val = asyncCache.<Long>future().get(timeout);
+ Long val = cache.getAsync(key2).get(timeout);
if (val != null)
println(cfg, "Entry [key=" + key2 + ", val=" + val + "]");
@@ -169,8 +167,8 @@ public class IgniteTransactionalInvokeRetryBenchmark extends IgniteFailoverAbstr
if (ex != null)
throw ex;
- asyncCache.invoke(key, new IncrementInvokeRetryCacheEntryProcessor());
- asyncCache.future().get(args.cacheOperationTimeoutMillis());
+ cache.invokeAsync(key, new IncrementInvokeRetryCacheEntryProcessor())
+ .get(args.cacheOperationTimeoutMillis());
AtomicLong prevVal = map.putIfAbsent(key, new AtomicLong(0));
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
index 67044a1..46ebd8c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
@@ -128,14 +128,12 @@ public class IgniteTransactionalWriteInvokeBenchmark extends IgniteFailoverAbstr
case 0: // Read scenario.
Map<String, Long> map = new HashMap<>();
- asyncCache.get(masterKey);
- Long cacheVal = asyncCache.<Long>future().get(timeout);
+ Long cacheVal = cache.getAsync(masterKey).get(timeout);
map.put(masterKey, cacheVal);
for (String key : keys) {
- asyncCache.get(key);
- cacheVal = asyncCache.<Long>future().get(timeout);
+ cacheVal = cache.getAsync(key).get(timeout);
map.put(key, cacheVal);
}
@@ -147,18 +145,16 @@ public class IgniteTransactionalWriteInvokeBenchmark extends IgniteFailoverAbstr
break;
case 1: // Invoke scenario.
- asyncCache.get(masterKey);
- Long val = asyncCache.<Long>future().get(timeout);
+ Long val = cache.getAsync(masterKey).get(timeout);
if (val == null)
badKeys.add(masterKey);
- asyncCache.put(masterKey, val == null ? -1 : val + 1);
- asyncCache.future().get(timeout);
+ cache.putAsync(masterKey, val == null ? -1 : val + 1).get(timeout);
for (String key : keys) {
- asyncCache.invoke(key, new IncrementWriteInvokeCacheEntryProcessor(), cacheName());
- Object o = asyncCache.future().get(timeout);
+ Object o = cache.invokeAsync(key,
+ new IncrementWriteInvokeCacheEntryProcessor(), cacheName()).get(timeout);
if (o != null)
badKeys.add(key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
index c4314ed..ef88056 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
@@ -54,8 +54,7 @@ public class IgniteTransactionalWriteReadBenchmark extends IgniteFailoverAbstrac
final int timeout = args.cacheOperationTimeoutMillis();
for (String key : keys) {
- asyncCache.get(key);
- Long val = asyncCache.<Long>future().get(timeout);
+ Long val = cache.getAsync(key).get(timeout);
map.put(key, val);
}
@@ -72,8 +71,7 @@ public class IgniteTransactionalWriteReadBenchmark extends IgniteFailoverAbstrac
for (int i = 0; i < args.keysCount(); i++) {
String key = "key-" + k + "-" + i;
- asyncCache.get(key);
- Long val = asyncCache.<Long>future().get(timeout);
+ Long val = cache.getAsync(key).get(timeout);
if (val != null)
println(cfg, "Entry [key=" + key + ", val=" + val + "]");
@@ -87,10 +85,8 @@ public class IgniteTransactionalWriteReadBenchmark extends IgniteFailoverAbstrac
final Long newVal = oldVal == null ? 0 : oldVal + 1;
- for (String key : keys) {
- asyncCache.put(key, newVal);
- asyncCache.future().get(timeout);
- }
+ for (String key : keys)
+ cache.putAsync(key, newVal).get(timeout);
return true;
}
[29/50] [abbrv] ignite git commit: IGNITE-4102 .NET: Generify
ICacheStore
Posted by ag...@apache.org.
IGNITE-4102 .NET: Generify ICacheStore
This closes #1670
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eab8334b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eab8334b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eab8334b
Branch: refs/heads/ignite-4003
Commit: eab8334bb49ceda249e742246d26f72539f9fa4c
Parents: 1308927
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Mar 27 16:02:47 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Mar 27 16:02:47 2017 +0300
----------------------------------------------------------------------
.../dotnet/PlatformDotNetCacheStore.java | 12 +-
.../Cache/CacheConfigurationTest.cs | 2 +-
.../Cache/Store/CacheStoreAdapterTest.cs | 14 +-
.../Cache/Store/CacheStoreSessionTest.cs | 2 +-
.../Cache/Store/CacheTestParallelLoadStore.cs | 16 +-
.../Cache/Store/CacheTestStore.cs | 13 +-
.../Apache.Ignite.Core.csproj | 4 +-
.../Cache/Configuration/CacheConfiguration.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 12 +-
.../Store/CacheParallelLoadStoreAdapter.cs | 38 ++-
.../Cache/Store/CacheStoreAdapter.cs | 30 +-
.../Cache/Store/ICacheStore.cs | 39 ++-
.../Cache/Store/ICacheStoreSession.cs | 2 +-
.../Datastream/IDataStreamer.cs | 2 +-
.../Impl/Cache/Store/CacheStore.cs | 233 ++++-----------
.../Impl/Cache/Store/CacheStoreInternal.cs | 285 +++++++++++++++++++
.../Impl/Cache/Store/ICacheStoreInternal.cs | 43 +++
.../Datagrid/StoreExample.cs | 1 +
.../Datagrid/EmployeeStore.cs | 27 +-
19 files changed, 497 insertions(+), 280 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
index c2f6001..dd61a54 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
@@ -201,7 +201,11 @@ public class PlatformDotNetCacheStore<K, V> implements CacheStore<K, V>, Platfor
writer.writeByte(OP_LOAD_ALL);
writer.writeLong(session());
writer.writeString(ses.cacheName());
- writer.writeCollection(keys0);
+
+ writer.writeInt(keys0.size());
+
+ for (Object o : keys0)
+ writer.writeObject(o);
}
}, new IgniteInClosureX<BinaryRawReaderEx>() {
@Override public void applyx(BinaryRawReaderEx reader) {
@@ -311,7 +315,11 @@ public class PlatformDotNetCacheStore<K, V> implements CacheStore<K, V>, Platfor
writer.writeByte(OP_RMV_ALL);
writer.writeLong(session());
writer.writeString(ses.cacheName());
- writer.writeCollection(keys);
+
+ writer.writeInt(keys.size());
+
+ for (Object o : keys)
+ writer.writeObject(o);
}
}, null);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 02c0fc3..7a30780 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -703,7 +703,7 @@ namespace Apache.Ignite.Core.Tests.Cache
/// <summary>
/// Test store.
/// </summary>
- private class CacheStoreTest : CacheStoreAdapter
+ private class CacheStoreTest : CacheStoreAdapter<object, object>
{
/** <inheritdoc /> */
public override object Load(object key)
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreAdapterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreAdapterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreAdapterTest.cs
index 6690584..02da750 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreAdapterTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreAdapterTest.cs
@@ -23,7 +23,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using NUnit.Framework;
/// <summary>
- /// Tests for <see cref="CacheStoreAdapter"/>.
+ /// Tests for <see cref="CacheStoreAdapter{K, V}"/>.
/// </summary>
public class CacheStoreAdapterTest
{
@@ -62,26 +62,26 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Test store.
/// </summary>
- private class Store : CacheStoreAdapter
+ private class Store : CacheStoreAdapter<int, string>
{
/** */
- public readonly Dictionary<object, object> Map = new Dictionary<object, object>();
+ public readonly Dictionary<int, string> Map = new Dictionary<int, string>();
/** <inheritdoc /> */
- public override object Load(object key)
+ public override string Load(int key)
{
- object res;
+ string res;
return Map.TryGetValue(key, out res) ? res : null;
}
/** <inheritdoc /> */
- public override void Write(object key, object val)
+ public override void Write(int key, string val)
{
Map[key] = val;
}
/** <inheritdoc /> */
- public override void Delete(object key)
+ public override void Delete(int key)
{
Map.Remove(key);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
index d01726a..6f9d791 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
@@ -155,7 +155,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// Test store implementation.
/// </summary>
// ReSharper disable once UnusedMember.Global
- public class Store : CacheStoreAdapter
+ public class Store : CacheStoreAdapter<object, object>
{
/** Store session. */
[StoreSessionResource]
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
index 81b4697..4786032 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
@@ -17,8 +17,6 @@
namespace Apache.Ignite.Core.Tests.Cache.Store
{
- using System;
- using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -28,7 +26,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Test cache store with parallel load.
/// </summary>
- public class CacheTestParallelLoadStore : CacheParallelLoadStoreAdapter
+ public class CacheTestParallelLoadStore :
+ CacheParallelLoadStoreAdapter<object, object, CacheTestParallelLoadStore.Record>
{
/** Length of input data sequence */
public const int InputDataLength = 10000;
@@ -61,23 +60,21 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
/** <inheritdoc /> */
- protected override IEnumerable GetInputData()
+ protected override IEnumerable<Record> GetInputData()
{
return Enumerable.Range(0, InputDataLength).Select(x => new Record {Id = x, Name = "Test Record " + x});
}
/** <inheritdoc /> */
- protected override KeyValuePair<object, object>? Parse(object inputRecord, params object[] args)
+ protected override KeyValuePair<object, object>? Parse(Record inputRecord, params object[] args)
{
var threadId = Thread.CurrentThread.ManagedThreadId;
ThreadIds.GetOrAdd(threadId, threadId);
var minId = (int)args[0];
- var rec = (Record)inputRecord;
-
- return rec.Id >= minId
- ? new KeyValuePair<object, object>(rec.Id, rec)
+ return inputRecord.Id >= minId
+ ? new KeyValuePair<object, object>(inputRecord.Id, inputRecord)
: (KeyValuePair<object, object>?) null;
}
@@ -94,6 +91,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Gets or sets the name.
/// </summary>
+ // ReSharper disable once UnusedAutoPropertyAccessor.Global
public string Name { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
index f80f5ce..36b190f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using System;
using System.Collections;
using System.Collections.Concurrent;
+ using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -29,7 +30,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using Apache.Ignite.Core.Resource;
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
- public class CacheTestStore : ICacheStore
+ public class CacheTestStore : ICacheStore<object, object>
{
public static readonly IDictionary Map = new ConcurrentDictionary<object, object>();
@@ -115,13 +116,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
return Map[key];
}
- public IDictionary LoadAll(ICollection keys)
+ public IEnumerable<KeyValuePair<object, object>> LoadAll(IEnumerable<object> keys)
{
ThrowIfNeeded();
Debug.Assert(_grid != null);
- return keys.OfType<object>().ToDictionary(key => key, key => "val_" + key);
+ return keys.ToDictionary(key => key, key =>(object)( "val_" + key));
}
public void Write(object key, object val)
@@ -133,13 +134,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Map[key] = val;
}
- public void WriteAll(IDictionary map)
+ public void WriteAll(IEnumerable<KeyValuePair<object, object>> map)
{
ThrowIfNeeded();
Debug.Assert(_grid != null);
- foreach (DictionaryEntry e in map)
+ foreach (var e in map)
Map[e.Key] = e.Value;
}
@@ -152,7 +153,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Map.Remove(key);
}
- public void DeleteAll(ICollection keys)
+ public void DeleteAll(IEnumerable<object> keys)
{
ThrowIfNeeded();
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 58002db..eab0bb5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -191,6 +191,8 @@
<Compile Include="Impl\Binary\SerializableSerializer.cs" />
<Compile Include="Impl\Binary\BinaryWriterExtensions.cs" />
<Compile Include="Impl\Cache\Affinity\AffinityFunctionBase.cs" />
+ <Compile Include="Impl\Cache\Store\CacheStore.cs" />
+ <Compile Include="Impl\Cache\Store\ICacheStoreInternal.cs" />
<Compile Include="Impl\Transactions\CacheTransactionManager.cs" />
<Compile Include="Impl\Cache\Expiry\ExpiryPolicyFactory.cs" />
<Compile Include="Impl\Cache\Expiry\ExpiryPolicySerializer.cs" />
@@ -299,7 +301,7 @@
<Compile Include="Impl\Cache\Query\Continuous\ContinuousQueryUtils.cs" />
<Compile Include="Impl\Cache\Query\FieldsQueryCursor.cs" />
<Compile Include="Impl\Cache\Query\QueryCursor.cs" />
- <Compile Include="Impl\Cache\Store\CacheStore.cs" />
+ <Compile Include="Impl\Cache\Store\CacheStoreInternal.cs" />
<Compile Include="Impl\Cache\Store\CacheStoreSession.cs" />
<Compile Include="Impl\Cache\Store\CacheStoreSessionProxy.cs" />
<Compile Include="Impl\Cluster\ClusterGroupImpl.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index ebf412d..29d2ee3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -602,7 +602,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Maximum batch size for write-behind cache store operations.
/// Store operations (get or remove) are combined in a batch of this size to be passed to
- /// <see cref="ICacheStore.WriteAll"/> or <see cref="ICacheStore.DeleteAll"/> methods.
+ /// <see cref="ICacheStore{K, V}.WriteAll"/> or <see cref="ICacheStore{K, V}.DeleteAll"/> methods.
/// </summary>
[DefaultValue(DefaultWriteBehindBatchSize)]
public int WriteBehindBatchSize { get; set; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
index 50938e1..77e47c7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
@@ -118,7 +118,7 @@ namespace Apache.Ignite.Core.Cache
/// Optional predicate. If provided, will be used to filter values to be put into cache.
/// </param>
/// <param name="args">
- /// Optional user arguments to be passed into <see cref="ICacheStore.LoadCache" />.
+ /// Optional user arguments to be passed into <see cref="ICacheStore{K, V}.LoadCache" />.
/// </param>
void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args);
@@ -129,12 +129,12 @@ namespace Apache.Ignite.Core.Cache
/// Optional predicate. If provided, will be used to filter values to be put into cache.
/// </param>
/// <param name="args">
- /// Optional user arguments to be passed into <see cref="ICacheStore.LoadCache" />.
+ /// Optional user arguments to be passed into <see cref="ICacheStore{K, V}.LoadCache" />.
/// </param>
Task LoadCacheAsync(ICacheEntryFilter<TK, TV> p, params object[] args);
/// <summary>
- /// Delegates to <see cref="ICacheStore.LoadCache" /> method to load state
+ /// Delegates to <see cref="ICacheStore{K, V}.LoadCache" /> method to load state
/// from the underlying persistent storage. The loaded values will then be given
/// to the optionally passed in predicate, and, if the predicate returns true,
/// will be stored in cache. If predicate is null, then all loaded values will be stored in cache.
@@ -143,12 +143,12 @@ namespace Apache.Ignite.Core.Cache
/// Optional predicate. If provided, will be used to filter values to be put into cache.
/// </param>
/// <param name="args">
- /// Optional user arguments to be passed into <see cref="ICacheStore.LoadCache" />.
+ /// Optional user arguments to be passed into <see cref="ICacheStore{K, V}.LoadCache" />.
/// </param>
void LocalLoadCache(ICacheEntryFilter<TK, TV> p, params object[] args);
/// <summary>
- /// Delegates to <see cref="ICacheStore.LoadCache" /> method to load state
+ /// Delegates to <see cref="ICacheStore{K, V}.LoadCache" /> method to load state
/// from the underlying persistent storage. The loaded values will then be given
/// to the optionally passed in predicate, and, if the predicate returns true,
/// will be stored in cache. If predicate is null, then all loaded values will be stored in cache.
@@ -157,7 +157,7 @@ namespace Apache.Ignite.Core.Cache
/// Optional predicate. If provided, will be used to filter values to be put into cache.
/// </param>
/// <param name="args">
- /// Optional user arguments to be passed into <see cref="ICacheStore.LoadCache" />.
+ /// Optional user arguments to be passed into <see cref="ICacheStore{K, V}.LoadCache" />.
/// </param>
Task LocalLoadCacheAsync(ICacheEntryFilter<TK, TV> p, params object[] args);
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
index c506838..467b246 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
@@ -18,10 +18,8 @@
namespace Apache.Ignite.Core.Cache.Store
{
using System;
- using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Linq;
using System.Threading.Tasks;
/// <summary>
@@ -32,19 +30,17 @@ namespace Apache.Ignite.Core.Cache.Store
/// GetInputData().GetEnumerator() result will be disposed if it implements IDisposable.
/// Any additional post-LoadCache steps can be performed by overriding LoadCache method.
/// </remarks>
- public abstract class CacheParallelLoadStoreAdapter : ICacheStore
+ /// <typeparam name="TK">Key type.</typeparam>
+ /// <typeparam name="TV">Value type.</typeparam>
+ /// <typeparam name="TData">Custom data entry type.</typeparam>
+ public abstract class CacheParallelLoadStoreAdapter<TK, TV, TData> : ICacheStore<TK, TV>
{
/// <summary>
- /// Default number of working threads (equal to the number of available processors).
- /// </summary>
- public static readonly int DefaultThreadsCount = Environment.ProcessorCount;
-
- /// <summary>
/// Constructor.
/// </summary>
protected CacheParallelLoadStoreAdapter()
{
- MaxDegreeOfParallelism = DefaultThreadsCount;
+ MaxDegreeOfParallelism = Environment.ProcessorCount;
}
/// <summary>
@@ -62,7 +58,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="act">Action for loaded values.</param>
/// <param name="args">Optional arguemnts passed to <see cref="ICache{K,V}.LocalLoadCache" /> method.</param>
/// <exception cref="CacheStoreException" />
- public virtual void LoadCache(Action<object, object> act, params object[] args)
+ public virtual void LoadCache(Action<TK, TV> act, params object[] args)
{
if (MaxDegreeOfParallelism == 0 || MaxDegreeOfParallelism < -1)
throw new ArgumentOutOfRangeException("MaxDegreeOfParallelism must be either positive or -1: " +
@@ -70,7 +66,7 @@ namespace Apache.Ignite.Core.Cache.Store
var options = new ParallelOptions {MaxDegreeOfParallelism = MaxDegreeOfParallelism};
- Parallel.ForEach(GetInputData().OfType<object>(), options, item =>
+ Parallel.ForEach(GetInputData(), options, item =>
{
var cacheEntry = Parse(item, args);
@@ -83,19 +79,19 @@ namespace Apache.Ignite.Core.Cache.Store
/// Gets the input data sequence to be used in LoadCache.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Semantics.")]
- protected abstract IEnumerable GetInputData();
+ protected abstract IEnumerable<TData> GetInputData();
/// <summary>
/// This method should transform raw data records from GetInputData
/// into valid key-value pairs to be stored into cache.
/// </summary>
- protected abstract KeyValuePair<object, object>? Parse(object inputRecord, params object[] args);
+ protected abstract KeyValuePair<TK, TV>? Parse(TData inputRecord, params object[] args);
/// <summary>
/// Gets or sets the maximum degree of parallelism to use in LoadCache.
/// Must be either positive or -1 for unlimited amount of threads.
/// <para />
- /// Defaults to <see cref="DefaultThreadsCount"/>.
+ /// Defaults to <see cref="Environment.ProcessorCount"/>.
/// </summary>
public int MaxDegreeOfParallelism { get; set; }
@@ -111,9 +107,9 @@ namespace Apache.Ignite.Core.Cache.Store
/// or <c>null</c> if the object can't be loaded
/// </returns>
[ExcludeFromCodeCoverage]
- public virtual object Load(object key)
+ public virtual TV Load(TK key)
{
- return null;
+ return default(TV);
}
/// <summary>
@@ -126,7 +122,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// A map of key, values to be stored in the cache.
/// </returns>
[ExcludeFromCodeCoverage]
- public virtual IDictionary LoadAll(ICollection keys)
+ public virtual IEnumerable<KeyValuePair<TK, TV>> LoadAll(IEnumerable<TK> keys)
{
return null;
}
@@ -139,7 +135,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="key">Key to write.</param>
/// <param name="val">Value to write.</param>
[ExcludeFromCodeCoverage]
- public virtual void Write(object key, object val)
+ public virtual void Write(TK key, TV val)
{
// No-op.
}
@@ -158,7 +154,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// to write for write-through. Upon return the collection must only contain entries
/// that were not successfully written. (see partial success above).</param>
[ExcludeFromCodeCoverage]
- public virtual void WriteAll(IDictionary entries)
+ public virtual void WriteAll(IEnumerable<KeyValuePair<TK, TV>> entries)
{
// No-op.
}
@@ -172,7 +168,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// </summary>
/// <param name="key">The key that is used for the delete operation.</param>
[ExcludeFromCodeCoverage]
- public virtual void Delete(object key)
+ public virtual void Delete(TK key)
{
// No-op.
}
@@ -195,7 +191,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// it contains the keys to delete for write-through. Upon return the collection must only contain
/// the keys that were not successfully deleted.</param>
[ExcludeFromCodeCoverage]
- public virtual void DeleteAll(ICollection keys)
+ public virtual void DeleteAll(IEnumerable<TK> keys)
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
index a38678d..769c4c2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
@@ -18,7 +18,7 @@
namespace Apache.Ignite.Core.Cache.Store
{
using System;
- using System.Collections;
+ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -34,7 +34,9 @@ namespace Apache.Ignite.Core.Cache.Store
/// Note that <c>LoadCache</c> method has empty implementation because it is
/// essentially up to the user to invoke it with specific arguments.
/// </summary>
- public abstract class CacheStoreAdapter : ICacheStore
+ /// <typeparam name="TK">Key type.</typeparam>
+ /// <typeparam name="TV">Value type.</typeparam>
+ public abstract class CacheStoreAdapter<TK, TV> : ICacheStore<TK, TV>
{
/// <summary>
/// Loads all values from underlying persistent storage. Note that keys are
@@ -50,11 +52,11 @@ namespace Apache.Ignite.Core.Cache.Store
/// </summary>
/// <param name="act">Action for loaded values.</param>
/// <param name="args">Optional arguemnts passed to <see cref="ICache{K,V}.LocalLoadCache" /> method.</param>
- public virtual void LoadCache(Action<object, object> act, params object[] args)
+ public virtual void LoadCache(Action<TK, TV> act, params object[] args)
{
// No-op.
}
-
+
/// <summary>
/// Loads multiple objects. Application developers should implement this method to customize
/// the loading of cache entries. This method is called when the requested object is not in the cache.
@@ -64,19 +66,19 @@ namespace Apache.Ignite.Core.Cache.Store
/// <returns>
/// A map of key, values to be stored in the cache.
/// </returns>
- public virtual IDictionary LoadAll(ICollection keys)
+ public virtual IEnumerable<KeyValuePair<TK, TV>> LoadAll(IEnumerable<TK> keys)
{
- return keys.OfType<object>().ToDictionary(key => key, Load);
+ return keys.ToDictionary(key => key, Load);
}
-
+
/// <summary>
/// Writes all.
/// </summary>
/// <param name="entries">The map.</param>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
- public virtual void WriteAll(IDictionary entries)
+ public virtual void WriteAll(IEnumerable<KeyValuePair<TK, TV>> entries)
{
- foreach (DictionaryEntry entry in entries)
+ foreach (var entry in entries)
Write(entry.Key, entry.Value);
}
@@ -98,9 +100,9 @@ namespace Apache.Ignite.Core.Cache.Store
/// it contains the keys to delete for write-through. Upon return the collection must only contain
/// the keys that were not successfully deleted.</param>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
- public virtual void DeleteAll(ICollection keys)
+ public virtual void DeleteAll(IEnumerable<TK> keys)
{
- foreach (object key in keys)
+ foreach (var key in keys)
Delete(key);
}
@@ -125,7 +127,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// The value for the entry that is to be stored in the cache
/// or <c>null</c> if the object can't be loaded
/// </returns>
- public abstract object Load(object key);
+ public abstract TV Load(TK key);
/// <summary>
/// Write the specified value under the specified key to the external resource.
@@ -134,7 +136,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// </summary>
/// <param name="key">Key to write.</param>
/// <param name="val">Value to write.</param>
- public abstract void Write(object key, object val);
+ public abstract void Write(TK key, TV val);
/// <summary>
/// Delete the cache entry from the external resource.
@@ -144,6 +146,6 @@ namespace Apache.Ignite.Core.Cache.Store
/// This method is invoked even if no mapping for the key exists.
/// </summary>
/// <param name="key">The key that is used for the delete operation.</param>
- public abstract void Delete(object key);
+ public abstract void Delete(TK key);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
index d6e4f80..044784a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
@@ -18,12 +18,19 @@
namespace Apache.Ignite.Core.Cache.Store
{
using System;
- using System.Collections;
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Transactions;
/// <summary>
/// API for cache persistent storage for read-through and write-through behavior.
- ///
+ /// <para />
+ /// Generic argument types depend on <see cref="CacheConfiguration.KeepBinaryInStore"/> property.
+ /// When <c>true</c> (default), cache store operates on <see cref="IBinaryObject"/> instances.
+ /// Otherwise, generic arguments should be the same as in corresponding <see cref="ICache{TK, TV}"/>.
+ /// <para />
/// Persistent store is configured in Ignite's Spring XML configuration file via
/// <c>CacheConfiguration.setStore()</c> property. If you have an implementation
/// of cache store in .NET, you should use special Java wrapper which accepts assembly name and
@@ -75,7 +82,9 @@ namespace Apache.Ignite.Core.Cache.Store
/// </code>
/// </example>
/// </summary>
- public interface ICacheStore
+ /// <typeparam name="TK">Key type.</typeparam>
+ /// <typeparam name="TV">Value type.</typeparam>
+ public interface ICacheStore<TK, TV> : ICacheStore
{
/// <summary>
/// Loads all values from underlying persistent storage. Note that keys are
@@ -92,7 +101,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="act">Action for loaded values.</param>
/// <param name="args">Optional arguemnts passed to <see cref="ICache{K,V}.LocalLoadCache"/> method.</param>
/// <exception cref="CacheStoreException" />
- void LoadCache(Action<object, object> act, params object[] args);
+ void LoadCache(Action<TK, TV> act, params object[] args);
/// <summary>
/// Loads an object. Application developers should implement this method to customize the loading
@@ -104,7 +113,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <returns>The value for the entry that is to be stored in the cache
/// or <c>null</c> if the object can't be loaded</returns>
/// <exception cref="CacheStoreException" />
- object Load(object key);
+ TV Load(TK key);
/// <summary>
/// Loads multiple objects. Application developers should implement this method to customize
@@ -114,7 +123,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="keys">Keys identifying the values to be loaded.</param>
/// <returns>A map of key, values to be stored in the cache.</returns>
/// <exception cref="CacheStoreException" />
- IDictionary LoadAll(ICollection keys);
+ IEnumerable<KeyValuePair<TK, TV>> LoadAll(IEnumerable<TK> keys);
/// <summary>
/// Write the specified value under the specified key to the external resource.
@@ -124,7 +133,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="key">Key to write.</param>
/// <param name="val">Value to write.</param>
/// <exception cref="CacheStoreException" />
- void Write(object key, object val);
+ void Write(TK key, TV val);
/// <summary>
/// Write the specified entries to the external resource.
@@ -140,7 +149,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// to write for write-through. Upon return the collection must only contain entries
/// that were not successfully written. (see partial success above).</param>
/// <exception cref="CacheStoreException" />
- void WriteAll(IDictionary entries);
+ void WriteAll(IEnumerable<KeyValuePair<TK, TV>> entries);
/// <summary>
/// Delete the cache entry from the external resource.
@@ -151,7 +160,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// </summary>
/// <param name="key">The key that is used for the delete operation.</param>
/// <exception cref="CacheStoreException" />
- void Delete(object key);
+ void Delete(TK key);
/// <summary>
/// Remove data and keys from the external resource for the given collection of keys, if present.
@@ -171,7 +180,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// it contains the keys to delete for write-through. Upon return the collection must only contain
/// the keys that were not successfully deleted.</param>
/// <exception cref="CacheStoreException" />
- void DeleteAll(ICollection keys);
+ void DeleteAll(IEnumerable<TK> keys);
/// <summary>
/// Tells store to commit or rollback a transaction depending on the value of the
@@ -181,4 +190,14 @@ namespace Apache.Ignite.Core.Cache.Store
/// <exception cref="CacheStoreException" />
void SessionEnd(bool commit);
}
+
+ /// <summary>
+ /// Non-generic base type for <see cref="ICacheStore{TK,TV}"/>, used only for configuration property.
+ /// Users should implement generic <see cref="ICacheStore{TK,TV}"/>.
+ /// </summary>
+ [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
+ public interface ICacheStore
+ {
+ // No-op.
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
index e20a660..bd9ccdf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
@@ -23,7 +23,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// Session for the cache store operations. The main purpose of cache store session
/// is to hold context between multiple store invocations whenever in transaction. For example,
/// you can save current database connection in the session <see cref="Properties"/> map. You can then
- /// commit this connection in the <see cref="ICacheStore.SessionEnd(bool)"/> method.
+ /// commit this connection in the <see cref="ICacheStore{K,V}.SessionEnd(bool)"/> method.
/// </summary>
public interface ICacheStoreSession
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
index 64c0f9e..d18040f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
@@ -34,7 +34,7 @@ namespace Apache.Ignite.Core.Datastream
/// <para />
/// Also note that <c>IDataStreamer</c> is not the only way to load data into cache.
/// Alternatively you can use
- /// <see cref="ICacheStore.LoadCache(Action{object, object}, object[])"/>
+ /// <see cref="ICacheStore{K, V}.LoadCache(Action{K, V}, object[])"/>
/// method to load data from underlying data store. You can also use standard cache
/// <c>put</c> and <c>putAll</c> operations as well, but they most likely will not perform
/// as well as this class for loading data. And finally, data can be loaded from underlying
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
index befe72b..f728e2b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
@@ -17,74 +17,37 @@
namespace Apache.Ignite.Core.Impl.Cache.Store
{
- using System.Collections;
+ using System;
using System.Diagnostics;
- using System.IO;
- using Apache.Ignite.Core.Binary;
+ using System.Globalization;
+ using System.Linq;
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary;
- using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Resource;
+ using Apache.Ignite.Core.Impl.Memory;
/// <summary>
- /// Interop cache store.
+ /// Interop cache store, delegates to generic <see cref="CacheStoreInternal{TK,TV}"/> wrapper.
/// </summary>
internal class CacheStore
{
- /** */
- private const byte OpLoadCache = 0;
-
- /** */
- private const byte OpLoad = 1;
-
- /** */
- private const byte OpLoadAll = 2;
-
- /** */
- private const byte OpPut = 3;
-
- /** */
- private const byte OpPutAll = 4;
-
- /** */
- private const byte OpRmv = 5;
-
- /** */
- private const byte OpRmvAll = 6;
-
- /** */
- private const byte OpSesEnd = 7;
-
- /** */
- private readonly bool _convertBinary;
-
/** Store. */
- private readonly ICacheStore _store;
-
- /** Session. */
- private readonly CacheStoreSessionProxy _sesProxy;
+ private readonly ICacheStoreInternal _store;
/** */
private readonly long _handle;
-
+
/// <summary>
/// Initializes a new instance of the <see cref="CacheStore" /> class.
/// </summary>
/// <param name="store">Store.</param>
- /// <param name="convertBinary">Whether to convert binary objects.</param>
/// <param name="registry">The handle registry.</param>
- private CacheStore(ICacheStore store, bool convertBinary, HandleRegistry registry)
+ private CacheStore(ICacheStoreInternal store, HandleRegistry registry)
{
Debug.Assert(store != null);
_store = store;
- _convertBinary = convertBinary;
-
- _sesProxy = new CacheStoreSessionProxy();
-
- ResourceProcessor.InjectStoreSession(store, _sesProxy);
_handle = registry.AllocateCritical(this);
}
@@ -97,7 +60,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Store
/// <returns>
/// Interop cache store.
/// </returns>
- internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
+ public static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
{
using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
{
@@ -109,7 +72,14 @@ namespace Apache.Ignite.Core.Impl.Cache.Store
ICacheStore store;
if (factory != null)
+ {
store = factory.CreateInstance();
+
+ if (store == null)
+ {
+ throw new IgniteException("Cache store factory should not return null: " + factory.GetType());
+ }
+ }
else
{
var className = reader.ReadString();
@@ -118,8 +88,13 @@ namespace Apache.Ignite.Core.Impl.Cache.Store
store = IgniteUtils.CreateInstance<ICacheStore>(className, propertyMap);
}
+ var iface = GetCacheStoreInterface(store);
- return new CacheStore(store, convertBinary, registry);
+ var storeType = typeof(CacheStoreInternal<,>).MakeGenericType(iface.GetGenericArguments());
+
+ var storeInt = (ICacheStoreInternal)Activator.CreateInstance(storeType, store, convertBinary);
+
+ return new CacheStore(storeInt, registry);
}
}
@@ -137,7 +112,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Store
/// <param name="grid">Grid.</param>
public void Init(Ignite grid)
{
- ResourceProcessor.Inject(_store, grid);
+ _store.Init(grid);
}
/// <summary>
@@ -147,148 +122,36 @@ namespace Apache.Ignite.Core.Impl.Cache.Store
/// <param name="grid">Grid.</param>
/// <returns>Invocation result.</returns>
/// <exception cref="IgniteException">Invalid operation type: + opType</exception>
- public int Invoke(IBinaryStream stream, Ignite grid)
+ public long Invoke(PlatformMemoryStream stream, Ignite grid)
{
- IBinaryReader reader = grid.Marshaller.StartUnmarshal(stream,
- _convertBinary ? BinaryMode.Deserialize : BinaryMode.ForceBinary);
-
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- int opType = rawReader.ReadByte();
-
- // Setup cache session for this invocation.
- long sesId = rawReader.ReadLong();
-
- CacheStoreSession ses = grid.HandleRegistry.Get<CacheStoreSession>(sesId, true);
-
- ses.CacheName = rawReader.ReadString();
-
- _sesProxy.SetSession(ses);
+ return _store.Invoke(stream, grid);
+ }
+
+ /// <summary>
+ /// Gets the generic <see cref="ICacheStore{TK,TV}"/> interface type.
+ /// </summary>
+ private static Type GetCacheStoreInterface(ICacheStore store)
+ {
+ var ifaces = store.GetType().GetInterfaces()
+ .Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICacheStore<,>))
+ .ToArray();
- try
+ if (ifaces.Length == 0)
{
- // Perform operation.
- switch (opType)
- {
- case OpLoadCache:
- {
- var args = rawReader.ReadArray<object>();
-
- stream.Seek(0, SeekOrigin.Begin);
-
- int cnt = 0;
- stream.WriteInt(cnt); // Reserve space for count.
-
- var writer = grid.Marshaller.StartMarshal(stream);
-
- _store.LoadCache((k, v) =>
- {
- lock (writer) // User-defined store can be multithreaded.
- {
- writer.WithDetach(w =>
- {
- w.WriteObject(k);
- w.WriteObject(v);
- });
-
- cnt++;
- }
- }, args);
-
- stream.WriteInt(0, cnt);
-
- grid.Marshaller.FinishMarshal(writer);
-
- break;
- }
-
- case OpLoad:
- {
- var val = _store.Load(rawReader.ReadObject<object>());
-
- stream.Seek(0, SeekOrigin.Begin);
-
- var writer = grid.Marshaller.StartMarshal(stream);
-
- writer.WriteObject(val);
-
- grid.Marshaller.FinishMarshal(writer);
-
- break;
- }
-
- case OpLoadAll:
- {
- var keys = rawReader.ReadCollection();
-
- var result = _store.LoadAll(keys);
-
- stream.Seek(0, SeekOrigin.Begin);
-
- stream.WriteInt(result.Count);
-
- var writer = grid.Marshaller.StartMarshal(stream);
-
- foreach (DictionaryEntry entry in result)
- {
- var entry0 = entry; // Copy modified closure.
-
- writer.WithDetach(w =>
- {
- w.WriteObject(entry0.Key);
- w.WriteObject(entry0.Value);
- });
- }
-
- grid.Marshaller.FinishMarshal(writer);
-
- break;
- }
-
- case OpPut:
- _store.Write(rawReader.ReadObject<object>(), rawReader.ReadObject<object>());
-
- break;
-
- case OpPutAll:
- var size = rawReader.ReadInt();
-
- var dict = new Hashtable(size);
-
- for (int i = 0; i < size; i++)
- dict[rawReader.ReadObject<object>()] = rawReader.ReadObject<object>();
-
- _store.WriteAll(dict);
-
- break;
-
- case OpRmv:
- _store.Delete(rawReader.ReadObject<object>());
-
- break;
-
- case OpRmvAll:
- _store.DeleteAll(rawReader.ReadCollection());
-
- break;
-
- case OpSesEnd:
- grid.HandleRegistry.Release(sesId);
-
- _store.SessionEnd(rawReader.ReadBoolean());
-
- break;
-
- default:
- throw new IgniteException("Invalid operation type: " + opType);
- }
-
- return 0;
+ throw new IgniteException(string.Format(
+ CultureInfo.InvariantCulture, "Cache store should implement generic {0} interface: {1}",
+ typeof(ICacheStore<,>), store.GetType()));
}
- finally
+
+ if (ifaces.Length > 1)
{
- _sesProxy.ClearSession();
+ throw new IgniteException(string.Format(
+ CultureInfo.InvariantCulture, "Cache store should not implement generic {0} " +
+ "interface more than once: {1}",
+ typeof(ICacheStore<,>), store.GetType()));
}
+
+ return ifaces[0];
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreInternal.cs
new file mode 100644
index 0000000..f147579
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreInternal.cs
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Cache.Store
+{
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.IO;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Store;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Resource;
+
+ /// <summary>
+ /// Generic cache store wrapper.
+ /// </summary>
+ internal class CacheStoreInternal<TK, TV> : ICacheStoreInternal
+ {
+ /** */
+ private const byte OpLoadCache = 0;
+
+ /** */
+ private const byte OpLoad = 1;
+
+ /** */
+ private const byte OpLoadAll = 2;
+
+ /** */
+ private const byte OpPut = 3;
+
+ /** */
+ private const byte OpPutAll = 4;
+
+ /** */
+ private const byte OpRmv = 5;
+
+ /** */
+ private const byte OpRmvAll = 6;
+
+ /** */
+ private const byte OpSesEnd = 7;
+
+ /** */
+ private readonly bool _convertBinary;
+
+ /** User store. */
+ private readonly ICacheStore<TK, TV> _store;
+
+ /** Session. */
+ private readonly CacheStoreSessionProxy _sesProxy;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CacheStoreInternal{TK,TV}"/> class.
+ /// </summary>
+ public CacheStoreInternal(ICacheStore<TK, TV> store, bool convertBinary)
+ {
+ Debug.Assert(store != null);
+
+ _store = store;
+
+ _convertBinary = convertBinary;
+
+ _sesProxy = new CacheStoreSessionProxy();
+
+ ResourceProcessor.InjectStoreSession(store, _sesProxy);
+ }
+
+ /// <summary>
+ /// Initializes this instance with a grid.
+ /// </summary>
+ /// <param name="grid">Grid.</param>
+ public void Init(Ignite grid)
+ {
+ ResourceProcessor.Inject(_store, grid);
+ }
+
+ /// <summary>
+ /// Invokes a store operation.
+ /// </summary>
+ /// <param name="stream">Input stream.</param>
+ /// <param name="grid">Grid.</param>
+ /// <returns>Invocation result.</returns>
+ /// <exception cref="IgniteException">Invalid operation type: + opType</exception>
+ public int Invoke(IBinaryStream stream, Ignite grid)
+ {
+ IBinaryReader reader = grid.Marshaller.StartUnmarshal(stream,
+ _convertBinary ? BinaryMode.Deserialize : BinaryMode.ForceBinary);
+
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ int opType = rawReader.ReadByte();
+
+ // Setup cache session for this invocation.
+ long sesId = rawReader.ReadLong();
+
+ CacheStoreSession ses = grid.HandleRegistry.Get<CacheStoreSession>(sesId, true);
+
+ ses.CacheName = rawReader.ReadString();
+
+ _sesProxy.SetSession(ses);
+
+ try
+ {
+ // Perform operation.
+ switch (opType)
+ {
+ case OpLoadCache:
+ {
+ var args = rawReader.ReadArray<object>();
+
+ stream.Seek(0, SeekOrigin.Begin);
+
+ int cnt = 0;
+ stream.WriteInt(cnt); // Reserve space for count.
+
+ var writer = grid.Marshaller.StartMarshal(stream);
+
+ _store.LoadCache((k, v) =>
+ {
+ lock (writer) // User-defined store can be multithreaded.
+ {
+ writer.WithDetach(w =>
+ {
+ w.WriteObject(k);
+ w.WriteObject(v);
+ });
+
+ cnt++;
+ }
+ }, args);
+
+ stream.WriteInt(0, cnt);
+
+ grid.Marshaller.FinishMarshal(writer);
+
+ break;
+ }
+
+ case OpLoad:
+ {
+ var val = _store.Load(rawReader.ReadObject<TK>());
+
+ stream.Seek(0, SeekOrigin.Begin);
+
+ var writer = grid.Marshaller.StartMarshal(stream);
+
+ writer.WriteObject(val);
+
+ grid.Marshaller.FinishMarshal(writer);
+
+ break;
+ }
+
+ case OpLoadAll:
+ {
+ // We can't do both read and write lazily because stream is reused.
+ // Read keys non-lazily, write result lazily.
+ var keys = ReadAllKeys(rawReader);
+
+ var result = _store.LoadAll(keys);
+
+ stream.Seek(0, SeekOrigin.Begin);
+
+ int cnt = 0;
+ stream.WriteInt(cnt); // Reserve space for count.
+
+ var writer = grid.Marshaller.StartMarshal(stream);
+
+ foreach (var entry in result)
+ {
+ var entry0 = entry; // Copy modified closure.
+
+ writer.WithDetach(w =>
+ {
+ w.WriteObject(entry0.Key);
+ w.WriteObject(entry0.Value);
+ });
+
+ cnt++;
+ }
+
+ stream.WriteInt(0, cnt);
+
+ grid.Marshaller.FinishMarshal(writer);
+
+ break;
+ }
+
+ case OpPut:
+ _store.Write(rawReader.ReadObject<TK>(), rawReader.ReadObject<TV>());
+
+ break;
+
+ case OpPutAll:
+ _store.WriteAll(ReadPairs(rawReader));
+
+ break;
+
+ case OpRmv:
+ _store.Delete(rawReader.ReadObject<TK>());
+
+ break;
+
+ case OpRmvAll:
+ _store.DeleteAll(ReadKeys(rawReader));
+
+ break;
+
+ case OpSesEnd:
+ grid.HandleRegistry.Release(sesId);
+
+ _store.SessionEnd(rawReader.ReadBoolean());
+
+ break;
+
+ default:
+ throw new IgniteException("Invalid operation type: " + opType);
+ }
+
+ return 0;
+ }
+ finally
+ {
+ _sesProxy.ClearSession();
+ }
+ }
+
+ /// <summary>
+ /// Reads key-value pairs.
+ /// </summary>
+ private static IEnumerable<KeyValuePair<TK, TV>> ReadPairs(IBinaryRawReader rawReader)
+ {
+ var size = rawReader.ReadInt();
+
+ for (var i = 0; i < size; i++)
+ {
+ yield return new KeyValuePair<TK, TV>(rawReader.ReadObject<TK>(), rawReader.ReadObject<TV>());
+ }
+ }
+
+ /// <summary>
+ /// Reads the keys.
+ /// </summary>
+ private static IEnumerable<TK> ReadKeys(IBinaryRawReader reader)
+ {
+ var cnt = reader.ReadInt();
+
+ for (var i = 0; i < cnt; i++)
+ {
+ yield return reader.ReadObject<TK>();
+ }
+ }
+ /// <summary>
+ /// Reads the keys.
+ /// </summary>
+ private static ICollection<TK> ReadAllKeys(IBinaryRawReader reader)
+ {
+ var cnt = reader.ReadInt();
+ var res = new List<TK>(cnt);
+
+ for (var i = 0; i < cnt; i++)
+ {
+ res.Add(reader.ReadObject<TK>());
+ }
+
+ return res;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/ICacheStoreInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/ICacheStoreInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/ICacheStoreInternal.cs
new file mode 100644
index 0000000..7ec44d9
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/ICacheStoreInternal.cs
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Cache.Store
+{
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary.IO;
+
+ /// <summary>
+ /// Provides a non-generic way to work with <see cref="CacheStoreInternal{TK, TV}"/>.
+ /// </summary>
+ internal interface ICacheStoreInternal
+ {
+ /// <summary>
+ /// Invokes a store operation.
+ /// </summary>
+ /// <param name="stream">Input stream.</param>
+ /// <param name="grid">Grid.</param>
+ /// <returns>Invocation result.</returns>
+ /// <exception cref="IgniteException">Invalid operation type: + opType</exception>
+ int Invoke(IBinaryStream stream, Ignite grid);
+
+ /// <summary>
+ /// Initializes this instance with a grid.
+ /// </summary>
+ /// <param name="grid">Grid.</param>
+ void Init(Ignite grid);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
index 62da647..6915d79 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
@@ -59,6 +59,7 @@ namespace Apache.Ignite.Examples.Datagrid
Name = CacheName,
ReadThrough = true,
WriteThrough = true,
+ KeepBinaryInStore = false, // Cache store works with deserialized data.
CacheStoreFactory = new EmployeeStoreFactory()
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/eab8334b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
index 7049011..9eb6539 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.ExamplesDll.Datagrid
{
using System;
- using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Apache.Ignite.Core.Cache;
@@ -28,22 +27,22 @@ namespace Apache.Ignite.ExamplesDll.Datagrid
/// <summary>
/// Example cache store implementation.
/// </summary>
- public class EmployeeStore : CacheStoreAdapter
+ public class EmployeeStore : CacheStoreAdapter<int, Employee>
{
/// <summary>
/// Dictionary representing the store.
/// </summary>
- private readonly ConcurrentDictionary<object, object> _db = new ConcurrentDictionary<object, object>(
- new List<KeyValuePair<object, object>>
+ private readonly ConcurrentDictionary<int, Employee> _db = new ConcurrentDictionary<int, Employee>(
+ new List<KeyValuePair<int, Employee>>
{
- new KeyValuePair<object, object>(1, new Employee(
+ new KeyValuePair<int, Employee>(1, new Employee(
"Allison Mathis",
25300,
new Address("2702 Freedom Lane, San Francisco, CA", 94109),
new List<string> {"Development"}
)),
- new KeyValuePair<object, object>(2, new Employee(
+ new KeyValuePair<int, Employee>(2, new Employee(
"Breana Robbin",
6500,
new Address("3960 Sundown Lane, Austin, TX", 78130),
@@ -57,7 +56,7 @@ namespace Apache.Ignite.ExamplesDll.Datagrid
/// </summary>
/// <param name="act">Action that loads a cache entry.</param>
/// <param name="args">Optional arguments.</param>
- public override void LoadCache(Action<object, object> act, params object[] args)
+ public override void LoadCache(Action<int, Employee> act, params object[] args)
{
// Iterate over whole underlying store and call act on each entry to load it into the cache.
foreach (var entry in _db)
@@ -72,9 +71,9 @@ namespace Apache.Ignite.ExamplesDll.Datagrid
/// <returns>
/// A map of key, values to be stored in the cache.
/// </returns>
- public override IDictionary LoadAll(ICollection keys)
+ public override IEnumerable<KeyValuePair<int, Employee>> LoadAll(IEnumerable<int> keys)
{
- var result = new Dictionary<object, object>();
+ var result = new Dictionary<int, Employee>();
foreach (var key in keys)
result[key] = Load(key);
@@ -88,9 +87,9 @@ namespace Apache.Ignite.ExamplesDll.Datagrid
/// </summary>
/// <param name="key">Key to load.</param>
/// <returns>Loaded value</returns>
- public override object Load(object key)
+ public override Employee Load(int key)
{
- object val;
+ Employee val;
_db.TryGetValue(key, out val);
@@ -102,7 +101,7 @@ namespace Apache.Ignite.ExamplesDll.Datagrid
/// </summary>
/// <param name="key">Key to write.</param>
/// <param name="val">Value to write.</param>
- public override void Write(object key, object val)
+ public override void Write(int key, Employee val)
{
_db[key] = val;
}
@@ -111,9 +110,9 @@ namespace Apache.Ignite.ExamplesDll.Datagrid
/// Delete cache entry form store.
/// </summary>
/// <param name="key">Key to delete.</param>
- public override void Delete(object key)
+ public override void Delete(int key)
{
- object val;
+ Employee val;
_db.TryRemove(key, out val);
}
[14/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index b39dabc..20bd9eb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -711,6 +711,26 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.put("key1", 1);
cache.put("key2", 2);
+ IgniteFuture<Integer> fut1 = cache.getAsync("key1");
+
+ IgniteFuture<Integer> fut2 = cache.getAsync("key2");
+
+ IgniteFuture<Integer> fut3 = cache.getAsync("wrongKey");
+
+ assert fut1.get() == 1;
+ assert fut2.get() == 2;
+ assert fut3.get() == null;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testGetAsyncOld() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
cacheAsync.get("key1");
@@ -730,6 +750,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert fut3.get() == null;
}
+
/**
* @throws Exception In case of error.
*/
@@ -963,6 +984,33 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
public void testGetAllAsync() throws Exception {
final IgniteCache<String, Integer> cache = jcache();
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ cache.getAllAsync(null);
+
+ return null;
+ }
+ }, NullPointerException.class, null);
+
+ IgniteFuture<Map<String, Integer>> fut2 = cache.getAllAsync(Collections.<String>emptySet());
+
+ IgniteFuture<Map<String, Integer>> fut3 = cache.getAllAsync(ImmutableSet.of("key1", "key2"));
+
+ assert fut2.get().isEmpty();
+ assert fut3.get().size() == 2 : "Invalid map: " + fut3.get();
+ assert fut3.get().get("key1") == 1;
+ assert fut3.get().get("key2") == 2;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testGetAllAsyncOld() throws Exception {
+ final IgniteCache<String, Integer> cache = jcache();
+
final IgniteCache<String, Integer> cacheAsync = cache.withAsync();
cache.put("key1", 1);
@@ -1581,7 +1629,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
- public void testGetAndPutAsync() throws Exception {
+ public void testGetAndPutAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -1607,7 +1655,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
- public void testPutAsync0() throws Exception {
+ public void testGetAndPutAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ IgniteFuture<Integer> fut1 = cache.getAndPutAsync("key1", 10);
+
+ IgniteFuture<Integer> fut2 = cache.getAndPutAsync("key2", 11);
+
+ assertEquals((Integer)1, fut1.get(5000));
+ assertEquals((Integer)2, fut2.get(5000));
+
+ assertEquals((Integer)10, cache.get("key1"));
+ assertEquals((Integer)11, cache.get("key2"));
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testPutAsyncOld0() throws Exception {
IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
cacheAsync.getAndPut("key1", 0);
@@ -1623,9 +1691,23 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @throws Exception In case of error.
+ */
+ public void testPutAsync0() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteFuture<Integer> fut1 = cache.getAndPutAsync("key1", 0);
+
+ IgniteFuture<Integer> fut2 = cache.getAndPutAsync("key2", 1);
+
+ assert fut1.get(5000) == null;
+ assert fut2.get(5000) == null;
+ }
+
+ /**
* @throws Exception If failed.
*/
- public void testInvokeAsync() throws Exception {
+ public void testInvokeAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
cache.put("key2", 1);
@@ -1660,6 +1742,33 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception If failed.
*/
+ public void testInvokeAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key2", 1);
+ cache.put("key3", 3);
+
+ IgniteFuture<?> fut0 = cache.invokeAsync("key1", INCR_PROCESSOR);
+
+ IgniteFuture<?> fut1 = cache.invokeAsync("key2", INCR_PROCESSOR);
+
+ IgniteFuture<?> fut2 = cache.invokeAsync("key3", RMV_PROCESSOR);
+
+ fut0.get();
+ fut1.get();
+ fut2.get();
+
+ assertEquals((Integer)1, cache.get("key1"));
+ assertEquals((Integer)2, cache.get("key2"));
+ assertNull(cache.get("key3"));
+
+ for (int i = 0; i < gridCount(); i++)
+ assertNull(jcache(i).localPeek("key3", ONHEAP));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testInvoke() throws Exception {
final IgniteCache<String, Integer> cache = jcache();
@@ -1755,7 +1864,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception If failed.
*/
- public void testPutAsync() throws Exception {
+ public void testPutAsyncOld() throws Exception {
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
@@ -1798,6 +1907,45 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @throws Exception If failed.
+ */
+ public void testPutAsync() throws Exception {
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ jcache().put("key2", 1);
+
+ IgniteFuture<?> fut1 = jcache().putAsync("key1", 10);
+
+ IgniteFuture<?> fut2 = jcache().putAsync("key2", 11);
+
+ IgniteFuture<Void> f = null;
+
+ if (tx != null)
+ f = tx.commitAsync();
+
+ assertNull(fut1.get());
+ assertNull(fut2.get());
+
+ try {
+ if (f != null)
+ f.get();
+ } catch (Throwable t) {
+ assert false : "Unexpected exception " + t;
+ }
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ checkSize(F.asSet("key1", "key2"));
+
+ assert jcache().get("key1") == 10;
+ assert jcache().get("key2") == 11;
+ }
+
+ /**
* @throws Exception In case of error.
*/
public void testPutAll() throws Exception {
@@ -2045,7 +2193,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
- public void testPutAllAsync() throws Exception {
+ public void testPutAllAsyncOld() throws Exception {
Map<String, Integer> map = F.asMap("key1", 1, "key2", 2);
IgniteCache<String, Integer> cache = jcache();
@@ -2075,6 +2223,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
+ public void testPutAllAsync() throws Exception {
+ Map<String, Integer> map = F.asMap("key1", 1, "key2", 2);
+
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteFuture<?> f1 = cache.putAllAsync(map);
+
+ map.put("key1", 10);
+ map.put("key2", 20);
+
+ IgniteFuture<?> f2 = cache.putAllAsync(map);
+
+ assertNull(f2.get());
+ assertNull(f1.get());
+
+ checkSize(F.asSet("key1", "key2"));
+
+ assert cache.get("key1") == 10;
+ assert cache.get("key2") == 20;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testGetAndPutIfAbsent() throws Exception {
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
@@ -2152,7 +2324,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception If failed.
*/
- public void testGetAndPutIfAbsentAsync() throws Exception {
+ public void testGetAndPutIfAbsentAsyncOld() throws Exception {
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache<String, Integer> cache = jcache();
@@ -2224,6 +2396,67 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception If failed.
*/
+ public void testGetAndPutIfAbsentAsync() throws Exception {
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ IgniteCache<String, Integer> cache = jcache();
+
+
+ try {
+ IgniteFuture<Integer> fut1 = cache.getAndPutIfAbsentAsync("key", 1);
+
+ assertNull(fut1.get());
+ assertEquals((Integer)1, cache.get("key"));
+
+ IgniteFuture<Integer> fut2 = cache.getAndPutIfAbsentAsync("key", 2);
+
+ assertEquals((Integer)1, fut2.get());
+ assertEquals((Integer)1, cache.get("key"));
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ // Check swap.
+ cache.put("key2", 1);
+
+ cache.localEvict(Collections.singleton("key2"));
+
+ assertEquals((Integer)1, cache.getAndPutIfAbsentAsync("key2", 3).get());
+
+ // Check db.
+ if (!isMultiJvm()) {
+ storeStgy.putToStore("key3", 3);
+
+ assertEquals((Integer)3, cache.getAndPutIfAbsentAsync("key3", 4).get());
+ }
+
+ cache.localEvict(Collections.singleton("key2"));
+
+ // Same checks inside tx.
+ tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ assertEquals(1, (int)cache.getAndPutIfAbsentAsync("key2", 3).get());
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals((Integer)1, cache.get("key2"));
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testPutIfAbsent() throws Exception {
IgniteCache<String, Integer> cache = jcache();
@@ -2285,7 +2518,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @param inTx In tx flag.
* @throws Exception If failed.
*/
- private void checkPutxIfAbsentAsync(boolean inTx) throws Exception {
+ private void checkPutxIfAbsentAsyncOld(boolean inTx) throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2353,9 +2586,65 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @param inTx In tx flag.
+ * @throws Exception If failed.
+ */
+ private void checkPutxIfAbsentAsync(boolean inTx) throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteFuture<Boolean> fut1 = cache.putIfAbsentAsync("key", 1);
+
+ assert fut1.get();
+ assert cache.get("key") != null && cache.get("key") == 1;
+
+ IgniteFuture<Boolean> fut2 = cache.putIfAbsentAsync("key", 2);
+
+ assert !fut2.get();
+ assert cache.get("key") != null && cache.get("key") == 1;
+
+ // Check swap.
+ cache.put("key2", 1);
+
+ cache.localEvict(Collections.singleton("key2"));
+
+ assertFalse(cache.putIfAbsentAsync("key2", 3).get());
+
+ // Check db.
+ if (!isMultiJvm()) {
+ storeStgy.putToStore("key3", 3);
+
+ assertFalse(cache.putIfAbsentAsync("key3", 4).get());
+ }
+
+ cache.localEvict(Collections.singletonList("key2"));
+
+ // Same checks inside tx.
+ Transaction tx = inTx ? transactions().txStart() : null;
+
+ try {
+ assertFalse(cache.putIfAbsentAsync("key2", 3).get());
+
+ if (!isMultiJvm())
+ assertFalse(cache.putIfAbsentAsync("key3", 4).get());
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ assertEquals((Integer)1, cache.get("key2"));
+
+ if (!isMultiJvm())
+ assertEquals((Integer)3, cache.get("key3"));
+ }
+
+ /**
* @throws Exception In case of error.
*/
- public void testPutIfAbsentAsyncConcurrent() throws Exception {
+ public void testPutIfAbsentAsyncConcurrentOld() throws Exception {
IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
cacheAsync.putIfAbsent("key1", 1);
@@ -2371,6 +2660,20 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @throws Exception In case of error.
+ */
+ public void testPutIfAbsentAsyncConcurrent() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteFuture<Boolean> fut1 = cache.putIfAbsentAsync("key1", 1);
+
+ IgniteFuture<Boolean> fut2 = cache.putIfAbsentAsync("key2", 2);
+
+ assert fut1.get();
+ assert fut2.get();
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testGetAndReplace() throws Exception {
@@ -2461,26 +2764,168 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
public void testReplace() throws Exception {
IgniteCache<String, Integer> cache = jcache();
- cache.put("key", 1);
+ cache.put("key", 1);
+
+ assert cache.get("key") == 1;
+
+ assert cache.replace("key", 2);
+
+ assert cache.get("key") == 2;
+
+ assert !cache.replace("wrong", 2);
+
+ cache.localEvict(Collections.singleton("key"));
+
+ assert cache.replace("key", 4);
+
+ assert cache.get("key") == 4;
+
+ if (!isMultiJvm()) {
+ storeStgy.putToStore("key2", 5);
+
+ assert cache.replace("key2", 6);
+
+ assertEquals((Integer)6, cache.get("key2"));
+ }
+
+ cache.localEvict(Collections.singleton("key"));
+
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ assert cache.replace("key", 5);
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ assert cache.get("key") == 5;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetAndReplaceAsyncOld() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ IgniteCache<String, Integer> cacheAsync = cache.withAsync();
+
+ cache.put("key", 1);
+
+ assert cache.get("key") == 1;
+
+ cacheAsync.getAndReplace("key", 2);
+
+ assert cacheAsync.<Integer>future().get() == 1;
+
+ assert cache.get("key") == 2;
+
+ cacheAsync.getAndReplace("wrong", 0);
+
+ assert cacheAsync.future().get() == null;
+
+ assert cache.get("wrong") == null;
+
+ cacheAsync.replace("key", 0, 3);
+
+ assert !cacheAsync.<Boolean>future().get();
+
+ assert cache.get("key") == 2;
+
+ cacheAsync.replace("key", 0, 3);
+
+ assert !cacheAsync.<Boolean>future().get();
+
+ assert cache.get("key") == 2;
+
+ cacheAsync.replace("key", 2, 3);
+
+ assert cacheAsync.<Boolean>future().get();
+
+ assert cache.get("key") == 3;
+
+ cache.localEvict(Collections.singleton("key"));
+
+ cacheAsync.replace("key", 3, 4);
+
+ assert cacheAsync.<Boolean>future().get();
+
+ assert cache.get("key") == 4;
+
+ if (!isMultiJvm()) {
+ storeStgy.putToStore("key2", 5);
+
+ cacheAsync.replace("key2", 5, 6);
+
+ assert cacheAsync.<Boolean>future().get();
+
+ assertEquals((Integer)6, cache.get("key2"));
+ }
+
+ cache.localEvict(Collections.singleton("key"));
+
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+ try {
+ cacheAsync.replace("key", 4, 5);
+
+ assert cacheAsync.<Boolean>future().get();
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ assert cache.get("key") == 5;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetAndReplaceAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key", 1);
+
+ assert cache.get("key") == 1;
+
+ assert cache.getAndReplaceAsync("key", 2).get() == 1;
+
+ assert cache.get("key") == 2;
+
+ assert cache.getAndReplaceAsync("wrong", 0).get() == null;
+
+ assert cache.get("wrong") == null;
+
+ assert !cache.replaceAsync("key", 0, 3).get();
- assert cache.get("key") == 1;
+ assert cache.get("key") == 2;
- assert cache.replace("key", 2);
+ assert !cache.replaceAsync("key", 0, 3).get();
assert cache.get("key") == 2;
- assert !cache.replace("wrong", 2);
+ assert cache.replaceAsync("key", 2, 3).get();
+
+ assert cache.get("key") == 3;
cache.localEvict(Collections.singleton("key"));
- assert cache.replace("key", 4);
+ assert cache.replaceAsync("key", 3, 4).get();
assert cache.get("key") == 4;
if (!isMultiJvm()) {
storeStgy.putToStore("key2", 5);
- assert cache.replace("key2", 6);
+ assert cache.replaceAsync("key2", 5, 6).get();
assertEquals((Integer)6, cache.get("key2"));
}
@@ -2490,7 +2935,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
- assert cache.replace("key", 5);
+ assert cache.replaceAsync("key", 4, 5).get();
if (tx != null)
tx.commit();
@@ -2506,7 +2951,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception If failed.
*/
- public void testGetAndReplaceAsync() throws Exception {
+ public void testReplacexAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2515,39 +2960,21 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert cache.get("key") == 1;
- cacheAsync.getAndReplace("key", 2);
-
- assert cacheAsync.<Integer>future().get() == 1;
-
- assert cache.get("key") == 2;
-
- cacheAsync.getAndReplace("wrong", 0);
-
- assert cacheAsync.future().get() == null;
-
- assert cache.get("wrong") == null;
+ cacheAsync.replace("key", 2);
- cacheAsync.replace("key", 0, 3);
+ assert cacheAsync.<Boolean>future().get();
- assert !cacheAsync.<Boolean>future().get();
+ info("Finished replace.");
- assert cache.get("key") == 2;
+ assertEquals((Integer)2, cache.get("key"));
- cacheAsync.replace("key", 0, 3);
+ cacheAsync.replace("wrond", 2);
assert !cacheAsync.<Boolean>future().get();
- assert cache.get("key") == 2;
-
- cacheAsync.replace("key", 2, 3);
-
- assert cacheAsync.<Boolean>future().get();
-
- assert cache.get("key") == 3;
-
cache.localEvict(Collections.singleton("key"));
- cacheAsync.replace("key", 3, 4);
+ cacheAsync.replace("key", 4);
assert cacheAsync.<Boolean>future().get();
@@ -2556,11 +2983,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
if (!isMultiJvm()) {
storeStgy.putToStore("key2", 5);
- cacheAsync.replace("key2", 5, 6);
+ cacheAsync.replace("key2", 6);
assert cacheAsync.<Boolean>future().get();
- assertEquals((Integer)6, cache.get("key2"));
+ assert cache.get("key2") == 6;
}
cache.localEvict(Collections.singleton("key"));
@@ -2568,7 +2995,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
- cacheAsync.replace("key", 4, 5);
+ cacheAsync.replace("key", 5);
assert cacheAsync.<Boolean>future().get();
@@ -2589,38 +3016,28 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
public void testReplacexAsync() throws Exception {
IgniteCache<String, Integer> cache = jcache();
- IgniteCache<String, Integer> cacheAsync = cache.withAsync();
-
cache.put("key", 1);
assert cache.get("key") == 1;
- cacheAsync.replace("key", 2);
-
- assert cacheAsync.<Boolean>future().get();
+ assert cache.replaceAsync("key", 2).get();
info("Finished replace.");
assertEquals((Integer)2, cache.get("key"));
- cacheAsync.replace("wrond", 2);
-
- assert !cacheAsync.<Boolean>future().get();
+ assert !cache.replaceAsync("wrond", 2).get();
cache.localEvict(Collections.singleton("key"));
- cacheAsync.replace("key", 4);
-
- assert cacheAsync.<Boolean>future().get();
+ assert cache.replaceAsync("key", 4).get();
assert cache.get("key") == 4;
if (!isMultiJvm()) {
storeStgy.putToStore("key2", 5);
- cacheAsync.replace("key2", 6);
-
- assert cacheAsync.<Boolean>future().get();
+ assert cache.replaceAsync("key2", 6).get();
assert cache.get("key2") == 6;
}
@@ -2630,9 +3047,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
- cacheAsync.replace("key", 5);
-
- assert cacheAsync.<Boolean>future().get();
+ assert cache.replaceAsync("key", 5).get();
if (tx != null)
tx.commit();
@@ -2769,9 +3184,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @throws Exception If failed.
+ */
+ public void testRemoveLoadAsync() throws Exception {
+ if (isMultiJvm())
+ return;
+
+ int cnt = 10;
+
+ Set<String> keys = new HashSet<>();
+
+ for (int i = 0; i < cnt; i++)
+ keys.add(String.valueOf(i));
+
+ jcache().removeAllAsync(keys).get();
+
+ for (String key : keys)
+ storeStgy.putToStore(key, Integer.parseInt(key));
+
+ for (int g = 0; g < gridCount(); g++)
+ grid(g).cache(null).localLoadCacheAsync(null).get();
+
+ for (int g = 0; g < gridCount(); g++) {
+ for (int i = 0; i < cnt; i++) {
+ String key = String.valueOf(i);
+
+ if (grid(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
+ assertEquals((Integer)i, peek(jcache(g), key));
+ else
+ assertNull(peek(jcache(g), key));
+ }
+ }
+ }
+
+ /**
* @throws Exception In case of error.
*/
- public void testRemoveAsync() throws Exception {
+ public void testRemoveAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2805,6 +3254,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
+ public void testRemoveAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ assert !cache.removeAsync("key1", 0).get();
+
+ assert cache.get("key1") != null && cache.get("key1") == 1;
+
+ assert cache.removeAsync("key1", 1).get();
+
+ assert cache.get("key1") == null;
+
+ assert cache.getAndRemoveAsync("key2").get() == 2;
+
+ assert cache.get("key2") == null;
+
+ assert cache.getAndRemoveAsync("key2").get() == null;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testRemove() throws Exception {
IgniteCache<String, Integer> cache = jcache();
@@ -2818,7 +3291,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
- public void testRemovexAsync() throws Exception {
+ public void testRemovexAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2839,6 +3312,21 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
+ public void testRemovexAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+
+ assert cache.removeAsync("key1").get();
+
+ assert cache.get("key1") == null;
+
+ assert !cache.removeAsync("key1").get();
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testGlobalRemoveAll() throws Exception {
globalRemoveAll(false);
}
@@ -2854,7 +3342,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @param async If {@code true} uses asynchronous operation.
* @throws Exception In case of error.
*/
- private void globalRemoveAll(boolean async) throws Exception {
+ private void globalRemoveAllOld(boolean async) throws Exception {
IgniteCache<String, Integer> cache = jcache();
cache.put("key1", 1);
@@ -2922,6 +3410,64 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @param async If {@code true} uses asynchronous operation.
+ * @throws Exception In case of error.
+ */
+ private void globalRemoveAll(boolean async) throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+ cache.put("key3", 3);
+
+ checkSize(F.asSet("key1", "key2", "key3"));
+
+ atomicClockModeDelay(cache);
+
+ if (async)
+ cache.removeAllAsync(F.asSet("key1", "key2")).get();
+ else
+ cache.removeAll(F.asSet("key1", "key2"));
+
+ checkSize(F.asSet("key3"));
+
+ checkContainsKey(false, "key1");
+ checkContainsKey(false, "key2");
+ checkContainsKey(true, "key3");
+
+ // Put values again.
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+ cache.put("key3", 3);
+
+ atomicClockModeDelay(cache);
+
+ if (async)
+ jcache(gridCount() > 1 ? 1 : 0).removeAllAsync().get();
+ else
+ jcache(gridCount() > 1 ? 1 : 0).removeAll();
+
+ assertEquals(0, cache.localSize());
+ long entryCnt = hugeRemoveAllEntryCount();
+
+ for (int i = 0; i < entryCnt; i++)
+ cache.put(String.valueOf(i), i);
+
+ for (int i = 0; i < entryCnt; i++)
+ assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i)));
+
+ atomicClockModeDelay(cache);
+
+ if (async)
+ cache.removeAllAsync().get();
+ else
+ cache.removeAll();
+
+ for (int i = 0; i < entryCnt; i++)
+ assertNull(cache.get(String.valueOf(i)));
+ }
+
+ /**
* @return Count of entries to be removed in removeAll() test.
*/
protected long hugeRemoveAllEntryCount() {
@@ -3012,7 +3558,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
- public void testRemoveAllAsync() throws Exception {
+ public void testRemoveAllAsyncOld() throws Exception {
IgniteCache<String, Integer> cache = jcache();
IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -3037,6 +3583,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @throws Exception In case of error.
*/
+ public void testRemoveAllAsync() throws Exception {
+ IgniteCache<String, Integer> cache = jcache();
+
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+ cache.put("key3", 3);
+
+ checkSize(F.asSet("key1", "key2", "key3"));
+
+ assertNull(cache.removeAllAsync(F.asSet("key1", "key2")).get());
+
+ checkSize(F.asSet("key3"));
+
+ checkContainsKey(false, "key1");
+ checkContainsKey(false, "key2");
+ checkContainsKey(true, "key3");
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
public void testLoadAll() throws Exception {
IgniteCache<String, Integer> cache = jcache();
@@ -3267,21 +3834,29 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testGlobalClearAll() throws Exception {
- globalClearAll(false);
+ globalClearAll(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGlobalClearAllAsyncOld() throws Exception {
+ globalClearAll(true, true);
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearAllAsync() throws Exception {
- globalClearAll(true);
+ globalClearAll(true, false);
}
/**
* @param async If {@code true} uses async method.
+ * @param oldAsync Use old async API.
* @throws Exception If failed.
*/
- protected void globalClearAll(boolean async) throws Exception {
+ protected void globalClearAll(boolean async, boolean oldAsync) throws Exception {
// Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
// because some of them were blocked due to having readers.
for (int i = 0; i < gridCount(); i++) {
@@ -3290,11 +3865,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
if (async) {
- IgniteCache<String, Integer> asyncCache = jcache().withAsync();
+ if(oldAsync) {
+ IgniteCache<String, Integer> asyncCache = jcache().withAsync();
- asyncCache.clear();
+ asyncCache.clear();
- asyncCache.future().get();
+ asyncCache.future().get();
+ } else
+ jcache().clearAsync().get();
}
else
jcache().clear();
@@ -4328,6 +4906,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @param key Key.
+ * @return Ignite instance for primary node.
*/
protected Ignite primaryIgnite(String key) {
ClusterNode node = grid(0).affinity(null).mapKeyToNode(key);
@@ -4356,6 +4935,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @param cache Cache.
* @param cnt Keys count.
+ * @param startFrom Begin value ofthe key.
* @return Collection of keys for which given cache is primary.
*/
protected List<String> primaryKeysForCache(IgniteCache<String, Integer> cache, int cnt, int startFrom) {
@@ -4771,36 +5351,51 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testGlobalClearKey() throws Exception {
- testGlobalClearKey(false, Arrays.asList("key25"));
+ testGlobalClearKey(false, Arrays.asList("key25"), false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGlobalClearKeyAsyncOld() throws Exception {
+ testGlobalClearKey(true, Arrays.asList("key25"), true);
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearKeyAsync() throws Exception {
- testGlobalClearKey(true, Arrays.asList("key25"));
+ testGlobalClearKey(true, Arrays.asList("key25"), false);
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearKeys() throws Exception {
- testGlobalClearKey(false, Arrays.asList("key25", "key100", "key150"));
+ testGlobalClearKey(false, Arrays.asList("key25", "key100", "key150"), false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGlobalClearKeysAsyncOld() throws Exception {
+ testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"), true);
}
/**
* @throws Exception If failed.
*/
public void testGlobalClearKeysAsync() throws Exception {
- testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"));
+ testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"), false);
}
/**
* @param async If {@code true} uses async method.
* @param keysToRmv Keys to remove.
+ * @param oldAsync Use old async API.
* @throws Exception If failed.
*/
- protected void testGlobalClearKey(boolean async, Collection<String> keysToRmv) throws Exception {
+ protected void testGlobalClearKey(boolean async, Collection<String> keysToRmv, boolean oldAsync) throws Exception {
// Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
// because some of them were blocked due to having readers.
for (int i = 0; i < 500; ++i) {
@@ -4812,14 +5407,22 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
if (async) {
- IgniteCache<String, Integer> asyncCache = jcache().withAsync();
+ if (oldAsync) {
+ IgniteCache<String, Integer> asyncCache = jcache().withAsync();
- if (keysToRmv.size() == 1)
- asyncCache.clear(F.first(keysToRmv));
- else
- asyncCache.clearAll(new HashSet<>(keysToRmv));
+ if (keysToRmv.size() == 1)
+ asyncCache.clear(F.first(keysToRmv));
+ else
+ asyncCache.clearAll(new HashSet<>(keysToRmv));
- asyncCache.future().get();
+ asyncCache.future().get();
+ } else {
+
+ if (keysToRmv.size() == 1)
+ jcache().clearAsync(F.first(keysToRmv)).get();
+ else
+ jcache().clearAllAsync(new HashSet<>(keysToRmv)).get();
+ }
}
else {
if (keysToRmv.size() == 1)
@@ -5437,21 +6040,22 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
- if (async)
- cache = cache.withAsync();
-
try (Transaction tx = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- Integer val0 = cache.get(keys.get(0));
+ Integer val0;
if (async)
- val0 = cache.<Integer>future().get();
+ val0 = cache.getAsync(keys.get(0)).get();
+ else
+ val0 = cache.get(keys.get(0));
assertEquals(0, val0.intValue());
- Map<String, Integer> allOutTx = cache.getAllOutTx(F.asSet(keys.get(1)));
+ Map<String, Integer> allOutTx;
if (async)
- allOutTx = cache.<Map<String, Integer>>future().get();
+ allOutTx = cache.getAllOutTxAsync(F.asSet(keys.get(1))).get();
+ else
+ allOutTx = cache.getAllOutTx(F.asSet(keys.get(1)));
assertEquals(1, allOutTx.size());
@@ -5484,13 +6088,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testTransformException() throws Exception {
- final IgniteCache<String, Integer> cache = jcache().withAsync();
-
- cache.invoke("key2", ERR_PROCESSOR);
+ final IgniteCache<String, Integer> cache = jcache();
assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- IgniteFuture fut = cache.future().chain(new IgniteClosure<IgniteFuture, Object>() {
+ IgniteFuture fut = cache.invokeAsync("key2", ERR_PROCESSOR).chain(new IgniteClosure<IgniteFuture, Object>() {
@Override public Object apply(IgniteFuture o) {
return o.get();
}
@@ -5554,27 +6156,32 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
IgniteCache<String, Integer> cache = jcache();
Ignite ignite = ignite(0);
- doTransformResourceInjection(ignite, cache);
- doTransformResourceInjection(ignite, cache.withAsync());
+ doTransformResourceInjection(ignite, cache, false, false);
+ doTransformResourceInjection(ignite, cache, true, false);
+ doTransformResourceInjection(ignite, cache, true, true);
if (txEnabled()) {
- doTransformResourceInjectionInTx(ignite, cache);
- doTransformResourceInjectionInTx(ignite, cache.withAsync());
+ doTransformResourceInjectionInTx(ignite, cache, false, false);
+ doTransformResourceInjectionInTx(ignite, cache, true, false);
+ doTransformResourceInjectionInTx(ignite, cache, true, true);
}
}
/**
* @param ignite Node.
* @param cache Cache.
+ * @param async Use async API.
+ * @param oldAsync Use old async API.
* @throws Exception If failed.
*/
- private void doTransformResourceInjectionInTx(Ignite ignite, IgniteCache<String, Integer> cache) throws Exception {
+ private void doTransformResourceInjectionInTx(Ignite ignite, IgniteCache<String, Integer> cache, boolean async,
+ boolean oldAsync) throws Exception {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
IgniteTransactions txs = ignite.transactions();
try (Transaction tx = txs.txStart(concurrency, isolation)) {
- doTransformResourceInjection(ignite, cache);
+ doTransformResourceInjection(ignite, cache, async, oldAsync);
tx.commit();
}
@@ -5585,9 +6192,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
/**
* @param ignite Node.
* @param cache Cache.
+ * @param async Use async API.
+ * @param oldAsync Use old async API.
* @throws Exception If failed.
*/
- private void doTransformResourceInjection(Ignite ignite, IgniteCache<String, Integer> cache) throws Exception {
+ private void doTransformResourceInjection(Ignite ignite, IgniteCache<String, Integer> cache, boolean async,
+ boolean oldAsync) throws Exception {
final Collection<ResourceType> required = Arrays.asList(ResourceType.IGNITE_INSTANCE,
ResourceType.CACHE_NAME,
ResourceType.LOGGER,
@@ -5600,11 +6210,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
UUID opId = evts.remoteListen(lsnr, null, EventType.EVT_CACHE_OBJECT_READ);
try {
- checkResourceInjectionOnInvoke(cache, required);
+ checkResourceInjectionOnInvoke(cache, required, async, oldAsync);
- checkResourceInjectionOnInvokeAll(cache, required);
+ checkResourceInjectionOnInvokeAll(cache, required, async, oldAsync);
- checkResourceInjectionOnInvokeAllMap(cache, required);
+ checkResourceInjectionOnInvokeAllMap(cache, required, async, oldAsync);
}
finally {
evts.stopRemoteListen(opId);
@@ -5616,9 +6226,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*
* @param cache Cache.
* @param required Expected injected resources.
+ * @param async Use async API.
+ * @param oldAsync Use old async API.
*/
private void checkResourceInjectionOnInvokeAllMap(IgniteCache<String, Integer> cache,
- Collection<ResourceType> required) {
+ Collection<ResourceType> required, boolean async, boolean oldAsync) {
Map<String, EntryProcessorResult<Integer>> results;
Map<String, EntryProcessor<String, Integer, Integer>> map = new HashMap<>();
@@ -5628,10 +6240,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
map.put(UUID.randomUUID().toString(), new ResourceInjectionEntryProcessor());
map.put(UUID.randomUUID().toString(), new ResourceInjectionEntryProcessor());
- results = cache.invokeAll(map);
+ if (async) {
+ if (oldAsync) {
+ IgniteCache<String, Integer> acache = cache.withAsync();
- if (cache.isAsync())
- results = cache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+ acache.invokeAll(map);
+
+ results = acache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+ }
+ else
+ results = cache.invokeAllAsync(map).get();
+ }
+ else
+ results = cache.invokeAll(map);
assertEquals(map.size(), results.size());
@@ -5648,19 +6269,31 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*
* @param cache Cache.
* @param required Expected injected resources.
+ * @param async Use async API.
+ * @param oldAsync Use old async API.
*/
private void checkResourceInjectionOnInvokeAll(IgniteCache<String, Integer> cache,
- Collection<ResourceType> required) {
+ Collection<ResourceType> required, boolean async, boolean oldAsync) {
Set<String> keys = new HashSet<>(Arrays.asList(UUID.randomUUID().toString(),
UUID.randomUUID().toString(),
UUID.randomUUID().toString(),
UUID.randomUUID().toString()));
- Map<String, EntryProcessorResult<Integer>> results = cache.invokeAll(keys,
- new ResourceInjectionEntryProcessor());
+ Map<String, EntryProcessorResult<Integer>> results;
+
+ if (async) {
+ if (oldAsync) {
+ IgniteCache<String, Integer> acache = cache.withAsync();
+
+ acache.invokeAll(keys, new ResourceInjectionEntryProcessor());
- if (cache.isAsync())
- results = cache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+ results = acache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+ }
+ else
+ results = cache.invokeAllAsync(keys, new ResourceInjectionEntryProcessor()).get();
+ }
+ else
+ results = cache.invokeAll(keys, new ResourceInjectionEntryProcessor());
assertEquals(keys.size(), results.size());
@@ -5677,13 +6310,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*
* @param cache Cache.
* @param required Expected injected resources.
+ * @param async Use async API.
+ * @param oldAsync Use old async API.
*/
private void checkResourceInjectionOnInvoke(IgniteCache<String, Integer> cache,
- Collection<ResourceType> required) {
+ Collection<ResourceType> required, boolean async, boolean oldAsync) {
String key = UUID.randomUUID().toString();
- Integer flags = cache.invoke(key, new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor());
+ Integer flags;
+
+ if (async) {
+ if (oldAsync) {
+ IgniteCache<String, Integer> acache = cache.withAsync();
+
+ acache.invoke(key, new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor());
+
+ flags = acache.<Integer>future().get();
+ }
+ else
+ flags = cache.invokeAsync(key,
+ new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor()).get();
+ }
+ else
+ flags = cache.invoke(key, new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor());
if (cache.isAsync())
flags = cache.<Integer>future().get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index 5ad7e5c..a858085 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -171,20 +171,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
public void testGetAndRemoveAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
-
for (int i = 0; i < KEY_CNT; i++)
cache.put(i, i);
assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
- for (int i = 0; i < KEY_CNT; i++) {
- cacheAsync.getAndRemove(i);
-
- IgniteFuture<Object> fut = cacheAsync.future();
-
- fut.get();
- }
+ for (int i = 0; i < KEY_CNT; i++)
+ cache.getAndRemoveAsync(i).get();
assert cache.localMetrics().getAverageRemoveTime() > 0;
}
@@ -194,7 +187,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testRemoveAsyncValAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
Integer key = 0;
@@ -210,9 +202,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
cache.put(key, key);
- cacheAsync.remove(key, key);
-
- IgniteFuture<Boolean> fut = cacheAsync.future();
+ IgniteFuture<Boolean> fut = cache.removeAsync(key, key);
assertTrue(fut.get());
@@ -265,7 +255,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testRemoveAllAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
Set<Integer> keys = new LinkedHashSet<>();
@@ -282,9 +271,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
- cacheAsync.removeAll(keys);
-
- IgniteFuture<?> fut = cacheAsync.future();
+ IgniteFuture<?> fut = cache.removeAllAsync(keys);
fut.get();
@@ -342,7 +329,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testGetAllAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
@@ -357,9 +343,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
keys.add(2);
keys.add(3);
- cacheAsync.getAll(keys);
-
- IgniteFuture<Map<Object, Object>> fut = cacheAsync.future();
+ IgniteFuture<Map<Object, Object>> fut = cache.getAllAsync(keys);
fut.get();
@@ -390,14 +374,11 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testPutAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
assertEquals(0, cache.localMetrics().getCachePuts());
- cacheAsync.put(1, 1);
-
- cacheAsync.future().get();
+ cache.putAsync(1, 1).get();
TimeUnit.MILLISECONDS.sleep(100L);
@@ -409,7 +390,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testGetAndPutAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
Integer key = null;
@@ -424,11 +404,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
- cacheAsync.getAndPut(key, key);
-
- IgniteFuture<?> fut = cacheAsync.future();
-
- fut.get();
+ cache.getAndPutAsync(key, key).get();
TimeUnit.MILLISECONDS.sleep(100L);
@@ -441,7 +417,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testPutIfAbsentAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
Integer key = null;
@@ -455,11 +430,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
assertEquals(0.0f, cache.localMetrics().getAveragePutTime());
- cacheAsync.putIfAbsent(key, key);
-
- IgniteFuture<Boolean> fut = cacheAsync.future();
-
- fut.get();
+ cache.putIfAbsentAsync(key, key).get();
TimeUnit.MILLISECONDS.sleep(100L);
@@ -471,7 +442,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
*/
public void testGetAndPutIfAbsentAsyncAvgTime() throws Exception {
IgniteCache<Object, Object> cache = grid(0).cache(null);
- IgniteCache<Object, Object> cacheAsync = cache.withAsync();
Integer key = null;
@@ -485,11 +455,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
assertEquals(0.0f, cache.localMetrics().getAveragePutTime());
- cacheAsync.getAndPutIfAbsent(key, key);
-
- IgniteFuture<?> fut = cacheAsync.future();
-
- fut.get();
+ cache.getAndPutIfAbsentAsync(key, key).get();
TimeUnit.MILLISECONDS.sleep(100L);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
index 84f4cc2..cebab2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.util.GridAtomicInteger;
import org.apache.ignite.internal.util.typedef.CI1;
@@ -57,13 +56,7 @@ public class GridCacheAsyncOperationsLimitSelfTest extends GridCacheAbstractSelf
cnt.incrementAndGet();
- IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
-
- cacheAsync.put("key" + i, i);
-
- IgniteFuture<?> fut = cacheAsync.future();
-
- fut.listen(new CI1<IgniteFuture<?>>() {
+ jcache().putAsync("key" + i, i).listen(new CI1<IgniteFuture<?>>() {
@Override public void apply(IgniteFuture<?> t) {
cnt.decrementAndGet();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
index 41232c0..589f910 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
@@ -342,11 +342,9 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
long submitTime1 = t0;
- IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode)).withAsync();
+ IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode));
- comp.execute(RequestTask.class, new Message(terminalId, nodeId));
-
- ComputeTaskFuture<Void> f1 = comp.future();
+ ComputeTaskFuture<Void> f1 = comp.executeAsync(RequestTask.class, new Message(terminalId, nodeId));
submitTime.setIfGreater(System.currentTimeMillis() - submitTime1);
@@ -354,9 +352,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
submitTime1 = System.currentTimeMillis();
- comp.execute(ResponseTask.class, new Message(terminalId, nodeId));
-
- ComputeTaskFuture<Void> f2 = comp.future();
+ ComputeTaskFuture<Void> f2 = comp.executeAsync(ResponseTask.class, new Message(terminalId, nodeId));
submitTime.setIfGreater(System.currentTimeMillis() - submitTime1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
index 73cd89d..26c69e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
@@ -254,18 +254,11 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
log.info("GetAsync 1.");
- IgniteCache<String, Integer> cacheAsync = cache.withAsync();
- if (needVer) {
- cacheAsync.getEntry(key);
-
- assertEquals((Integer)101, cacheAsync.<CacheEntry<String, Integer>>future().get().getValue());
- }
- else {
- cacheAsync.get(key);
-
- assertEquals((Integer)101, cacheAsync.<Integer>future().get());
- }
+ if (needVer)
+ assertEquals((Integer)101, cache.getEntryAsync(key).get().getValue());
+ else
+ assertEquals((Integer)101, cache.getAsync(key).get());
assertEquals(1, interceptor.invokeCnt.get());
@@ -303,8 +296,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
IgniteCache<String, Integer> cache = jcache(0);
- IgniteCache<String, Integer> cacheAsync = cache.withAsync();
-
Collection<CacheEntry<String, Integer>> c;
Map<String, Integer> map;
@@ -368,11 +359,8 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
if (needVer) {
if (j == 0)
c = cache.getEntries(keys);
- else {
- cacheAsync.getEntries(keys);
-
- c = cacheAsync.<Collection<CacheEntry<String, Integer>>>future().get();
- }
+ else
+ c = cache.getEntriesAsync(keys).get();
for (CacheEntry<String, Integer> e : c) {
int k = Integer.valueOf(e.getKey());
@@ -398,11 +386,8 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
else {
if (j == 0)
map = cache.getAll(keys);
- else {
- cacheAsync.getAll(keys);
-
- map = cacheAsync.<Map<String, Integer>>future().get();
- }
+ else
+ map = cache.getAllAsync(keys).get();
int i = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
index ac56d18..f3d2434 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
@@ -123,11 +123,7 @@ public class GridCacheMissingCommitVersionSelfTest extends GridCommonAbstractTes
for (Integer key : q) {
log.info("Trying to update " + key);
- IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
-
- asyncCache.put(key, 2);
-
- IgniteFuture<?> fut = asyncCache.future();
+ IgniteFuture<?> fut = cache.putAsync(key, 2);
try {
fut.get(5000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index 406194c..d700856 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -318,7 +318,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
final AtomicBoolean inputExhausted = new AtomicBoolean();
- IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter)).withAsync();
+ IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter));
for (Integer key : testKeys) {
dataChunk.add(key);
@@ -331,14 +331,12 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
log.info("Pushing data chunk [chunkNo=" + chunkCntr + "]");
- comp.execute(
+ ComputeTaskFuture<Void> fut = comp.executeAsync(
new GridCachePutAllTask(
runningWorkers.get(rnd.nextInt(runningWorkers.size())).cluster().localNode().id(),
CACHE_NAME),
dataChunk);
- ComputeTaskFuture<Void> fut = comp.future();
-
resQueue.put(fut); // Blocks if queue is full.
fut.listen(new CI1<IgniteFuture<Void>>() {
@@ -514,7 +512,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
final AtomicBoolean inputExhausted = new AtomicBoolean();
- IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter)).withAsync();
+ IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter));
for (Integer key : testKeys) {
ClusterNode mappedNode = master.affinity(CACHE_NAME).mapKeyToNode(key);
@@ -536,9 +534,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
log.info("Pushing data chunk [chunkNo=" + chunkCntr + "]");
- comp.execute(new GridCachePutAllTask(nodeId, CACHE_NAME), data);
-
- ComputeTaskFuture<Void> fut = comp.future();
+ ComputeTaskFuture<Void> fut = comp.executeAsync(new GridCachePutAllTask(nodeId, CACHE_NAME), data);
resQueue.put(fut); // Blocks if queue is full.
@@ -587,9 +583,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
}
for (Map.Entry<UUID, Collection<Integer>> entry : dataChunks.entrySet()) {
- comp.execute(new GridCachePutAllTask(entry.getKey(), CACHE_NAME), entry.getValue());
-
- ComputeTaskFuture<Void> fut = comp.future();
+ ComputeTaskFuture<Void> fut = comp.executeAsync(new GridCachePutAllTask(entry.getKey(), CACHE_NAME), entry.getValue());
resQueue.put(fut); // Blocks if queue is full.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
index 0eb8ccc..42bba79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
@@ -357,7 +357,6 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
try {
IgniteCache<Integer, TestValue> cache = g.cache(null);
- IgniteCache<Integer, TestValue> cacheAsync = cache.withAsync();
refs.add(new WeakReference<Object>(cacheContext(cache)));
@@ -365,9 +364,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
refs.add(new WeakReference<Object>(val));
- cacheAsync.putIfAbsent(0, val);
-
- cacheAsync.future().get();
+ cache.putIfAbsentAsync(0, val).get();
}
finally {
G.stop(g.name(), cancel);
@@ -393,7 +390,6 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
try {
IgniteCache<Integer, TestValue> cache = g.cache(null);
- IgniteCache<Integer, TestValue> cacheAsync = cache.withAsync();
refs.add(new WeakReference<Object>(cacheContext(cache)));
@@ -404,9 +400,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
refs.add(new WeakReference<Object>(val));
- cacheAsync.putIfAbsent(0, val);
-
- futs.add(cacheAsync.future());
+ futs.add(cache.putIfAbsentAsync(0, val));
}
for (IgniteFuture<?> fut : futs)
@@ -473,7 +467,6 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
try {
IgniteCache<Integer, TestValue> cache = g.cache(null);
- IgniteCache<Integer, TestValue> cacheAsync = cache.withAsync();
refs.add(new WeakReference<Object>(cacheContext(cache)));
@@ -484,9 +477,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
refs.add(new WeakReference<Object>(val));
- cacheAsync.put(i, val);
-
- cacheAsync.future().get();
+ cache.putAsync(i, val).get();
}
tx.commit();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
index a131307..dc357f1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetR
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
@@ -206,13 +207,11 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
@Override public Object call() throws Exception {
info("Start operation.");
- IgniteCache<Object, Object> cache = clientCache().withAsync();
-
- cache.getAndPut(1, 1);
+ IgniteFuture f = clientCache().getAndPutAsync(1, 1);
info("Stop operation.");
- return cache.future().get();
+ return f.get();
}
});
}
[24/50] [abbrv] ignite git commit: IGNITE-4827: Remove compatibility
logic for 1.x versions. This closes #1654.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/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 1f21fd2..9805a66 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
@@ -17,10 +17,6 @@
package org.apache.ignite.internal.processors.closure;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -70,7 +66,6 @@ import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.internal.util.worker.GridWorkerFuture;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteReducer;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.resources.LoadBalancerResource;
@@ -87,9 +82,6 @@ import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKe
*
*/
public class GridClosureProcessor extends GridProcessorAdapter {
- /** Ignite version in which binarylizable versions of closures were introduced. */
- public static final IgniteProductVersion BINARYLIZABLE_CLOSURES_SINCE = IgniteProductVersion.fromString("1.6.0");
-
/** Pool processor. */
private final PoolProcessor pools;
@@ -262,7 +254,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
case BROADCAST: {
for (ClusterNode n : nodes)
for (Runnable r : jobs)
- mapper.map(downgradeJobIfNeeded(job(r), n), n);
+ mapper.map(job(r), n);
break;
}
@@ -273,7 +265,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
ClusterNode n = lb.getBalancedNode(job, null);
- mapper.map(downgradeJobIfNeeded(job, n), n);
+ mapper.map(job, n);
}
break;
@@ -316,7 +308,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
case BROADCAST: {
for (ClusterNode n : nodes)
for (Callable<R> c : jobs)
- mapper.map(downgradeJobIfNeeded(job(c), n), n);
+ mapper.map(job(c), n);
break;
}
@@ -327,7 +319,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
ClusterNode n = lb.getBalancedNode(job, null);
- mapper.map(downgradeJobIfNeeded(job, n), n);
+ mapper.map(job, n);
}
break;
@@ -1018,7 +1010,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
private static <T, R> ComputeJob job(final IgniteClosure<T, R> job, @Nullable final T arg) {
A.notNull(job, "job");
- return job instanceof ComputeJobMasterLeaveAware ? new C1MLAV2<>(job, arg) : new C1V2<>(job, arg);
+ return job instanceof ComputeJobMasterLeaveAware ? new C1MLA<>(job, arg) : new C1<>(job, arg);
}
/**
@@ -1030,7 +1022,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
private static <R> ComputeJob job(final Callable<R> c) {
A.notNull(c, "job");
- return c instanceof ComputeJobMasterLeaveAware ? new C2MLAV2<>(c) : new C2V2<>(c);
+ return c instanceof ComputeJobMasterLeaveAware ? new C2MLA<>(c) : new C2<>(c);
}
/**
@@ -1042,46 +1034,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
private static ComputeJob job(final Runnable r) {
A.notNull(r, "job");
- return r instanceof ComputeJobMasterLeaveAware ? new C4MLAV2(r) : new C4V2(r);
- }
-
- /**
- * Downgrades provided job to older version if target does not support it.
- *
- * @param job Job.
- * @param node Node.
- * @return Provided or downgraded job.
- */
- private static ComputeJob downgradeJobIfNeeded(ComputeJob job, ClusterNode node) {
- A.notNull(job, "job");
-
- assert node != null;
-
- IgniteProductVersion nodeVer = node.version();
-
- if (nodeVer.compareTo(BINARYLIZABLE_CLOSURES_SINCE) >= 0)
- return job;
-
- if (job instanceof C1V2) {
- if (job instanceof C1MLAV2)
- return new C1MLA<>(((C1MLAV2)job).job, ((C1MLAV2)job).arg);
- else
- return new C1<>(((C1V2)job).job, ((C1V2)job).arg);
- }
- else if (job instanceof C2V2) {
- if (job instanceof C2MLAV2)
- return new C2MLA<>(((C2MLAV2)job).c);
- else
- return new C2<>(((C2V2)job).c);
- }
- else if (job instanceof C4V2) {
- if (job instanceof C4MLAV2)
- return new C4MLA(((C4MLAV2)job).r);
- else
- return new C4(((C4V2)job).r);
- }
-
- return job;
+ return r instanceof ComputeJobMasterLeaveAware ? new C4MLA(r) : new C4(r);
}
/**
@@ -1113,12 +1066,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** */
private boolean hadLocNode;
- /** */
- private byte[] closureBytes;
-
- /** */
- private IgniteClosure<?, ?> closure;
-
/**
* @param expJobCnt Expected Jobs count.
*/
@@ -1136,22 +1083,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
if (hadLocNode) {
Marshaller marsh = ctx.config().getMarshaller();
- if (job instanceof C1) {
- C1 c = (C1)job;
-
- if (closureBytes == null) {
- closure = c.job;
-
- closureBytes = U.marshal(marsh, c.job);
- }
-
- if (c.job == closure)
- c.job = U.unmarshal(marsh, closureBytes, U.resolveClassLoader(ctx.config()));
- else
- c.job = U.unmarshal(marsh, U.marshal(marsh, c.job), U.resolveClassLoader(ctx.config()));
- }
- else
- job = U.unmarshal(marsh, U.marshal(marsh, job), U.resolveClassLoader(ctx.config()));
+ job = U.unmarshal(marsh, U.marshal(marsh, job), U.resolveClassLoader(ctx.config()));
}
else
hadLocNode = true;
@@ -1351,7 +1283,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Void arg) {
- return Collections.singletonMap(downgradeJobIfNeeded(job(this.job), node), node);
+ return Collections.singletonMap(job(job), node);
}
/** {@inheritDoc} */
@@ -1415,7 +1347,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Void arg) {
- return Collections.singletonMap(downgradeJobIfNeeded(job(this.job), node), node);
+ return Collections.singletonMap(job(job), node);
}
/** {@inheritDoc} */
@@ -1560,7 +1492,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
ClusterNode node = lb.getBalancedNode(job, null);
- return Collections.singletonMap(downgradeJobIfNeeded(job, node), node);
+ return Collections.singletonMap(job, node);
}
/** {@inheritDoc} */
@@ -1611,7 +1543,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
ClusterNode node = lb.getBalancedNode(job, null);
- mapper.map(downgradeJobIfNeeded(job, node), node);
+ mapper.map(job, node);
}
return mapper.map();
@@ -1669,7 +1601,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
ClusterNode node = lb.getBalancedNode(job, null);
- mapper.map(downgradeJobIfNeeded(job, node), node);
+ mapper.map(job, node);
}
return mapper.map();
@@ -1723,7 +1655,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
JobMapper mapper = new JobMapper(subgrid.size());
for (ClusterNode n : subgrid)
- mapper.map(downgradeJobIfNeeded(job(job, arg), n), n);
+ mapper.map(job(job, arg), n);
return mapper.map();
}
@@ -1741,7 +1673,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*
*/
- private static class C1<T, R> implements ComputeJob, Externalizable, GridNoImplicitInjection,
+ public static class C1<T, R> implements ComputeJob, Binarylizable, GridNoImplicitInjection,
GridInternalWrapper<IgniteClosure> {
/** */
private static final long serialVersionUID = 0L;
@@ -1752,7 +1684,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** */
@GridToStringInclude(sensitive = true)
- private T arg;
+ protected T arg;
/**
*
@@ -1780,71 +1712,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
// No-op.
}
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(job);
- out.writeObject(arg);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- job = (IgniteClosure<T, R>)in.readObject();
- arg = (T)in.readObject();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteClosure userObject() {
- return job;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(C1.class, this);
- }
- }
-
- /**
- *
- */
- public static class C1V2<T, R> implements ComputeJob, Binarylizable, GridNoImplicitInjection,
- GridInternalWrapper<IgniteClosure> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- @GridToStringInclude
- protected IgniteClosure<T, R> job;
-
- /** */
- @GridToStringInclude(sensitive = true)
- protected T arg;
-
- /**
- *
- */
- public C1V2() {
- // No-op.
- }
-
- /**
- * @param job Job.
- * @param arg Argument.
- */
- C1V2(IgniteClosure<T, R> job, T arg) {
- this.job = job;
- this.arg = arg;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object execute() {
- return job.apply(arg);
- }
-
- /** {@inheritDoc} */
- @Override public void cancel() {
- // No-op.
- }
-
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
BinaryRawWriter rawWriter = writer.rawWriter();
@@ -1866,14 +1733,14 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(C1V2.class, this);
+ return S.toString(C1.class, this);
}
}
/**
*
*/
- private static class C1MLA<T, R> extends C1<T, R> implements ComputeJobMasterLeaveAware {
+ public static class C1MLA<T, R> extends C1<T, R> implements ComputeJobMasterLeaveAware {
/** */
private static final long serialVersionUID = 0L;
@@ -1906,40 +1773,8 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*
*/
- public static class C1MLAV2<T, R> extends C1V2<T, R> implements ComputeJobMasterLeaveAware {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- *
- */
- public C1MLAV2() {
- // No-op.
- }
-
- /**
- * @param job Job.
- * @param arg Argument.
- */
- private C1MLAV2(IgniteClosure<T, R> job, T arg) {
- super(job, arg);
- }
-
- /** {@inheritDoc} */
- @Override public void onMasterNodeLeft(ComputeTaskSession ses) {
- ((ComputeJobMasterLeaveAware)job).onMasterNodeLeft(ses);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(C1MLAV2.class, this, super.toString());
- }
- }
-
- /**
- *
- */
- private static class C2<R> implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Callable> {
+ public static class C2<R> implements ComputeJob, Binarylizable, GridNoImplicitInjection,
+ GridInternalWrapper<Callable> {
/** */
private static final long serialVersionUID = 0L;
@@ -1976,68 +1811,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
// No-op.
}
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(c);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- c = (Callable<R>)in.readObject();
- }
-
- /** {@inheritDoc} */
- @Override public Callable userObject() {
- return c;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(C2.class, this);
- }
- }
-
- /**
- *
- */
- public static class C2V2<R> implements ComputeJob, Binarylizable, GridNoImplicitInjection,
- GridInternalWrapper<Callable> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- @GridToStringInclude
- protected Callable<R> c;
-
- /**
- *
- */
- public C2V2() {
- // No-op.
- }
-
- /**
- * @param c Callable.
- */
- private C2V2(Callable<R> c) {
- this.c = c;
- }
-
- /** {@inheritDoc} */
- @Override public Object execute() {
- try {
- return c.call();
- }
- catch (Exception e) {
- throw new IgniteException(e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public void cancel() {
- // No-op.
- }
-
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
writer.rawWriter().writeObject(c);
}
@@ -2053,14 +1826,14 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(C2V2.class, this);
+ return S.toString(C2.class, this);
}
}
/**
*
*/
- private static class C2MLA<R> extends C2<R> implements ComputeJobMasterLeaveAware {
+ public static class C2MLA<R> extends C2<R> implements ComputeJobMasterLeaveAware {
/** */
private static final long serialVersionUID = 0L;
@@ -2090,40 +1863,8 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/**
- *
*/
- public static class C2MLAV2<R> extends C2V2<R> implements ComputeJobMasterLeaveAware {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- *
- */
- public C2MLAV2() {
- // No-op.
- }
-
- /**
- * @param c Callable.
- */
- private C2MLAV2(Callable<R> c) {
- super(c);
- }
-
- /** {@inheritDoc} */
- @Override public void onMasterNodeLeft(ComputeTaskSession ses) {
- ((ComputeJobMasterLeaveAware)c).onMasterNodeLeft(ses);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(C2MLAV2.class, this, super.toString());
- }
- }
-
- /**
- */
- private static class C4 implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
+ public static class C4 implements ComputeJob, Binarylizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
/** */
private static final long serialVersionUID = 0L;
@@ -2157,63 +1898,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
// No-op.
}
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(r);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- r = (Runnable)in.readObject();
- }
-
- /** {@inheritDoc} */
- @Override public Runnable userObject() {
- return r;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(C4.class, this);
- }
- }
-
- /**
- */
- public static class C4V2 implements ComputeJob, Binarylizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- @GridToStringInclude
- protected Runnable r;
-
- /**
- *
- */
- public C4V2() {
- // No-op.
- }
-
- /**
- * @param r Runnable.
- */
- private C4V2(Runnable r) {
- this.r = r;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object execute() {
- r.run();
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void cancel() {
- // No-op.
- }
-
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
writer.rawWriter().writeObject(r);
}
@@ -2229,14 +1913,14 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(C4V2.class, this);
+ return S.toString(C4.class, this);
}
}
/**
*
*/
- private static class C4MLA extends C4 implements ComputeJobMasterLeaveAware {
+ public static class C4MLA extends C4 implements ComputeJobMasterLeaveAware {
/** */
private static final long serialVersionUID = 0L;
@@ -2264,36 +1948,4 @@ public class GridClosureProcessor extends GridProcessorAdapter {
return S.toString(C4MLA.class, this, super.toString());
}
}
-
- /**
- *
- */
- public static class C4MLAV2 extends C4V2 implements ComputeJobMasterLeaveAware {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- *
- */
- public C4MLAV2() {
- // No-op.
- }
-
- /**
- * @param r Runnable.
- */
- private C4MLAV2(Runnable r) {
- super(r);
- }
-
- /** {@inheritDoc} */
- @Override public void onMasterNodeLeft(ComputeTaskSession ses) {
- ((ComputeJobMasterLeaveAware)r).onMasterNodeLeft(ses);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(C4MLAV2.class, this, super.toString());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index ffdf3ba..641208d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -117,9 +117,6 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
/** Threads started by this processor. */
private final Map<UUID, IgniteThread> bufCheckThreads = new ConcurrentHashMap8<>();
- /** */
- public static final IgniteProductVersion QUERY_MSG_VER_2_SINCE = IgniteProductVersion.fromString("1.5.9");
-
/** */
private final ConcurrentMap<IgniteUuid, SyncMessageAckFuture> syncMsgFuts = new ConcurrentHashMap8<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
deleted file mode 100644
index 8314549..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.twostep.messages;
-
-import java.nio.ByteBuffer;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteCodeGeneratingFail;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
-import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * Query request.
- */
-@Deprecated
-@IgniteCodeGeneratingFail
-public class GridQueryRequest implements Message, GridCacheQueryMarshallable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private long reqId;
-
- /** */
- private int pageSize;
-
- /** */
- private String space;
-
- /** */
- @GridToStringInclude
- @GridDirectCollection(GridCacheSqlQuery.class)
- private Collection<GridCacheSqlQuery> qrys;
-
- /** Topology version. */
- private AffinityTopologyVersion topVer;
-
- /** */
- @GridToStringInclude
- @GridDirectCollection(String.class)
- private List<String> extraSpaces;
-
- /** */
- @GridToStringInclude
- private int[] parts;
-
- /** */
- private int timeout;
-
- /**
- * Default constructor.
- */
- public GridQueryRequest() {
- // No-op.
- }
-
- /**
- * @param reqId Request ID.
- * @param pageSize Page size.
- * @param space Space.
- * @param qrys Queries.
- * @param topVer Topology version.
- * @param extraSpaces All space names participating in query other than {@code space}.
- * @param parts Optional partitions for unstable topology.
- * @param timeout Timeout in millis.
- */
- public GridQueryRequest(
- long reqId,
- int pageSize,
- String space,
- Collection<GridCacheSqlQuery> qrys,
- AffinityTopologyVersion topVer,
- List<String> extraSpaces,
- int[] parts,
- int timeout) {
- this.reqId = reqId;
- this.pageSize = pageSize;
- this.space = space;
-
- this.qrys = qrys;
- this.topVer = topVer;
- this.extraSpaces = extraSpaces;
- this.parts = parts;
- this.timeout = timeout;
- }
-
- /**
- * @param cp Copy from.
- */
- public GridQueryRequest(GridQueryRequest cp) {
- this.reqId = cp.reqId;
- this.pageSize = cp.pageSize;
- this.space = cp.space;
- this.qrys = cp.qrys;
- this.topVer = cp.topVer;
- this.extraSpaces = cp.extraSpaces;
- this.parts = cp.parts;
- }
-
- /**
- * @return All the needed partitions for {@link #space()} and {@link #extraSpaces()}.
- */
- public int[] partitions() {
- return parts;
- }
-
- /**
- * @param parts All the needed partitions for {@link #space()} and {@link #extraSpaces()}.
- */
- public void partitions(int[] parts) {
- this.parts = parts;
- }
-
- /**
- * @return All extra space names participating in query other than {@link #space()}.
- */
- public List<String> extraSpaces() {
- return extraSpaces;
- }
-
- /**
- * @return Topology version.
- */
- public AffinityTopologyVersion topologyVersion() {
- return topVer;
- }
-
- /**
- * @return Request ID.
- */
- public long requestId() {
- return reqId;
- }
-
- /**
- * @return Page size.
- */
- public int pageSize() {
- return pageSize;
- }
-
- /**
- * @return Space.
- */
- public String space() {
- return space;
- }
-
- /**
- * @return Timeout.
- */
- public int timeout() {
- return this.timeout;
- }
-
- /**
- * @return Queries.
- */
- public Collection<GridCacheSqlQuery> queries() {
- return qrys;
- }
-
- /** {@inheritDoc} */
- @Override public void marshall(Marshaller m) {
- if (F.isEmpty(qrys))
- return;
-
- for (GridCacheSqlQuery qry : qrys)
- qry.marshall(m);
- }
-
- /** {@inheritDoc} */
- @Override public void unmarshall(Marshaller m, GridKernalContext ctx) {
- if (F.isEmpty(qrys))
- return;
-
- for (GridCacheSqlQuery qry : qrys)
- qry.unmarshall(m, ctx);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridQueryRequest.class, this);
- }
-
- /** {@inheritDoc} */
- @Override public void onAckReceived() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 0:
- if (!writer.writeInt("pageSize", pageSize))
- return false;
-
- writer.incrementState();
-
- case 1:
- if (!writer.writeCollection("qrys", qrys, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 2:
- if (!writer.writeLong("reqId", reqId))
- return false;
-
- writer.incrementState();
-
- case 3:
- if (!writer.writeString("space", space))
- return false;
-
- writer.incrementState();
-
- case 4:
- if (!writer.writeMessage("topVer", topVer))
- return false;
-
- writer.incrementState();
-
- case 5:
- if (!writer.writeCollection("extraSpaces", extraSpaces, MessageCollectionItemType.STRING))
- return false;
-
- writer.incrementState();
-
- case 6:
- if (!writer.writeIntArray("parts", parts))
- return false;
-
- writer.incrementState();
-
- case 7:
- if (!writer.writeInt("timeout", timeout))
- return false;
-
- writer.incrementState();
-
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- switch (reader.state()) {
- case 0:
- pageSize = reader.readInt("pageSize");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 1:
- qrys = reader.readCollection("qrys", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 2:
- reqId = reader.readLong("reqId");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 3:
- space = reader.readString("space");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 4:
- topVer = reader.readMessage("topVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 5:
- extraSpaces = reader.readCollection("extraSpaces", MessageCollectionItemType.STRING);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 6:
- parts = reader.readIntArray("parts");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 7:
- timeout = reader.readInt("timeout");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- }
-
- return reader.afterMessageRead(GridQueryRequest.class);
- }
-
- /** {@inheritDoc} */
- @Override public short directType() {
- return 110;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 8;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index e0a5c7c..bf44723 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -20,14 +20,11 @@ package org.apache.ignite.internal.processors.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
@@ -92,7 +89,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -101,7 +97,6 @@ import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceConfiguration;
import org.apache.ignite.services.ServiceDescriptor;
-import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.apache.ignite.thread.IgniteThreadFactory;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -121,12 +116,6 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter", "ConstantConditions"})
public class GridServiceProcessor extends GridProcessorAdapter {
/** */
- public static final IgniteProductVersion LAZY_SERVICES_CFG_SINCE = IgniteProductVersion.fromString("1.5.22");
-
- /** Versions that only compatible with each other, and from 1.5.33. */
- private static final Set<IgniteProductVersion> SERVICE_TOP_CALLABLE_VER1;
-
- /** */
private final Boolean srvcCompatibilitySysProp;
/** Time to wait before reassignment retries. */
@@ -173,31 +162,6 @@ public class GridServiceProcessor extends GridProcessorAdapter {
/** Topology listener. */
private DiscoveryEventListener topLsnr = new TopologyListener();
- static {
- Set<IgniteProductVersion> versions = new TreeSet<>(new Comparator<IgniteProductVersion>() {
- @Override public int compare(final IgniteProductVersion o1, final IgniteProductVersion o2) {
- return o1.compareToIgnoreTimestamp(o2);
- }
- });
-
- versions.add(IgniteProductVersion.fromString("1.5.30"));
- versions.add(IgniteProductVersion.fromString("1.5.31"));
- versions.add(IgniteProductVersion.fromString("1.5.32"));
- versions.add(IgniteProductVersion.fromString("1.6.3"));
- versions.add(IgniteProductVersion.fromString("1.6.4"));
- versions.add(IgniteProductVersion.fromString("1.6.5"));
- versions.add(IgniteProductVersion.fromString("1.6.6"));
- versions.add(IgniteProductVersion.fromString("1.6.7"));
- versions.add(IgniteProductVersion.fromString("1.6.8"));
- versions.add(IgniteProductVersion.fromString("1.6.9"));
- versions.add(IgniteProductVersion.fromString("1.6.10"));
- versions.add(IgniteProductVersion.fromString("1.7.0"));
- versions.add(IgniteProductVersion.fromString("1.7.1"));
- versions.add(IgniteProductVersion.fromString("1.7.2"));
-
- SERVICE_TOP_CALLABLE_VER1 = Collections.unmodifiableSet(versions);
- }
-
/**
* @param ctx Kernal context.
*/
@@ -700,25 +664,20 @@ public class GridServiceProcessor extends GridProcessorAdapter {
* @param name Service name.
* @param timeout If greater than 0 limits task execution time. Cannot be negative.
* @return Service topology.
+ * @throws IgniteCheckedException On error.
*/
public Map<UUID, Integer> serviceTopology(String name, long timeout) throws IgniteCheckedException {
ClusterNode node = cache.affinity().mapKeyToNode(name);
- if (node.version().compareTo(ServiceTopologyCallable.SINCE_VER) >= 0) {
- final ServiceTopologyCallable call = new ServiceTopologyCallable(name);
+ final ServiceTopologyCallable call = new ServiceTopologyCallable(name);
- call.serialize = SERVICE_TOP_CALLABLE_VER1.contains(node.version());
-
- return ctx.closure().callAsyncNoFailover(
- GridClosureCallMode.BROADCAST,
- call,
- Collections.singletonList(node),
- false,
- timeout
- ).get();
- }
- else
- return serviceTopology(cache, name);
+ return ctx.closure().callAsyncNoFailover(
+ GridClosureCallMode.BROADCAST,
+ call,
+ Collections.singletonList(node),
+ false,
+ timeout
+ ).get();
}
/**
@@ -1306,63 +1265,13 @@ public class GridServiceProcessor extends GridProcessorAdapter {
}
}
- /** {@inheritDoc} */
- @Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node) {
- IgniteNodeValidationResult res = super.validateNode(node);
-
- if (res != null)
- return res;
-
- boolean rmtNodeIsOld = node.version().compareToIgnoreTimestamp(LAZY_SERVICES_CFG_SINCE) < 0;
-
- if (!rmtNodeIsOld)
- return null;
-
- while (true) {
- ServicesCompatibilityState state = compatibilityState.get();
-
- if (state.srvcCompatibility)
- return null;
-
- // Remote node is old and services are in not compatible mode.
- if (!state.used) {
- if (!compatibilityState.compareAndSet(state, new ServicesCompatibilityState(true, false)))
- continue;
-
- return null;
- }
-
- ClusterNode locNode = ctx.discovery().localNode();
-
- return new IgniteNodeValidationResult(node.id(), "Local node uses IgniteServices and works in not " +
- "compatible mode with old nodes (" + IGNITE_SERVICES_COMPATIBILITY_MODE + " system property can be " +
- "set explicitly) [locNodeId=" + locNode.id() + ", rmtNodeId=" + node.id() + "]",
- "Remote node uses IgniteServices and works in not compatible mode with old nodes " +
- IGNITE_SERVICES_COMPATIBILITY_MODE + " system property can be set explicitly" +
- "[locNodeId=" + node.id() + ", rmtNodeId=" + locNode.id() + "]");
- }
- }
-
/**
* @param nodes Remote nodes.
*/
public void initCompatibilityMode(Collection<ClusterNode> nodes) {
- boolean mode;
+ boolean mode = false;
- if (srvcCompatibilitySysProp == null) {
- boolean clusterHasOldNode = false;
-
- for (ClusterNode n : nodes) {
- if (n.version().compareToIgnoreTimestamp(LAZY_SERVICES_CFG_SINCE) < 0) {
- clusterHasOldNode = true;
-
- break;
- }
- }
-
- mode = clusterHasOldNode;
- }
- else
+ if (srvcCompatibilitySysProp != null)
mode = srvcCompatibilitySysProp;
while (true) {
@@ -1881,12 +1790,6 @@ public class GridServiceProcessor extends GridProcessorAdapter {
private static final long serialVersionUID = 0L;
/** */
- private static final IgniteProductVersion SINCE_VER = IgniteProductVersion.fromString("1.5.7");
-
- /** */
- private static final String[] SER_FIELDS = {"waitedCacheInit", "jCtx", "log"};
-
- /** */
private final String svcName;
/** */
@@ -1904,9 +1807,6 @@ public class GridServiceProcessor extends GridProcessorAdapter {
@LoggerResource
private transient IgniteLogger log;
- /** */
- transient boolean serialize;
-
/**
* @param svcName Service name.
*/
@@ -1951,16 +1851,6 @@ public class GridServiceProcessor extends GridProcessorAdapter {
return serviceTopology(cache, svcName);
}
-
- /**
- * @param self Instance of current class before serialization.
- * @param ver Sender job version.
- * @return List of serializable transient fields.
- */
- @SuppressWarnings("unused")
- private static String[] serializableTransient(ServiceTopologyCallable self, IgniteProductVersion ver) {
- return (self != null && self.serialize) || (ver != null && SERVICE_TOP_CALLABLE_VER1.contains(ver)) ? SER_FIELDS : null;
- }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index a440ac3..ec6a350 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -18,8 +18,6 @@
package org.apache.ignite.internal.visor.cache;
import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
@@ -27,14 +25,14 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.internal.processors.cache.GridCacheSwapManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
-import org.apache.ignite.internal.util.lang.IgnitePair;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -91,11 +89,22 @@ public class VisorCache implements Serializable, LessNamingBean {
/** Number of partitions. */
private int partitions;
- /** @deprecated Needed only for backward compatibility. */
- private Collection<IgnitePair<Integer>> primaryPartitions;
+ /**
+ * Flag indicating that cache has near cache.
+ */
+ private boolean near;
+
+ /** Number of primary entries in offheap. */
+ private int offHeapPrimaryEntriesCnt;
- /** @deprecated Needed only for backward compatibility. */
- private Collection<IgnitePair<Integer>> backupPartitions;
+ /** Number of backup entries in offheap. */
+ private int offHeapBackupEntriesCnt;
+
+ /** Number of primary entries in swap. */
+ private int swapPrimaryEntriesCnt;
+
+ /** Number of backup entries in swap. */
+ private int swapBackupEntriesCnt;
/** Cache metrics. */
private VisorCacheMetrics metrics;
@@ -130,9 +139,6 @@ public class VisorCache implements Serializable, LessNamingBean {
swapKeys = -1;
}
- primaryPartitions = Collections.emptyList();
- backupPartitions = Collections.emptyList();
-
CacheConfiguration cfg = ca.configuration();
mode = cfg.getCacheMode();
@@ -151,11 +157,8 @@ public class VisorCache implements Serializable, LessNamingBean {
if (dca != null) {
GridDhtPartitionTopology top = dca.topology();
- if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0) {
- GridDhtPartitionMap2 map2 = top.localPartitionMap();
-
- partitionsMap = new GridDhtPartitionMap(map2.nodeId(), map2.updateSequence(), map2.map());
- }
+ if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0)
+ partitionsMap = top.localPartitionMap();
}
}
@@ -168,6 +171,15 @@ public class VisorCache implements Serializable, LessNamingBean {
offHeapEntriesCnt = ca.offHeapEntriesCount();
partitions = ca.affinity().partitions();
metrics = new VisorCacheMetrics().from(ignite, cacheName);
+ near = ca.context().isNear();
+
+ GridCacheSwapManager swap = ca.context().swap();
+
+ offHeapPrimaryEntriesCnt = swap.offheapEntriesCount(true, false, AffinityTopologyVersion.NONE);
+ offHeapBackupEntriesCnt = swap.offheapEntriesCount(false, true, AffinityTopologyVersion.NONE);
+
+ swapPrimaryEntriesCnt = swap.swapEntriesCount(true, false, AffinityTopologyVersion.NONE);
+ swapBackupEntriesCnt = swap.swapEntriesCount(false, true, AffinityTopologyVersion.NONE);
estimateMemorySize(ignite, ca, sample);
@@ -230,9 +242,12 @@ public class VisorCache implements Serializable, LessNamingBean {
c.swapSize = swapSize;
c.swapKeys = swapKeys;
c.partitions = partitions;
- c.primaryPartitions = Collections.emptyList();
- c.backupPartitions = Collections.emptyList();
c.metrics = metrics;
+ c.near = near;
+ c.offHeapPrimaryEntriesCnt = offHeapPrimaryEntriesCnt;
+ c.offHeapBackupEntriesCnt = offHeapBackupEntriesCnt;
+ c.swapPrimaryEntriesCnt = swapPrimaryEntriesCnt;
+ c.swapBackupEntriesCnt = swapBackupEntriesCnt;
}
return c;
@@ -353,17 +368,38 @@ public class VisorCache implements Serializable, LessNamingBean {
}
/**
- * @deprecated Needed only for backward compatibility.
+ * @return {@code true} if cache has near cache.
+ */
+ public boolean near() {
+ return near;
+ }
+
+ /**
+ * @return Off-heap heap primary entries count.
+ */
+ public int offHeapPrimaryEntriesCount() {
+ return offHeapPrimaryEntriesCnt;
+ }
+
+ /**
+ * @return Off-heap heap backup entries count.
+ */
+ public int offHeapBackupEntriesCount() {
+ return offHeapBackupEntriesCnt;
+ }
+
+ /**
+ * @return Swap primary entries count.
*/
- public Collection<IgnitePair<Integer>> primaryPartitions() {
- return primaryPartitions;
+ public int swapPrimaryEntriesCount() {
+ return swapPrimaryEntriesCnt;
}
/**
- * @deprecated Needed only for backward compatibility.
+ * @return Swap backup entries count.
*/
- public Collection<IgnitePair<Integer>> backupPartitions() {
- return backupPartitions;
+ public int swapBackupEntriesCount() {
+ return swapBackupEntriesCnt;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index c779051..586fa87 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -206,7 +206,7 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
* @return Off heap entries count.
*/
private long offHeapEntriesCount(VisorCacheMetrics metric) {
- return metric instanceof VisorCacheMetricsV2 ? ((VisorCacheMetricsV2) metric).offHeapEntriesCount() : 0;
+ return metric.offHeapEntriesCount();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 869a12c..cf2ba7a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -24,13 +24,11 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
-import org.apache.ignite.lang.IgniteProductVersion;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -41,9 +39,6 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
/** */
private static final long serialVersionUID = 0L;
- /** */
- private static final IgniteProductVersion VER_1_4_1 = IgniteProductVersion.fromString("1.4.1");
-
/** Cache name. */
private String name;
@@ -158,20 +153,9 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
nearCfg = VisorCacheNearConfiguration.from(ccfg);
dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
- boolean compatibility = false;
-
- for (ClusterNode node : ignite.cluster().nodes()) {
- if (node.version().compareToIgnoreTimestamp(VER_1_4_1) <= 0) {
- compatibility = true;
-
- break;
- }
- }
-
- storeCfg = (compatibility ? new VisorCacheStoreConfiguration() : new VisorCacheStoreConfigurationV2())
- .from(ignite, ccfg);
+ storeCfg = new VisorCacheStoreConfiguration().from(ignite, ccfg);
- qryCfg = (compatibility ? new VisorCacheQueryConfiguration() : new VisorCacheQueryConfigurationV2()).from(ccfg);
+ qryCfg = new VisorCacheQueryConfiguration().from(ccfg);
return this;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 1204cbc..507aacd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -23,6 +23,7 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -156,6 +157,12 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
/** Number of cached rolled back DHT transaction IDs. */
private int txDhtRolledbackVersionsSize;
+ /** Memory size allocated in off-heap. */
+ private long offHeapAllocatedSize;
+
+ /** Number of cache entries stored in off-heap memory. */
+ private long offHeapEntriesCount;
+
/**
* Calculate rate of metric per second.
*
@@ -228,6 +235,11 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
txDhtCommittedVersionsSize = m.getTxDhtCommittedVersionsSize();
txDhtRolledbackVersionsSize = m.getTxDhtRolledbackVersionsSize();
+ GridCacheAdapter<Object, Object> ca = cacheProcessor.internalCache(cacheName);
+
+ offHeapAllocatedSize = ca.offHeapAllocatedSize();
+ offHeapEntriesCount = ca.offHeapEntriesCount();
+
return this;
}
@@ -520,6 +532,20 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
return txDhtRolledbackVersionsSize;
}
+ /**
+ * @return Memory size allocated in off-heap.
+ */
+ public long offHeapAllocatedSize() {
+ return offHeapAllocatedSize;
+ }
+
+ /**
+ * @return Number of cache entries stored in off-heap memory.
+ */
+ public long offHeapEntriesCount() {
+ return offHeapEntriesCount;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheMetrics.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index 4dd1e28..4fd85de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
@@ -31,7 +30,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorMultiNodeTask;
import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.jetbrains.annotations.Nullable;
/**
@@ -83,9 +81,6 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
/** */
private static final long serialVersionUID = 0L;
- /** */
- private static final IgniteProductVersion V2_SINCE = IgniteProductVersion.fromString("1.5.8");
-
/**
* Create job with given argument.
*
@@ -120,18 +115,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
if (ca.context().started()) {
String cacheName = ca.getName();
- boolean compatibilityMode = false;
-
- for (ClusterNode node : ignite.cluster().nodes()) {
- if (node.version().compareToIgnoreTimestamp(V2_SINCE) < 0) {
- compatibilityMode = true;
-
- break;
- }
- }
-
- VisorCacheMetrics cm = (compatibilityMode ? new VisorCacheMetrics() : new VisorCacheMetricsV2())
- .from(ignite, cacheName);
+ VisorCacheMetrics cm = new VisorCacheMetrics().from(ignite, cacheName);
if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.system()))
res.add(cm);
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsV2.java
deleted file mode 100644
index 2376db0..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsV2.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.cache.CacheMetrics;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
-
-/**
- * Data transfer object for {@link CacheMetrics}.
- */
-public class VisorCacheMetricsV2 extends VisorCacheMetrics {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Memory size allocated in off-heap. */
- private long offHeapAllocatedSize;
-
- /** Number of cache entries stored in off-heap memory. */
- private long offHeapEntriesCount;
-
- /** {@inheritDoc} */
- @Override
- public VisorCacheMetrics from(IgniteEx ignite, String cacheName) {
- super.from(ignite, cacheName);
-
- GridCacheProcessor cacheProcessor = ignite.context().cache();
-
- GridCacheAdapter<Object, Object> c = cacheProcessor.internalCache(cacheName);
-
- offHeapAllocatedSize = c.offHeapAllocatedSize();
- offHeapEntriesCount = c.offHeapEntriesCount();
-
- return this;
- }
-
- /**
- * @return Memory size allocated in off-heap.
- */
- public long offHeapAllocatedSize() {
- return offHeapAllocatedSize;
- }
-
- /**
- * @return Number of cache entries stored in off-heap memory.
- */
- public long offHeapEntriesCount() {
- return offHeapEntriesCount;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
index e0d1e72..d1a0cdf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
@@ -44,6 +44,16 @@ public class VisorCacheQueryConfiguration implements Serializable, LessNamingBea
/** */
private int sqlOnheapRowCacheSize;
+ /** */
+ private String sqlSchema;
+
+ /**
+ * @return Schema name, which is used by SQL engine for SQL statements generation.
+ */
+ public String sqlSchema() {
+ return sqlSchema;
+ }
+
/**
* @param clss Classes to compact.
*/
@@ -71,6 +81,7 @@ public class VisorCacheQueryConfiguration implements Serializable, LessNamingBea
sqlEscapeAll = ccfg.isSqlEscapeAll();
indexedTypes = compactClasses(ccfg.getIndexedTypes());
sqlOnheapRowCacheSize = ccfg.getSqlOnheapRowCacheSize();
+ sqlSchema = ccfg.getSqlSchema();
return this;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java
deleted file mode 100644
index e914b73..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.configuration.CacheConfiguration;
-
-/**
- * Data transfer object for cache query configuration data.
- */
-public class VisorCacheQueryConfigurationV2 extends VisorCacheQueryConfiguration {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private String sqlSchema;
-
- /**
- * @return Schema name, which is used by SQL engine for SQL statements generation.
- */
- public String sqlSchema() {
- return sqlSchema;
- }
-
- /** {@inheritDoc} */
- @Override public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) {
- super.from(ccfg);
-
- sqlSchema = ccfg.getSqlSchema();
-
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
index 5d3e1e1..fd3d980 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
@@ -66,6 +66,9 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
/** Number of threads that will perform cache flushing. */
private int flushThreadCnt;
+ /** Keep binary in store flag. */
+ private boolean storeKeepBinary;
+
/**
* @param ignite Ignite instance.
* @param ccfg Cache configuration.
@@ -90,6 +93,8 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
flushSz = ccfg.getWriteBehindFlushSize();
flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();
+ storeKeepBinary = ccfg.isStoreKeepBinary();
+
return this;
}
@@ -170,6 +175,13 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
return flushThreadCnt;
}
+ /**
+ * @return Keep binary in store flag.
+ */
+ public boolean storeKeepBinary() {
+ return storeKeepBinary;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheStoreConfiguration.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java
deleted file mode 100644
index 8595177..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-
-/**
- * Data transfer object for cache store configuration properties.
- */
-public class VisorCacheStoreConfigurationV2 extends VisorCacheStoreConfiguration {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Keep binary in store flag. */
- private boolean storeKeepBinary;
-
- /** {@inheritDoc} */
- @Override public VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
- super.from(ignite, ccfg);
-
- storeKeepBinary = ccfg.isStoreKeepBinary();
-
- return this;
- }
-
- /**
- * @return Keep binary in store flag.
- */
- public boolean storeKeepBinary() {
- return storeKeepBinary;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java
deleted file mode 100644
index 61551cc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-
-/**
- * Data transfer object for {@link IgniteCache}.
- */
-public class VisorCacheV2 extends VisorCache {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Flag indicating that cache has near cache.
- */
- private boolean near;
-
- /** {@inheritDoc} */
- @Override public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
- VisorCache c = super.from(ignite, cacheName, sample);
-
- if (c != null && c instanceof VisorCacheV2) {
- GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
-
- // Process only started caches.
- if (ca != null && ca.context().started())
- ((VisorCacheV2)c).near = ca.context().isNear();
- }
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override protected VisorCache initHistory(VisorCache c) {
- super.initHistory(c);
-
- if (c instanceof VisorCacheV2)
- ((VisorCacheV2) c).near = near;
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override public VisorCache history() {
- return initHistory(new VisorCacheV2());
- }
-
- /**
- * @return {@code true} if cache has near cache.
- */
- public boolean near() {
- return near;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV3.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV3.java
deleted file mode 100644
index fab37e3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV3.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.util.Collection;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.internal.util.lang.GridTuple3;
-
-/**
- * Data transfer object for {@link IgniteCache}.
- *
- * @deprecated Needed only for backward compatibility.
- */
-public class VisorCacheV3 extends VisorCacheV2 {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** @deprecated Needed only for backward compatibility. */
- private Collection<GridTuple3<Integer, Long, Long>> primaryPartsOffheapSwap;
-
- /** @deprecated Needed only for backward compatibility. */
- private Collection<GridTuple3<Integer, Long, Long>> backupPartsOffheapSwap;
-
- /**
- * @deprecated Needed only for backward compatibility.
- */
- public Collection<GridTuple3<Integer, Long, Long>> primaryPartitionsOffheapSwap() {
- return primaryPartsOffheapSwap;
- }
-
- /**
- * @deprecated Needed only for backward compatibility.
- */
- public Collection<GridTuple3<Integer, Long, Long>> backupPartitionsOffheapSwap() {
- return backupPartsOffheapSwap;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java
deleted file mode 100644
index a5f66be..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cache.GridCacheSwapManager;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for {@link IgniteCache}.
- */
-public class VisorCacheV4 extends VisorCacheV2 {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Number of primary entries in offheap. */
- private int offHeapPrimaryEntriesCnt;
-
- /** Number of backup entries in offheap. */
- private int offHeapBackupEntriesCnt;
-
- /** Number of primary entries in swap. */
- private int swapPrimaryEntriesCnt;
-
- /** Number of backup entries in swap. */
- private int swapBackupEntriesCnt;
-
- /** {@inheritDoc} */
- @Override public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
- VisorCache c = super.from(ignite, cacheName, sample);
-
- if (c != null && c instanceof VisorCacheV4) {
- VisorCacheV4 cacheV4 = (VisorCacheV4)c;
-
- GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
-
- // Process only started caches.
- if (ca != null && ca.context().started()) {
- GridCacheSwapManager swap = ca.context().swap();
-
- cacheV4.offHeapPrimaryEntriesCnt = swap.offheapEntriesCount(true, false, AffinityTopologyVersion.NONE);
- cacheV4.offHeapBackupEntriesCnt = swap.offheapEntriesCount(false, true, AffinityTopologyVersion.NONE);
-
- cacheV4.swapPrimaryEntriesCnt = swap.swapEntriesCount(true, false, AffinityTopologyVersion.NONE);
- cacheV4.swapBackupEntriesCnt = swap.swapEntriesCount(false, true, AffinityTopologyVersion.NONE);
- }
- }
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override protected VisorCache initHistory(VisorCache c) {
- super.initHistory(c);
-
- if (c instanceof VisorCacheV4) {
- VisorCacheV4 cacheV4 = (VisorCacheV4)c;
-
- cacheV4.offHeapPrimaryEntriesCnt = offHeapPrimaryEntriesCnt;
- cacheV4.offHeapBackupEntriesCnt = offHeapBackupEntriesCnt;
- cacheV4.swapPrimaryEntriesCnt = swapPrimaryEntriesCnt;
- cacheV4.swapBackupEntriesCnt = swapBackupEntriesCnt;
- }
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override public VisorCache history() {
- return initHistory(new VisorCacheV4());
- }
-
- /**
- * @return Off-heap heap primary entries count.
- */
- public int offHeapPrimaryEntriesCount() {
- return offHeapPrimaryEntriesCnt;
- }
-
- /**
- * @return Off-heap heap backup entries count.
- */
- public int offHeapBackupEntriesCount() {
- return offHeapBackupEntriesCnt;
- }
-
- /**
- * @return Swap primary entries count.
- */
- public int swapPrimaryEntriesCount() {
- return swapPrimaryEntriesCnt;
- }
-
- /**
- * @return Swap backup entries count.
- */
- public int swapBackupEntriesCount() {
- return swapBackupEntriesCnt;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorCacheV4.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
index 7d970de..bad6966 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
@@ -38,6 +38,9 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
/** If node that caused this event is daemon. */
private final boolean isDaemon;
+ /** Topology version. */
+ private final long topVer;
+
/**
* Create event with given parameters.
*
@@ -51,6 +54,7 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
* @param evtNodeId Event node id.
* @param addr Event node address.
* @param isDaemon If event node is daemon on not.
+ * @param topVer Topology version.
*/
public VisorGridDiscoveryEvent(
int typeId,
@@ -62,13 +66,15 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
String shortDisplay,
UUID evtNodeId,
String addr,
- boolean isDaemon
+ boolean isDaemon,
+ long topVer
) {
super(typeId, id, name, nid, ts, msg, shortDisplay);
this.evtNodeId = evtNodeId;
this.addr = addr;
this.isDaemon = isDaemon;
+ this.topVer = topVer;
}
/**
@@ -92,8 +98,16 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
return isDaemon;
}
+ /**
+ * @return Topology version or {@code 0} if configured discovery SPI implementation
+ * does not support versioning.
+ **/
+ public long topologyVersion() {
+ return topVer;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorGridDiscoveryEvent.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEventV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEventV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEventV2.java
deleted file mode 100644
index b66aacf..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEventV2.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.visor.event;
-
-import java.util.UUID;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Lightweight counterpart for {@link org.apache.ignite.events.DiscoveryEvent}.
- */
-public class VisorGridDiscoveryEventV2 extends VisorGridDiscoveryEvent {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Topology version. */
- private final long topVer;
-
- /**
- * Create event with given parameters.
- *
- * @param typeId Event type.
- * @param id Event id.
- * @param name Event name.
- * @param nid Event node ID.
- * @param ts Event timestamp.
- * @param msg Event message.
- * @param shortDisplay Shortened version of {@code toString()} result.
- * @param evtNodeId Event node id.
- * @param addr Event node address.
- * @param isDaemon If event node is daemon on not.
- * @param topVer Topology version.
- */
- public VisorGridDiscoveryEventV2(
- int typeId,
- IgniteUuid id,
- String name,
- UUID nid,
- long ts,
- @Nullable String msg,
- String shortDisplay,
- UUID evtNodeId,
- String addr,
- boolean isDaemon,
- long topVer
- ) {
- super(typeId, id, name, nid, ts, msg, shortDisplay, evtNodeId, addr, isDaemon);
-
- this.topVer = topVer;
- }
-
- /**
- * @return Topology version or {@code 0} if configured discovery SPI implementation
- * does not support versioning.
- **/
- public long topologyVersion() {
- return topVer;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorGridDiscoveryEventV2.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/488b25e1/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index f45725f..0617e70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -30,19 +30,14 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.cache.VisorCache;
-import org.apache.ignite.internal.visor.cache.VisorCacheV2;
-import org.apache.ignite.internal.visor.cache.VisorCacheV3;
-import org.apache.ignite.internal.visor.cache.VisorCacheV4;
import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
-import org.apache.ignite.lang.IgniteProductVersion;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
import static org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder.COMPUTE_MONITORING_HOLDER_KEY;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.EVT_MAPPER;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.EVT_MAPPER_V2;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.VISOR_TASK_EVTS;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.checkExplicitTaskMonitoring;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.collectEvents;
@@ -55,18 +50,6 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
/** */
private static final long serialVersionUID = 0L;
- /** */
- private static final IgniteProductVersion VER_1_4_1 = IgniteProductVersion.fromString("1.4.1");
-
- /** */
- private static final IgniteProductVersion VER_1_5_10 = IgniteProductVersion.fromString("1.5.10");
-
- /** */
- private static final IgniteProductVersion VER_1_5_26 = IgniteProductVersion.fromString("1.5.26");
-
- /** */
- protected static final IgniteProductVersion VER_1_7_2 = IgniteProductVersion.fromString("1.7.2");
-
/**
* Create job with given argument.
*
@@ -87,8 +70,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
*/
protected void events0(VisorNodeDataCollectorJobResult res, String evtOrderKey, String evtThrottleCntrKey,
final boolean all) {
- res.events().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all,
- compatibleWith(VER_1_7_2) ? EVT_MAPPER_V2 : EVT_MAPPER));
+ res.events().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all, EVT_MAPPER));
}
/**
@@ -135,34 +117,6 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
/**
- * @param ver Version to check.
- * @return {@code true} if found at least one compatible node with specified version.
- */
- protected boolean compatibleWith(IgniteProductVersion ver) {
- for (ClusterNode node : ignite.cluster().nodes())
- if (node.version().compareToIgnoreTimestamp(ver) <= 0)
- return true;
-
- return false;
- }
-
- /**
- * @return Compatible {@link VisorCache} instance.
- */
- private VisorCache createVisorCache() {
- if (compatibleWith(VER_1_4_1))
- return new VisorCache();
-
- if (compatibleWith(VER_1_5_10))
- return new VisorCacheV2();
-
- if (compatibleWith(VER_1_5_26))
- return new VisorCacheV3();
-
- return new VisorCacheV4();
- }
-
- /**
* @param cacheName Cache name to check.
* @return {@code true} if cache on local node is not a data cache or near cache disabled.
*/
@@ -189,11 +143,11 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
continue;
if (arg.systemCaches() ||
- !(isSystemCache(cacheName) || isIgfsCache(ignite.configuration(), cacheName))) {
+ !(isSystemCache(cacheName) || isIgfsCache(cfg, cacheName))) {
long start0 = U.currentTimeMillis();
try {
- VisorCache cache = createVisorCache().from(ignite, cacheName, arg.sample());
+ VisorCache cache = new VisorCache().from(ignite, cacheName, arg.sample());
if (cache != null)
res.caches().add(cache);
[49/50] [abbrv] ignite git commit: ignite-4003 Async outgoing
connections for communication SPI
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffa5f826/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 42879b7..9622c84 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -35,6 +35,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -46,8 +47,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
@@ -66,7 +65,7 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.util.GridConcurrentFactory;
-import org.apache.ignite.internal.util.GridSpinReadWriteLock;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.ipc.IpcEndpoint;
import org.apache.ignite.internal.util.ipc.IpcToNioAdapter;
@@ -78,6 +77,7 @@ import org.apache.ignite.internal.util.nio.GridConnectionBytesVerifyFilter;
import org.apache.ignite.internal.util.nio.GridDirectParser;
import org.apache.ignite.internal.util.nio.GridNioCodecFilter;
import org.apache.ignite.internal.util.nio.GridNioFilter;
+import org.apache.ignite.internal.util.nio.GridNioFuture;
import org.apache.ignite.internal.util.nio.GridNioMessageReaderFactory;
import org.apache.ignite.internal.util.nio.GridNioMessageTracker;
import org.apache.ignite.internal.util.nio.GridNioMessageWriterFactory;
@@ -90,9 +90,7 @@ import org.apache.ignite.internal.util.nio.GridNioSession;
import org.apache.ignite.internal.util.nio.GridNioSessionMetaKey;
import org.apache.ignite.internal.util.nio.GridShmemCommunicationClient;
import org.apache.ignite.internal.util.nio.GridTcpNioCommunicationClient;
-import org.apache.ignite.internal.util.nio.ssl.BlockingSslHandler;
import org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter;
-import org.apache.ignite.internal.util.nio.ssl.GridSslMeta;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
@@ -106,7 +104,6 @@ import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
@@ -136,7 +133,6 @@ import org.jsr166.LongAdder8;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
-import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.SSL_META;
/**
* <tt>TcpCommunicationSpi</tt> is default communication SPI which uses
@@ -297,10 +293,15 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** Connection index meta for session. */
private static final int CONN_IDX_META = GridNioSessionMetaKey.nextUniqueKey();
+ /** Recovery descriptor meta key. */
+ private static final int RECOVERY_DESC_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
/** Message tracker meta for session. */
private static final int TRACKER_META = GridNioSessionMetaKey.nextUniqueKey();
+ /** Connection context meta key. */
+ private static final int CONN_CTX_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
/**
* Default local port range (value is <tt>100</tt>).
* See {@link #setLocalPortRange(int)} for details.
@@ -335,6 +336,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** Handshake message type. */
public static final short HANDSHAKE_MSG_TYPE = -3;
+ /** Ignite header message. */
+ private static final Message IGNITE_HEADER_MSG = new IgniteHeaderMessage();
+
+ /** Skip ack. For test purposes only. */
+ private boolean skipAck;
+
/** */
private ConnectGateway connectGate;
@@ -408,10 +415,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
log.debug("Session was closed but there are unacknowledged messages, " +
"will try to reconnect [rmtNode=" + outDesc.node().id() + ']');
- DisconnectedSessionInfo disconnectData =
- new DisconnectedSessionInfo(outDesc, connId.connectionIndex());
+ SessionInfo sesInfo =
+ new SessionInfo(ses, connId.connectionIndex(), SessionState.RECONNECT);
- commWorker.addProcessDisconnectRequest(disconnectData);
+ commWorker.addSessionStateChangeRequest(sesInfo);
}
}
else
@@ -437,14 +444,69 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (msg instanceof NodeIdMessage) {
sndId = U.bytesToUuid(((NodeIdMessage) msg).nodeIdBytes, 0);
- connKey = new ConnectionKey(sndId, 0, -1);
+
+ if (ses.remoteAddress() != null) { // Not shmem.
+ assert !ses.accepted();
+
+ ConnectContext ctx = ses.meta(CONN_CTX_META_KEY);
+
+ assert ctx != null;
+ assert ctx.expNodeId != null;
+
+ if (sndId.equals(ctx.expNodeId)) {
+ GridNioRecoveryDescriptor recoveryDesc = ses.outRecoveryDescriptor();
+
+ assert recoveryDesc != null;
+
+ long connCnt = recoveryDesc.incrementConnectCount();
+
+ connKey = new ConnectionKey(sndId, ctx.connIdx, connCnt);
+
+ final ConnectionKey old = ses.addMeta(CONN_IDX_META, connKey);
+
+ assert old == null;
+
+ ses.send(IGNITE_HEADER_MSG);
+
+ ClusterNode locNode = getLocalNode();
+
+ if (locNode == null) {
+ commWorker.addSessionStateChangeRequest(new SessionInfo(ses, SessionState.CLOSE,
+ new IgniteCheckedException("Local node has not been started or " +
+ "fully initialized [isStopping=" + getSpiContext().isStopping() + ']')));
+
+ return;
+ }
+
+ int handshakeConnIdx = connPlc.connectionIndex();
+
+ HandshakeMessage handshakeMsg = new HandshakeMessage2(locNode.id(), connCnt,
+ recoveryDesc.received(), handshakeConnIdx);
+
+ if (log.isDebugEnabled())
+ log.debug("Write handshake message [rmtNode=" + sndId +
+ ", msg=" + handshakeMsg + ']');
+
+ ses.send(handshakeMsg);
+ }
+ else {
+ commWorker.addSessionStateChangeRequest(new SessionInfo(ses, SessionState.CLOSE,
+ new IgniteCheckedException("Remote node ID is not as expected [expected=" +
+ ctx.expNodeId + ", rcvd=" + sndId + ']')));
+ }
+
+ return;
+ }
+ else
+ connKey = new ConnectionKey(sndId, 0, -1);
}
else {
assert msg instanceof HandshakeMessage : msg;
HandshakeMessage msg0 = (HandshakeMessage)msg;
- sndId = ((HandshakeMessage)msg).nodeId();
+ sndId = msg0.nodeId();
+
connKey = new ConnectionKey(sndId, msg0.connectionIndex(), msg0.connectCount());
}
@@ -485,30 +547,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (reserve)
connectedNew(recoveryDesc, ses, true);
else {
- if (c.failed) {
- ses.send(new RecoveryLastReceivedMessage(-1));
-
- for (GridNioSession ses0 : nioSrvr.sessions()) {
- ConnectionKey key0 = ses0.meta(CONN_IDX_META);
-
- if (ses0.accepted() && key0 != null &&
- key0.nodeId().equals(connKey.nodeId()) &&
- key0.connectionIndex() == connKey.connectionIndex() &&
- key0.connectCount() < connKey.connectCount())
- ses0.close();
- }
+ for (GridNioSession ses0 : nioSrvr.sessions()) {
+ ConnectionKey key0 = ses0.meta(CONN_IDX_META);
+
+ if (ses0.accepted() && key0 != null &&
+ key0.nodeId().equals(connKey.nodeId()) &&
+ key0.connectionIndex() == connKey.connectionIndex() &&
+ key0.connectCount() < connKey.connectCount())
+ ses0.close();
}
}
}
else {
assert connKey.connectionIndex() >= 0 : connKey;
- GridCommunicationClient[] curClients = clients.get(sndId);
-
- GridCommunicationClient oldClient =
- curClients != null && connKey.connectionIndex() < curClients.length ?
- curClients[connKey.connectionIndex()] :
- null;
+ GridCommunicationClient oldClient = nodeClient(sndId, connKey.connectionIndex());
boolean hasShmemClient = false;
@@ -537,10 +590,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
final GridNioRecoveryDescriptor recoveryDesc = inRecoveryDescriptor(rmtNode, connKey);
if (oldFut == null) {
- curClients = clients.get(sndId);
-
- oldClient = curClients != null && connKey.connectionIndex() < curClients.length ?
- curClients[connKey.connectionIndex()] : null;
+ oldClient = nodeClient(sndId, connKey.connectionIndex());
if (oldClient != null) {
if (oldClient instanceof GridTcpNioCommunicationClient) {
@@ -584,7 +634,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
}
else {
- if (oldFut instanceof ConnectFuture && locNode.order() < rmtNode.order()) {
+ if (oldFut instanceof ReserveClientFuture && locNode.order() < rmtNode.order()) {
if (log.isDebugEnabled()) {
log.debug("Received incoming connection from remote node while " +
"connecting to this node, rejecting [locNode=" + locNode.id() +
@@ -606,17 +656,31 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
}
- @Override public void onMessage(GridNioSession ses, Message msg) {
+ @Override public void onMessage(final GridNioSession ses, Message msg) {
ConnectionKey connKey = ses.meta(CONN_IDX_META);
if (connKey == null) {
- assert ses.accepted() : ses;
-
- if (!connectGate.tryEnter()) {
+ if (ses.accepted() && !connectGate.tryEnter()) { // Outgoing connection already entered gate.
if (log.isDebugEnabled())
log.debug("Close incoming connection, failed to enter gateway.");
- ses.close();
+ try {
+ nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(-1), new IgniteInClosure<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> fut) {
+ try {
+ fut.get();
+
+ ses.close();
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to send last received message: " + e, e);
+ }
+ }
+ });
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to send message: " + e, e);
+ }
return;
}
@@ -625,7 +689,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
onFirstMessage(ses, msg);
}
finally {
- connectGate.leave();
+ if (ses.accepted())
+ connectGate.leave();
}
}
else {
@@ -637,13 +702,49 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (recovery != null) {
RecoveryLastReceivedMessage msg0 = (RecoveryLastReceivedMessage)msg;
+ long rcvCnt = msg0.received();
+
if (log.isDebugEnabled()) {
log.debug("Received recovery acknowledgement [rmtNode=" + connKey.nodeId() +
", connIdx=" + connKey.connectionIndex() +
", rcvCnt=" + msg0.received() + ']');
}
- recovery.ackReceived(msg0.received());
+ ConnectContext ctx = ses.meta(CONN_CTX_META_KEY);
+
+ if (!ses.accepted() && ctx != null && ctx.rcvCnt == Long.MIN_VALUE) {
+ HandshakeTimeoutObject timeoutObj = ctx.handshakeTimeoutObj;
+
+ Exception err = null;
+
+ if (timeoutObj != null && !cancelHandshakeTimeout(timeoutObj)) {
+ err = new HandshakeTimeoutException("Failed to perform handshake due to timeout " +
+ "(consider increasing 'connectionTimeout' configuration property).");
+ }
+
+ if (rcvCnt == -1 || err != null) {
+ if (ses.remoteAddress() != null) {
+ SessionInfo sesInfo = new SessionInfo(ses, SessionState.CLOSE, err);
+
+ commWorker.addSessionStateChangeRequest(sesInfo);
+ }
+ }
+ else {
+ ctx.rcvCnt = rcvCnt;
+
+ recovery.onHandshake(rcvCnt);
+
+ nioSrvr.resend(ses);
+
+ recovery.onConnected();
+
+ SessionInfo sesInfo = new SessionInfo(ses, connKey.idx, SessionState.READY);
+
+ commWorker.addSessionStateChangeRequest(sesInfo);
+ }
+ }
+ else
+ recovery.ackReceived(rcvCnt);
return;
}
@@ -661,7 +762,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
", rcvCnt=" + rcvCnt + ']');
}
- ses.systemMessage(new RecoveryLastReceivedMessage(rcvCnt));
+ if (!skipAck)
+ ses.systemMessage(new RecoveryLastReceivedMessage(rcvCnt));
recovery.lastAcknowledged(rcvCnt);
}
@@ -712,7 +814,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
assert connKey != null && connKey.connectionIndex() >= 0 : connKey;
assert !usePairedConnections(node);
- recovery.onHandshake(rcvCnt);
+ if (ses.accepted())
+ recovery.onHandshake(rcvCnt);
ses.inRecoveryDescriptor(recovery);
ses.outRecoveryDescriptor(recovery);
@@ -778,9 +881,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** */
private final ClusterNode rmtNode;
- /** */
- private boolean failed;
-
/**
* @param ses Incoming session.
* @param recoveryDesc Recovery descriptor.
@@ -797,8 +897,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public void apply(Boolean success) {
try {
- failed = !success;
-
if (success) {
IgniteInClosure<IgniteInternalFuture<?>> lsnr = new IgniteInClosure<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> msgFut) {
@@ -919,10 +1017,28 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
else {
try {
- fut.onDone();
+ nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(-1), new IgniteInClosure<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> msgFut) {
+ try {
+ msgFut.get();
+ } catch (IgniteCheckedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to send recovery handshake " +
+ "[rmtNode=" + rmtNode.id() + ", err=" + e + ']');
+
+ recoveryDesc.release();
+ } finally {
+ fut.onDone();
+
+ clientFuts.remove(connKey, fut);
+
+ ses.close();
+ }
+ }
+ });
}
- finally {
- clientFuts.remove(connKey, fut);
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to send message: " + e, e);
}
}
}
@@ -1727,12 +1843,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
nioSrvr.dumpStats();
}
- /** */
- private final ThreadLocal<Integer> threadConnIdx = new ThreadLocal<>();
-
- /** */
- private final AtomicInteger connIdx = new AtomicInteger();
-
/** {@inheritDoc} */
@Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
initFailureDetectionTimeout();
@@ -1988,9 +2098,20 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
assert formatter != null;
+ UUID rmtNodeId = null;
+
ConnectionKey key = ses.meta(CONN_IDX_META);
- return key != null ? formatter.writer(key.nodeId()) : null;
+ if (key != null)
+ rmtNodeId = key.nodeId();
+ else {
+ ConnectContext ctx = ses.meta(CONN_CTX_META_KEY);
+
+ if (ctx != null)
+ rmtNodeId = ctx.expNodeId;
+ }
+
+ return key != null ? formatter.writer(rmtNodeId) : null;
}
};
@@ -2000,7 +2121,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
IgnitePredicate<Message> skipRecoveryPred = new IgnitePredicate<Message>() {
@Override public boolean apply(Message msg) {
- return msg instanceof RecoveryLastReceivedMessage;
+ return msg instanceof NotRecoverable;
}
};
@@ -2339,48 +2460,108 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
int connIdx = connPlc.connectionIndex();
+ send(node, connIdx, msg, ackC);
+ }
+ }
+
+ /**
+ * Try to send message.
+ */
+ private void send(final ClusterNode node,
+ final int connIdx,
+ final Message msg,
+ final IgniteInClosure<IgniteException> ackC
+ ) {
+ final GridCommunicationClient client = nodeClient(node.id(), connIdx);
+
+ if (client != null && client.reserve()) {
try {
- boolean retry;
+ send0(client, node, msg, ackC);
+ }
+ catch (IgniteCheckedException e) {
+ if (removeNodeClient(node.id(), client))
+ client.forceClose();
- do {
- client = reserveClient(node, connIdx);
+ throw new IgniteSpiException("Failed to send message to remote node: " + node, e);
+ }
+ }
+ else {
+ if (client != null)
+ removeNodeClient(node.id(), client);
- UUID nodeId = null;
+ IgniteInternalFuture<GridCommunicationClient> clientFut = reserveClient(node, connIdx);
- if (!client.async())
- nodeId = node.id();
+ clientFut.listen(new IgniteInClosure<IgniteInternalFuture<GridCommunicationClient>>() {
+ @Override public void apply(IgniteInternalFuture<GridCommunicationClient> fut) {
+ GridCommunicationClient client = null;
- retry = client.sendMessage(nodeId, msg, ackC);
+ try {
+ client = fut.get();
- client.release();
+ send0(client, node, msg, ackC);
+ }
+ catch (IgniteCheckedException e) {
+ LT.error(log, e, "Unexpected error occurred during sending of message to node: " + node.id());
- if (!retry)
- sentMsgsCnt.increment();
- else {
- removeNodeClient(node.id(), client);
+ if (client != null && removeNodeClient(node.id(), client))
+ client.forceClose();
+ }
+ }
+ });
+ }
+ }
- ClusterNode node0 = getSpiContext().node(node.id());
+ /**
+ * @param client Client.
+ * @param node Node.
+ * @param msg Message.
+ * @param ackC Ack closure.
+ */
+ private void send0(
+ GridCommunicationClient client,
+ ClusterNode node,
+ Message msg,
+ IgniteInClosure<IgniteException> ackC
+ ) throws IgniteCheckedException {
+ assert client != null;
- if (node0 == null)
- throw new IgniteCheckedException("Failed to send message to remote node " +
- "(node has left the grid): " + node.id());
- }
+ UUID nodeId = null;
- client = null;
- }
- while (retry);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteSpiException("Failed to send message to remote node: " + node, e);
- }
- finally {
- if (client != null && removeNodeClient(node.id(), client))
- client.forceClose();
+ if (!client.async())
+ nodeId = node.id();
+
+ boolean retry = client.sendMessage(nodeId, msg, ackC);
+
+ client.release();
+
+ if (!retry)
+ sentMsgsCnt.increment();
+ else {
+ removeNodeClient(node.id(), client);
+
+ ClusterNode node0 = getSpiContext().node(node.id());
+
+ if (node0 == null) {
+ U.warn(log, "Failed to send message to remote node (node has left the grid): " + node.id());
+
+ return;
}
+
+ send(node, client.connectionIndex(), msg, ackC);
}
}
/**
+ * @param nodeId Node id.
+ * @param connIdx Connection index.
+ */
+ private GridCommunicationClient nodeClient(UUID nodeId, int connIdx) {
+ GridCommunicationClient[] curClients = clients.get(nodeId);
+
+ return curClients != null && connIdx < curClients.length ? curClients[connIdx] : null;
+ }
+
+ /**
* @param nodeId Node ID.
* @param rmvClient Client to remove.
* @return {@code True} if client was removed.
@@ -2449,95 +2630,245 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
* @param node Node to which client should be open.
* @param connIdx Connection index.
* @return The existing or just created client.
- * @throws IgniteCheckedException Thrown if any exception occurs.
*/
- private GridCommunicationClient reserveClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
- assert node != null;
- assert (connIdx >= 0 && connIdx < connectionsPerNode) || !usePairedConnections(node) : connIdx;
+ private IgniteInternalFuture<GridCommunicationClient> reserveClient(ClusterNode node, int connIdx) {
+ GridFutureAdapter<GridCommunicationClient> fut = new GridFutureAdapter<>();
- UUID nodeId = node.id();
+ tryReserveClient(node, connIdx, fut);
- while (true) {
- GridCommunicationClient[] curClients = clients.get(nodeId);
+ return fut;
+ }
+
+ /**
+ * @param node Node.
+ * @param connIdx Connection index.
+ * @param fut Future.
+ */
+ private void tryReserveClient(
+ final ClusterNode node,
+ final int connIdx,
+ final GridFutureAdapter<GridCommunicationClient> fut)
+ {
+ final ReserveClientFuture reserveFut = new ReserveClientFuture(node, connIdx);
+
+ reserveFut.listen(new IgniteInClosure<IgniteInternalFuture<GridCommunicationClient>>() {
+ @Override public void apply(IgniteInternalFuture<GridCommunicationClient> fut0) {
+ try {
+ GridCommunicationClient client = fut0.get();
+
+ if (client != null)
+ fut.onDone(client);
+ else
+ tryReserveClient(node, connIdx, fut);
+ }
+ catch (IgniteCheckedException e) {
+ fut.onDone(e);
+ }
+ }
+ });
+
+ try {
+ reserveFut.reserve();
+ }
+ catch (Exception e) {
+ fut.onDone(e);
+ }
+ }
+
+ /**
+ *
+ */
+ private class ReserveClientFuture extends GridFutureAdapter<GridCommunicationClient> {
+ /** Node. */
+ private final ClusterNode node;
+
+ /** Connection index. */
+ private final int connIdx;
+
+ /**
+ * @param node Node.
+ */
+ ReserveClientFuture(ClusterNode node, int connIdx) {
+ assert node != null;
+ assert (connIdx >= 0 && connIdx < connectionsPerNode) || !usePairedConnections(node) : connIdx;
+
+ this.node = node;
+ this.connIdx = connIdx;
+ }
+
+ /**
+ *
+ */
+ void reserve() {
+ final UUID nodeId = node.id();
- GridCommunicationClient client = curClients != null && connIdx < curClients.length ?
- curClients[connIdx] : null;
+ final GridCommunicationClient client = nodeClient(nodeId, connIdx);
+
+ final GridFutureAdapter<GridCommunicationClient> connFut;
if (client == null) {
- if (stopping)
- throw new IgniteSpiException("Node is stopping.");
+ if (stopping) {
+ onDone(new IgniteSpiException("Node is stopping."));
+
+ return;
+ }
// Do not allow concurrent connects.
- GridFutureAdapter<GridCommunicationClient> fut = new ConnectFuture();
+ connFut = this;
- ConnectionKey connKey = new ConnectionKey(nodeId, connIdx, -1);
+ final ConnectionKey connKey = new ConnectionKey(nodeId, connIdx, -1);
- GridFutureAdapter<GridCommunicationClient> oldFut = clientFuts.putIfAbsent(connKey, fut);
+ final GridFutureAdapter<GridCommunicationClient> oldFut = clientFuts.putIfAbsent(connKey, connFut);
if (oldFut == null) {
try {
- GridCommunicationClient[] curClients0 = clients.get(nodeId);
-
- GridCommunicationClient client0 = curClients0 != null && connIdx < curClients0.length ?
- curClients0[connIdx] : null;
+ GridCommunicationClient client0 = nodeClient(nodeId, connIdx);
if (client0 == null) {
- client0 = createNioClient(node, connIdx);
-
- if (client0 != null) {
- addNodeClient(node, connIdx, client0);
+ IgniteInternalFuture<GridCommunicationClient> clientFut = createNioClient(node, connIdx);
- if (client0 instanceof GridTcpNioCommunicationClient) {
- GridTcpNioCommunicationClient tcpClient = ((GridTcpNioCommunicationClient)client0);
-
- if (tcpClient.session().closeTime() > 0 && removeNodeClient(nodeId, client0)) {
- if (log.isDebugEnabled())
- log.debug("Session was closed after client creation, will retry " +
- "[node=" + node + ", client=" + client0 + ']');
+ clientFut.listen(new IgniteInClosure<IgniteInternalFuture<GridCommunicationClient>>() {
+ @Override public void apply(IgniteInternalFuture<GridCommunicationClient> fut) {
+ try {
+ GridCommunicationClient client0 = fut.get();
+
+ if (client0 != null) {
+ addNodeClient(node, connIdx, client0);
+
+ if (client0 instanceof GridTcpNioCommunicationClient) {
+ GridTcpNioCommunicationClient tcpClient =
+ ((GridTcpNioCommunicationClient)client0);
+
+ if (tcpClient.session().closeTime() > 0 && removeNodeClient(nodeId, client0)) {
+ if (log.isDebugEnabled())
+ log.debug("Session was closed after client creation, " +
+ "will retry [node=" + node + ", client=" + client0 + ']');
+
+ client0 = null;
+ }
+ }
+
+ if (client0 == null) {
+ clientFuts.remove(connKey, connFut);
+
+ onDone();
+ }
+ else if (client0.reserve()) {
+ clientFuts.remove(connKey, connFut);
+
+ onDone(client0);
+ }
+ else {
+ clientFuts.remove(connKey, connFut);
+
+ removeNodeClient(nodeId, client0);
+
+ onDone();
+ }
+ }
+ else {
+ final long currTime = U.currentTimeMillis();
+
+ addTimeoutObject(new IgniteSpiTimeoutObject() {
+ private final IgniteUuid id = IgniteUuid.randomUuid();
+
+ @Override public IgniteUuid id() {
+ return id;
+ }
+
+ @Override public long endTime() {
+ return currTime + 200;
+ }
+
+ @Override public void onTimeout() {
+ SessionInfo sesInfo = new SessionInfo(null, SessionState.RETRY,
+ new Runnable() {
+ @Override public void run() {
+ clientFuts.remove(connKey, connFut);
+
+ onDone();
+ }
+ });
+
+ commWorker.addSessionStateChangeRequest(sesInfo);
+ }
+ });
+ }
+ }
+ catch (IgniteCheckedException e) {
+ clientFuts.remove(connKey, connFut);
- client0 = null;
+ onDone(e);
}
}
- }
- else
- U.sleep(200);
+ });
}
+ else {
+ assert connIdx == client0.connectionIndex() : client0;
- fut.onDone(client0);
+ if (client0.reserve())
+ onDone(client0);
+ else {
+ removeNodeClient(nodeId, client0);
+
+ onDone();
+ }
+ }
}
catch (Throwable e) {
- fut.onDone(e);
+ connFut.onDone(e);
if (e instanceof Error)
throw (Error)e;
}
- finally {
- clientFuts.remove(connKey, fut);
- }
}
- else
- fut = oldFut;
+ else {
+ oldFut.listen(new IgniteInClosure<IgniteInternalFuture<GridCommunicationClient>>() {
+ @Override public void apply(IgniteInternalFuture<GridCommunicationClient> fut) {
+ try {
+ GridCommunicationClient client0 = fut.get();
- client = fut.get();
+ if (client0 == null) {
+ clientFuts.remove(connKey, oldFut);
- if (client == null)
- continue;
+ onDone();
+ }
+ else if (client0.reserve()) {
+ clientFuts.remove(connKey, oldFut);
- if (getSpiContext().node(nodeId) == null) {
- if (removeNodeClient(nodeId, client))
- client.forceClose();
+ onDone(client0);
+ }
+ else {
+ clientFuts.remove(connKey, oldFut);
+
+ removeNodeClient(nodeId, client0);
- throw new IgniteSpiException("Destination node is not in topology: " + node.id());
+ onDone();
+ }
+ }
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
+ }
+ });
}
}
+ else {
+ assert connIdx == client.connectionIndex() : client;
+
+ if (client.reserve())
+ onDone(client);
+ else {
+ removeNodeClient(nodeId, client);
- assert connIdx == client.connectionIndex() : client;
+ onDone();
+ }
+ }
+ }
- if (client.reserve())
- return client;
- else
- // Client has just been closed by idle worker. Help it and try again.
- removeNodeClient(nodeId, client);
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(ReserveClientFuture.class, this);
}
}
@@ -2545,10 +2876,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
* @param node Node to create client for.
* @param connIdx Connection index.
* @return Client.
- * @throws IgniteCheckedException If failed.
*/
- @Nullable private GridCommunicationClient createNioClient(ClusterNode node, int connIdx)
- throws IgniteCheckedException {
+ protected IgniteInternalFuture<GridCommunicationClient> createNioClient(ClusterNode node, int connIdx) {
assert node != null;
Integer shmemPort = node.attribute(createSpiAttributeName(ATTR_SHMEM_PORT));
@@ -2556,7 +2885,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
ClusterNode locNode = getSpiContext().localNode();
if (locNode == null)
- throw new IgniteCheckedException("Failed to create NIO client (local node is stopping)");
+ return new GridFinishedFuture<>(
+ new IgniteCheckedException("Failed to create NIO client (local node is stopping)")
+ );
if (log.isDebugEnabled())
log.debug("Creating NIO client to node: " + node);
@@ -2573,7 +2904,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (log.isDebugEnabled())
log.debug("Shmem client created: " + client);
- return client;
+ return new GridFinishedFuture<>(client);
}
catch (IgniteCheckedException e) {
if (e.hasCause(IpcOutOfSystemResourcesException.class))
@@ -2584,21 +2915,17 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
else if (log.isDebugEnabled())
log.debug("Failed to establish shared memory connection with local node (node has left): " +
node.id());
+
+ return new GridFinishedFuture<>(e);
}
}
- connectGate.enter();
try {
- GridCommunicationClient client = createTcpClient(node, connIdx);
-
- if (log.isDebugEnabled())
- log.debug("TCP client created: " + client);
-
- return client;
+ return createTcpClient(node, connIdx);
}
- finally {
- connectGate.leave();
+ catch (IgniteCheckedException e) {
+ return new GridFinishedFuture<>(e);
}
}
@@ -2647,12 +2974,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
try {
- safeHandshake(client,
- null,
- node.id(),
- timeoutHelper.nextTimeoutChunk(connTimeout0),
- null,
- null);
+ safeHandshake(client, node.id(), timeoutHelper.nextTimeoutChunk(connTimeout0));
}
catch (HandshakeTimeoutException | IgniteSpiOperationTimeoutException e) {
client.forceClose();
@@ -2714,7 +3036,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
ConnectionKey id = ses.meta(CONN_IDX_META);
if (id != null) {
- ClusterNode node = getSpiContext().node(id.nodeId);
+ ClusterNode node = getSpiContext().node(id.nodeId());
if (node != null && node.isClient()) {
String msg = "Client node outbound message queue size exceeded slowClientQueueLimit, " +
@@ -2737,532 +3059,527 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
*
* @param node Remote node.
* @param connIdx Connection index.
- * @return Client.
+ * @return Client future.
* @throws IgniteCheckedException If failed.
*/
- protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
- Collection<String> rmtAddrs0 = node.attribute(createSpiAttributeName(ATTR_ADDRS));
- Collection<String> rmtHostNames0 = node.attribute(createSpiAttributeName(ATTR_HOST_NAMES));
- Integer boundPort = node.attribute(createSpiAttributeName(ATTR_PORT));
- Collection<InetSocketAddress> extAddrs = node.attribute(createSpiAttributeName(ATTR_EXT_ADDRS));
-
- boolean isRmtAddrsExist = (!F.isEmpty(rmtAddrs0) && boundPort != null);
- boolean isExtAddrsExist = !F.isEmpty(extAddrs);
+ protected IgniteInternalFuture<GridCommunicationClient> createTcpClient(ClusterNode node, int connIdx)
+ throws IgniteCheckedException
+ {
+ TcpClientFuture fut = new TcpClientFuture(node, connIdx);
- if (!isRmtAddrsExist && !isExtAddrsExist)
- throw new IgniteCheckedException("Failed to send message to the destination node. Node doesn't have any " +
- "TCP communication addresses or mapped external addresses. Check configuration and make sure " +
- "that you use the same communication SPI on all nodes. Remote node id: " + node.id());
+ connectGate.enter();
- LinkedHashSet<InetSocketAddress> addrs;
+ fut.connect();
- // Try to connect first on bound addresses.
- if (isRmtAddrsExist) {
- List<InetSocketAddress> addrs0 = new ArrayList<>(U.toSocketAddresses(rmtAddrs0, rmtHostNames0, boundPort));
+ fut.listen(new IgniteInClosure<IgniteInternalFuture<GridCommunicationClient>>() {
+ @Override public void apply(IgniteInternalFuture<GridCommunicationClient> fut0) {
+ connectGate.leave();
+ }
+ });
- boolean sameHost = U.sameMacs(getSpiContext().localNode(), node);
+ return fut;
+ }
- Collections.sort(addrs0, U.inetAddressesComparator(sameHost));
+ /**
+ * @param timeoutObj Timeout object.
+ */
+ private boolean cancelHandshakeTimeout(HandshakeTimeoutObject timeoutObj) {
+ boolean cancelled = timeoutObj.cancel();
- addrs = new LinkedHashSet<>(addrs0);
- }
- else
- addrs = new LinkedHashSet<>();
+ if (cancelled)
+ removeTimeoutObject(timeoutObj);
- // Then on mapped external addresses.
- if (isExtAddrsExist)
- addrs.addAll(extAddrs);
+ return cancelled;
+ }
- Set<InetAddress> allInetAddrs = U.newHashSet(addrs.size());
+ /**
+ *
+ */
+ private class TcpClientFuture extends GridFutureAdapter<GridCommunicationClient> {
+ /** Node. */
+ private final ClusterNode node;
- for (InetSocketAddress addr : addrs)
- allInetAddrs.add(addr.getAddress());
+ /** Timeout helper. */
+ private final IgniteSpiOperationTimeoutHelper timeoutHelper =
+ new IgniteSpiOperationTimeoutHelper(TcpCommunicationSpi.this);
- List<InetAddress> reachableInetAddrs = U.filterReachable(allInetAddrs);
+ /** Addresses. */
+ private Collection<InetSocketAddress> addrs;
- if (reachableInetAddrs.size() < allInetAddrs.size()) {
- LinkedHashSet<InetSocketAddress> addrs0 = U.newLinkedHashSet(addrs.size());
+ /** Addresses it. */
+ private Iterator<InetSocketAddress> addrsIt;
- for (InetSocketAddress addr : addrs) {
- if (reachableInetAddrs.contains(addr.getAddress()))
- addrs0.add(addr);
- }
- for (InetSocketAddress addr : addrs) {
- if (!reachableInetAddrs.contains(addr.getAddress()))
- addrs0.add(addr);
- }
+ /** Current addresses. */
+ private volatile InetSocketAddress currAddr;
- addrs = addrs0;
- }
+ /** Err. */
+ private volatile IgniteCheckedException err;
- if (log.isDebugEnabled())
- log.debug("Addresses to connect for node [rmtNode=" + node.id() + ", addrs=" + addrs.toString() + ']');
+ /** Connect attempts. */
+ private volatile int connectAttempts;
- boolean conn = false;
- GridCommunicationClient client = null;
- IgniteCheckedException errs = null;
+ /** Attempts. */
+ private volatile int attempt;
- int connectAttempts = 1;
+ /** Connection index. */
+ private volatile int connIdx;
- for (InetSocketAddress addr : addrs) {
- long connTimeout0 = connTimeout;
+ /**
+ * @param node Node.
+ */
+ TcpClientFuture(ClusterNode node, int connIdx) {
+ this.node = node;
+ this.connIdx = connIdx;
+ }
- int attempt = 1;
+ /**
+ * Connects to remote node.
+ */
+ void connect() {
+ try {
+ addrs = addrs();
+ }
+ catch (IgniteCheckedException e) {
+ onDone(e);
- IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this);
+ return;
+ }
- while (!conn) { // Reconnection on handshake timeout.
- try {
- SocketChannel ch = SocketChannel.open();
+ addrsIt = addrs.iterator();
- ch.configureBlocking(true);
+ tryConnect(true);
+ }
- ch.socket().setTcpNoDelay(tcpNoDelay);
- ch.socket().setKeepAlive(true);
+ /**
+ *
+ */
+ private void tryConnect(boolean next) {
+ if (next && !addrsIt.hasNext()) {
+ IgniteCheckedException err0 = err;
- if (sockRcvBuf > 0)
- ch.socket().setReceiveBufferSize(sockRcvBuf);
+ assert err0 != null;
- if (sockSndBuf > 0)
- ch.socket().setSendBufferSize(sockSndBuf);
+ UUID nodeId = node.id();
- if (getSpiContext().node(node.id()) == null) {
- U.closeQuiet(ch);
+ if (getSpiContext().node(nodeId) != null && (CU.clientNode(node) || !CU.clientNode(getLocalNode())) &&
+ X.hasCause(err, ConnectException.class, SocketTimeoutException.class, HandshakeTimeoutException.class,
+ IgniteSpiOperationTimeoutException.class))
+ {
+ LT.warn(log, "TcpCommunicationSpi failed to establish connection to node, node will be " +
+ "dropped from cluster [" + "rmtNode=" + node + ", err=" + err +
+ ", connectErrs=" + Arrays.toString(err.getSuppressed()) + ']');
- throw new ClusterTopologyCheckedException("Failed to send message " +
- "(node left topology): " + node);
- }
+ getSpiContext().failNode(nodeId, "TcpCommunicationSpi failed to establish connection to node " +
+ "[rmtNode=" + node + ", errs=" + err + ", connectErrs=" + Arrays.toString(err.getSuppressed()) + ']');
+ }
- ConnectionKey connKey = new ConnectionKey(node.id(), connIdx, -1);
+ onDone(err0);
- GridNioRecoveryDescriptor recoveryDesc = outRecoveryDescriptor(node, connKey);
+ return;
+ }
- if (!recoveryDesc.reserve()) {
- U.closeQuiet(ch);
+ if (next) {
+ attempt = 0;
- return null;
- }
+ connectAttempts = 0;
- long rcvCnt = -1;
+ currAddr = addrsIt.next();
+ }
- Map<Integer, Object> meta = new HashMap<>();
+ InetSocketAddress addr = currAddr;
- GridSslMeta sslMeta = null;
+ try {
+ final SocketChannel ch = SocketChannel.open();
- try {
- ch.socket().connect(addr, (int)timeoutHelper.nextTimeoutChunk(connTimeout));
+ ch.configureBlocking(false);
- if (isSslEnabled()) {
- meta.put(SSL_META.ordinal(), sslMeta = new GridSslMeta());
+ ch.socket().setTcpNoDelay(tcpNoDelay);
+ ch.socket().setKeepAlive(true);
- SSLEngine sslEngine = ignite.configuration().getSslContextFactory().create().createSSLEngine();
+ if (sockRcvBuf > 0)
+ ch.socket().setReceiveBufferSize(sockRcvBuf);
- sslEngine.setUseClientMode(true);
+ if (sockSndBuf > 0)
+ ch.socket().setSendBufferSize(sockSndBuf);
- sslMeta.sslEngine(sslEngine);
- }
+ if (getSpiContext().node(node.id()) == null) {
+ U.closeQuiet(ch);
- Integer handshakeConnIdx = connIdx;
+ onError(new ClusterTopologyCheckedException("Failed to send message " +
+ "(node left topology): " + node));
- rcvCnt = safeHandshake(ch,
- recoveryDesc,
- node.id(),
- timeoutHelper.nextTimeoutChunk(connTimeout0),
- sslMeta,
- handshakeConnIdx);
+ return;
+ }
- if (rcvCnt == -1)
- return null;
- }
- finally {
- if (recoveryDesc != null && rcvCnt == -1)
- recoveryDesc.release();
- }
+ final ConnectionKey connKey = new ConnectionKey(node.id(), connIdx, -1);
- try {
- meta.put(CONN_IDX_META, connKey);
+ final GridNioRecoveryDescriptor recoveryDesc = outRecoveryDescriptor(node, connKey);
- if (recoveryDesc != null) {
- recoveryDesc.onHandshake(rcvCnt);
+ if (!recoveryDesc.reserve()) {
+ U.closeQuiet(ch);
- meta.put(-1, recoveryDesc);
- }
+ onDone();
- GridNioSession ses = nioSrvr.createSession(ch, meta).get();
+ return;
+ }
- client = new GridTcpNioCommunicationClient(connIdx, ses, log);
+ final Map<Integer, Object> meta = new HashMap<>();
- conn = true;
- }
- finally {
- if (!conn) {
- if (recoveryDesc != null)
- recoveryDesc.release();
- }
- }
- }
- catch (HandshakeTimeoutException | IgniteSpiOperationTimeoutException e) {
- if (client != null) {
- client.forceClose();
+ final ConnectContext ctx = new ConnectContext();
- client = null;
- }
+ ctx.expNodeId = node.id();
- if (failureDetectionTimeoutEnabled() && (e instanceof HandshakeTimeoutException ||
- timeoutHelper.checkFailureTimeoutReached(e))) {
+ ctx.tcpClientFut = this;
- String msg = "Handshake timed out (failure detection timeout is reached) " +
- "[failureDetectionTimeout=" + failureDetectionTimeout() + ", addr=" + addr + ']';
+ ctx.connIdx = connIdx;
- onException(msg, e);
+ meta.put(CONN_CTX_META_KEY, ctx);
- if (log.isDebugEnabled())
- log.debug(msg);
+ meta.put(RECOVERY_DESC_META_KEY, recoveryDesc);
- if (errs == null)
- errs = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
- "Make sure that each ComputeTask and cache Transaction has a timeout set " +
- "in order to prevent parties from waiting forever in case of network issues " +
- "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
+ final int timeoutChunk = (int)timeoutHelper.nextTimeoutChunk(connTimeout);
- errs.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + addr, e));
+ final int attempt0 = attempt;
- break;
- }
+ final ConnectionTimeoutObject connTimeoutObj = new ConnectionTimeoutObject(ch, meta,
+ U.currentTimeMillis() + timeoutChunk * (1L << attempt0));
- assert !failureDetectionTimeoutEnabled();
+ addTimeoutObject(connTimeoutObj);
- onException("Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout0 +
- ", addr=" + addr + ']', e);
+ boolean connect = ch.connect(addr);
- if (log.isDebugEnabled())
- log.debug(
- "Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout0 +
- ", addr=" + addr + ", err=" + e + ']');
+ IgniteInClosure<IgniteInternalFuture<GridNioSession>> lsnr0 = new IgniteInClosure<IgniteInternalFuture<GridNioSession>>() {
+ @Override public void apply(final IgniteInternalFuture<GridNioSession> fut) {
+ GridNioSession ses = null;
- if (attempt == reconCnt || connTimeout0 > maxConnTimeout) {
- if (log.isDebugEnabled())
- log.debug("Handshake timedout (will stop attempts to perform the handshake) " +
- "[timeout=" + connTimeout0 + ", maxConnTimeout=" + maxConnTimeout +
- ", attempt=" + attempt + ", reconCnt=" + reconCnt +
- ", err=" + e.getMessage() + ", addr=" + addr + ']');
+ try {
+ ses = fut.get();
- if (errs == null)
- errs = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
- "Make sure that each ComputeTask and cache Transaction has a timeout set " +
- "in order to prevent parties from waiting forever in case of network issues " +
- "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
+ boolean canceled = connTimeoutObj.cancel();
- errs.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + addr, e));
+ if (canceled)
+ removeTimeoutObject(connTimeoutObj);
+ else {
+ final GridNioSession ses0 = ses;
- break;
- }
- else {
- attempt++;
+ Runnable clo = new Runnable() {
+ @Override public void run() {
+ GridNioFuture<Boolean> fut = nioSrvr.close(ses0);
- connTimeout0 *= 2;
+ final SocketTimeoutException e = new SocketTimeoutException("Connect timed " +
+ "(consider increasing 'connTimeout' configuration property) [addr=" +
+ currAddr + ", connTimeout=" + connTimeout + ']');
- // Continue loop.
- }
- }
- catch (Exception e) {
- if (client != null) {
- client.forceClose();
+ fut.listen(new IgniteInClosure<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> fut0) {
+ Runnable clo = new Runnable() {
+ @Override public void run() {
+ onError(e);
+ }
+ };
- client = null;
- }
+ SessionInfo sesInfo = new SessionInfo(null, SessionState.RETRY, clo);
- onException("Client creation failed [addr=" + addr + ", err=" + e + ']', e);
+ commWorker.addSessionStateChangeRequest(sesInfo);
+ }
+ });
+ }
+ };
- if (log.isDebugEnabled())
- log.debug("Client creation failed [addr=" + addr + ", err=" + e + ']');
+ commWorker.addSessionStateChangeRequest(new SessionInfo(null, SessionState.RETRY, clo));
- boolean failureDetThrReached = timeoutHelper.checkFailureTimeoutReached(e);
+ return;
+ }
- if (failureDetThrReached)
- LT.warn(log, "Connect timed out (consider increasing 'failureDetectionTimeout' " +
- "configuration property) [addr=" + addr + ", failureDetectionTimeout=" +
- failureDetectionTimeout() + ']');
- else if (X.hasCause(e, SocketTimeoutException.class))
- LT.warn(log, "Connect timed out (consider increasing 'connTimeout' " +
- "configuration property) [addr=" + addr + ", connTimeout=" + connTimeout + ']');
+ int timeoutChunk1 = (int) timeoutHelper.nextTimeoutChunk(connTimeout);
- if (errs == null)
- errs = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
- "Make sure that each ComputeTask and cache Transaction has a timeout set " +
- "in order to prevent parties from waiting forever in case of network issues " +
- "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
+ long time = U.currentTimeMillis() + timeoutChunk1 * (1L << attempt0);
- errs.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + addr, e));
+ HandshakeTimeoutObject<SocketChannel> handshakeTimeoutObj =
+ new HandshakeTimeoutObject<>(ch, TcpClientFuture.this, time);
- // Reconnect for the second time, if connection is not established.
- if (!failureDetThrReached && connectAttempts < 2 &&
- (e instanceof ConnectException || X.hasCause(e, ConnectException.class))) {
- connectAttempts++;
+ ctx.handshakeTimeoutObj = handshakeTimeoutObj;
- continue;
- }
+ addTimeoutObject(handshakeTimeoutObj);
+ }
+ catch (final IgniteSpiOperationTimeoutException e) {
+ assert ses != null;
- break;
- }
- }
+ final GridNioSession ses0 = ses;
- if (conn)
- break;
- }
+ commWorker.addSessionStateChangeRequest(new SessionInfo(null, SessionState.RETRY, new Runnable() {
+ @Override public void run() {
+ GridNioFuture<Boolean> closeFut = nioSrvr.close(ses0);
- if (client == null) {
- assert errs != null;
+ closeFut.listen(new IgniteInClosure<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> fut0) {
+ Runnable clo = new Runnable() {
+ @Override public void run() {
+ onError(e);
+ }
+ };
- if (X.hasCause(errs, ConnectException.class))
- LT.warn(log, "Failed to connect to a remote node " +
- "(make sure that destination node is alive and " +
- "operating system firewall is disabled on local and remote hosts) " +
- "[addrs=" + addrs + ']');
+ SessionInfo sesInfo = new SessionInfo(null, SessionState.RETRY, clo);
- if (getSpiContext().node(node.id()) != null && (CU.clientNode(node) || !CU.clientNode(getLocalNode())) &&
- X.hasCause(errs, ConnectException.class, SocketTimeoutException.class, HandshakeTimeoutException.class,
- IgniteSpiOperationTimeoutException.class)) {
- LT.warn(log, "TcpCommunicationSpi failed to establish connection to node, node will be dropped from " +
- "cluster [" +
- "rmtNode=" + node +
- ", err=" + errs +
- ", connectErrs=" + Arrays.toString(errs.getSuppressed()) + ']');
+ commWorker.addSessionStateChangeRequest(sesInfo);
+ }
+ });
+ }
+ }));
+ }
+ catch (IgniteCheckedException e) {
+ connTimeoutObj.cancel();
- getSpiContext().failNode(node.id(), "TcpCommunicationSpi failed to establish connection to node [" +
- "rmtNode=" + node +
- ", errs=" + errs +
- ", connectErrs=" + Arrays.toString(errs.getSuppressed()) + ']');
- }
+ removeTimeoutObject(connTimeoutObj);
- throw errs;
+ recoveryDesc.release();
+
+ onError(e);
+ }
+ }
+ };
+
+ nioSrvr.createSession(ch, meta, !connect, lsnr0);
+ }
+ catch (Exception e) {
+ onDone(e);
+ }
}
- return client;
- }
+ /**
+ * @param e Exception.
+ */
+ void onError(Exception e) {
+ if (e instanceof HandshakeTimeoutException || e instanceof IgniteSpiOperationTimeoutException) {
+ if (failureDetectionTimeoutEnabled() && (e instanceof HandshakeTimeoutException ||
+ timeoutHelper.checkFailureTimeoutReached(e))) {
- /**
- * Performs handshake in timeout-safe way.
- *
- * @param client Client.
- * @param recovery Recovery descriptor if use recovery handshake, otherwise {@code null}.
- * @param rmtNodeId Remote node.
- * @param timeout Timeout for handshake.
- * @param sslMeta Session meta.
- * @param handshakeConnIdx Non null connection index if need send it in handshake.
- * @throws IgniteCheckedException If handshake failed or wasn't completed withing timeout.
- * @return Handshake response.
- */
- @SuppressWarnings("ThrowFromFinallyBlock")
- private <T> long safeHandshake(
- T client,
- @Nullable GridNioRecoveryDescriptor recovery,
- UUID rmtNodeId,
- long timeout,
- GridSslMeta sslMeta,
- @Nullable Integer handshakeConnIdx
- ) throws IgniteCheckedException {
- HandshakeTimeoutObject<T> obj = new HandshakeTimeoutObject<>(client, U.currentTimeMillis() + timeout);
+ String msg = "Handshake timed out (failure detection timeout is reached) " +
+ "[failureDetectionTimeout=" + failureDetectionTimeout() + ", addr=" + currAddr + ']';
- addTimeoutObject(obj);
+ onException(msg, e);
- long rcvCnt = 0;
+ if (log.isDebugEnabled())
+ log.debug(msg);
- try {
- if (client instanceof GridCommunicationClient)
- ((GridCommunicationClient)client).doHandshake(new HandshakeClosure(rmtNodeId));
- else {
- SocketChannel ch = (SocketChannel)client;
+ if (err == null)
+ err = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
+ "Make sure that each ComputeTask and cache Transaction has a timeout set " +
+ "in order to prevent parties from waiting forever in case of network issues " +
+ "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
- boolean success = false;
+ err.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + currAddr, e));
- try {
- BlockingSslHandler sslHnd = null;
+ tryConnect(true);
- ByteBuffer buf;
+ return;
+ }
- if (isSslEnabled()) {
- assert sslMeta != null;
+ assert !failureDetectionTimeoutEnabled();
- sslHnd = new BlockingSslHandler(sslMeta.sslEngine(), ch, directBuf, ByteOrder.nativeOrder(), log);
+ long connTimeout0 = connTimeout * attempt;
- if (!sslHnd.handshake())
- throw new IgniteCheckedException("SSL handshake is not completed.");
+ onException("Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout +
+ ", addr=" + currAddr + ']', e);
- ByteBuffer handBuff = sslHnd.applicationBuffer();
+ if (log.isDebugEnabled())
+ log.debug(
+ "Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout +
+ ", addr=" + currAddr + ", err=" + e + ']');
- if (handBuff.remaining() < NodeIdMessage.MESSAGE_FULL_SIZE) {
- buf = ByteBuffer.allocate(1000);
+ if (attempt == reconCnt || connTimeout0 > maxConnTimeout) {
+ if (log.isDebugEnabled())
+ log.debug("Handshake timedout (will stop attempts to perform the handshake) " +
+ "[timeout=" + connTimeout0 + ", maxConnTimeout=" + maxConnTimeout +
+ ", attempt=" + attempt + ", reconCnt=" + reconCnt +
+ ", err=" + e.getMessage() + ", addr=" + currAddr + ']');
- int read = ch.read(buf);
+ if (err == null)
+ err = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
+ "Make sure that each ComputeTask and cache Transaction has a timeout set " +
+ "in order to prevent parties from waiting forever in case of network issues " +
+ "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
- if (read == -1)
- throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
+ err.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + currAddr, e));
- buf.flip();
+ tryConnect(true);
+ }
+ else {
+ attempt++;
- buf = sslHnd.decode(buf);
- }
- else
- buf = handBuff;
- }
- else {
- buf = ByteBuffer.allocate(NodeIdMessage.MESSAGE_FULL_SIZE);
+ tryConnect(false); // Reconnection on handshake timeout.
+ }
+ }
+ else {
+ onException("Client creation failed [addr=" + currAddr + ", err=" + e + ']', e);
- for (int i = 0; i < NodeIdMessage.MESSAGE_FULL_SIZE; ) {
- int read = ch.read(buf);
+ if (log.isDebugEnabled())
+ log.debug("Client creation failed [addr=" + currAddr + ", err=" + e + ']');
- if (read == -1)
- throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
+ boolean failureDetThrReached = timeoutHelper.checkFailureTimeoutReached(e);
- i += read;
- }
- }
+ if (failureDetThrReached)
+ LT.warn(log, "Connect timed out (consider increasing 'failureDetectionTimeout' " +
+ "configuration property) [addr=" + currAddr + ", failureDetectionTimeout=" +
+ failureDetectionTimeout() + ']');
+ else if (X.hasCause(e, SocketTimeoutException.class))
+ LT.warn(log, "Connect timed out (consider increasing 'connTimeout' " +
+ "configuration property) [addr=" + currAddr + ", connTimeout=" + connTimeout + ']');
- UUID rmtNodeId0 = U.bytesToUuid(buf.array(), Message.DIRECT_TYPE_SIZE);
+ if (err == null)
+ err = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
+ "Make sure that each ComputeTask and GridCacheTransaction has a timeout set " +
+ "in order to prevent parties from waiting forever in case of network issues " +
+ "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
- if (!rmtNodeId.equals(rmtNodeId0))
- throw new IgniteCheckedException("Remote node ID is not as expected [expected=" + rmtNodeId +
- ", rcvd=" + rmtNodeId0 + ']');
- else if (log.isDebugEnabled())
- log.debug("Received remote node ID: " + rmtNodeId0);
+ err.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + currAddr, e));
- if (isSslEnabled()) {
- assert sslHnd != null;
+ // Reconnect for the second time, if connection is not established.
+ int connectAttempts0;
- ch.write(sslHnd.encrypt(ByteBuffer.wrap(U.IGNITE_HEADER)));
- }
- else
- ch.write(ByteBuffer.wrap(U.IGNITE_HEADER));
+ if (!failureDetThrReached && (connectAttempts0 = connectAttempts) <= 2 &&
+ (e instanceof SocketTimeoutException || X.hasCause(e, SocketTimeoutException.class))) {
+ connectAttempts = connectAttempts0 + 1;
- ClusterNode locNode = getLocalNode();
+ tryConnect(false);
- if (locNode == null)
- throw new IgniteCheckedException("Local node has not been started or " +
- "fully initialized [isStopping=" + getSpiContext().isStopping() + ']');
+ return;
+ }
- if (recovery != null) {
- HandshakeMessage msg;
+ tryConnect(true);
+ }
- int msgSize = HandshakeMessage.MESSAGE_FULL_SIZE;
+ onDone(e);
+ }
- if (handshakeConnIdx != null) {
- msg = new HandshakeMessage2(locNode.id(),
- recovery.incrementConnectCount(),
- recovery.received(),
- handshakeConnIdx);
+ /**
+ *
+ */
+ private Collection<InetSocketAddress> addrs() throws IgniteCheckedException {
+ Collection<String> rmtAddrs0 = node.attribute(createSpiAttributeName(ATTR_ADDRS));
+ Collection<String> rmtHostNames0 = node.attribute(createSpiAttributeName(ATTR_HOST_NAMES));
+ Integer boundPort = node.attribute(createSpiAttributeName(ATTR_PORT));
+ Collection<InetSocketAddress> extAddrs = node.attribute(createSpiAttributeName(ATTR_EXT_ADDRS));
- msgSize += 4;
- }
- else {
- msg = new HandshakeMessage(locNode.id(),
- recovery.incrementConnectCount(),
- recovery.received());
- }
+ boolean isRmtAddrsExist = (!F.isEmpty(rmtAddrs0) && boundPort != null);
+ boolean isExtAddrsExist = !F.isEmpty(extAddrs);
- if (log.isDebugEnabled())
- log.debug("Write handshake message [rmtNode=" + rmtNodeId + ", msg=" + msg + ']');
+ if (!isRmtAddrsExist && !isExtAddrsExist)
+ throw new IgniteCheckedException("Failed to send message to the destination node. Node doesn't have any " +
+ "TCP communication addresses or mapped external addresses. Check configuration and make sure " +
+ "that you use the same communication SPI on all nodes. Remote node id: " + node.id());
- buf = ByteBuffer.allocate(msgSize);
+ LinkedHashSet<InetSocketAddress> addrs;
- buf.order(ByteOrder.nativeOrder());
+ // Try to connect first on bound addresses.
+ if (isRmtAddrsExist) {
+ List<InetSocketAddress> addrs0 = new ArrayList<>(U.toSocketAddresses(rmtAddrs0, rmtHostNames0, boundPort));
- boolean written = msg.writeTo(buf, null);
+ boolean sameHost = U.sameMacs(getSpiContext().localNode(), node);
- assert written;
+ Collections.sort(addrs0, U.inetAddressesComparator(sameHost));
- buf.flip();
+ addrs = new LinkedHashSet<>(addrs0);
+ }
+ else
+ addrs = new LinkedHashSet<>();
- if (isSslEnabled()) {
- assert sslHnd != null;
+ // Then on mapped external addresses.
+ if (isExtAddrsExist)
+ addrs.addAll(extAddrs);
- ch.write(sslHnd.encrypt(buf));
- }
- else
- ch.write(buf);
- }
- else {
- if (isSslEnabled()) {
- assert sslHnd != null;
+ Set<InetAddress> allInetAddrs = U.newHashSet(addrs.size());
- ch.write(sslHnd.encrypt(ByteBuffer.wrap(nodeIdMessage().nodeIdBytesWithType)));
- }
- else
- ch.write(ByteBuffer.wrap(nodeIdMessage().nodeIdBytesWithType));
- }
+ for (InetSocketAddress addr : addrs)
+ allInetAddrs.add(addr.getAddress());
- if (recovery != null) {
- if (log.isDebugEnabled())
- log.debug("Waiting for handshake [rmtNode=" + rmtNodeId + ']');
+ List<InetAddress> reachableInetAddrs = U.filterReachable(allInetAddrs);
+
+ if (reachableInetAddrs.size() < allInetAddrs.size()) {
+ LinkedHashSet<InetSocketAddress> addrs0 = U.newLinkedHashSet(addrs.size());
- if (isSslEnabled()) {
- assert sslHnd != null;
+ for (InetSocketAddress addr : addrs) {
+ if (reachableInetAddrs.contains(addr.getAddress()))
+ addrs0.add(addr);
+ }
+ for (InetSocketAddress addr : addrs) {
+ if (!reachableInetAddrs.contains(addr.getAddress()))
+ addrs0.add(addr);
+ }
- buf = ByteBuffer.allocate(1000);
+ addrs = addrs0;
+ }
- ByteBuffer decode = null;
+ if (log.isDebugEnabled())
+ log.debug("Addresses to connect for node [rmtNode=" + node.id() + ", addrs=" + addrs.toString() + ']');
- buf.order(ByteOrder.nativeOrder());
+ return addrs;
+ }
- for (int i = 0; i < RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE; ) {
- int read = ch.read(buf);
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TcpClientFuture.class, this);
+ }
+ }
- if (read == -1)
- throw new IgniteCheckedException("Failed to read remote node recovery handshake " +
- "(connection closed).");
+ /**
+ * Performs handshake in timeout-safe way.
+ *
+ * @param client Client.
+ * @param rmtNodeId Remote node.
+ * @param timeout Timeout for handshake.
+ * @throws IgniteCheckedException If handshake failed or wasn't completed withing timeout.
+ * @return Handshake response.
+ */
+ @SuppressWarnings("ThrowFromFinallyBlock")
+ private <T> long safeHandshake(T client, UUID rmtNodeId, long timeout) throws IgniteCheckedException {
+ HandshakeTimeoutObject<T> obj = new HandshakeTimeoutObject<>(client, null, U.currentTimeMillis() + timeout);
- buf.flip();
+ addTimeoutObject(obj);
- decode = sslHnd.decode(buf);
+ long rcvCnt = 0;
- i += decode.remaining();
+ try {
+ if (client instanceof GridCommunicationClient)
+ ((GridCommunicationClient)client).doHandshake(new HandshakeClosure(rmtNodeId));
+ else {
+ SocketChannel ch = (SocketChannel)client;
- buf.clear();
- }
+ boolean success = false;
- rcvCnt = decode.getLong(Message.DIRECT_TYPE_SIZE);
+ try {
+ ByteBuffer buf;
- if (decode.limit() > RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE) {
- decode.position(RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE);
+ buf = ByteBuffer.allocate(17);
- sslMeta.decodedBuffer(decode);
- }
+ for (int i = 0; i < 17; ) {
+ int read = ch.read(buf);
- ByteBuffer inBuf = sslHnd.inputBuffer();
+ if (read == -1)
+ throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
- if (inBuf.position() > 0)
- sslMeta.encodedBuffer(inBuf);
- }
- else {
- buf = ByteBuffer.allocate(RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE);
+ i += read;
+ }
- buf.order(ByteOrder.nativeOrder());
+ UUID rmtNodeId0 = U.bytesToUuid(buf.array(), Message.DIRECT_TYPE_SIZE);
- for (int i = 0; i < RecoveryLastReceivedMessage.MESSAGE_FULL_SIZE; ) {
- int read = ch.read(buf);
+ if (!rmtNodeId.equals(rmtNodeId0))
+ throw new IgniteCheckedException("Remote node ID is not as expected [expected=" + rmtNodeId +
+ ", rcvd=" + rmtNodeId0 + ']');
+ else if (log.isDebugEnabled())
+ log.debug("Received remote node ID: " + rmtNodeId0);
- if (read == -1)
- throw new IgniteCheckedException("Failed to read remote node recovery handshake " +
- "(connection closed).");
+ ch.write(ByteBuffer.wrap(U.IGNITE_HEADER));
- i += read;
- }
+ ClusterNode locNode = getLocalNode();
- rcvCnt = buf.getLong(Message.DIRECT_TYPE_SIZE);
- }
+ if (locNode == null)
+ throw new IgniteCheckedException("Local node has not been started or " +
+ "fully initialized [isStopping=" + getSpiContext().isStopping() + ']');
- if (log.isDebugEnabled())
- log.debug("Received handshake message [rmtNode=" + rmtNodeId + ", rcvCnt=" + rcvCnt + ']');
+ ch.write(ByteBuffer.wrap(nodeIdMessage().nodeIdBytesWithType));
- if (rcvCnt == -1) {
- if (log.isDebugEnabled())
- log.debug("Connection rejected, will retry client creation [rmtNode=" + rmtNodeId + ']');
- }
- else
- success = true;
- }
- else
- success = true;
+ success = true;
}
catch (IOException e) {
if (log.isDebugEnabled())
@@ -3619,7 +3936,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
*/
private class CommunicationWorker extends IgniteSpiThread {
/** */
- private final BlockingQueue<DisconnectedSessionInfo> q = new LinkedBlockingQueue<>();
+ private final BlockingQueue<SessionInfo> q = new LinkedBlockingQueue<>();
/**
* @param igniteInstanceName Ignite instance name.
@@ -3634,10 +3951,56 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
log.debug("Tcp communication worker has been started.");
while (!isInterrupted()) {
- DisconnectedSessionInfo disconnectData = q.poll(idleConnTimeout, TimeUnit.MILLISECONDS);
+ SessionInfo sesInfo = q.poll(idleConnTimeout, TimeUnit.MILLISECONDS);
+
+ if (sesInfo != null) {
+ ConnectContext ctx;
+
+ TcpClientFuture clientFut;
+
+ switch (sesInfo.state) {
+ case RECONNECT:
+ processDisconnect(sesInfo);
+
+ break;
+
+ case RETRY:
+ Runnable clo = sesInfo.clo;
+
+ assert clo != null;
- if (disconnectData != null)
- processDisconnect(disconnectData);
+ clo.run();
+
+ break;
+
+ case READY:
+ ctx = sesInfo.ses.meta(CONN_CTX_META_KEY);
+
+ assert ctx != null;
+ assert ctx.tcpClientFut != null;
+
+ GridTcpNioCommunicationClient client =
+
<TRUNCATED>
[06/50] [abbrv] ignite git commit: IGNITE-4829 Spring context
injected into JDBC driver client node.
Posted by ag...@apache.org.
IGNITE-4829 Spring context injected into JDBC driver client node.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88b61246
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88b61246
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88b61246
Branch: refs/heads/ignite-4003
Commit: 88b61246f503ee6e737004d6b1ff6debe615b191
Parents: 746ed2b
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Mar 24 10:46:56 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Mar 24 10:46:56 2017 +0700
----------------------------------------------------------------------
modules/clients/pom.xml | 7 ++
.../src/test/config/jdbc-config-cache-store.xml | 124 ++++++++++++++++++
.../jdbc2/JdbcAbstractDmlStatementSelfTest.java | 3 +
.../internal/jdbc2/JdbcConnectionSelfTest.java | 28 +++--
.../internal/jdbc2/JdbcSpringSelfTest.java | 125 +++++++++++++++++++
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 1 +
.../ignite/internal/jdbc2/JdbcConnection.java | 13 +-
.../testframework/junits/GridAbstractTest.java | 68 +++++++++-
8 files changed, 351 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index 022edb7..195204c 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -117,6 +117,13 @@
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/clients/src/test/config/jdbc-config-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/config/jdbc-config-cache-store.xml b/modules/clients/src/test/config/jdbc-config-cache-store.xml
new file mode 100644
index 0000000..1e2db3b
--- /dev/null
+++ b/modules/clients/src/test/config/jdbc-config-cache-store.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+ Ignite Spring configuration file.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+
+ <!-- Data source beans for POJO store. -->
+ <bean id="dsTest" class="org.h2.jdbcx.JdbcDataSource">
+ <property name="URL" value="jdbc:h2:mem:demo-db"/>
+ <property name="user" value="sa"/>
+ <property name="password" value=""/>
+ </bean>
+
+ <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <!-- JDBC driver should force true value -->
+ <property name="clientMode" value="false"/>
+
+ <property name="localHost" value="127.0.0.1"/>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <value>127.0.0.1:47500..47501</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+
+ <property name="peerClassLoadingEnabled" value="true"/>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="custom-cache"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="TestCacheWithStore"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
+ <property name="dataSourceBean" value="dsTest"/>
+ <property name="dialect">
+ <bean class="org.apache.ignite.cache.store.jdbc.dialect.H2Dialect"/>
+ </property>
+
+ <property name="types">
+ <list>
+ <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+ <property name="cacheName" value="TestCacheWithStore"/>
+ <property name="keyType" value="java.lang.Integer"/>
+ <property name="valueType" value="java.lang.String"/>
+ <property name="databaseSchema" value="public"/>
+ <property name="databaseTable" value="city"/>
+
+ <property name="keyFields">
+ <list>
+ <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
+ <constructor-arg>
+ <util:constant static-field="java.sql.Types.INTEGER"/>
+ </constructor-arg>
+ <constructor-arg value="id"/>
+ <constructor-arg value="int"/>
+ <constructor-arg value="id"/>
+ </bean>
+ </list>
+ </property>
+
+ <property name="valueFields">
+ <list>
+ <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
+ <constructor-arg>
+ <util:constant static-field="java.sql.Types.VARCHAR"/>
+ </constructor-arg>
+ <constructor-arg value="name"/>
+ <constructor-arg value="java.lang.String"/>
+ <constructor-arg value="name"/>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </property>
+
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ </bean>
+ </list>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
index afaadd1..440f6d0 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
@@ -150,6 +150,9 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
grid(0).cache(null).clear();
assertEquals(0, grid(0).cache(null).size(CachePeekMode.ALL));
+
+ conn.close();
+ assertTrue(conn.isClosed());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
index 6c44076..15826fb 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
@@ -44,9 +44,6 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
/** Custom cache name. */
private static final String CUSTOM_CACHE_NAME = "custom-cache";
- /** Ignite configuration URL. */
- private static final String CFG_URL = "modules/clients/src/test/config/jdbc-config.xml";
-
/** Grid count. */
private static final int GRID_CNT = 2;
@@ -56,6 +53,13 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
/** Client node flag. */
private boolean client;
+ /**
+ * @return Config URL to use in test.
+ */
+ protected String configURL() {
+ return "modules/clients/src/test/config/jdbc-config.xml";
+ }
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -104,7 +108,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testDefaults() throws Exception {
- String url = CFG_URL_PREFIX + CFG_URL;
+ String url = CFG_URL_PREFIX + configURL();
try (Connection conn = DriverManager.getConnection(url)) {
assertNotNull(conn);
@@ -121,13 +125,13 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testNodeId() throws Exception {
- String url = CFG_URL_PREFIX + "nodeId=" + grid(0).localNode().id() + '@' + CFG_URL;
+ String url = CFG_URL_PREFIX + "nodeId=" + grid(0).localNode().id() + '@' + configURL();
try (Connection conn = DriverManager.getConnection(url)) {
assertNotNull(conn);
}
- url = CFG_URL_PREFIX + "cache=" + CUSTOM_CACHE_NAME + ":nodeId=" + grid(0).localNode().id() + '@' + CFG_URL;
+ url = CFG_URL_PREFIX + "cache=" + CUSTOM_CACHE_NAME + ":nodeId=" + grid(0).localNode().id() + '@' + configURL();
try (Connection conn = DriverManager.getConnection(url)) {
assertNotNull(conn);
@@ -140,7 +144,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
public void testWrongNodeId() throws Exception {
UUID wrongId = UUID.randomUUID();
- final String url = CFG_URL_PREFIX + "nodeId=" + wrongId + '@' + CFG_URL;
+ final String url = CFG_URL_PREFIX + "nodeId=" + wrongId + '@' + configURL();
GridTestUtils.assertThrows(
log,
@@ -166,7 +170,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
UUID clientId = client.localNode().id();
- final String url = CFG_URL_PREFIX + "nodeId=" + clientId + '@' + CFG_URL;
+ final String url = CFG_URL_PREFIX + "nodeId=" + clientId + '@' + configURL();
GridTestUtils.assertThrows(
log,
@@ -192,7 +196,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
UUID daemonId = daemon.localNode().id();
- final String url = CFG_URL_PREFIX + "nodeId=" + daemonId + '@' + CFG_URL;
+ final String url = CFG_URL_PREFIX + "nodeId=" + daemonId + '@' + configURL();
GridTestUtils.assertThrows(
log,
@@ -212,7 +216,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testCustomCache() throws Exception {
- String url = CFG_URL_PREFIX + "cache=" + CUSTOM_CACHE_NAME + '@' + CFG_URL;
+ String url = CFG_URL_PREFIX + "cache=" + CUSTOM_CACHE_NAME + '@' + configURL();
try (Connection conn = DriverManager.getConnection(url)) {
assertNotNull(conn);
@@ -223,7 +227,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testWrongCache() throws Exception {
- final String url = CFG_URL_PREFIX + "cache=wrongCacheName@" + CFG_URL;
+ final String url = CFG_URL_PREFIX + "cache=wrongCacheName@" + configURL();
GridTestUtils.assertThrows(
log,
@@ -243,7 +247,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testClose() throws Exception {
- String url = CFG_URL_PREFIX + CFG_URL;
+ String url = CFG_URL_PREFIX + configURL();
try(final Connection conn = DriverManager.getConnection(url)) {
assertNotNull(conn);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcSpringSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcSpringSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcSpringSelfTest.java
new file mode 100644
index 0000000..fb03ae8
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcSpringSelfTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import javax.sql.DataSource;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteComponentType;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.resource.GridResourceIoc;
+import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
+import org.apache.ignite.resources.SpringApplicationContextResource;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
+
+/**
+ * Test of cluster and JDBC driver with config that contains cache with POJO store and datasource bean.
+ */
+public class JdbcSpringSelfTest extends JdbcConnectionSelfTest {
+ /** Grid count. */
+ private static final int GRID_CNT = 2;
+
+ /** {@inheritDoc} */
+ @Override protected String configURL() {
+ return "modules/clients/src/test/config/jdbc-config-cache-store.xml";
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setMarshaller(null); // In this test we are using default Marshaller.
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGridsWithSpringCtx(GRID_CNT, false, configURL());
+
+ Class.forName("org.apache.ignite.IgniteJdbcDriver");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testClientNodeId() throws Exception {
+ IgniteEx client = (IgniteEx) startGridWithSpringCtx(getTestIgniteInstanceName(), true, configURL());
+
+ UUID clientId = client.localNode().id();
+
+ final String url = CFG_URL_PREFIX + "nodeId=" + clientId + '@' + configURL();
+
+ GridTestUtils.assertThrows(
+ log,
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try (Connection conn = DriverManager.getConnection(url)) {
+ return conn;
+ }
+ }
+ },
+ SQLException.class,
+ "Failed to establish connection with node (is it a server node?): " + clientId
+ );
+ }
+
+ /**
+ * Special class to test Spring context injection.
+ */
+ private static class TestInjectTarget {
+ /** */
+ @SpringApplicationContextResource
+ private Object appCtx;
+ }
+
+ /**
+ * Test that we have valid Spring context and also could create beans from it.
+ *
+ * @throws Exception If test failed.
+ */
+ public void testSpringBean() throws Exception {
+ String url = CFG_URL_PREFIX + configURL();
+
+ // Create connection.
+ try (Connection conn = DriverManager.getConnection(url)) {
+ assertNotNull(conn);
+
+ TestInjectTarget target = new TestInjectTarget();
+
+ IgniteKernal kernal = (IgniteKernal)((JdbcConnection)conn).ignite();
+
+ // Inject Spring context to test object.
+ kernal.context().resource().inject(target, GridResourceIoc.AnnotationSet.GENERIC);
+
+ assertNotNull(target.appCtx);
+
+ IgniteSpringHelper spring = IgniteComponentType.SPRING.create(false);
+
+ // Load bean by name.
+ DataSource ds = spring.loadBeanFromAppContext(target.appCtx, "dsTest");
+
+ assertNotNull(ds);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 7395fcb..85e7d90 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -52,6 +52,7 @@ public class IgniteJdbcDriverTestSuite extends TestSuite {
// Ignite client node based driver tests
suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcConnectionSelfTest.class));
+ suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcSpringSelfTest.class));
suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcStatementSelfTest.class));
suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcPreparedStatementSelfTest.class));
suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcResultSetSelfTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
index 18c13ca..2220bfe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
@@ -219,8 +219,12 @@ public class JdbcConnection implements Connection {
ignite = Ignition.start();
}
- else
- ignite = Ignition.start(loadConfiguration(cfgUrl));
+ else {
+ IgniteBiTuple<IgniteConfiguration, ? extends GridSpringResourceContext> cfgAndCtx =
+ loadConfiguration(cfgUrl);
+
+ ignite = IgnitionEx.start(cfgAndCtx.get1(), cfgAndCtx.get2());
+ }
fut.onDone(ignite);
}
@@ -241,8 +245,9 @@ public class JdbcConnection implements Connection {
/**
* @param cfgUrl Config URL.
+ * @return Ignite config and Spring context.
*/
- private IgniteConfiguration loadConfiguration(String cfgUrl) {
+ private IgniteBiTuple<IgniteConfiguration, ? extends GridSpringResourceContext> loadConfiguration(String cfgUrl) {
try {
IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap =
IgnitionEx.loadConfigurations(cfgUrl);
@@ -254,7 +259,7 @@ public class JdbcConnection implements Connection {
cfg.setClientMode(true); // Force client mode.
- return cfg;
+ return new IgniteBiTuple<>(cfg, cfgMap.getValue());
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88b61246/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 5a76ddd..ddcf91f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -71,6 +71,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.marshaller.Marshaller;
@@ -828,6 +829,68 @@ public abstract class GridAbstractTest extends TestCase {
}
/**
+ * Starts new grid with given name.
+ *
+ * @param gridName Grid name.
+ * @param client Client mode.
+ * @param cfgUrl Config URL.
+ * @return Started grid.
+ * @throws Exception If failed.
+ */
+ protected Ignite startGridWithSpringCtx(String gridName, boolean client, String cfgUrl) throws Exception {
+ IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap =
+ IgnitionEx.loadConfigurations(cfgUrl);
+
+ IgniteConfiguration cfg = F.first(cfgMap.get1());
+
+ cfg.setIgniteInstanceName(gridName);
+ cfg.setClientMode(client);
+
+ return IgnitionEx.start(cfg, cfgMap.getValue());
+ }
+
+ /**
+ * Starts new node with given index.
+ *
+ * @param idx Index of the node to start.
+ * @param client Client mode.
+ * @param cfgUrl Config URL.
+ * @return Started node.
+ * @throws Exception If failed.
+ */
+ protected Ignite startGridWithSpringCtx(int idx, boolean client, String cfgUrl) throws Exception {
+ return startGridWithSpringCtx(getTestIgniteInstanceName(idx), client, cfgUrl);
+ }
+
+ /**
+ * Start specified amount of nodes.
+ *
+ * @param cnt Nodes count.
+ * @param client Client mode.
+ * @param cfgUrl Config URL.
+ * @return First started node.
+ * @throws Exception If failed.
+ */
+ protected Ignite startGridsWithSpringCtx(int cnt, boolean client, String cfgUrl) throws Exception {
+ assert cnt > 0;
+
+ Ignite ignite = null;
+
+ for (int i = 0; i < cnt; i++) {
+ if (ignite == null)
+ ignite = startGridWithSpringCtx(i, client, cfgUrl);
+ else
+ startGridWithSpringCtx(i, client, cfgUrl);
+ }
+
+ checkTopology(cnt);
+
+ assert ignite != null;
+
+ return ignite;
+ }
+
+ /**
* Starts new grid at another JVM with given name.
*
* @param igniteInstanceName Ignite instance name.
@@ -1859,7 +1922,7 @@ public abstract class GridAbstractTest extends TestCase {
* @param store Store.
*/
protected <T> Factory<T> singletonFactory(T store) {
- return notSerializableProxy(new FactoryBuilder.SingletonFactory<T>(store), Factory.class);
+ return notSerializableProxy(new FactoryBuilder.SingletonFactory<>(store), Factory.class);
}
/**
@@ -2179,7 +2242,8 @@ public abstract class GridAbstractTest extends TestCase {
}
/** */
- public static abstract class TestIgniteIdxCallable<R> implements Serializable {
+ public abstract static class TestIgniteIdxCallable<R> implements Serializable {
+ /** */
@IgniteInstanceResource
protected Ignite ignite;
[39/50] [abbrv] ignite git commit: .NET: Remove unused imports
Posted by ag...@apache.org.
.NET: Remove unused imports
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/90506c41
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/90506c41
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/90506c41
Branch: refs/heads/ignite-4003
Commit: 90506c418508976509daf04acbd6942b48199932
Parents: 831b272
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 28 16:27:48 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 28 16:27:48 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs | 1 -
.../Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs | 1 -
2 files changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/90506c41/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
index f06937d..4a3885f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.Core.Cache.Affinity.Fair
{
using System;
- using Apache.Ignite.Core.Impl.Cache.Affinity;
/// <summary>
/// Fair affinity function which tries to ensure that all nodes get equal number of partitions with
http://git-wip-us.apache.org/repos/asf/ignite/blob/90506c41/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
index 928324c..98ec364 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.Core.Cache.Affinity.Rendezvous
{
using System;
- using Apache.Ignite.Core.Impl.Cache.Affinity;
/// <summary>
/// Affinity function for partitioned cache based on Highest Random Weight algorithm.
[16/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TransactionProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TransactionProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TransactionProxyImpl.java
index 8ffec00..8750cab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TransactionProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TransactionProxyImpl.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
@@ -46,6 +47,7 @@ import org.apache.ignite.transactions.TransactionState;
/**
* Cache transaction proxy.
*/
+@SuppressWarnings("unchecked")
public class TransactionProxyImpl<K, V> implements TransactionProxy, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -270,6 +272,18 @@ public class TransactionProxyImpl<K, V> implements TransactionProxy, Externaliza
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> commitAsync() throws IgniteException {
+ enter();
+
+ try {
+ return (IgniteFuture<Void>)createFuture(cctx.commitTxAsync(tx));
+ }
+ finally {
+ leave();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void close() {
enter();
@@ -304,6 +318,21 @@ public class TransactionProxyImpl<K, V> implements TransactionProxy, Externaliza
}
}
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> rollbackAsync() throws IgniteException {
+ enter();
+
+ try {
+ return (IgniteFuture<Void>)(new IgniteFutureImpl(cctx.rollbackTxAsync(tx)));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ finally {
+ leave();
+ }
+ }
+
/**
* @param res Result to convert to finished future.
*/
@@ -315,6 +344,14 @@ public class TransactionProxyImpl<K, V> implements TransactionProxy, Externaliza
* @param fut Internal future.
*/
private void saveFuture(IgniteInternalFuture<IgniteInternalTx> fut) {
+ asyncRes = createFuture(fut);
+ }
+
+ /**
+ * @param fut Internal future.
+ * @return User future.
+ */
+ private IgniteFuture<?> createFuture(IgniteInternalFuture<IgniteInternalTx> fut) {
IgniteInternalFuture<Transaction> fut0 = fut.chain(new CX1<IgniteInternalFuture<IgniteInternalTx>, Transaction>() {
@Override public Transaction applyx(IgniteInternalFuture<IgniteInternalTx> fut) throws IgniteCheckedException {
fut.get();
@@ -323,7 +360,7 @@ public class TransactionProxyImpl<K, V> implements TransactionProxy, Externaliza
}
});
- asyncRes = new IgniteFutureImpl(fut0);
+ return new IgniteFutureImpl(fut0);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
index 106ef60..b5289a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
@@ -21,6 +21,7 @@ import java.net.URI;
import java.util.Collection;
import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.igfs.IgfsBlockLocation;
@@ -36,6 +37,7 @@ import org.apache.ignite.igfs.mapreduce.IgfsTask;
import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
import org.apache.ignite.internal.AsyncSupportAdapter;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -58,7 +60,7 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
/** {@inheritDoc} */
@Override public void format() {
try {
- saveOrGet(igfs.formatAsync());
+ saveOrGet(igfs.formatAsync0());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -66,10 +68,15 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> formatAsync() throws IgniteException {
+ return igfs.formatAsync();
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, @Nullable T arg) {
try {
- return saveOrGet(igfs.executeAsync(task, rslvr, paths, arg));
+ return saveOrGet(igfs.executeAsync0(task, rslvr, paths, arg));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -77,10 +84,16 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
+ return igfs.executeAsync(task, rslvr, paths, arg);
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) {
try {
- return saveOrGet(igfs.executeAsync(task, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg));
+ return saveOrGet(igfs.executeAsync0(task, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -88,10 +101,17 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen,
+ @Nullable T arg) throws IgniteException {
+ return igfs.executeAsync(task, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg);
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) {
try {
- return saveOrGet(igfs.executeAsync(taskCls, rslvr, paths, arg));
+ return saveOrGet(igfs.executeAsync0(taskCls, rslvr, paths, arg));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -99,11 +119,17 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
+ return igfs.executeAsync(taskCls, rslvr, paths, arg);
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
long maxRangeLen, @Nullable T arg) {
try {
- return saveOrGet(igfs.executeAsync(taskCls, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg));
+ return saveOrGet(igfs.executeAsync0(taskCls, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -111,6 +137,13 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen,
+ @Nullable T arg) throws IgniteException {
+ return igfs.executeAsync(taskCls, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg);
+ }
+
+ /** {@inheritDoc} */
@Override public void stop(boolean cancel) {
igfs.stop(cancel);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 7165f31..18506cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -83,6 +83,7 @@ import org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallabl
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.A;
@@ -1430,12 +1431,17 @@ public final class IgfsImpl implements IgfsEx {
}
}
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> formatAsync() throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(formatAsync0());
+ }
+
/**
* Formats the file system removing all existing entries from it.
*
* @return Future.
*/
- IgniteInternalFuture<?> formatAsync() {
+ IgniteInternalFuture<?> formatAsync0() {
GridFutureAdapter<?> fut = new GridFutureAdapter<>();
Thread t = new Thread(new FormatRunnable(fut), "igfs-format-" + cfg.getName() + "-" +
@@ -1452,7 +1458,7 @@ public final class IgfsImpl implements IgfsEx {
@Override public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, @Nullable T arg) {
try {
- return executeAsync(task, rslvr, paths, arg).get();
+ return executeAsync0(task, rslvr, paths, arg).get();
}
catch (Exception e) {
throw IgfsUtils.toIgfsException(e);
@@ -1460,10 +1466,16 @@ public final class IgfsImpl implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
+ return createFuture(executeAsync0(task, rslvr, paths, arg));
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) {
try {
- return executeAsync(task, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg).get();
+ return executeAsync0(task, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg).get();
}
catch (Exception e) {
throw IgfsUtils.toIgfsException(e);
@@ -1471,10 +1483,17 @@ public final class IgfsImpl implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen,
+ @Nullable T arg) throws IgniteException {
+ return createFuture(executeAsync0(task, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg));
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) {
try {
- return executeAsync(taskCls, rslvr, paths, arg).get();
+ return executeAsync0(taskCls, rslvr, paths, arg).get();
}
catch (Exception e) {
throw IgfsUtils.toIgfsException(e);
@@ -1482,17 +1501,30 @@ public final class IgfsImpl implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
+ return createFuture(executeAsync0(taskCls, rslvr, paths, arg));
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
long maxRangeSize, @Nullable T arg) {
try {
- return executeAsync(taskCls, rslvr, paths, skipNonExistentFiles, maxRangeSize, arg).get();
+ return executeAsync0(taskCls, rslvr, paths, skipNonExistentFiles, maxRangeSize, arg).get();
}
catch (Exception e) {
throw IgfsUtils.toIgfsException(e);
}
}
+ /** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen,
+ @Nullable T arg) throws IgniteException {
+ return createFuture(executeAsync0(taskCls, rslvr, paths, skipNonExistentFiles, maxRangeLen, arg));
+ }
+
/**
* Executes IGFS task asynchronously.
*
@@ -1502,9 +1534,9 @@ public final class IgfsImpl implements IgfsEx {
* @param arg Optional task argument.
* @return Execution future.
*/
- <T, R> IgniteInternalFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ <T, R> IgniteInternalFuture<R> executeAsync0(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, @Nullable T arg) {
- return executeAsync(task, rslvr, paths, true, cfg.getMaximumTaskRangeLength(), arg);
+ return executeAsync0(task, rslvr, paths, true, cfg.getMaximumTaskRangeLength(), arg);
}
/**
@@ -1521,7 +1553,7 @@ public final class IgfsImpl implements IgfsEx {
* @param arg Optional task argument.
* @return Execution future.
*/
- <T, R> IgniteInternalFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ <T, R> IgniteInternalFuture<R> executeAsync0(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) {
return igfsCtx.kernalContext().task().execute(task, new IgfsTaskArgsImpl<>(cfg.getName(), paths, rslvr,
skipNonExistentFiles, maxRangeLen, arg));
@@ -1536,9 +1568,9 @@ public final class IgfsImpl implements IgfsEx {
* @param arg Optional task argument.
* @return Execution future.
*/
- <T, R> IgniteInternalFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ <T, R> IgniteInternalFuture<R> executeAsync0(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) {
- return executeAsync(taskCls, rslvr, paths, true, cfg.getMaximumTaskRangeLength(), arg);
+ return executeAsync0(taskCls, rslvr, paths, true, cfg.getMaximumTaskRangeLength(), arg);
}
/**
@@ -1555,7 +1587,7 @@ public final class IgfsImpl implements IgfsEx {
* @return Execution future.
*/
@SuppressWarnings("unchecked")
- <T, R> IgniteInternalFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ <T, R> IgniteInternalFuture<R> executeAsync0(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
long maxRangeLen, @Nullable T arg) {
return igfsCtx.kernalContext().task().execute((Class<IgfsTask<T, R>>)taskCls,
@@ -1780,6 +1812,14 @@ public final class IgfsImpl implements IgfsEx {
}
/**
+ * @param fut Internal future.
+ * @return Public API future.
+ */
+ private <R> IgniteFuture<R> createFuture(IgniteInternalFuture<R> fut) {
+ return new IgniteFutureImpl<>(fut);
+ }
+
+ /**
* IGFS thread factory.
*/
@SuppressWarnings("NullableProblems")
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
index 396e784..5e785e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
@@ -33,7 +33,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Abstract interop target.
*/
-public abstract class PlatformAbstractTarget implements PlatformTarget, PlatformAsyncTarget {
+public abstract class PlatformAbstractTarget implements PlatformTarget {
/** Constant: TRUE.*/
protected static final int TRUE = 1;
@@ -73,16 +73,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget, Platform
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture currentFuture() throws IgniteCheckedException {
- throw new IgniteCheckedException("Future listening is not supported in " + getClass());
- }
-
- /** {@inheritDoc} */
- @Override @Nullable public PlatformFutureUtils.Writer futureWriter(int opId){
- return null;
- }
-
- /** {@inheritDoc} */
@Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
return throwUnsupported(type);
}
@@ -203,18 +193,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget, Platform
}
/**
- * Reads future information and listens.
- *
- * @param reader Reader.
- * @throws IgniteCheckedException In case of error.
- */
- protected long readAndListenFuture(BinaryRawReader reader) throws IgniteCheckedException {
- readAndListenFuture(reader, currentFuture(), null);
-
- return TRUE;
- }
-
- /**
* Wraps a listenable to be returned to platform.
*
* @param listenable Listenable.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncTarget.java
deleted file mode 100644
index a4d35c9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncTarget.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.platform;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Async target.
- */
-public interface PlatformAsyncTarget {
- /**
- * Gets future for the current operation.
- *
- * @return current future.
- * @throws IgniteCheckedException If failed.
- */
- IgniteInternalFuture currentFuture() throws IgniteCheckedException;
-
- /**
- * Gets a custom future writer.
- *
- * @param opId Operation id.
- * @return A custom writer for given op id.
- */
- @Nullable PlatformFutureUtils.Writer futureWriter(int opId);
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
index c2a0797..1ee57cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.platform;
-import org.apache.ignite.IgniteCheckedException;
import org.jetbrains.annotations.Nullable;
/**
@@ -106,27 +105,6 @@ public interface PlatformTargetProxy {
void inStreamAsync(int type, long memPtr) throws Exception;
/**
- * Start listening for the future.
- *
- * @param futId Future ID.
- * @param typ Result type.
- * @throws IgniteCheckedException In case of failure.
- */
- @SuppressWarnings("UnusedDeclaration")
- void listenFuture(final long futId, int typ) throws Exception;
-
- /**
- * Start listening for the future for specific operation type.
- *
- * @param futId Future ID.
- * @param typ Result type.
- * @param opId Operation ID required to pick correct result writer.
- * @throws IgniteCheckedException In case of failure.
- */
- @SuppressWarnings("UnusedDeclaration")
- void listenFutureForOperation(final long futId, int typ, int opId) throws Exception;
-
- /**
* Returns the underlying target.
*
* @return Underlying target.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
index 7e0036d..44044b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
@@ -17,9 +17,7 @@
package org.apache.ignite.internal.processors.platform;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
@@ -37,6 +35,10 @@ public class PlatformTargetProxyImpl implements PlatformTargetProxy {
/** Underlying target. */
private final PlatformTarget target;
+ /**
+ * @param target Platform target.
+ * @param platformCtx Platform context.
+ */
public PlatformTargetProxyImpl(PlatformTarget target, PlatformContext platformCtx) {
assert platformCtx != null;
assert target != null;
@@ -115,15 +117,13 @@ public class PlatformTargetProxyImpl implements PlatformTargetProxy {
final PlatformAsyncResult res = target.processInStreamAsync(type, reader);
- if (res == null) {
+ if (res == null)
throw new IgniteException("PlatformTarget.processInStreamAsync should not return null.");
- }
IgniteFuture fut = res.future();
- if (fut == null) {
+ if (fut == null)
throw new IgniteException("PlatformAsyncResult.future() should not return null.");
- }
PlatformFutureUtils.listen(platformCtx, fut, futId, futTyp, new PlatformFutureUtils.Writer() {
/** {@inheritDoc} */
@@ -211,35 +211,11 @@ public class PlatformTargetProxyImpl implements PlatformTargetProxy {
}
/** {@inheritDoc} */
- @Override public void listenFuture(final long futId, int typ) throws Exception {
- PlatformFutureUtils.listen(platformCtx, currentFuture(), futId, typ, null, target);
- }
-
- /** {@inheritDoc} */
- @Override public void listenFutureForOperation(final long futId, int typ, int opId) throws Exception {
- PlatformFutureUtils.listen(platformCtx, currentFuture(), futId, typ, futureWriter(opId), target);
- }
-
- /** {@inheritDoc} */
@Override public PlatformTarget unwrap() {
return target;
}
/**
- * @return Future writer.
- */
- private PlatformFutureUtils.Writer futureWriter(int opId) {
- return ((PlatformAsyncTarget)target).futureWriter(opId);
- }
-
- /**
- * @return Current future.
- */
- private IgniteInternalFuture currentFuture() throws IgniteCheckedException {
- return ((PlatformAsyncTarget)target).currentFuture();
- }
-
- /**
* Wraps an object in a proxy when possible.
*
* @param obj Object to wrap.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 2abcc0d..72f5d62 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -32,7 +32,6 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.TextQuery;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.cache.CacheOperationContext;
@@ -56,7 +55,6 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformListenable;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
import org.apache.ignite.internal.util.GridConcurrentFactory;
-import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.lang.IgniteBiInClosure;
@@ -334,9 +332,6 @@ public class PlatformCache extends PlatformAbstractTarget {
/** Initial JCache (not in binary mode). */
private final IgniteCache rawCache;
- /** Underlying JCache in async mode. */
- private final IgniteCache cacheAsync;
-
/** Whether this cache is created with "keepBinary" flag on the other side. */
private final boolean keepBinary;
@@ -386,8 +381,9 @@ public class PlatformCache extends PlatformAbstractTarget {
assert exts != null;
rawCache = cache;
+
IgniteCache binCache = cache.withKeepBinary();
- cacheAsync = binCache.withAsync();
+
this.cache = (IgniteCacheProxy)binCache;
this.keepBinary = keepBinary;
this.exts = exts;
@@ -448,12 +444,12 @@ public class PlatformCache extends PlatformAbstractTarget {
reader.readObjectDetached()) ? TRUE : FALSE;
case OP_LOC_LOAD_CACHE:
- loadCache0(reader, true, cache);
+ loadCache0(reader, true);
return TRUE;
case OP_LOAD_CACHE:
- loadCache0(reader, false, cache);
+ loadCache0(reader, false);
return TRUE;
@@ -553,66 +549,66 @@ public class PlatformCache extends PlatformAbstractTarget {
});
}
-
case OP_PUT_ASYNC: {
- cacheAsync.put(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.putAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_CLEAR_CACHE_ASYNC: {
- cacheAsync.clear();
+ readAndListenFuture(reader, cache.clearAsync());
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_CLEAR_ALL_ASYNC: {
- cacheAsync.clearAll(PlatformUtils.readSet(reader));
+ readAndListenFuture(reader, cache.clearAllAsync(PlatformUtils.readSet(reader)));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_REMOVE_ALL2_ASYNC: {
- cacheAsync.removeAll();
+ readAndListenFuture(reader, cache.removeAllAsync());
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_SIZE_ASYNC: {
CachePeekMode[] modes = PlatformUtils.decodeCachePeekModes(reader.readInt());
- cacheAsync.size(modes);
+ readAndListenFuture(reader, cache.sizeAsync(modes));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_CLEAR_ASYNC: {
- cacheAsync.clear(reader.readObjectDetached());
+ readAndListenFuture(reader, cache.clearAsync(reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_LOAD_CACHE_ASYNC: {
- loadCache0(reader, false, cacheAsync);
+ readAndListenFuture(reader, loadCacheAsync0(reader, false));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_LOC_LOAD_CACHE_ASYNC: {
- loadCache0(reader, true, cacheAsync);
+ readAndListenFuture(reader, loadCacheAsync0(reader, true));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_PUT_ALL_ASYNC:
- cacheAsync.putAll(PlatformUtils.readMap(reader));
+ readAndListenFuture(reader, cache.putAllAsync(PlatformUtils.readMap(reader)));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_REMOVE_ALL_ASYNC:
- cacheAsync.removeAll(PlatformUtils.readSet(reader));
+ readAndListenFuture(reader, cache.removeAllAsync(PlatformUtils.readSet(reader)));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_REBALANCE:
readAndListenFuture(reader, cache.rebalance());
@@ -620,79 +616,81 @@ public class PlatformCache extends PlatformAbstractTarget {
return TRUE;
case OP_GET_ASYNC:
- cacheAsync.get(reader.readObjectDetached());
+ readAndListenFuture(reader, cache.getAsync(reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_CONTAINS_KEY_ASYNC:
- cacheAsync.containsKey(reader.readObjectDetached());
+ readAndListenFuture(reader, cache.containsKeyAsync(reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_CONTAINS_KEYS_ASYNC:
- cacheAsync.containsKeys(PlatformUtils.readSet(reader));
+ readAndListenFuture(reader, cache.containsKeysAsync(PlatformUtils.readSet(reader)));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_REMOVE_OBJ_ASYNC:
- cacheAsync.remove(reader.readObjectDetached());
+ readAndListenFuture(reader, cache.removeAsync(reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_REMOVE_BOOL_ASYNC:
- cacheAsync.remove(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.removeAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_GET_ALL_ASYNC: {
Set keys = PlatformUtils.readSet(reader);
- cacheAsync.getAll(keys);
-
- readAndListenFuture(reader, cacheAsync.future(), WRITER_GET_ALL);
+ readAndListenFuture(reader, cache.getAllAsync(keys), WRITER_GET_ALL);
return TRUE;
}
case OP_GET_AND_PUT_ASYNC:
- cacheAsync.getAndPut(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.getAndPutAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_GET_AND_PUT_IF_ABSENT_ASYNC:
- cacheAsync.getAndPutIfAbsent(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.getAndPutIfAbsentAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_GET_AND_REMOVE_ASYNC:
- cacheAsync.getAndRemove(reader.readObjectDetached());
+ readAndListenFuture(reader, cache.getAndRemoveAsync(reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_GET_AND_REPLACE_ASYNC:
- cacheAsync.getAndReplace(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.getAndReplaceAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_REPLACE_2_ASYNC:
- cacheAsync.replace(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.replaceAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_REPLACE_3_ASYNC:
- cacheAsync.replace(reader.readObjectDetached(), reader.readObjectDetached(),
- reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.replaceAsync(reader.readObjectDetached(), reader.readObjectDetached(),
+ reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_INVOKE_ASYNC: {
Object key = reader.readObjectDetached();
CacheEntryProcessor proc = platformCtx.createCacheEntryProcessor(reader.readObjectDetached(), 0);
- cacheAsync.invoke(key, proc);
-
- readAndListenFuture(reader, cacheAsync.future(), WRITER_INVOKE);
+ readAndListenFuture(reader, cache.invokeAsync(key, proc), WRITER_INVOKE);
return TRUE;
}
@@ -702,17 +700,16 @@ public class PlatformCache extends PlatformAbstractTarget {
CacheEntryProcessor proc = platformCtx.createCacheEntryProcessor(reader.readObjectDetached(), 0);
- cacheAsync.invokeAll(keys, proc);
-
- readAndListenFuture(reader, cacheAsync.future(), WRITER_INVOKE_ALL);
+ readAndListenFuture(reader, cache.invokeAllAsync(keys, proc), WRITER_INVOKE_ALL);
return TRUE;
}
case OP_PUT_IF_ABSENT_ASYNC:
- cacheAsync.putIfAbsent(reader.readObjectDetached(), reader.readObjectDetached());
+ readAndListenFuture(reader,
+ cache.putIfAbsentAsync(reader.readObjectDetached(), reader.readObjectDetached()));
- return readAndListenFuture(reader);
+ return TRUE;
case OP_INVOKE: {
Object key = reader.readObjectDetached();
@@ -807,8 +804,45 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Loads cache via localLoadCache or loadCache.
+ *
+ * @param reader Binary reader.
+ * @param loc Local flag.
+ * @return Cache async operation future.
*/
- private void loadCache0(BinaryRawReaderEx reader, boolean loc, IgniteCache cache) {
+ private void loadCache0(BinaryRawReaderEx reader, boolean loc) {
+ PlatformCacheEntryFilter filter = createPlatformCacheEntryFilter(reader);
+
+ Object[] args = readLoadCacheArgs(reader);
+
+ if (loc)
+ cache.localLoadCache(filter, args);
+ else
+ cache.loadCache(filter, args);
+ }
+
+ /**
+ * Asynchronously loads cache via localLoadCacheAsync or loadCacheAsync.
+ *
+ * @param reader Binary reader.
+ * @param loc Local flag.
+ * @return Cache async operation future.
+ */
+ private IgniteFuture<Void> loadCacheAsync0(BinaryRawReaderEx reader, boolean loc) {
+ PlatformCacheEntryFilter filter = createPlatformCacheEntryFilter(reader);
+
+ Object[] args = readLoadCacheArgs(reader);
+
+ if (loc)
+ return cache.localLoadCacheAsync(filter, args);
+ else
+ return cache.loadCacheAsync(filter, args);
+ }
+
+ /**
+ * @param reader Binary reader.
+ * @return created object.
+ */
+ @Nullable private PlatformCacheEntryFilter createPlatformCacheEntryFilter(BinaryRawReaderEx reader) {
PlatformCacheEntryFilter filter = null;
Object pred = reader.readObjectDetached();
@@ -816,6 +850,14 @@ public class PlatformCache extends PlatformAbstractTarget {
if (pred != null)
filter = platformCtx.createCacheEntryFilter(pred, 0);
+ return filter;
+ }
+
+ /**
+ * @param reader Binary reader.
+ * @return Arguments array.
+ */
+ @Nullable private Object[] readLoadCacheArgs(BinaryRawReaderEx reader) {
Object[] args = null;
int argCnt = reader.readInt();
@@ -827,10 +869,7 @@ public class PlatformCache extends PlatformAbstractTarget {
args[i] = reader.readObjectDetached();
}
- if (loc)
- cache.localLoadCache(filter, args);
- else
- cache.loadCache(filter, args);
+ return args;
}
/** {@inheritDoc} */
@@ -1130,25 +1169,6 @@ public class PlatformCache extends PlatformAbstractTarget {
}
}
- /** <inheritDoc /> */
- @Override public IgniteInternalFuture currentFuture() throws IgniteCheckedException {
- return ((IgniteFutureImpl) cacheAsync.future()).internalFuture();
- }
-
- /** <inheritDoc /> */
- @Nullable @Override public PlatformFutureUtils.Writer futureWriter(int opId) {
- if (opId == OP_GET_ALL)
- return WRITER_GET_ALL;
-
- if (opId == OP_INVOKE)
- return WRITER_INVOKE;
-
- if (opId == OP_INVOKE_ALL)
- return WRITER_INVOKE_ALL;
-
- return null;
- }
-
/**
* Get lock by id.
*
@@ -1179,6 +1199,10 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Runs specified query.
+ *
+ * @param qry Query.
+ * @return Query cursor.
+ * @throws IgniteCheckedException On error.
*/
private PlatformQueryCursor runQuery(Query qry) throws IgniteCheckedException {
@@ -1195,6 +1219,10 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Runs specified fields query.
+ *
+ * @param qry Query.
+ * @return Query cursor.
+ * @throws IgniteCheckedException On error.
*/
private PlatformFieldsQueryCursor runFieldsQuery(Query qry)
throws IgniteCheckedException {
@@ -1211,6 +1239,10 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Reads the query of specified type.
+ *
+ * @param reader Binary reader.
+ * @return Query.
+ * @throws IgniteCheckedException On error.
*/
private Query readInitialQuery(BinaryRawReaderEx reader) throws IgniteCheckedException {
int typ = reader.readInt();
@@ -1234,6 +1266,9 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Reads sql query.
+ *
+ * @param reader Binary reader.
+ * @return Query.
*/
private Query readSqlQuery(BinaryRawReaderEx reader) {
boolean loc = reader.readBoolean();
@@ -1250,6 +1285,9 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Reads fields query.
+ *
+ * @param reader Binary reader.
+ * @return Query.
*/
private Query readFieldsQuery(BinaryRawReaderEx reader) {
boolean loc = reader.readBoolean();
@@ -1267,6 +1305,9 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Reads text query.
+ *
+ * @param reader Binary reader.
+ * @return Query.
*/
private Query readTextQuery(BinaryRawReader reader) {
boolean loc = reader.readBoolean();
@@ -1279,6 +1320,9 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Reads scan query.
+ *
+ * @param reader Binary reader.
+ * @return Query.
*/
private Query readScanQuery(BinaryRawReaderEx reader) {
boolean loc = reader.readBoolean();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
index 9d9a4d2..2b2a78a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
@@ -240,9 +240,10 @@ public class PlatformCompute extends PlatformAbstractTarget {
* Execute task.
*
* @param task Task.
+ * @return Target.
*/
private PlatformTarget executeNative0(final PlatformAbstractTask task) {
- IgniteInternalFuture fut = computeForPlatform.executeAsync(task, null);
+ IgniteInternalFuture fut = computeForPlatform.executeAsync0(task, null);
fut.listen(new IgniteInClosure<IgniteInternalFuture>() {
private static final long serialVersionUID = 0L;
@@ -266,7 +267,9 @@ public class PlatformCompute extends PlatformAbstractTarget {
* Execute task taking arguments from the given reader.
*
* @param reader Reader.
+ * @param async Execute asynchronously flag.
* @return Task result.
+ * @throws IgniteCheckedException On error.
*/
protected Object executeJavaTask(BinaryRawReaderEx reader, boolean async) throws IgniteCheckedException {
String taskName = reader.readString();
@@ -277,18 +280,13 @@ public class PlatformCompute extends PlatformAbstractTarget {
IgniteCompute compute0 = computeForTask(nodeIds);
- if (async)
- compute0 = compute0.withAsync();
-
if (!keepBinary && arg instanceof BinaryObjectImpl)
arg = ((BinaryObject)arg).deserialize();
- Object res = compute0.execute(taskName, arg);
-
if (async)
- return readAndListenFuture(reader, new ComputeConvertingFuture(compute0.future()));
+ return readAndListenFuture(reader, new ComputeConvertingFuture(compute0.executeAsync(taskName, arg)));
else
- return toBinary(res);
+ return toBinary(compute0.execute(taskName, arg));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/entityframework/PlatformDotNetEntityFrameworkCacheExtension.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/entityframework/PlatformDotNetEntityFrameworkCacheExtension.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/entityframework/PlatformDotNetEntityFrameworkCacheExtension.java
index d4755de..cb27b19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/entityframework/PlatformDotNetEntityFrameworkCacheExtension.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/entityframework/PlatformDotNetEntityFrameworkCacheExtension.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.entityframework;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
@@ -187,11 +186,10 @@ public class PlatformDotNetEntityFrameworkCacheExtension implements PlatformCach
final ClusterGroup dataNodes = grid.cluster().forDataNodes(dataCacheName);
- IgniteCompute asyncCompute = grid.compute(dataNodes).withAsync();
+ IgniteFuture f = grid.compute(dataNodes).broadcastAsync(
+ new RemoveOldEntriesRunnable(dataCacheName, currentVersions));
- asyncCompute.broadcast(new RemoveOldEntriesRunnable(dataCacheName, currentVersions));
-
- asyncCompute.future().listen(new CleanupCompletionListener(metaCache, dataCacheName));
+ f.listen(new CleanupCompletionListener(metaCache, dataCacheName));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
index 9ddcc37..845c06a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
@@ -17,11 +17,11 @@
package org.apache.ignite.internal.processors.platform.events;
+import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteEvents;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventAdapter;
-import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
@@ -29,8 +29,8 @@ import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.PlatformEventFilterListener;
import org.apache.ignite.internal.processors.platform.PlatformTarget;
import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
-import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
@@ -91,9 +91,6 @@ public class PlatformEvents extends PlatformAbstractTarget {
private final IgniteEvents events;
/** */
- private final IgniteEvents eventsAsync;
-
- /** */
private final EventResultWriter eventResWriter;
/** */
@@ -111,7 +108,6 @@ public class PlatformEvents extends PlatformAbstractTarget {
assert events != null;
this.events = events;
- eventsAsync = events.withAsync();
eventResWriter = new EventResultWriter(platformCtx);
eventColResWriter = new EventCollectionResultWriter(platformCtx);
@@ -148,16 +144,12 @@ public class PlatformEvents extends PlatformAbstractTarget {
return TRUE;
case OP_REMOTE_QUERY_ASYNC:
- startRemoteQuery(reader, eventsAsync);
-
- readAndListenFuture(reader, currentFuture(), eventColResWriter);
+ readAndListenFuture(reader, startRemoteQueryAsync(reader, events), eventColResWriter);
return TRUE;
case OP_WAIT_FOR_LOCAL_ASYNC: {
- startWaitForLocal(reader, eventsAsync);
-
- readAndListenFuture(reader, currentFuture(), eventResWriter);
+ readAndListenFuture(reader, startWaitForLocalAsync(reader, events), eventResWriter);
return TRUE;
}
@@ -253,6 +245,23 @@ public class PlatformEvents extends PlatformAbstractTarget {
}
/**
+ * Starts the waitForLocal asynchronously.
+ *
+ * @param reader Reader
+ * @param events Events.
+ * @return Result.
+ */
+ private IgniteFuture<EventAdapter> startWaitForLocalAsync(BinaryRawReaderEx reader, IgniteEvents events) {
+ Long filterHnd = reader.readObject();
+
+ IgnitePredicate filter = filterHnd != null ? localFilter(filterHnd) : null;
+
+ int[] eventTypes = readEventTypes(reader);
+
+ return events.waitForLocalAsync(filter, eventTypes);
+ }
+
+ /**
* Starts the remote query.
*
* @param reader Reader.
@@ -271,6 +280,25 @@ public class PlatformEvents extends PlatformAbstractTarget {
return events.remoteQuery(filter, timeout);
}
+ /**
+ * Starts the remote query asynchronously.
+ *
+ * @param reader Reader.
+ * @param events Events.
+ * @return Result.
+ */
+ private IgniteFuture<List<Event>> startRemoteQueryAsync(BinaryRawReaderEx reader, IgniteEvents events) {
+ Object pred = reader.readObjectDetached();
+
+ long timeout = reader.readLong();
+
+ int[] types = readEventTypes(reader);
+
+ PlatformEventFilterListener filter = platformCtx.createRemoteEventFilter(pred, types);
+
+ return events.remoteQueryAsync(filter, timeout);
+ }
+
/** {@inheritDoc} */
@Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
switch (type) {
@@ -310,24 +338,6 @@ public class PlatformEvents extends PlatformAbstractTarget {
return super.processInLongOutLong(type, val);
}
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture currentFuture() throws IgniteCheckedException {
- return ((IgniteFutureImpl)eventsAsync.future()).internalFuture();
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public PlatformFutureUtils.Writer futureWriter(int opId) {
- switch (opId) {
- case OP_WAIT_FOR_LOCAL:
- return eventResWriter;
-
- case OP_REMOTE_QUERY:
- return eventColResWriter;
- }
-
- return null;
- }
-
/**
* Reads event types array.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging.java
index 6fe109e..8018986 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.platform.messaging;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
@@ -27,7 +26,7 @@ import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.PlatformTarget;
import org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-import org.apache.ignite.internal.util.future.IgniteFutureImpl;
+import org.apache.ignite.lang.IgniteFuture;
import java.util.UUID;
@@ -68,9 +67,6 @@ public class PlatformMessaging extends PlatformAbstractTarget {
/** */
private final IgniteMessaging messaging;
- /** */
- private final IgniteMessaging messagingAsync;
-
/**
* Ctor.
*
@@ -83,7 +79,6 @@ public class PlatformMessaging extends PlatformAbstractTarget {
assert messaging != null;
this.messaging = messaging;
- messagingAsync = messaging.withAsync();
}
/** {@inheritDoc} */
@@ -132,15 +127,15 @@ public class PlatformMessaging extends PlatformAbstractTarget {
}
case OP_REMOTE_LISTEN_ASYNC: {
- startRemoteListen(reader, messagingAsync);
+ readAndListenFuture(reader, startRemoteListenAsync(reader, messaging));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_STOP_REMOTE_LISTEN_ASYNC: {
- messagingAsync.stopRemoteListen(reader.readUuid());
+ readAndListenFuture(reader, messaging.stopRemoteListenAsync(reader.readUuid()));
- return readAndListenFuture(reader);
+ return TRUE;
}
default:
@@ -167,6 +162,7 @@ public class PlatformMessaging extends PlatformAbstractTarget {
/**
* Starts the remote listener.
* @param reader Reader.
+ * @param messaging Messaging.
* @return Listen id.
*/
private UUID startRemoteListen(BinaryRawReaderEx reader, IgniteMessaging messaging) {
@@ -181,9 +177,22 @@ public class PlatformMessaging extends PlatformAbstractTarget {
return messaging.remoteListen(topic, filter);
}
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture currentFuture() throws IgniteCheckedException {
- return ((IgniteFutureImpl)messagingAsync.future()).internalFuture();
+ /**
+ * Starts the remote listener.
+ * @param reader Reader.
+ * @param messaging Messaging.
+ * @return Future of the operation.
+ */
+ private IgniteFuture<UUID> startRemoteListenAsync(BinaryRawReaderEx reader, IgniteMessaging messaging) {
+ Object nativeFilter = reader.readObjectDetached();
+
+ long ptr = reader.readLong(); // interop pointer
+
+ Object topic = reader.readObjectDetached();
+
+ PlatformMessageFilter filter = platformCtx.createRemoteMessageFilter(nativeFilter, ptr);
+
+ return messaging.remoteListenAsync(topic, filter);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
index 37727f5..827bc5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.services;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteServices;
-import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
@@ -32,8 +31,8 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterBiClosure;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
import org.apache.ignite.internal.processors.service.GridServiceProxy;
-import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceConfiguration;
@@ -46,6 +45,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.jetbrains.annotations.NotNull;
/**
* Interop services.
@@ -107,9 +107,6 @@ public class PlatformServices extends PlatformAbstractTarget {
/** */
private final IgniteServices services;
- /** */
- private final IgniteServices servicesAsync;
-
/** Server keep binary flag. */
private final boolean srvKeepBinary;
@@ -126,7 +123,6 @@ public class PlatformServices extends PlatformAbstractTarget {
assert services != null;
this.services = services;
- servicesAsync = services.withAsync();
this.srvKeepBinary = srvKeepBinary;
}
@@ -155,21 +151,21 @@ public class PlatformServices extends PlatformAbstractTarget {
}
case OP_DOTNET_DEPLOY_ASYNC: {
- dotnetDeploy(reader, servicesAsync);
+ readAndListenFuture(reader, dotnetDeployAsync(reader, services));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_DOTNET_DEPLOY_MULTIPLE: {
- dotnetDeployMultiple(reader, services);
+ dotnetDeployMultiple(reader);
return TRUE;
}
case OP_DOTNET_DEPLOY_MULTIPLE_ASYNC: {
- dotnetDeployMultiple(reader, servicesAsync);
+ readAndListenFuture(reader, dotnetDeployMultipleAsync(reader));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_CANCEL: {
@@ -179,15 +175,15 @@ public class PlatformServices extends PlatformAbstractTarget {
}
case OP_CANCEL_ASYNC: {
- servicesAsync.cancel(reader.readString());
+ readAndListenFuture(reader, services.cancelAsync(reader.readString()));
- return readAndListenFuture(reader);
+ return TRUE;
}
case OP_CANCEL_ALL_ASYNC: {
- servicesAsync.cancelAll();
+ readAndListenFuture(reader, services.cancelAllAsync());
- return readAndListenFuture(reader);
+ return TRUE;
}
default:
@@ -350,15 +346,12 @@ public class PlatformServices extends PlatformAbstractTarget {
return super.processInStreamOutObject(type, reader);
}
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture currentFuture() throws IgniteCheckedException {
- return ((IgniteFutureImpl)servicesAsync.future()).internalFuture();
- }
-
/**
* Deploys multiple dotnet services.
+ *
+ * @param reader Binary reader.
*/
- private void dotnetDeployMultiple(BinaryRawReaderEx reader, IgniteServices services) {
+ private void dotnetDeployMultiple(BinaryRawReaderEx reader) {
String name = reader.readString();
Object svc = reader.readObjectDetached();
int totalCnt = reader.readInt();
@@ -369,9 +362,53 @@ public class PlatformServices extends PlatformAbstractTarget {
}
/**
+ * Asynchronously deploys multiple dotnet services.
+ *
+ * @param reader Binary reader.
+ * @return Future of the operation.
+ */
+ private IgniteFuture<Void> dotnetDeployMultipleAsync(BinaryRawReaderEx reader) {
+ String name = reader.readString();
+ Object svc = reader.readObjectDetached();
+ int totalCnt = reader.readInt();
+ int maxPerNodeCnt = reader.readInt();
+
+ return services.deployMultipleAsync(name, new PlatformDotNetServiceImpl(svc, platformCtx, srvKeepBinary),
+ totalCnt, maxPerNodeCnt);
+ }
+
+ /**
* Deploys dotnet service.
+ *
+ * @param reader Binary reader.
+ * @param services Services.
*/
private void dotnetDeploy(BinaryRawReaderEx reader, IgniteServices services) {
+ ServiceConfiguration cfg = dotnetConfiguration(reader);
+
+ services.deploy(cfg);
+ }
+
+ /**
+ * Deploys dotnet service asynchronously.
+ *
+ * @param reader Binary reader.
+ * @param services Services.
+ * @return Future of the operation.
+ */
+ private IgniteFuture<Void> dotnetDeployAsync(BinaryRawReaderEx reader, IgniteServices services) {
+ ServiceConfiguration cfg = dotnetConfiguration(reader);
+
+ return services.deployAsync(cfg);
+ }
+
+ /**
+ * Read the dotnet service configuration.
+ *
+ * @param reader Binary reader,
+ * @return Service configuration.
+ */
+ @NotNull private ServiceConfiguration dotnetConfiguration(BinaryRawReaderEx reader) {
ServiceConfiguration cfg = new ServiceConfiguration();
cfg.setName(reader.readString());
@@ -386,7 +423,7 @@ public class PlatformServices extends PlatformAbstractTarget {
if (filter != null)
cfg.setNodeFilter(platformCtx.createClusterNodeFilter(filter));
- services.deploy(cfg);
+ return cfg;
}
/**
@@ -403,8 +440,8 @@ public class PlatformServices extends PlatformAbstractTarget {
/** */
private static final Map<Class<?>, Class<?>> PRIMITIVES_TO_WRAPPERS = new HashMap<>();
- /**
- * Class initializer.
+ /*
+ Class initializer.
*/
static {
PRIMITIVES_TO_WRAPPERS.put(boolean.class, Boolean.class);
@@ -422,6 +459,7 @@ public class PlatformServices extends PlatformAbstractTarget {
*
* @param proxy Proxy object.
* @param clazz Proxy class.
+ * @param ctx Platform context.
*/
private ServiceProxyHolder(Object proxy, Class clazz, PlatformContext ctx) {
super(ctx);
@@ -435,18 +473,18 @@ public class PlatformServices extends PlatformAbstractTarget {
/**
* Invokes the proxy.
+ *
* @param mthdName Method name.
* @param srvKeepBinary Binary flag.
* @param args Args.
* @return Invocation result.
- * @throws IgniteCheckedException
- * @throws NoSuchMethodException
+ * @throws IgniteCheckedException On error.
+ * @throws NoSuchMethodException On error.
*/
public Object invoke(String mthdName, boolean srvKeepBinary, Object[] args)
throws IgniteCheckedException, NoSuchMethodException {
- if (proxy instanceof PlatformService) {
+ if (proxy instanceof PlatformService)
return ((PlatformService)proxy).invokeMethod(mthdName, srvKeepBinary, args);
- }
else {
assert proxy instanceof GridServiceProxy;
@@ -467,6 +505,7 @@ public class PlatformServices extends PlatformAbstractTarget {
* @param mthdName Name.
* @param args Args.
* @return Method.
+ * @throws NoSuchMethodException On error.
*/
private static Method getMethod(Class clazz, String mthdName, Object[] args) throws NoSuchMethodException {
assert clazz != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
index 21f71fa..8f34343 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
@@ -196,17 +196,16 @@ public class PlatformTransactions extends PlatformAbstractTarget {
@Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
long txId = reader.readLong();
- final Transaction asyncTx = (Transaction)tx(txId).withAsync();
+ IgniteFuture fut0;
switch (type) {
case OP_COMMIT_ASYNC:
- asyncTx.commit();
+ fut0 = tx(txId).commitAsync();
break;
-
case OP_ROLLBACK_ASYNC:
- asyncTx.rollback();
+ fut0 = tx(txId).rollbackAsync();
break;
@@ -215,7 +214,7 @@ public class PlatformTransactions extends PlatformAbstractTarget {
}
// Future result is the tx itself, we do not want to return it to the platform.
- IgniteFuture fut = asyncTx.future().chain(new C1<IgniteFuture, Object>() {
+ IgniteFuture fut = fut0.chain(new C1<IgniteFuture, Object>() {
private static final long serialVersionUID = 0L;
@Override public Object apply(IgniteFuture fut) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
index ce74f17..7556e7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
@@ -112,26 +112,20 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
futs = new IgniteFuture[3];
if (futs[0] == null || futs[1] == null || futs[2] == null) {
- IgniteCache cache = ignite.cache(cacheName).withAsync();
+ IgniteCache cache = ignite.cache(cacheName);
if (futs[0] == null) {
- cache.size(CachePeekMode.PRIMARY);
-
- if (callAsync(cache.<Integer>future(), 0))
+ if (callAsync(cache.sizeAsync(CachePeekMode.PRIMARY), 0))
return null;
}
if (futs[1] == null) {
- cache.clear();
-
- if (callAsync(cache.<Integer>future(), 1))
+ if (callAsync(cache.clearAsync(), 1))
return null;
}
if (futs[2] == null) {
- cache.size(CachePeekMode.PRIMARY);
-
- if (callAsync(cache.<Integer>future(), 2))
+ if (callAsync(cache.sizeAsync(CachePeekMode.PRIMARY), 2))
return null;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
index a64ec6d..8f42eb2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
@@ -370,11 +370,9 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
}
}
- IgniteCompute comp = ignite.compute(ignite.cluster().forNodeIds(nids)).withAsync();
-
- comp.execute(taskName, new VisorTaskArgument<>(nids, jobArgs, false));
+ IgniteCompute comp = ignite.compute(ignite.cluster().forNodeIds(nids));
- fut = comp.future();
+ fut = comp.executeAsync(taskName, new VisorTaskArgument<>(nids, jobArgs, false));
fut.listen(new CI1<IgniteFuture<Object>>() {
@Override public void apply(IgniteFuture<Object> f) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
index 50a8700..3e31b51 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
@@ -18,25 +18,75 @@
package org.apache.ignite.lang;
/**
- * Allows to enable asynchronous mode on Ignite APIs.
+ * Allows to enable asynchronous mode on Ignite APIs, e.g.
+ * <pre>
+ * IgniteFuture f = cache.getAsync();
+ * </pre>
+ * instead of old-style async API:
+ * <pre>
+ * IgniteCache asyncCache = cache.withAsync();
+ * asyncCache.get(key);
+ * IgniteFuture fut = asyncCache.future();
+ * </pre>
+ * @deprecated since 2.0. Please use specialized asynchronous methods.
*/
+@Deprecated
public interface IgniteAsyncSupport {
/**
* Gets instance of this component with asynchronous mode enabled.
*
* @return Instance of this component with asynchronous mode enabled.
+ *
+ * @deprecated since 2.0. Please use new specialized async method
+ * e.g.
+ * <pre>
+ * IgniteFuture f = cache.getAsync();
+ * </pre>
+ * instead of old-style async API:
+ * <pre>
+ * IgniteCache asyncCache = cache.withAsync();
+ * asyncCache.get(key);
+ * IgniteFuture fut = asyncCache.future();
+ * </pre>
*/
+ @Deprecated
public IgniteAsyncSupport withAsync();
/**
* @return {@code True} if asynchronous mode is enabled.
+ *
+ * @deprecated since 2.0. Please use new specialized async method
+ * e.g.
+ * <pre>
+ * IgniteFuture f = cache.getAsync();
+ * </pre>
+ * instead of old-style async API:
+ * <pre>
+ * IgniteCache asyncCache = cache.withAsync();
+ * asyncCache.get(key);
+ * IgniteFuture fut = asyncCache.future();
+ * </pre>
*/
+ @Deprecated
public boolean isAsync();
/**
* Gets and resets future for previous asynchronous operation.
*
* @return Future for previous asynchronous operation.
+ *
+ * @deprecated since 2.0. Please use new specialized async method
+ * e.g.
+ * <pre>
+ * IgniteFuture f = cache.getAsync();
+ * </pre>
+ * instead of old-style async API:
+ * <pre>
+ * IgniteCache asyncCache = cache.withAsync();
+ * asyncCache.get(key);
+ * IgniteFuture fut = asyncCache.future();
+ * </pre>
*/
+ @Deprecated
public <R> IgniteFuture<R> future();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupported.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupported.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupported.java
index 1bb7162..2dfea51 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupported.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupported.java
@@ -31,11 +31,13 @@ import java.lang.annotation.Target;
*
* TODO coding example.
*
+ * @deprecated since 2.0. Please use specialized asynchronous methods.
* @see IgniteAsyncSupport
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
+@Deprecated
public @interface IgniteAsyncSupported {
-
+ // No-op.
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java b/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java
index e2e7100..57a2b00 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java
@@ -22,6 +22,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteTransactions;
import org.apache.ignite.lang.IgniteAsyncSupport;
import org.apache.ignite.lang.IgniteAsyncSupported;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
/**
@@ -237,6 +238,19 @@ public interface Transaction extends AutoCloseable, IgniteAsyncSupport {
public void commit() throws IgniteException;
/**
+ * Asynchronously commits this transaction by initiating {@code two-phase-commit} process.
+ *
+ * @return a Future representing pending completion of the commit.
+ * @throws IgniteException If commit failed.
+ * @throws TransactionTimeoutException If transaction is timed out.
+ * @throws TransactionRollbackException If transaction is automatically rolled back.
+ * @throws TransactionOptimisticException If transaction concurrency is {@link TransactionConcurrency#OPTIMISTIC}
+ * and commit is optimistically failed.
+ * @throws TransactionHeuristicException If transaction has entered an unknown state.
+ */
+ public IgniteFuture<Void> commitAsync() throws IgniteException;
+
+ /**
* Ends the transaction. Transaction will be rolled back if it has not been committed.
*
* @throws IgniteException If transaction could not be gracefully ended.
@@ -250,4 +264,12 @@ public interface Transaction extends AutoCloseable, IgniteAsyncSupport {
*/
@IgniteAsyncSupported
public void rollback() throws IgniteException;
+
+ /**
+ * Asynchronously rolls back this transaction.
+ *
+ * @return a Future representing pending completion of the rollback.
+ * @throws IgniteException If rollback failed.
+ */
+ public IgniteFuture<Void> rollbackAsync() throws IgniteException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
index 4d94400..722e37f 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
@@ -102,13 +102,8 @@ public class IgniteCacheExpiryStoreLoadSelfTest extends GridCacheAbstractSelfTes
keys.add(primaryKey(jcache(1)));
keys.add(primaryKey(jcache(2)));
- if (async) {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
- asyncCache.loadCache(null, keys.toArray(new Integer[3]));
-
- asyncCache.future().get();
- }
+ if (async)
+ cache.loadCacheAsync(null, keys.toArray(new Integer[3])).get();
else
cache.loadCache(null, keys.toArray(new Integer[3]));
@@ -143,13 +138,8 @@ public class IgniteCacheExpiryStoreLoadSelfTest extends GridCacheAbstractSelfTes
List<Integer> keys = primaryKeys(cache, 3);
- if (async) {
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
- asyncCache.localLoadCache(null, keys.toArray(new Integer[3]));
-
- asyncCache.future().get();
- }
+ if (async)
+ cache.localLoadCacheAsync(null, keys.toArray(new Integer[3])).get();
else
cache.localLoadCache(null, keys.toArray(new Integer[3]));
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
index 6fdaeb0..fbf938d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
@@ -33,7 +33,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCluster;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
@@ -356,11 +355,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
* @throws Exception If failed.
*/
private void run1(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(runJob);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<Void> fut = compute(prj).broadcastAsync(runJob);
waitForExecution(fut);
@@ -378,11 +373,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
private void run2(AtomicInteger cnt) throws Exception {
Collection<IgniteRunnable> jobs = F.asList(runJob);
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.run(jobs);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<Void> fut = compute(prj).runAsync(jobs);
waitForExecution(fut);
@@ -398,11 +389,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
* @throws Exception If failed.
*/
private void call1(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(calJob);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<Collection<String>> fut = compute(prj).broadcastAsync(calJob);
waitForExecution(fut);
@@ -418,13 +405,9 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
* @throws Exception If failed.
*/
private void call2(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
Collection<IgniteCallable<String>> jobs = F.asList(calJob);
- comp.call(jobs);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<Collection<String>> fut = compute(prj).callAsync(jobs);
waitForExecution(fut);
@@ -440,11 +423,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
* @throws Exception If failed.
*/
private void call3(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.apply(clrJob, (String) null);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<String> fut = compute(prj).applyAsync(clrJob, (String) null);
waitForExecution(fut);
@@ -462,11 +441,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
private void call4(AtomicInteger cnt) throws Exception {
Collection<String> args = F.asList("a", "b", "c");
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.apply(clrJob, args);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<Collection<String>> fut = compute(prj).applyAsync(clrJob, args);
waitForExecution(fut);
@@ -482,11 +457,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
* @throws Exception If failed.
*/
private void call5(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(new TestClosure(), "arg");
-
- ComputeTaskFuture<Collection<String>> fut = comp.future();
+ IgniteFuture<Collection<String>> fut = compute(prj).broadcastAsync(new TestClosure(), "arg");
waitForExecution(fut);
@@ -509,11 +480,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
private void forkjoin1(AtomicInteger cnt) throws Exception {
Collection<String> args = F.asList("a", "b", "c");
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.apply(clrJob, args, rdc);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture fut = compute(prj).applyAsync(clrJob, args, rdc);
waitForExecution(fut);
@@ -531,11 +498,7 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
private void forkjoin2(AtomicInteger cnt) throws Exception {
Collection<IgniteCallable<String>> jobs = F.asList(calJob);
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.call(jobs, rdc);
-
- ComputeTaskFuture fut = comp.future();
+ IgniteFuture<Object> fut = compute(prj).callAsync(jobs, rdc);
waitForExecution(fut);
@@ -676,26 +639,22 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
* @throws Exception If test failed.
*/
private void checkActiveFutures() throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- assertEquals(0, comp.activeTaskFutures().size());
+ assertEquals(0, compute(prj).activeTaskFutures().size());
cnt.set(0);
- Collection<ComputeTaskFuture<Object>> futsList = new ArrayList<>();
+ Collection<IgniteFuture<Object>> futsList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
- comp.call(new TestWaitCallable<>());
-
- ComputeTaskFuture<Object> fut = comp.future();
+ IgniteFuture<Object> fut = compute(prj).callAsync(new TestWaitCallable<>());
assertFalse(fut.isDone());
- Map<IgniteUuid, ComputeTaskFuture<Object>> futs = comp.activeTaskFutures();
+ Map<IgniteUuid, ComputeTaskFuture<Object>> futs = compute(prj).activeTaskFutures();
assertEquals(i + 1, futs.size());
- assertTrue(futs.containsKey(fut.getTaskSession().getId()));
+ assertTrue(futs.containsKey(((ComputeTaskFuture)fut).getTaskSession().getId()));
futsList.add(fut);
}
@@ -706,10 +665,10 @@ public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest im
mux.notifyAll();
}
- for (ComputeTaskFuture<Object> fut : futsList)
+ for (IgniteFuture<Object> fut : futsList)
fut.get();
- assertEquals(0, comp.activeTaskFutures().size());
+ assertEquals(0, compute(prj).activeTaskFutures().size());
}
/**
[20/50] [abbrv] ignite git commit: IGNITE-4558 Use
BinaryArrayIdentityResolver by default. This closes #1649.
Posted by ag...@apache.org.
IGNITE-4558 Use BinaryArrayIdentityResolver by default. This closes #1649.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/24f90d6d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/24f90d6d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/24f90d6d
Branch: refs/heads/ignite-4003
Commit: 24f90d6d242c3d10bddc83ef6123def8c367f399
Parents: 282b334
Author: Evgenii Zhuravlev <ez...@gridgain.com>
Authored: Mon Mar 27 13:53:48 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Mar 27 13:53:48 2017 +0300
----------------------------------------------------------------------
.../ignite/binary/BinaryObjectBuilder.java | 10 --
.../store/jdbc/CacheAbstractJdbcStore.java | 24 ++--
.../cache/store/jdbc/CacheJdbcPojoStore.java | 18 +--
.../internal/binary/BinaryClassDescriptor.java | 23 +---
.../ignite/internal/binary/BinaryContext.java | 5 +-
.../internal/binary/BinaryObjectExImpl.java | 4 -
.../ignite/internal/binary/BinaryUtils.java | 5 +-
.../internal/binary/BinaryWriterExImpl.java | 45 ++-----
.../binary/builder/BinaryObjectBuilderImpl.java | 20 +--
.../processors/cache/GridCacheUtils.java | 4 -
.../ignite/internal/util/IgniteUtils.java | 10 --
.../binary/BinaryMarshallerSelfTest.java | 4 -
.../BinaryObjectBuilderAdditionalSelfTest.java | 9 +-
...naryObjectBuilderDefaultMappersSelfTest.java | 127 +++++--------------
...ridCacheStoreManagerDeserializationTest.java | 1 -
.../cache/GridCacheUtilsSelfTest.java | 4 -
...calCacheStoreManagerDeserializationTest.java | 2 +-
.../IgniteCacheBinaryObjectsScanSelfTest.java | 2 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 36 ------
.../CacheContinuousQueryVariationsTest.java | 5 +
.../query/h2/DmlStatementsProcessor.java | 35 -----
.../processors/query/h2/IgniteH2Indexing.java | 26 ++--
22 files changed, 97 insertions(+), 322 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
index 21f1c37..15bd799 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
@@ -127,16 +127,6 @@ public interface BinaryObjectBuilder {
public BinaryObjectBuilder removeField(String fieldName);
/**
- * Sets hash code for resulting binary object returned by {@link #build()} method.
- * <p>
- * If not set {@code 0} is used.
- *
- * @param hashCode Hash code.
- * @return {@code this} instance for chaining.
- */
- public BinaryObjectBuilder hashCode(int hashCode);
-
- /**
* Builds binary object.
*
* @return Binary object.
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 7af238b..41709a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -215,15 +215,13 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
* @param typeName Type name.
* @param typeKind Type kind.
* @param flds Fields descriptors.
- * @param hashFlds Field names for hash code calculation.
* @param loadColIdxs Select query columns index.
* @param rs ResultSet.
* @return Constructed object.
* @throws CacheLoaderException If failed to construct cache object.
*/
protected abstract <R> R buildObject(@Nullable String cacheName, String typeName, TypeKind typeKind,
- JdbcTypeField[] flds, Collection<String> hashFlds, Map<String, Integer> loadColIdxs, ResultSet rs)
- throws CacheLoaderException;
+ JdbcTypeField[] flds, Map<String, Integer> loadColIdxs, ResultSet rs) throws CacheLoaderException;
/**
* Calculate type ID for object.
@@ -457,8 +455,11 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
- K key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), em.keyCols, em.loadColIdxs, rs);
- V val = buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(), null, em.loadColIdxs, rs);
+ K key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(),
+ em.loadColIdxs, rs);
+
+ V val = buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(),
+ em.loadColIdxs, rs);
clo.apply(key, val);
}
@@ -875,7 +876,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
ResultSet rs = stmt.executeQuery();
if (rs.next())
- return buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(), null, em.loadColIdxs, rs);
+ return buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(), em.loadColIdxs, rs);
}
catch (SQLException e) {
throw new CacheLoaderException("Failed to load object [table=" + em.fullTableName() +
@@ -1993,8 +1994,8 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
colIdxs.put(meta.getColumnLabel(i).toUpperCase(), i);
while (rs.next()) {
- K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), em.keyCols, colIdxs, rs);
- V1 val = buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(), null, colIdxs, rs);
+ K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), colIdxs, rs);
+ V1 val = buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(), colIdxs, rs);
clo.apply(key, val);
}
@@ -2089,8 +2090,11 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
Map<K1, V1> entries = U.newHashMap(keys.size());
while (rs.next()) {
- K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), em.keyCols, em.loadColIdxs, rs);
- V1 val = buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(), null, em.loadColIdxs, rs);
+ K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(),
+ em.loadColIdxs, rs);
+
+ V1 val = buildObject(em.cacheName, em.valueType(), em.valueKind(), em.valueColumns(),
+ em.loadColIdxs, rs);
entries.put(key, val);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
index b9f6e8a..00a8ade 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
@@ -126,7 +126,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
/** {@inheritDoc} */
@Override protected <R> R buildObject(@Nullable String cacheName, String typeName, TypeKind typeKind,
- JdbcTypeField[] flds, Collection<String> hashFlds, Map<String, Integer> loadColIdxs, ResultSet rs)
+ JdbcTypeField[] flds, Map<String, Integer> loadColIdxs, ResultSet rs)
throws CacheLoaderException {
switch (typeKind) {
case BUILT_IN:
@@ -134,7 +134,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
case POJO:
return (R)buildPojoObject(cacheName, typeName, flds, loadColIdxs, rs);
default:
- return (R)buildBinaryObject(typeName, flds, hashFlds, loadColIdxs, rs);
+ return (R)buildBinaryObject(typeName, flds, loadColIdxs, rs);
}
}
@@ -233,35 +233,23 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
*
* @param typeName Type name.
* @param fields Fields descriptors.
- * @param hashFields Collection of fields to build hash for.
* @param loadColIdxs Select query columns index.
* @param rs ResultSet.
* @return Constructed binary object.
* @throws CacheLoaderException If failed to construct binary object.
*/
- protected Object buildBinaryObject(String typeName, JdbcTypeField[] fields,
- Collection<String> hashFields, Map<String, Integer> loadColIdxs, ResultSet rs) throws CacheLoaderException {
+ protected Object buildBinaryObject(String typeName, JdbcTypeField[] fields, Map<String, Integer> loadColIdxs, ResultSet rs) throws CacheLoaderException {
try {
BinaryObjectBuilder builder = ignite.binary().builder(typeName);
- boolean calcHash = hashFields != null;
-
- Collection<Object> hashValues = calcHash ? new ArrayList<>(hashFields.size()) : null;
-
for (JdbcTypeField field : fields) {
Integer colIdx = columnIndex(loadColIdxs, field.getDatabaseFieldName());
Object colVal = transformer.getColumnValue(rs, colIdx, field.getJavaFieldType());
builder.setField(field.getJavaFieldName(), colVal, (Class<Object>)field.getJavaFieldType());
-
- if (calcHash)
- hashValues.add(colVal);
}
- if (calcHash)
- builder.hashCode(hasher.hashCode(hashValues));
-
return builder.build();
}
catch (SQLException e) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 32db1f7..7eaf6c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -43,7 +43,6 @@ import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -120,9 +119,6 @@ public class BinaryClassDescriptor {
private final boolean excluded;
/** */
- private final boolean overridesHashCode;
-
- /** */
private final Class<?>[] intfs;
/** Whether stable schema was published. */
@@ -176,8 +172,6 @@ public class BinaryClassDescriptor {
this.mapper = mapper;
this.registered = registered;
- overridesHashCode = IgniteUtils.overridesEqualsAndHashCode(cls);
-
schemaReg = ctx.schemaRegistry(typeId);
excluded = MarshallerExclusions.isExcluded(cls);
@@ -744,7 +738,7 @@ public class BinaryClassDescriptor {
else
((Binarylizable)obj).writeBinary(writer);
- postWrite(writer, obj);
+ postWrite(writer);
// Check whether we need to update metadata.
if (obj.getClass() != BinaryMetadata.class) {
@@ -800,7 +794,7 @@ public class BinaryClassDescriptor {
writer.schemaId(stableSchema.schemaId());
- postWrite(writer, obj);
+ postWrite(writer);
postWriteHashCode(writer, obj);
}
finally {
@@ -903,18 +897,9 @@ public class BinaryClassDescriptor {
* Post-write phase.
*
* @param writer Writer.
- * @param obj Object.
*/
- private void postWrite(BinaryWriterExImpl writer, Object obj) {
- if (obj instanceof CacheObjectImpl)
- writer.postWrite(userType, registered, 0, false);
- else if (obj instanceof BinaryObjectEx) {
- boolean flagSet = ((BinaryObjectEx)obj).isFlagSet(BinaryUtils.FLAG_EMPTY_HASH_CODE);
-
- writer.postWrite(userType, registered, obj.hashCode(), !flagSet);
- }
- else
- writer.postWrite(userType, registered, obj.hashCode(), overridesHashCode);
+ private void postWrite(BinaryWriterExImpl writer) {
+ writer.postWrite(userType, registered);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 3517b8c..febfb04 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.binary;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.binary.BinaryArrayIdentityResolver;
import org.apache.ignite.binary.BinaryBasicIdMapper;
import org.apache.ignite.binary.BinaryBasicNameMapper;
import org.apache.ignite.binary.BinaryIdMapper;
@@ -1234,7 +1235,9 @@ public class BinaryContext {
* @return Type identity.
*/
public BinaryIdentityResolver identity(int typeId) {
- return identities.get(typeId);
+ BinaryIdentityResolver rslvr = identities.get(typeId);
+
+ return rslvr != null ? rslvr : BinaryArrayIdentityResolver.instance();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
index 5b5aeba..88ae832 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
@@ -23,7 +23,6 @@ import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryArrayIdentityResolver;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryObjectException;
@@ -160,9 +159,6 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
BinaryIdentityResolver identity = context().identity(typeId());
- if (identity == null)
- identity = BinaryArrayIdentityResolver.instance();
-
return identity.equals(this, (BinaryObject)other);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index 28659ab..d3ff2ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -110,9 +110,6 @@ public class BinaryUtils {
/** Flag: compact footer, no field IDs. */
public static final short FLAG_COMPACT_FOOTER = 0x0020;
- /** Flag: no hash code has been set. */
- public static final short FLAG_EMPTY_HASH_CODE = 0x0040;
-
/** Offset which fits into 1 byte. */
public static final int OFFSET_1 = 1;
@@ -142,7 +139,7 @@ public class BinaryUtils {
/** FNV1 hash prime. */
private static final int FNV1_PRIME = 0x01000193;
- /**
+ /*
* Static class initializer.
*/
static {
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
index b091001..5ae47fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
@@ -247,10 +247,8 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
*
* @param userType User type flag.
* @param registered Whether type is registered.
- * @param hashCode Hash code.
- * @param isHashCodeSet Hash code presence flag.
*/
- public void postWrite(boolean userType, boolean registered, int hashCode, boolean isHashCodeSet) {
+ public void postWrite(boolean userType, boolean registered) {
short flags;
boolean useCompactFooter;
@@ -307,9 +305,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
}
}
- if (!isHashCodeSet)
- flags |= BinaryUtils.FLAG_EMPTY_HASH_CODE;
-
// Actual write.
int retPos = out.position();
@@ -319,7 +314,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
out.unsafeWriteByte(GridBinaryMarshaller.PROTO_VER);
out.unsafeWriteShort(flags);
out.unsafeWriteInt(registered ? typeId : GridBinaryMarshaller.UNREGISTERED_TYPE_ID);
- out.unsafeWriteInt(hashCode);
+ out.unsafePosition(start + GridBinaryMarshaller.TOTAL_LEN_POS);
out.unsafeWriteInt(retPos - start);
out.unsafeWriteInt(finalSchemaId);
out.unsafeWriteInt(offset);
@@ -337,35 +332,23 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
BinaryIdentityResolver identity = ctx.identity(typeId);
- if (identity != null) {
- if (out.hasArray()) {
- // Heap.
- byte[] data = out.array();
-
- BinaryObjectImpl obj = new BinaryObjectImpl(ctx, data, start);
-
- short flags = BinaryPrimitives.readShort(data, start + GridBinaryMarshaller.FLAGS_POS);
-
- BinaryPrimitives.writeShort(data, start + GridBinaryMarshaller.FLAGS_POS,
- (short) (flags & ~BinaryUtils.FLAG_EMPTY_HASH_CODE));
-
- BinaryPrimitives.writeInt(data, start + GridBinaryMarshaller.HASH_CODE_POS, identity.hashCode(obj));
- }
- else {
- // Offheap.
- long ptr = out.rawOffheapPointer();
+ if (out.hasArray()) {
+ // Heap.
+ byte[] data = out.array();
- assert ptr != 0;
+ BinaryObjectImpl obj = new BinaryObjectImpl(ctx, data, start);
- BinaryObjectOffheapImpl obj = new BinaryObjectOffheapImpl(ctx, ptr, start, out.capacity());
+ BinaryPrimitives.writeInt(data, start + GridBinaryMarshaller.HASH_CODE_POS, identity.hashCode(obj));
+ }
+ else {
+ // Offheap.
+ long ptr = out.rawOffheapPointer();
- short flags = BinaryPrimitives.readShort(ptr, start + GridBinaryMarshaller.FLAGS_POS);
+ assert ptr != 0;
- BinaryPrimitives.writeShort(ptr, start + GridBinaryMarshaller.FLAGS_POS,
- (short) (flags & ~BinaryUtils.FLAG_EMPTY_HASH_CODE));
+ BinaryObjectOffheapImpl obj = new BinaryObjectOffheapImpl(ctx, ptr, start, out.capacity());
- BinaryPrimitives.writeInt(ptr, start + GridBinaryMarshaller.HASH_CODE_POS, identity.hashCode(obj));
- }
+ BinaryPrimitives.writeInt(ptr, start + GridBinaryMarshaller.HASH_CODE_POS, identity.hashCode(obj));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index fd6c351..4ab9df8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -85,12 +85,6 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
/** Context of BinaryObject reading process. Or {@code null} if object is not created from BinaryObject. */
private final BinaryBuilderReader reader;
- /** */
- private int hashCode;
-
- /** */
- private boolean isHashCodeSet;
-
/**
* @param clsName Class name.
* @param ctx Binary context.
@@ -122,7 +116,6 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
*/
public BinaryObjectBuilderImpl(BinaryObjectImpl obj) {
this(new BinaryBuilderReader(obj), obj.start());
- isHashCodeSet = !obj.isFlagSet(BinaryUtils.FLAG_EMPTY_HASH_CODE);
reader.registerObject(this);
}
@@ -143,7 +136,6 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
int typeId = reader.readIntPositioned(start + GridBinaryMarshaller.TYPE_ID_POS);
ctx = reader.binaryContext();
- hashCode = reader.readIntPositioned(start + GridBinaryMarshaller.HASH_CODE_POS);
if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
int mark = reader.position();
@@ -338,7 +330,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
}
//noinspection NumberEquality
- writer.postWrite(true, registeredType, hashCode, isHashCodeSet);
+ writer.postWrite(true, registeredType);
// Update metadata if needed.
int schemaId = writer.schemaId();
@@ -432,16 +424,6 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
return fieldsMeta;
}
- /** {@inheritDoc} */
- @SuppressWarnings("UnnecessaryBoxing")
- @Override public BinaryObjectBuilderImpl hashCode(int hashCode) {
- this.hashCode = hashCode;
-
- isHashCodeSet = true;
-
- return this;
- }
-
/**
* Get field position and length.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 7131612..bce054a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1115,10 +1115,6 @@ public class GridCacheUtils {
if (!U.overridesEqualsAndHashCode(key))
throw new IllegalArgumentException("Cache key must override hashCode() and equals() methods: " +
key.getClass().getName());
-
- if (U.isHashCodeEmpty(key))
- throw new IllegalArgumentException("Cache key created with BinaryBuilder is missing hash code - " +
- "please set it explicitly during building by using BinaryBuilder.hashCode(int)");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 4620f12..2106bd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -8539,16 +8539,6 @@ public abstract class IgniteUtils {
}
/**
- * @param obj Object.
- * @return {@code True} if given object is a {@link BinaryObjectEx} and
- * has {@link BinaryUtils#FLAG_EMPTY_HASH_CODE} set
- */
- public static boolean isHashCodeEmpty(Object obj) {
- return obj != null && obj instanceof BinaryObjectEx &&
- ((BinaryObjectEx)obj).isFlagSet(BinaryUtils.FLAG_EMPTY_HASH_CODE);
- }
-
- /**
* Checks if error is MAC invalid argument error which ususally requires special handling.
*
* @param e Exception.
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index 1cac1a8..ee72919 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -695,8 +695,6 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
BinaryObject po = marshal(obj, marsh);
- assertEquals(obj.hashCode(), po.hashCode());
-
assertEquals(obj, po.deserialize());
assertEquals(obj.b, (byte)po.field("b"));
@@ -781,8 +779,6 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
BinaryObject po = marshal(obj, marsh);
- assertEquals(obj.hashCode(), po.hashCode());
-
assertEquals(obj, po.deserialize());
assertEquals(obj.b, (byte)po.field("_b"));
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
index 100f109..09f1c39 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
@@ -49,6 +49,7 @@ import junit.framework.TestCase;
import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryArrayIdentityResolver;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryObjectException;
@@ -896,11 +897,9 @@ public class BinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstractTes
BinaryObjectBuilderImpl mutableObj = wrap(obj);
- assertEquals(obj.hashCode(), mutableObj.build().hashCode());
+ BinaryObject bo = mutableObj.build();
- mutableObj.hashCode(25);
-
- assertEquals(25, mutableObj.build().hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(bo), bo.hashCode());
}
/**
@@ -1377,7 +1376,7 @@ public class BinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstractTes
jcache(0, "partitioned").withKeepBinary();
BinaryObjectBuilder keyBuilder = ignite(0).binary().builder("keyType")
- .setField("F1", "V1").hashCode("V1".hashCode());
+ .setField("F1", "V1");
BinaryObjectBuilder valBuilder = ignite(0).binary().builder("valueType")
.setField("F2", "V2")
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
index a4388a1..a4d9860 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
@@ -29,6 +29,7 @@ import java.util.UUID;
import junit.framework.TestCase;
import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryArrayIdentityResolver;
import org.apache.ignite.binary.BinaryIdMapper;
import org.apache.ignite.binary.BinaryNameMapper;
import org.apache.ignite.binary.BinaryObject;
@@ -132,8 +133,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testNullField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(42);
-
builder.setField("objField", (Object)null);
builder.setField("otherField", "value");
@@ -142,7 +141,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
assertNull(obj.field("objField"));
assertEquals("value", obj.field("otherField"));
- assertEquals(42, obj.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(obj), obj.hashCode());
builder = builder(obj);
@@ -153,7 +152,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
assertNull(obj.field("otherField"));
assertEquals("value", obj.field("objField"));
- assertEquals(42, obj.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(obj), obj.hashCode());
}
/**
@@ -162,14 +161,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testByteField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("byteField", (byte)1);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals((byte) 1, po.<Byte>field("byteField").byteValue());
}
@@ -180,14 +177,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testShortField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("shortField", (short)1);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals((short)1, po.<Short>field("shortField").shortValue());
}
@@ -198,14 +193,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testIntField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("intField", 1);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1, po.<Integer>field("intField").intValue());
}
@@ -216,14 +209,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testLongField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("longField", 1L);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1L, po.<Long>field("longField").longValue());
}
@@ -234,14 +225,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testFloatField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("floatField", 1.0f);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1.0f, po.<Float>field("floatField").floatValue(), 0);
}
@@ -252,14 +241,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testDoubleField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("doubleField", 1.0d);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1.0d, po.<Double>field("doubleField").doubleValue(), 0);
}
@@ -270,14 +257,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testCharField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("charField", (char)1);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals((char)1, po.<Character>field("charField").charValue());
}
@@ -305,14 +290,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testBooleanField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("booleanField", true);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(po.<Boolean>field("booleanField"));
}
@@ -323,14 +306,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testDecimalField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("decimalField", BigDecimal.TEN);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(BigDecimal.TEN, po.<BigDecimal>field("decimalField"));
}
@@ -341,14 +322,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testStringField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("stringField", "str");
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals("str", po.<String>field("stringField"));
}
@@ -378,8 +357,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testUuidField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
UUID uuid = UUID.randomUUID();
builder.setField("uuidField", uuid);
@@ -387,7 +364,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(uuid, po.<UUID>field("uuidField"));
}
@@ -398,14 +375,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testByteArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("byteArrayField", new byte[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new byte[] {1, 2, 3}, po.<byte[]>field("byteArrayField")));
}
@@ -416,14 +391,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testShortArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("shortArrayField", new short[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new short[] {1, 2, 3}, po.<short[]>field("shortArrayField")));
}
@@ -434,14 +407,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testIntArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("intArrayField", new int[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new int[] {1, 2, 3}, po.<int[]>field("intArrayField")));
}
@@ -452,14 +423,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testLongArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("longArrayField", new long[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new long[] {1, 2, 3}, po.<long[]>field("longArrayField")));
}
@@ -470,14 +439,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testFloatArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("floatArrayField", new float[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new float[] {1, 2, 3}, po.<float[]>field("floatArrayField")));
}
@@ -488,14 +455,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testDoubleArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("doubleArrayField", new double[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new double[] {1, 2, 3}, po.<double[]>field("doubleArrayField")));
}
@@ -506,14 +471,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testCharArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("charArrayField", new char[] {1, 2, 3});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new char[] {1, 2, 3}, po.<char[]>field("charArrayField")));
}
@@ -524,14 +487,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testBooleanArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("booleanArrayField", new boolean[] {true, false});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
boolean[] arr = po.field("booleanArrayField");
@@ -547,14 +508,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testDecimalArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("decimalArrayField", new BigDecimal[] {BigDecimal.ONE, BigDecimal.TEN});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new BigDecimal[] {BigDecimal.ONE, BigDecimal.TEN}, po.<String[]>field("decimalArrayField")));
}
@@ -565,14 +524,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testStringArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("stringArrayField", new String[] {"str1", "str2", "str3"});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new String[] {"str1", "str2", "str3"}, po.<String[]>field("stringArrayField")));
}
@@ -610,8 +567,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testUuidArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
UUID[] arr = new UUID[] {UUID.randomUUID(), UUID.randomUUID()};
builder.setField("uuidArrayField", arr);
@@ -619,7 +574,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(arr, po.<UUID[]>field("uuidArrayField")));
}
@@ -630,14 +585,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testObjectField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("objectField", new Value(1));
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1, po.<BinaryObject>field("objectField").<Value>deserialize().i);
}
@@ -648,14 +601,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testObjectArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("objectArrayField", new Value[] {new Value(1), new Value(2)});
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
Object[] arr = po.field("objectArrayField");
@@ -671,15 +622,13 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testCollectionField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("collectionField", Arrays.asList(new Value(1), new Value(2)));
builder.setField("collectionField2", Arrays.asList(new Value(1), new Value(2)), Collection.class);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
List<Value> list = po.field("collectionField");
@@ -700,15 +649,13 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testMapField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("mapField", F.asMap(new Key(1), new Value(1), new Key(2), new Value(2)));
builder.setField("mapField2", F.asMap(new Key(1), new Value(1), new Key(2), new Value(2)), Map.class);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
// Test non-standard map.
Map<Key, Value> map = po.field("mapField");
@@ -733,8 +680,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testSeveralFields() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("i", 111);
builder.setField("f", 111.111f);
builder.setField("iArr", new int[] {1, 2, 3});
@@ -744,7 +689,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
- assertEquals(100, po.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(111, po.<Integer>field("i").intValue());
assertEquals(111.111f, po.<Float>field("f").floatValue(), 0);
@@ -765,8 +710,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testOffheapBinary() throws Exception {
BinaryObjectBuilder builder = builder("Class");
- builder.hashCode(100);
-
builder.setField("i", 111);
builder.setField("f", 111.111f);
builder.setField("iArr", new int[] {1, 2, 3});
@@ -799,7 +742,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
assertEquals(BinaryObjectOffheapImpl.class, offheapObj.getClass());
assertEquals(expectedHashCode("Class"), offheapObj.type().typeId());
- assertEquals(100, offheapObj.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), offheapObj.hashCode());
assertEquals(111, offheapObj.<Integer>field("i").intValue());
assertEquals(111.111f, offheapObj.<Float>field("f").floatValue(), 0);
@@ -827,14 +770,12 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testBuildAndDeserialize() throws Exception {
BinaryObjectBuilder builder = builder(Value.class.getName());
- builder.hashCode(100);
-
builder.setField("i", 1);
BinaryObject bo = builder.build();
assertEquals(expectedHashCode(Value.class.getName()), bo.type().typeId());
- assertEquals(100, bo.hashCode());
+ assertEquals(BinaryArrayIdentityResolver.instance().hashCode(bo), bo.hashCode());
assertEquals(1, bo.<Value>deserialize().i);
}
@@ -874,8 +815,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
public void testMetaData() throws Exception {
BinaryObjectBuilder builder = builder("org.test.MetaTest");
- builder.hashCode(100);
-
builder.setField("intField", 1);
builder.setField("byteArrayField", new byte[] {1, 2, 3});
@@ -897,8 +836,6 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
builder = builder("org.test.MetaTest");
- builder.hashCode(100);
-
builder.setField("intField", 2);
builder.setField("uuidField", UUID.randomUUID());
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
index 2c22758..73d01fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
@@ -279,7 +279,6 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
for (int i = 0; i < 1; i++) {
builder.setField("id", i);
- builder.hashCode(i);
entity = builder.build();
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
index d30aad5..e28daf3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
@@ -143,10 +143,6 @@ public class GridCacheUtilsSelfTest extends GridCommonAbstractTest {
BinaryObjectBuilderImpl binBuilder = new BinaryObjectBuilderImpl(binaryContext(),
EqualsAndHashCode.class.getName());
- assertThrowsForInvalidKey(binBuilder.build());
-
- binBuilder.hashCode(0xFE12);
-
BinaryObject binObj = binBuilder.build();
CU.validateCacheKey(binObj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
index b86fe53..827b3cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
@@ -86,7 +86,7 @@ public class GridLocalCacheStoreManagerDeserializationTest extends GridCacheStor
final BinaryObjectBuilder builder = grid.binary().builder("custom_type");
- final BinaryObject entity = builder.setField("id", 0).hashCode(0).build();
+ final BinaryObject entity = builder.setField("id", 0).build();
cache.put(entity, entity);
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
index fbc065d..666505b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
@@ -127,7 +127,7 @@ public class IgniteCacheBinaryObjectsScanSelfTest extends GridCommonAbstractTest
assertEquals(PERSON_CLS_NAME, entry.getValue().getClass().getName());
}
- entries = cache.query(new ScanQuery<>(1)).getAll();
+ entries = cache.query(new ScanQuery<>(1023)).getAll();
assertFalse(entries.isEmpty());
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index f3b14b1..ea151be 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -926,42 +926,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
}
/**
- * @throws Exception If failed.
- */
- @SuppressWarnings({ "ThrowableResultOfMethodCallIgnored", "unchecked" })
- public void testPutWithoutHashCode() throws Exception {
- final IgniteCache c = jcache(0);
-
- GridCacheAdapter<Object, Object> cache0 = grid(0).context().cache().internalCache(null);
-
- cache0.forceKeyCheck();
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- /** {@inheritDoc} */
- @Override public Object call() throws Exception {
- c.put(new TestObject(5), 5);
- return null;
- }
- }, IllegalArgumentException.class, "Cache key must override hashCode() and equals() methods: ");
-
- BinaryObjectBuilder bldr = grid(0).binary().builder(TestObject.class.getName());
- bldr.setField("val", 5);
-
- final BinaryObject binKey = bldr.build();
-
- cache0.forceKeyCheck();
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- /** {@inheritDoc} */
- @Override public Object call() throws Exception {
- c.put(binKey, 5);
- return null;
- }
- }, IllegalArgumentException.class, "Cache key created with BinaryBuilder is missing hash code - " +
- "please set it explicitly during building by using BinaryBuilder.hashCode(int)");
- }
-
- /**
*
*/
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryVariationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryVariationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryVariationsTest.java
index bd5a122..ab086bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryVariationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryVariationsTest.java
@@ -713,6 +713,11 @@ public class CacheContinuousQueryVariationsTest extends IgniteCacheConfigVariati
cache.remove(key);
cache.remove(key);
+ //Wait when remove event will be added to evts
+ while (evts.size() != 10) {
+ Thread.sleep(100);
+ }
+
evts.clear();
log.info("Finish iteration: " + i);
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index cbf39f6..c064fa1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -41,7 +41,6 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryArrayIdentityResolver;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.cache.query.SqlFieldsQuery;
@@ -979,45 +978,11 @@ public class DmlStatementsProcessor {
if (val instanceof BinaryObjectBuilder)
val = ((BinaryObjectBuilder) val).build();
-
- if (key instanceof BinaryObject)
- key = updateHashCodeIfNeeded(cctx, (BinaryObject) key);
-
- if (val instanceof BinaryObject)
- val = updateHashCodeIfNeeded(cctx, (BinaryObject) val);
}
return new IgniteBiTuple<>(key, val);
}
- /**
- * Set hash code to binary object if it does not have one.
- *
- * @param cctx Cache context.
- * @param binObj Binary object.
- * @return Binary object with hash code set.
- */
- private BinaryObject updateHashCodeIfNeeded(GridCacheContext cctx, BinaryObject binObj) {
- if (U.isHashCodeEmpty(binObj)) {
- if (WARNED_TYPES.add(binObj.type().typeId()))
- U.warn(indexing.getLogger(), "Binary object's type does not have identity resolver explicitly set, therefore " +
- "BinaryArrayIdentityResolver is used to generate hash codes for its instances, and therefore " +
- "hash code of this binary object will most likely not match that of its non serialized form. " +
- "For finer control over identity of this type, please update your BinaryConfiguration accordingly." +
- " [typeId=" + binObj.type().typeId() + ", typeName=" + binObj.type().typeName() + ']');
-
- int hash = BinaryArrayIdentityResolver.instance().hashCode(binObj);
-
- // Empty hash code means no identity set for the type, therefore, we can safely set hash code
- // via this Builder as it won't be overwritten.
- return cctx.grid().binary().builder(binObj)
- .hashCode(hash)
- .build();
- }
- else
- return binObj;
- }
-
/** */
private final static class InsertEntryProcessor implements EntryProcessor<Object, Object, Boolean> {
/** Value to set. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/24f90d6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index b0d3850..79121e4 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1967,11 +1967,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
SysProperties.serializeJavaObject = false;
}
- if (JdbcUtils.serializer != null)
- U.warn(log, "Custom H2 serialization is already configured, will override.");
-
- JdbcUtils.serializer = h2Serializer();
-
String dbName = (ctx != null ? ctx.localNodeId() : UUID.randomUUID()).toString();
dbUrl = "jdbc:h2:mem:" + dbName + DB_OPTIONS;
@@ -2027,6 +2022,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}, CLEANUP_STMT_CACHE_PERIOD, CLEANUP_STMT_CACHE_PERIOD);
}
+ if (JdbcUtils.serializer != null)
+ U.warn(log, "Custom H2 serialization is already configured, will override.");
+
+ JdbcUtils.serializer = h2Serializer();
+
// TODO https://issues.apache.org/jira/browse/IGNITE-2139
// registerMBean(igniteInstanceName, this, GridH2IndexingSpiMBean.class);
}
@@ -2122,16 +2122,16 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*/
private JavaObjectSerializer h2Serializer() {
return new JavaObjectSerializer() {
- @Override public byte[] serialize(Object obj) throws Exception {
- return U.marshal(marshaller, obj);
- }
+ @Override public byte[] serialize(Object obj) throws Exception {
+ return U.marshal(marshaller, obj);
+ }
- @Override public Object deserialize(byte[] bytes) throws Exception {
- ClassLoader clsLdr = ctx != null ? U.resolveClassLoader(ctx.config()) : null;
+ @Override public Object deserialize(byte[] bytes) throws Exception {
+ ClassLoader clsLdr = ctx != null ? U.resolveClassLoader(ctx.config()) : null;
- return U.unmarshal(marshaller, bytes, clsLdr);
- }
- };
+ return U.unmarshal(marshaller, bytes, clsLdr);
+ }
+ };
}
/**
[46/50] [abbrv] ignite git commit: IGNITE-3539 .NET: Remove
deprecated code
Posted by ag...@apache.org.
IGNITE-3539 .NET: Remove deprecated code
CacheEvent.LockId removed, CompiledQuery removed, CompiledQuery2 renamed to CompiledQuery
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3f8f4bd2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3f8f4bd2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3f8f4bd2
Branch: refs/heads/ignite-4003
Commit: 3f8f4bd2f27a973978f6ebab7857e6dab371de8b
Parents: 6f1e970
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Mar 29 13:05:33 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Mar 29 13:05:33 2017 +0300
----------------------------------------------------------------------
.../Cache/Query/CacheLinqTest.cs | 113 ++------
.../Apache.Ignite.Core.Tests/EventsTest.cs | 1 -
.../Apache.Ignite.Core/Events/CacheEvent.cs | 8 -
.../Apache.Ignite.Linq.csproj | 1 -
.../dotnet/Apache.Ignite.Linq/CompiledQuery.cs | 112 +++++---
.../dotnet/Apache.Ignite.Linq/CompiledQuery2.cs | 257 -------------------
.../Datagrid/LinqExample.cs | 2 +-
7 files changed, 106 insertions(+), 388 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index 6d7ddc4..8acf89c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -814,7 +814,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Assert.AreEqual(subSelectCheckCount, subSelectCount, "subselecting another CacheQueryable failed");
var ex = Assert.Throws<NotSupportedException>(() =>
- CompiledQuery2.Compile((int[] k) => cache.Where(x => k.Contains(x.Key))));
+ CompiledQuery.Compile((int[] k) => cache.Where(x => k.Contains(x.Key))));
Assert.AreEqual("'Contains' clause coming from compiled query parameter is not supported.", ex.Message);
}
@@ -995,21 +995,21 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var roles = GetRoleCache().AsCacheQueryable();
// Embedded args
- var qry0 = CompiledQuery2.Compile(() => persons.Where(x => x.Key < 3 && x.Value.Name.Contains("son")));
+ var qry0 = CompiledQuery.Compile(() => persons.Where(x => x.Key < 3 && x.Value.Name.Contains("son")));
Assert.AreEqual(3, qry0().Count());
// Lambda args
- var qry1 = CompiledQuery2.Compile((int minKey, int take, int skip) => persons.Where(x => x.Key > minKey)
+ var qry1 = CompiledQuery.Compile((int minKey, int take, int skip) => persons.Where(x => x.Key > minKey)
.Take(take).Skip(skip));
Assert.AreEqual(3, qry1(-1, 3, 1).GetAll().Count);
- qry1 = CompiledQuery2.Compile((int skip, int take, int minKey) => persons.Where(x => x.Key > minKey)
+ qry1 = CompiledQuery.Compile((int skip, int take, int minKey) => persons.Where(x => x.Key > minKey)
.Take(take).Skip(skip));
Assert.AreEqual(5, qry1(2, 5, 20).GetAll().Count);
// Mixed args
- var qry2 = CompiledQuery2.Compile((int maxKey, int minKey) =>
+ var qry2 = CompiledQuery.Compile((int maxKey, int minKey) =>
persons.Where(x => x.Key < maxKey
&& x.Value.Name.Contains("er")
&& x.Value.Age < maxKey
@@ -1018,13 +1018,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Assert.AreEqual(6, qry2(10, 1).Count());
// Join
- var qry3 = CompiledQuery2.Compile(() =>
+ var qry3 = CompiledQuery.Compile(() =>
roles.Join(persons, r => r.Key.Foo, p => p.Key, (r, p) => r.Value.Name));
Assert.AreEqual(RoleCount, qry3().Count());
// Join with subquery
- var qry4 = CompiledQuery2.Compile(
+ var qry4 = CompiledQuery.Compile(
(int a, int b, string sep) =>
roles
.Where(x => x.Key.Bar > a)
@@ -1039,12 +1039,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Assert.AreEqual(new[] { " Person_2 =Role_2|", " Person_3 =|"}, qry4(1, PersonCount, "=").ToArray());
// Union
- var qry5 = CompiledQuery2.Compile(() => roles.Select(x => -x.Key.Foo).Union(persons.Select(x => x.Key)));
+ var qry5 = CompiledQuery.Compile(() => roles.Select(x => -x.Key.Foo).Union(persons.Select(x => x.Key)));
Assert.AreEqual(RoleCount + PersonCount, qry5().Count());
// Projection
- var qry6 = CompiledQuery2.Compile((int minAge) => persons
+ var qry6 = CompiledQuery.Compile((int minAge) => persons
.Select(x => x.Value)
.Where(x => x.Age >= minAge)
.Select(x => new {x.Name, x.Age})
@@ -1065,57 +1065,57 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var cache = GetPersonCache().AsCacheQueryable();
// const args are allowed
- Assert.AreEqual(5, CompiledQuery2.Compile(() => cache.Where(x => x.Key < 5))().GetAll().Count);
+ Assert.AreEqual(5, CompiledQuery.Compile(() => cache.Where(x => x.Key < 5))().GetAll().Count);
// 0 arg
- var qry0 = CompiledQuery2.Compile(() => cache.Select(x => x.Value.Name));
+ var qry0 = CompiledQuery.Compile(() => cache.Select(x => x.Value.Name));
Assert.AreEqual(PersonCount, qry0().ToArray().Length);
// 1 arg
- var qry1 = CompiledQuery2.Compile((int k) => cache.Where(x => x.Key < k));
+ var qry1 = CompiledQuery.Compile((int k) => cache.Where(x => x.Key < k));
Assert.AreEqual(3, qry1(3).ToArray().Length);
// 1 arg twice
- var qry1T = CompiledQuery2.Compile((int k) => cache.Where(x => x.Key < k && x.Value.Age < k));
+ var qry1T = CompiledQuery.Compile((int k) => cache.Where(x => x.Key < k && x.Value.Age < k));
Assert.AreEqual(3, qry1T(3).ToArray().Length);
// 2 arg
var qry2 =
- CompiledQuery2.Compile((int i, string s) => cache.Where(x => x.Key < i && x.Value.Name.StartsWith(s)));
+ CompiledQuery.Compile((int i, string s) => cache.Where(x => x.Key < i && x.Value.Name.StartsWith(s)));
Assert.AreEqual(5, qry2(5, " Pe").ToArray().Length);
// Changed param order
var qry2R =
- CompiledQuery2.Compile((string s, int i) => cache.Where(x => x.Key < i && x.Value.Name.StartsWith(s)));
+ CompiledQuery.Compile((string s, int i) => cache.Where(x => x.Key < i && x.Value.Name.StartsWith(s)));
Assert.AreEqual(5, qry2R(" Pe", 5).ToArray().Length);
// 3 arg
- var qry3 = CompiledQuery2.Compile((int i, string s, double d) =>
+ var qry3 = CompiledQuery.Compile((int i, string s, double d) =>
cache.Where(x => x.Value.Address.Zip > d && x.Key < i && x.Value.Name.Contains(s)));
Assert.AreEqual(5, qry3(5, "son", -10).ToArray().Length);
// 4 arg
- var qry4 = CompiledQuery2.Compile((int a, int b, int c, int d) =>
+ var qry4 = CompiledQuery.Compile((int a, int b, int c, int d) =>
cache.Select(x => x.Key).Where(k => k > a && k > b && k > c && k < d));
Assert.AreEqual(new[] {3, 4}, qry4(0, 1, 2, 5).ToArray());
// 5 arg
- var qry5 = CompiledQuery2.Compile((int a, int b, int c, int d, int e) =>
+ var qry5 = CompiledQuery.Compile((int a, int b, int c, int d, int e) =>
cache.Select(x => x.Key).Where(k => k > a && k > b && k > c && k < d && k < e));
Assert.AreEqual(new[] {3, 4}, qry5(0, 1, 2, 5, 6).ToArray());
// 6 arg
- var qry6 = CompiledQuery2.Compile((int a, int b, int c, int d, int e, int f) =>
+ var qry6 = CompiledQuery.Compile((int a, int b, int c, int d, int e, int f) =>
cache.Select(x => x.Key).Where(k => k > a && k > b && k > c && k < d && k < e && k < f));
Assert.AreEqual(new[] {3, 4}, qry6(0, 1, 2, 5, 6, 7).ToArray());
// 7 arg
- var qry7 = CompiledQuery2.Compile((int a, int b, int c, int d, int e, int f, int g) =>
+ var qry7 = CompiledQuery.Compile((int a, int b, int c, int d, int e, int f, int g) =>
cache.Select(x => x.Key).Where(k => k > a && k > b && k > c && k < d && k < e && k < f && k < g));
Assert.AreEqual(new[] {3, 4}, qry7(0, 1, 2, 5, 6, 7, 8).ToArray());
// 8 arg
- var qry8 = CompiledQuery2.Compile((int a, int b, int c, int d, int e, int f, int g, int h) =>
+ var qry8 = CompiledQuery.Compile((int a, int b, int c, int d, int e, int f, int g, int h) =>
cache.Select(x => x.Key).Where(k => k > a && k > b && k > c && k < d && k < e && k < f && k < g && k < h));
Assert.AreEqual(new[] {3, 4}, qry8(0, 1, 2, 5, 6, 7, 8, 9).ToArray());
}
@@ -1131,19 +1131,19 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var qry = cache.Where(x => x.Key < 5);
// Simple
- var compiled = CompiledQuery2.Compile(qry);
+ var compiled = CompiledQuery.Compile(qry);
Assert.AreEqual(5, compiled(5).Count());
Assert.AreEqual(6, compiled(6).Count());
// Select
- var compiledSelect = CompiledQuery2.Compile(qry.Select(x => x.Value.Name).OrderBy(x => x));
+ var compiledSelect = CompiledQuery.Compile(qry.Select(x => x.Value.Name).OrderBy(x => x));
Assert.AreEqual(3, compiledSelect(3).Count());
Assert.AreEqual(" Person_0 ", compiledSelect(1).Single());
// Join
- var compiledJoin = CompiledQuery2.Compile(qry.Join(
+ var compiledJoin = CompiledQuery.Compile(qry.Join(
GetOrgCache().AsCacheQueryable().Where(x => x.Value.Name.StartsWith("Org")),
p => p.Value.OrganizationId, o => o.Value.Id, (p, o) => o.Key));
@@ -1156,74 +1156,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
.Where(x => x.Value.Address.Zip > 0)
.Where(x => x.Value.Age == 7);
- var compiled2 = CompiledQuery2.Compile(qry2);
+ var compiled2 = CompiledQuery.Compile(qry2);
Assert.AreEqual(17, compiled2(18, 16, "ers", 13, 17).Single().Key);
}
-#pragma warning disable 618 // obsolete class
- /// <summary>
- /// Tests the old, deprecated compiled query.
- /// </summary>
- [Test]
- public void TestCompiledQueryOld()
- {
- var cache = GetPersonCache().AsCacheQueryable();
-
- // const args are not allowed
- Assert.Throws<InvalidOperationException>(() => CompiledQuery.Compile(() => cache.Where(x => x.Key < 5)));
-
- // 0 arg
- var qry0 = CompiledQuery.Compile(() => cache.Select(x => x.Value.Name));
- Assert.AreEqual(PersonCount, qry0().ToArray().Length);
-
- // 1 arg
- var qry1 = CompiledQuery.Compile((int k) => cache.Where(x => x.Key < k));
- Assert.AreEqual(3, qry1(3).ToArray().Length);
-
- // 2 arg
- var qry2 =
- CompiledQuery.Compile((int i, string s) => cache.Where(x => x.Key < i && x.Value.Name.StartsWith(s)));
- Assert.AreEqual(5, qry2(5, " Pe").ToArray().Length);
-
- // Changed param order
- var qry2R =
- CompiledQuery.Compile((string s, int i) => cache.Where(x => x.Key < i && x.Value.Name.StartsWith(s)));
- Assert.AreEqual(5, qry2R(" Pe", 5).ToArray().Length);
-
- // 3 arg
- var qry3 = CompiledQuery.Compile((int i, string s, double d) =>
- cache.Where(x => x.Value.Address.Zip > d && x.Key < i && x.Value.Name.Contains(s)));
- Assert.AreEqual(5, qry3(5, "son", -10).ToArray().Length);
-
- // 4 arg
- var keys = cache.Select(x => x.Key);
- var qry4 = CompiledQuery.Compile((int a, int b, int c, int d) =>
- keys.Where(k => k > a && k > b && k > c && k < d));
- Assert.AreEqual(new[] { 3, 4 }, qry4(0, 1, 2, 5).ToArray());
-
- // 5 arg
- var qry5 = CompiledQuery.Compile((int a, int b, int c, int d, int e) =>
- keys.Where(k => k > a && k > b && k > c && k < d && k < e));
- Assert.AreEqual(new[] { 3, 4 }, qry5(0, 1, 2, 5, 6).ToArray());
-
- // 6 arg
- var qry6 = CompiledQuery.Compile((int a, int b, int c, int d, int e, int f) =>
- keys.Where(k => k > a && k > b && k > c && k < d && k < e && k < f));
- Assert.AreEqual(new[] { 3, 4 }, qry6(0, 1, 2, 5, 6, 7).ToArray());
-
- // 7 arg
- var qry7 = CompiledQuery.Compile((int a, int b, int c, int d, int e, int f, int g) =>
- keys.Where(k => k > a && k > b && k > c && k < d && k < e && k < f && k < g));
- Assert.AreEqual(new[] { 3, 4 }, qry7(0, 1, 2, 5, 6, 7, 8).ToArray());
-
- // 8 arg
- var qry8 = CompiledQuery.Compile((int a, int b, int c, int d, int e, int f, int g, int h) =>
- keys.Where(k => k > a && k > b && k > c && k < d && k < e && k < f && k < g && k < h));
- Assert.AreEqual(new[] { 3, 4 }, qry8(0, 1, 2, 5, 6, 7, 8, 9).ToArray());
- }
-#pragma warning restore 618
-
/// <summary>
/// Tests the cache of primitive types.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index cc21490..994b334 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -525,7 +525,6 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(true, cacheEvent.IsNear);
Assert.AreEqual(2, cacheEvent.Key);
Assert.AreEqual(expectedGridGuid, cacheEvent.Xid);
- Assert.AreEqual(null, cacheEvent.LockId);
Assert.AreEqual(4, cacheEvent.NewValue);
Assert.AreEqual(true, cacheEvent.HasNewValue);
Assert.AreEqual(5, cacheEvent.OldValue);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
index 62687b9..089c04f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.Core.Events
{
using System;
- using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cluster;
@@ -120,13 +119,6 @@ namespace Apache.Ignite.Core.Events
public IgniteGuid? Xid { get { return _xid; } }
/// <summary>
- /// ID of the lock if held or null if no lock held.
- /// </summary>
- [Obsolete("LockId is no longer provided. This property is always null.")]
- [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Compatibility")]
- public object LockId { get { return null; } }
-
- /// <summary>
/// Gets new value for this event.
/// </summary>
public object NewValue { get { return _newValue; } }
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.csproj b/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.csproj
index 04b4916..a7ec402 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.csproj
@@ -52,7 +52,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CacheExtensions.cs" />
- <Compile Include="CompiledQuery2.cs" />
<Compile Include="CompiledQuery.cs" />
<Compile Include="ICacheQueryable.cs" />
<Compile Include="Impl\AliasDictionary.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
index 817c423..e1e1f88 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
@@ -21,14 +21,22 @@ namespace Apache.Ignite.Linq
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
+ using System.Linq.Expressions;
using Apache.Ignite.Core.Cache.Query;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Linq.Impl;
/// <summary>
+ /// Delegate for compiled query with arbitrary number of arguments.
+ /// </summary>
+ /// <typeparam name="T">Result type.</typeparam>
+ /// <param name="args">The arguments.</param>
+ /// <returns>Query cursor.</returns>
+ public delegate IQueryCursor<T> CompiledQueryFunc<T>(params object[] args);
+
+ /// <summary>
/// Represents a compiled cache query.
/// </summary>
- [Obsolete("Use CompiledQuery2 class.")]
public static class CompiledQuery
{
/// <summary>
@@ -38,27 +46,55 @@ namespace Apache.Ignite.Linq
/// <returns>Delegate that represents the compiled cache query.</returns>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
- public static Func<IQueryCursor<T>> Compile<T>(Func<IQueryable<T>> query)
+ public static Func<IQueryCursor<T>> Compile<T>(Expression<Func<IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return () => compiledQuery(new object[0]);
}
/// <summary>
+ /// Creates a new delegate that represents the compiled cache query with any number of arguments.
+ /// <para />
+ /// This method differs from other Compile methods in that it takes in <see cref="ICacheQueryable"/> directly,
+ /// and returns a delegate that takes an array of parameters.
+ /// It is up to the user to provide query arguments in correct order.
+ /// <para />
+ /// This method also imposes no restrictions on where the query comes from (in contrary to other methods).
+ /// </summary>
+ /// <param name="query">The query to compile.</param>
+ /// <returns>Delegate that represents the compiled cache query.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
+ Justification = "Invalid warning, validation is present.")]
+ public static CompiledQueryFunc<T> Compile<T>(IQueryable<T> query)
+ {
+ IgniteArgumentCheck.NotNull(query, "query");
+
+ var cacheQueryable = query as ICacheQueryableInternal;
+
+ if (cacheQueryable == null)
+ throw GetInvalidQueryException(query);
+
+ var compileQuery = cacheQueryable.CompileQuery<T>();
+
+ // Special delegate is required to allow params[].
+ return args => compileQuery(args);
+ }
+
+ /// <summary>
/// Creates a new delegate that represents the compiled cache query.
/// </summary>
/// <param name="query">The query to compile.</param>
/// <returns>Delegate that represents the compiled cache query.</returns>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
- public static Func<T1, IQueryCursor<T>> Compile<T, T1>(Func<T1, IQueryable<T>> query)
+ public static Func<T1, IQueryCursor<T>> Compile<T, T1>(Expression<Func<T1, IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return x => compiledQuery(new object[] {x});
}
@@ -70,12 +106,12 @@ namespace Apache.Ignite.Linq
/// <returns>Delegate that represents the compiled cache query.</returns>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, IQueryCursor<T>> Compile<T, T1, T2>(Func<T1, T2,
- IQueryable<T>> query)
+ public static Func<T1, T2, IQueryCursor<T>> Compile<T, T1, T2>(Expression<Func<T1, T2,
+ IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1), default(T2)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y) => compiledQuery(new object[] {x, y});
}
@@ -87,12 +123,12 @@ namespace Apache.Ignite.Linq
/// <returns>Delegate that represents the compiled cache query.</returns>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, IQueryCursor<T>> Compile<T, T1, T2, T3>(Func<T1, T2, T3,
- IQueryable<T>> query)
+ public static Func<T1, T2, T3, IQueryCursor<T>> Compile<T, T1, T2, T3>(Expression<Func<T1, T2, T3,
+ IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1), default(T2), default(T3)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y, z) => compiledQuery(new object[] {x, y, z});
}
@@ -104,12 +140,12 @@ namespace Apache.Ignite.Linq
/// <returns>Delegate that represents the compiled cache query.</returns>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, T4, IQueryCursor<T>> Compile<T, T1, T2, T3, T4>(Func<T1, T2, T3, T4,
- IQueryable<T>> query)
+ public static Func<T1, T2, T3, T4, IQueryCursor<T>> Compile<T, T1, T2, T3, T4>(Expression<Func<T1, T2, T3, T4,
+ IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1), default(T2), default(T3), default(T4)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y, z, a) => compiledQuery(new object[] {x, y, z, a});
}
@@ -122,12 +158,11 @@ namespace Apache.Ignite.Linq
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
public static Func<T1, T2, T3, T4, T5, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5>(
- Func<T1, T2, T3, T4, T5, IQueryable<T>> query)
+ Expression<Func<T1, T2, T3, T4, T5, IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery =
- GetCompiledQuery(query(default(T1), default(T2), default(T3), default(T4), default(T5)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y, z, a, b) => compiledQuery(new object[] {x, y, z, a, b});
}
@@ -140,12 +175,11 @@ namespace Apache.Ignite.Linq
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
public static Func<T1, T2, T3, T4, T5, T6, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5, T6>(
- Func<T1, T2, T3, T4, T5, T6, IQueryable<T>> query)
+ Expression<Func<T1, T2, T3, T4, T5, T6, IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1), default(T2), default(T3), default(T4),
- default(T5), default(T6)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y, z, a, b, c) => compiledQuery(new object[] {x, y, z, a, b, c});
}
@@ -158,12 +192,11 @@ namespace Apache.Ignite.Linq
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
public static Func<T1, T2, T3, T4, T5, T6, T7, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5, T6, T7>(
- Func<T1, T2, T3, T4, T5, T6, T7, IQueryable<T>> query)
+ Expression<Func<T1, T2, T3, T4, T5, T6, T7, IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1), default(T2), default(T3), default(T4),
- default(T5), default(T6), default(T7)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y, z, a, b, c, d) => compiledQuery(new object[] {x, y, z, a, b, c, d});
}
@@ -176,12 +209,11 @@ namespace Apache.Ignite.Linq
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
Justification = "Invalid warning, validation is present.")]
public static Func<T1, T2, T3, T4, T5, T6, T7, T8, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5, T6, T7, T8>(
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IQueryable<T>> query)
+ Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, IQueryable<T>>> query)
{
IgniteArgumentCheck.NotNull(query, "query");
- var compiledQuery = GetCompiledQuery(query(default(T1), default(T2), default(T3), default(T4),
- default(T5), default(T6), default(T7), default(T8)), query);
+ var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
return (x, y, z, a, b, c, d, e) => compiledQuery(new object[] {x, y, z, a, b, c, d, e});
}
@@ -189,21 +221,37 @@ namespace Apache.Ignite.Linq
/// <summary>
/// Gets the compiled query.
/// </summary>
- private static Func<object[], IQueryCursor<T>> GetCompiledQuery<T>(IQueryable<T> queryable,
+ private static Func<object[], IQueryCursor<T>> GetCompiledQuery<T>(LambdaExpression expression,
Delegate queryCaller)
{
+ Debug.Assert(expression != null);
Debug.Assert(queryCaller != null);
+ // Get default parameter values.
+ var paramValues = expression.Parameters
+ .Select(x => x.Type)
+ .Select(x => x.IsValueType ? Activator.CreateInstance(x) : null)
+ .ToArray();
+
+ // Invoke the delegate to obtain the cacheQueryable.
+ var queryable = queryCaller.DynamicInvoke(paramValues);
+
var cacheQueryable = queryable as ICacheQueryableInternal;
if (cacheQueryable == null)
- throw new ArgumentException(
- string.Format("{0} can only compile cache queries produced by AsCacheQueryable method. " +
- "Provided query is not valid: '{1}'", typeof (CompiledQuery).FullName, queryable));
+ throw GetInvalidQueryException(queryable);
- Debug.WriteLine(queryable);
+ return cacheQueryable.CompileQuery<T>(expression);
+ }
- return cacheQueryable.CompileQuery<T>(queryCaller);
+ /// <summary>
+ /// Gets the invalid query exception.
+ /// </summary>
+ private static ArgumentException GetInvalidQueryException(object queryable)
+ {
+ return new ArgumentException(
+ string.Format("{0} can only compile cache queries produced by AsCacheQueryable method. " +
+ "Provided query is not valid: '{1}'", typeof(CompiledQuery).FullName, queryable));
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery2.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery2.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery2.cs
deleted file mode 100644
index 4131992..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery2.cs
+++ /dev/null
@@ -1,257 +0,0 @@
-\ufeff/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Linq
-{
- using System;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Linq.Expressions;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Linq.Impl;
-
- /// <summary>
- /// Delegate for compiled query with arbitrary number of arguments.
- /// </summary>
- /// <typeparam name="T">Result type.</typeparam>
- /// <param name="args">The arguments.</param>
- /// <returns>Query cursor.</returns>
- public delegate IQueryCursor<T> CompiledQueryFunc<T>(params object[] args);
-
- /// <summary>
- /// Represents a compiled cache query.
- /// </summary>
- public static class CompiledQuery2
- {
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<IQueryCursor<T>> Compile<T>(Expression<Func<IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return () => compiledQuery(new object[0]);
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query with any number of arguments.
- /// <para />
- /// This method differs from other Compile methods in that it takes in <see cref="ICacheQueryable"/> directly,
- /// and returns a delegate that takes an array of parameters.
- /// It is up to the user to provide query arguments in correct order.
- /// <para />
- /// This method also imposes no restrictions on where the query comes from (in contrary to other methods).
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static CompiledQueryFunc<T> Compile<T>(IQueryable<T> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var cacheQueryable = query as ICacheQueryableInternal;
-
- if (cacheQueryable == null)
- throw GetInvalidQueryException(query);
-
- var compileQuery = cacheQueryable.CompileQuery<T>();
-
- // Special delegate is required to allow params[].
- return args => compileQuery(args);
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, IQueryCursor<T>> Compile<T, T1>(Expression<Func<T1, IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return x => compiledQuery(new object[] {x});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, IQueryCursor<T>> Compile<T, T1, T2>(Expression<Func<T1, T2,
- IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y) => compiledQuery(new object[] {x, y});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, IQueryCursor<T>> Compile<T, T1, T2, T3>(Expression<Func<T1, T2, T3,
- IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y, z) => compiledQuery(new object[] {x, y, z});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, T4, IQueryCursor<T>> Compile<T, T1, T2, T3, T4>(Expression<Func<T1, T2, T3, T4,
- IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y, z, a) => compiledQuery(new object[] {x, y, z, a});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, T4, T5, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5>(
- Expression<Func<T1, T2, T3, T4, T5, IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y, z, a, b) => compiledQuery(new object[] {x, y, z, a, b});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, T4, T5, T6, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5, T6>(
- Expression<Func<T1, T2, T3, T4, T5, T6, IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y, z, a, b, c) => compiledQuery(new object[] {x, y, z, a, b, c});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, T4, T5, T6, T7, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5, T6, T7>(
- Expression<Func<T1, T2, T3, T4, T5, T6, T7, IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y, z, a, b, c, d) => compiledQuery(new object[] {x, y, z, a, b, c, d});
- }
-
- /// <summary>
- /// Creates a new delegate that represents the compiled cache query.
- /// </summary>
- /// <param name="query">The query to compile.</param>
- /// <returns>Delegate that represents the compiled cache query.</returns>
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
- Justification = "Invalid warning, validation is present.")]
- public static Func<T1, T2, T3, T4, T5, T6, T7, T8, IQueryCursor<T>> Compile<T, T1, T2, T3, T4, T5, T6, T7, T8>(
- Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, IQueryable<T>>> query)
- {
- IgniteArgumentCheck.NotNull(query, "query");
-
- var compiledQuery = GetCompiledQuery<T>(query, query.Compile());
-
- return (x, y, z, a, b, c, d, e) => compiledQuery(new object[] {x, y, z, a, b, c, d, e});
- }
-
- /// <summary>
- /// Gets the compiled query.
- /// </summary>
- private static Func<object[], IQueryCursor<T>> GetCompiledQuery<T>(LambdaExpression expression,
- Delegate queryCaller)
- {
- Debug.Assert(expression != null);
- Debug.Assert(queryCaller != null);
-
- // Get default parameter values.
- var paramValues = expression.Parameters
- .Select(x => x.Type)
- .Select(x => x.IsValueType ? Activator.CreateInstance(x) : null)
- .ToArray();
-
- // Invoke the delegate to obtain the cacheQueryable.
- var queryable = queryCaller.DynamicInvoke(paramValues);
-
- var cacheQueryable = queryable as ICacheQueryableInternal;
-
- if (cacheQueryable == null)
- throw GetInvalidQueryException(queryable);
-
- return cacheQueryable.CompileQuery<T>(expression);
- }
-
- /// <summary>
- /// Gets the invalid query exception.
- /// </summary>
- private static ArgumentException GetInvalidQueryException(object queryable)
- {
- return new ArgumentException(
- string.Format("{0} can only compile cache queries produced by AsCacheQueryable method. " +
- "Provided query is not valid: '{1}'", typeof(CompiledQuery2).FullName, queryable));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f8f4bd2/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs
index 7af8569..1f8b71b 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs
@@ -127,7 +127,7 @@ namespace Apache.Ignite.Examples.Datagrid
// Compile cache query to eliminate LINQ overhead on multiple runs.
Func<int, IQueryCursor<ICacheEntry<int, Employee>>> qry =
- CompiledQuery2.Compile((int z) => cache0.Where(emp => emp.Value.Address.Zip == z));
+ CompiledQuery.Compile((int z) => cache0.Where(emp => emp.Value.Address.Zip == z));
Console.WriteLine();
Console.WriteLine(">>> Employees with zipcode {0} using compiled query:", zip);
[35/50] [abbrv] ignite git commit: IGNITE-4870 .NET:
QueryEntity.TableName
Posted by ag...@apache.org.
IGNITE-4870 .NET: QueryEntity.TableName
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/738bb122
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/738bb122
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/738bb122
Branch: refs/heads/ignite-4003
Commit: 738bb1224737ec6368ee944cb8a3bafb67d7b151
Parents: 58b31b9
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 28 11:49:45 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 28 11:49:45 2017 +0300
----------------------------------------------------------------------
.../platform/utils/PlatformConfigurationUtils.java | 2 ++
.../Cache/CacheConfigurationTest.cs | 2 ++
.../Cache/Query/CacheLinqTest.cs | 11 +++++++++--
.../Cache/Query/CacheQueriesCodeConfigurationTest.cs | 7 +++++++
.../Cache/Configuration/QueryEntity.cs | 8 ++++++++
.../Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs | 10 +++++++++-
6 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/738bb122/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index bce3735..b2926e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -469,6 +469,7 @@ public class PlatformConfigurationUtils {
res.setKeyType(in.readString());
res.setValueType(in.readString());
+ res.setTableName(in.readString());
// Fields
int cnt = in.readInt();
@@ -899,6 +900,7 @@ public class PlatformConfigurationUtils {
writer.writeString(queryEntity.getKeyType());
writer.writeString(queryEntity.getValueType());
+ writer.writeString(queryEntity.getTableName());
// Fields
LinkedHashMap<String, String> fields = queryEntity.getFields();
http://git-wip-us.apache.org/repos/asf/ignite/blob/738bb122/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 7a30780..1e02399 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -356,6 +356,7 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(x.KeyTypeName, y.KeyTypeName);
Assert.AreEqual(x.ValueTypeName, y.ValueTypeName);
+ Assert.AreEqual(x.TableName, y.TableName);
AssertConfigsAreEqual(x.Fields, y.Fields);
AssertConfigsAreEqual(x.Aliases, y.Aliases);
@@ -630,6 +631,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
KeyTypeName = "Integer",
ValueTypeName = "java.lang.String",
+ TableName = "MyTable",
Fields = new[]
{
new QueryField("length", typeof(int)),
http://git-wip-us.apache.org/repos/asf/ignite/blob/738bb122/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index 7897ea7..6d7ddc4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -1456,8 +1456,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
private static ICache<int, Person> GetSecondPersonCache()
{
return Ignition.GetIgnite()
- .GetOrCreateCache<int, Person>(new CacheConfiguration(PersonSecondCacheName,
- new QueryEntity(typeof (int), typeof (Person))) {CacheMode = CacheMode.Replicated});
+ .GetOrCreateCache<int, Person>(
+ new CacheConfiguration(PersonSecondCacheName,
+ new QueryEntity(typeof(int), typeof(Person))
+ {
+ TableName = "CustomPersons"
+ })
+ {
+ CacheMode = CacheMode.Replicated
+ });
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/738bb122/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
index 22088d6..8157a56 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
@@ -49,6 +49,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
{
new CacheConfiguration(CacheName, new QueryEntity(typeof (int), typeof (QueryPerson))
{
+ TableName = "CustomTableName",
Fields = new[]
{
new QueryField("Name", typeof (string)),
@@ -78,6 +79,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Assert.AreEqual(2, cursor.GetAll().Single().Key);
}
+ using (var cursor = cache.QueryFields(new SqlFieldsQuery(
+ "select _key from CustomTableName where age > ? and birthday < ?", 10, DateTime.UtcNow)))
+ {
+ Assert.AreEqual(2, cursor.GetAll().Single()[0]);
+ }
+
using (var cursor = cache.Query(new TextQuery(typeof (QueryPerson), "Ar*")))
{
Assert.AreEqual(1, cursor.GetAll().Single().Key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/738bb122/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
index 2cd0295..b67f206 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
@@ -148,6 +148,12 @@ namespace Apache.Ignite.Core.Cache.Configuration
}
/// <summary>
+ /// Gets or sets the name of the SQL table.
+ /// When not set, value type name is used.
+ /// </summary>
+ public string TableName { get; set; }
+
+ /// <summary>
/// Gets or sets query fields, a map from field name to Java type name.
/// The order of fields defines the order of columns returned by the 'select *' queries.
/// </summary>
@@ -176,6 +182,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
{
KeyTypeName = reader.ReadString();
ValueTypeName = reader.ReadString();
+ TableName = reader.ReadString();
var count = reader.ReadInt();
Fields = count == 0
@@ -199,6 +206,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
{
writer.WriteString(KeyTypeName);
writer.WriteString(ValueTypeName);
+ writer.WriteString(TableName);
if (Fields != null)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/738bb122/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
index 3f5fe34..e909575 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
@@ -187,7 +187,7 @@ namespace Apache.Ignite.Linq.Impl
// Split on '.' to throw away Java type namespace
var validTableNames = _cacheConfiguration.QueryEntities == null
? null
- : _cacheConfiguration.QueryEntities.Select(e => e.ValueTypeName.Split('.').Last()).ToArray();
+ : _cacheConfiguration.QueryEntities.Select(GetTableName).ToArray();
if (validTableNames == null || !validTableNames.Any())
throw new CacheException(string.Format("Queries are not configured for cache '{0}'",
@@ -197,6 +197,14 @@ namespace Apache.Ignite.Linq.Impl
}
/// <summary>
+ /// Gets the name of the SQL table.
+ /// </summary>
+ private static string GetTableName(QueryEntity e)
+ {
+ return e.TableName ?? e.ValueTypeName.Split('.').Last();
+ }
+
+ /// <summary>
/// Infers the name of the table from cache configuration.
/// </summary>
/// <param name="cacheValueType"></param>
[17/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/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 58ce001..7499a5d 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
@@ -30,6 +30,7 @@ import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteDeploymentException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.compute.ComputeTask;
import org.apache.ignite.compute.ComputeTaskFuture;
@@ -83,9 +84,18 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
* @param ctx Kernal context.
* @param prj Projection.
* @param subjId Subject ID.
+ */
+ public IgniteComputeImpl(GridKernalContext ctx, ClusterGroupAdapter prj, UUID subjId) {
+ this(ctx, prj, subjId, false);
+ }
+
+ /**
+ * @param ctx Kernal context.
+ * @param prj Projection.
+ * @param subjId Subject ID.
* @param async Async support flag.
*/
- public IgniteComputeImpl(GridKernalContext ctx, ClusterGroupAdapter prj, UUID subjId, boolean async) {
+ private IgniteComputeImpl(GridKernalContext ctx, ClusterGroupAdapter prj, UUID subjId, boolean async) {
super(async);
this.ctx = ctx;
@@ -105,6 +115,29 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public void affinityRun(@Nullable String cacheName, Object affKey, IgniteRunnable job) {
+ try {
+ saveOrGet(affinityRunAsync0(cacheName, affKey, job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> affinityRunAsync(@Nullable String cacheName, Object affKey,
+ IgniteRunnable job) throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(affinityRunAsync0(cacheName, affKey, job));
+ }
+
+ /**
+ * Affinity run implementation.
+ *
+ * @param cacheName Cache name.
+ * @param affKey Affinity key.
+ * @param job Job.
+ * @return Internal future.
+ */
+ private IgniteInternalFuture<?> affinityRunAsync0(@Nullable String cacheName, Object affKey, IgniteRunnable job) {
A.notNull(affKey, "affKey");
A.notNull(job, "job");
@@ -119,7 +152,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, job, prj.nodes()));
+ return ctx.closure().affinityRun(Collections.singletonList(cacheName), partId, job, prj.nodes());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -131,6 +164,30 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public void affinityRun(@NotNull Collection<String> cacheNames, Object affKey, IgniteRunnable job) {
+ try {
+ saveOrGet(affinityRunAsync0(cacheNames, affKey, job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> affinityRunAsync(@NotNull Collection<String> cacheNames, Object affKey,
+ IgniteRunnable job) throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(affinityRunAsync0(cacheNames, affKey, job));
+ }
+
+ /**
+ * Affinity run implementation.
+ *
+ * @param cacheNames Cache names collection.
+ * @param affKey Affinity key.
+ * @param job Job.
+ * @return Internal future.
+ */
+ private IgniteInternalFuture<?> affinityRunAsync0(@NotNull Collection<String> cacheNames, Object affKey,
+ IgniteRunnable job) {
A.notNull(affKey, "affKey");
A.notNull(job, "job");
A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
@@ -148,7 +205,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, job, prj.nodes()));
+ return ctx.closure().affinityRun(cacheNames, partId, job, prj.nodes());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -160,6 +217,30 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public void affinityRun(@NotNull Collection<String> cacheNames, int partId, IgniteRunnable job) {
+ try {
+ saveOrGet(affinityRunAsync0(cacheNames, partId, job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> affinityRunAsync(@NotNull Collection<String> cacheNames, int partId,
+ IgniteRunnable job) throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(affinityRunAsync0(cacheNames, partId, job));
+ }
+
+ /**
+ * Affinity run implementation.
+ *
+ * @param cacheNames Cache names collection.
+ * @param partId partition ID.
+ * @param job Job.
+ * @return Internal future.
+ */
+ private IgniteInternalFuture<?> affinityRunAsync0(@NotNull Collection<String> cacheNames, int partId,
+ IgniteRunnable job) {
A.ensure(partId >= 0, "partId = " + partId);
A.notNull(job, "job");
A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
@@ -167,7 +248,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
guard();
try {
- saveOrGet(ctx.closure().affinityRun(cacheNames, partId, job, prj.nodes()));
+ return ctx.closure().affinityRun(cacheNames, partId, job, prj.nodes());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -179,6 +260,30 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R> R affinityCall(@Nullable String cacheName, Object affKey, IgniteCallable<R> job) {
+ try {
+ return saveOrGet(affinityCallAsync0(cacheName, affKey, job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> affinityCallAsync(@Nullable String cacheName, Object affKey,
+ IgniteCallable<R> job) throws IgniteException {
+ return createFuture(affinityCallAsync0(cacheName, affKey, job));
+ }
+
+ /**
+ * Affinity call implementation.
+
+ * @param cacheName Cache name.
+ * @param affKey Affinity key.
+ * @param job Job.
+ * @return Internal future.
+ */
+ private <R> IgniteInternalFuture<R> affinityCallAsync0(@Nullable String cacheName, Object affKey,
+ IgniteCallable<R> job) {
A.notNull(affKey, "affKey");
A.notNull(job, "job");
@@ -193,8 +298,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, job,
- prj.nodes()));
+ return ctx.closure().affinityCall(Collections.singletonList(cacheName), partId, job, prj.nodes());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -206,8 +310,30 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R> R affinityCall(@NotNull Collection<String> cacheNames, Object affKey, IgniteCallable<R> job) {
+ try {
+ return saveOrGet(affinityCallAsync0(cacheNames, affKey, job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> affinityCallAsync(@NotNull Collection<String> cacheNames, Object affKey,
+ IgniteCallable<R> job) throws IgniteException {
+ return createFuture(affinityCallAsync0(cacheNames, affKey, job));
+ }
+ /**
+ * Affinity call implementation.
+
+ * @param cacheNames Cache names collection.
+ * @param affKey Affinity key.
+ * @param job Job.
+ * @return Internal future.
+ */
+ private <R> IgniteInternalFuture<R> affinityCallAsync0(@NotNull Collection<String> cacheNames, Object affKey,
+ IgniteCallable<R> job) {
A.notNull(affKey, "affKey");
A.notNull(job, "job");
A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
@@ -225,7 +351,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, job, prj.nodes()));
+ return ctx.closure().affinityCall(cacheNames, partId, job, prj.nodes());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -237,6 +363,30 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R> R affinityCall(@NotNull Collection<String> cacheNames, int partId, IgniteCallable<R> job) {
+ try {
+ return saveOrGet(affinityCallAsync0(cacheNames, partId, job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> affinityCallAsync(@NotNull Collection<String> cacheNames, int partId,
+ IgniteCallable<R> job) throws IgniteException {
+ return createFuture(affinityCallAsync0(cacheNames, partId, job));
+ }
+
+ /**
+ * Affinity call implementation.
+
+ * @param cacheNames Cache names collection.
+ * @param partId Partition ID.
+ * @param job Job.
+ * @return Internal future.
+ */
+ private <R> IgniteInternalFuture<R> affinityCallAsync0(@NotNull Collection<String> cacheNames, int partId,
+ IgniteCallable<R> job) {
A.ensure(partId >= 0, "partId = " + partId);
A.notNull(job, "job");
A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
@@ -244,7 +394,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
guard();
try {
- return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, job, prj.nodes()));
+ return ctx.closure().affinityCall(cacheNames, partId, job, prj.nodes());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -257,6 +407,28 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T, R> R execute(String taskName, @Nullable T arg) {
+ try {
+ return (R)saveOrGet(executeAsync0(taskName, arg));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T, R> ComputeTaskFuture<R> executeAsync(String taskName, @Nullable T arg) throws IgniteException {
+ return (ComputeTaskFuture<R>)createFuture(executeAsync0(taskName, arg));
+ }
+
+ /**
+ * Execute implementation.
+ *
+ * @param taskName Task name.
+ * @param arg Argument.
+ * @return Internal future.
+ */
+ @SuppressWarnings("unchecked")
+ private <T, R> IgniteInternalFuture<R> executeAsync0(String taskName, @Nullable T arg) {
A.notNull(taskName, "taskName");
guard();
@@ -265,10 +437,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
ctx.task().setThreadContextIfNotNull(TC_SUBGRID, prj.nodes());
ctx.task().setThreadContextIfNotNull(TC_SUBJ_ID, subjId);
- return (R)saveOrGet(ctx.task().execute(taskName, arg));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.task().execute(taskName, arg);
}
finally {
unguard();
@@ -277,6 +446,29 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends ComputeTask<T, R>> taskCls, @Nullable T arg) {
+ try {
+ return (R)saveOrGet(executeAsync0(taskCls, arg));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T, R> ComputeTaskFuture<R> executeAsync(Class<? extends ComputeTask<T, R>> taskCls,
+ @Nullable T arg) throws IgniteException {
+ return (ComputeTaskFuture<R>)createFuture(executeAsync0(taskCls, arg));
+ }
+
+ /**
+ * Execute implementation.
+ *
+ * @param taskCls Task class.
+ * @param arg Argument.
+ * @return Internal future.
+ */
+ @SuppressWarnings("unchecked")
+ private <T, R> IgniteInternalFuture<R> executeAsync0(Class<? extends ComputeTask<T, R>> taskCls, @Nullable T arg) {
A.notNull(taskCls, "taskCls");
guard();
@@ -285,10 +477,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
ctx.task().setThreadContextIfNotNull(TC_SUBGRID, prj.nodes());
ctx.task().setThreadContextIfNotNull(TC_SUBJ_ID, subjId);
- return saveOrGet(ctx.task().execute(taskCls, arg));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.task().execute(taskCls, arg);
}
finally {
unguard();
@@ -297,30 +486,28 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <T, R> R execute(ComputeTask<T, R> task, @Nullable T arg) {
- A.notNull(task, "task");
-
- guard();
-
try {
- ctx.task().setThreadContextIfNotNull(TC_SUBGRID, prj.nodes());
- ctx.task().setThreadContextIfNotNull(TC_SUBJ_ID, subjId);
-
- return saveOrGet(ctx.task().execute(task, arg));
+ return (R)saveOrGet(executeAsync0(task, arg));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
}
- finally {
- unguard();
- }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T, R> ComputeTaskFuture<R> executeAsync(ComputeTask<T, R> task, @Nullable T arg)
+ throws IgniteException {
+ return (ComputeTaskFuture<R>)createFuture(executeAsync0(task, arg));
}
/**
+ * Execute implementation.
+ *
* @param task Task.
* @param arg Task argument.
* @return Task future.
*/
- public <T, R> ComputeTaskInternalFuture<R> executeAsync(ComputeTask<T, R> task, @Nullable T arg) {
+ public <T, R> ComputeTaskInternalFuture<R> executeAsync0(ComputeTask<T, R> task, @Nullable T arg) {
A.notNull(task, "task");
guard();
@@ -336,21 +523,34 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
}
}
+ /** {@inheritDoc} */
+ @Override public void broadcast(IgniteRunnable job) {
+ try {
+ saveOrGet(broadcastAsync0(job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> broadcastAsync(IgniteRunnable job) throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(broadcastAsync0(job));
+ }
+
/**
- * @param taskName Task name.
- * @param arg Task argument.
- * @return Task future.
+ * Broadcast implementation.
+ *
+ * @param job Job.
+ * @return Internal future.
*/
- public <T, R> ComputeTaskInternalFuture<R> executeAsync(String taskName, @Nullable T arg) {
- A.notNull(taskName, "taskName");
+ private IgniteInternalFuture<?> broadcastAsync0(IgniteRunnable job) {
+ A.notNull(job, "job");
guard();
try {
- ctx.task().setThreadContextIfNotNull(TC_SUBGRID, prj.nodes());
- ctx.task().setThreadContextIfNotNull(TC_SUBJ_ID, subjId);
-
- return ctx.task().execute(taskName, arg);
+ return ctx.closure().runAsync(BROADCAST, job, prj.nodes());
}
finally {
unguard();
@@ -358,33 +558,33 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
}
/** {@inheritDoc} */
- @Override public void broadcast(IgniteRunnable job) {
- A.notNull(job, "job");
-
- guard();
-
+ @Override public <R> Collection<R> broadcast(IgniteCallable<R> job) {
try {
- saveOrGet(ctx.closure().runAsync(BROADCAST, job, prj.nodes()));
+ return saveOrGet(broadcastAsync0(job));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
}
- finally {
- unguard();
- }
}
/** {@inheritDoc} */
- @Override public <R> Collection<R> broadcast(IgniteCallable<R> job) {
+ @Override public <R> IgniteFuture<Collection<R>> broadcastAsync(IgniteCallable<R> job) throws IgniteException {
+ return createFuture(broadcastAsync0(job));
+ }
+
+ /**
+ * Broadcast implementation.
+ *
+ * @param job Job.
+ * @return Internal future.
+ */
+ private <R> IgniteInternalFuture<Collection<R>> broadcastAsync0(IgniteCallable<R> job) {
A.notNull(job, "job");
guard();
try {
- return saveOrGet(ctx.closure().callAsync(BROADCAST, Collections.singletonList(job), prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().callAsync(BROADCAST, Collections.singletonList(job), prj.nodes());
}
finally {
unguard();
@@ -393,15 +593,34 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R, T> Collection<R> broadcast(IgniteClosure<T, R> job, @Nullable T arg) {
+ try {
+ return saveOrGet(broadcastAsync0(job, arg));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R, T> IgniteFuture<Collection<R>> broadcastAsync(IgniteClosure<T, R> job,
+ @Nullable T arg) throws IgniteException {
+ return createFuture(broadcastAsync0(job, arg));
+ }
+
+ /**
+ * Broadcast implementation.
+ *
+ * @param job Job.
+ * @param arg Argument.
+ * @return Internal future.
+ */
+ private <R, T> IgniteInternalFuture<Collection<R>> broadcastAsync0(IgniteClosure<T, R> job, @Nullable T arg) {
A.notNull(job, "job");
guard();
try {
- return saveOrGet(ctx.closure().broadcast(job, arg, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().broadcast(job, arg, prj.nodes());
}
finally {
unguard();
@@ -410,15 +629,32 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public void run(IgniteRunnable job) {
+ try {
+ saveOrGet(runAsync0(job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> runAsync(IgniteRunnable job) throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(runAsync0(job));
+ }
+
+ /**
+ * Run implementation.
+ *
+ * @param job Job.
+ * @return Internal future.
+ */
+ private IgniteInternalFuture<?> runAsync0(IgniteRunnable job) {
A.notNull(job, "job");
guard();
try {
- saveOrGet(ctx.closure().runAsync(BALANCE, job, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().runAsync(BALANCE, job, prj.nodes());
}
finally {
unguard();
@@ -427,15 +663,33 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public void run(Collection<? extends IgniteRunnable> jobs) {
+ try {
+ saveOrGet(runAsync0(jobs));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> runAsync(Collection<? extends IgniteRunnable> jobs)
+ throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(runAsync0(jobs));
+ }
+
+ /**
+ * Run implementation.
+ *
+ * @param jobs Jobs.
+ * @return Internal future.
+ */
+ private IgniteInternalFuture<?> runAsync0(Collection<? extends IgniteRunnable> jobs) {
A.notEmpty(jobs, "jobs");
guard();
try {
- saveOrGet(ctx.closure().runAsync(BALANCE, jobs, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().runAsync(BALANCE, jobs, prj.nodes());
}
finally {
unguard();
@@ -444,15 +698,34 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R, T> R apply(IgniteClosure<T, R> job, @Nullable T arg) {
+ try {
+ return saveOrGet(applyAsync0(job, arg));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R, T> IgniteFuture<R> applyAsync(IgniteClosure<T, R> job, @Nullable T arg)
+ throws IgniteException {
+ return (IgniteFuture<R>)createFuture(applyAsync0(job, arg));
+ }
+
+ /**
+ * Apply implementation.
+ *
+ * @param job Job.
+ * @param arg Argument.
+ * @return Internal future.
+ */
+ private <R, T> IgniteInternalFuture<R> applyAsync0(IgniteClosure<T, R> job, @Nullable T arg) {
A.notNull(job, "job");
guard();
try {
- return saveOrGet(ctx.closure().callAsync(job, arg, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().callAsync(job, arg, prj.nodes());
}
finally {
unguard();
@@ -461,15 +734,32 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R> R call(IgniteCallable<R> job) {
+ try {
+ return saveOrGet(callAsync0(job));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> callAsync(IgniteCallable<R> job) throws IgniteException {
+ return (IgniteFuture<R>)createFuture(callAsync0(job));
+ }
+
+ /**
+ * Call implementation.
+ *
+ * @param job Job.
+ * @return Internal future.
+ */
+ private <R> IgniteInternalFuture<R> callAsync0(IgniteCallable<R> job) {
A.notNull(job, "job");
guard();
try {
- return saveOrGet(ctx.closure().callAsync(BALANCE, job, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().callAsync(BALANCE, job, prj.nodes());
}
finally {
unguard();
@@ -478,15 +768,33 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R> Collection<R> call(Collection<? extends IgniteCallable<R>> jobs) {
+ try {
+ return saveOrGet(callAsync0(jobs));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<Collection<R>> callAsync(
+ Collection<? extends IgniteCallable<R>> jobs) throws IgniteException {
+ return (IgniteFuture<Collection<R>>)createFuture(callAsync0(jobs));
+ }
+
+ /**
+ * Call implementation.
+ *
+ * @param jobs Jobs.
+ * @return Internal future.
+ */
+ private <R> IgniteInternalFuture<Collection<R>> callAsync0(Collection<? extends IgniteCallable<R>> jobs) {
A.notEmpty(jobs, "jobs");
guard();
try {
- return saveOrGet(ctx.closure().callAsync(BALANCE, (Collection<? extends Callable<R>>)jobs, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().callAsync(BALANCE, (Collection<? extends Callable<R>>)jobs, prj.nodes());
}
finally {
unguard();
@@ -495,16 +803,36 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <T, R> Collection<R> apply(final IgniteClosure<T, R> job, @Nullable Collection<? extends T> args) {
+ try {
+ return saveOrGet(applyAsync0(job, args));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<Collection<R>> applyAsync(IgniteClosure<T, R> job,
+ Collection<? extends T> args) throws IgniteException {
+ return (IgniteFuture<Collection<R>>)createFuture(applyAsync0(job, args));
+ }
+
+ /**
+ * Apply implementation.
+ *
+ * @param job Job.
+ * @param args Arguments/
+ * @return Internal future.
+ */
+ private <T, R> IgniteInternalFuture<Collection<R>> applyAsync0(final IgniteClosure<T, R> job,
+ @Nullable Collection<? extends T> args) {
A.notNull(job, "job");
A.notNull(args, "args");
guard();
try {
- return saveOrGet(ctx.closure().callAsync(job, args, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().callAsync(job, args, prj.nodes());
}
finally {
unguard();
@@ -513,16 +841,36 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R1, R2> R2 call(Collection<? extends IgniteCallable<R1>> jobs, IgniteReducer<R1, R2> rdc) {
+ try {
+ return saveOrGet(callAsync0(jobs, rdc));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R1, R2> IgniteFuture<R2> callAsync(Collection<? extends IgniteCallable<R1>> jobs,
+ IgniteReducer<R1, R2> rdc) throws IgniteException {
+ return (IgniteFuture<R2>)createFuture(callAsync0(jobs, rdc));
+ }
+
+ /**
+ * Call with reducer implementation.
+ *
+ * @param jobs Jobs.
+ * @param rdc Reducer.
+ * @return Internal future.
+ */
+ private <R1, R2> IgniteInternalFuture<R2> callAsync0(Collection<? extends IgniteCallable<R1>> jobs,
+ IgniteReducer<R1, R2> rdc) {
A.notEmpty(jobs, "jobs");
A.notNull(rdc, "rdc");
guard();
try {
- return saveOrGet(ctx.closure().forkjoinAsync(BALANCE, jobs, rdc, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().forkjoinAsync(BALANCE, jobs, rdc, prj.nodes());
}
finally {
unguard();
@@ -532,6 +880,30 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
/** {@inheritDoc} */
@Override public <R1, R2, T> R2 apply(IgniteClosure<T, R1> job, Collection<? extends T> args,
IgniteReducer<R1, R2> rdc) {
+ try {
+ return saveOrGet(applyAsync0(job, args, rdc));
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R1, R2, T> IgniteFuture<R2> applyAsync(IgniteClosure<T, R1> job,
+ Collection<? extends T> args, IgniteReducer<R1, R2> rdc) throws IgniteException {
+ return createFuture(applyAsync0(job, args, rdc));
+ }
+
+ /**
+ * Apply with reducer implementation.
+ *
+ * @param job Job
+ * @param args Arguments.
+ * @param rdc Reducer.
+ * @return Internal future.
+ */
+ private <R1, R2, T> IgniteInternalFuture<R2> applyAsync0(IgniteClosure<T, R1> job, Collection<? extends T> args,
+ IgniteReducer<R1, R2> rdc) {
A.notNull(job, "job");
A.notNull(rdc, "rdc");
A.notNull(args, "args");
@@ -539,10 +911,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
guard();
try {
- return saveOrGet(ctx.closure().callAsync(job, args, rdc, prj.nodes()));
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ return ctx.closure().callAsync(job, args, rdc, prj.nodes());
}
finally {
unguard();
@@ -646,7 +1015,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
guard();
try {
- ctx.deploy().undeployTask(taskName, prj.node(ctx.localNodeId()) != null, prj.forRemotes().nodes());
+ ctx.deploy().undeployTask(taskName, prj.node(ctx.localNodeId()) != null,
+ prj.forRemotes().nodes());
}
finally {
unguard();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
index 3c6218d..9acccab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
@@ -27,13 +27,16 @@ import java.util.List;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteEvents;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
@@ -93,12 +96,34 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<List<T>> remoteQueryAsync(IgnitePredicate<T> p, long timeout,
+ @Nullable int... types) throws IgniteException {
+
+ guard();
+
+ try {
+ return new IgniteFutureImpl<>(ctx.event().remoteEventsAsync(compoundPredicate(p, types),
+ prj.nodes(), timeout));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> UUID remoteListen(@Nullable IgniteBiPredicate<UUID, T> locLsnr,
@Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types) {
return remoteListen(1, 0, true, locLsnr, rmtFilter, types);
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<UUID> remoteListenAsync(
+ @Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types) throws IgniteException {
+ return remoteListenAsync(1, 0, true, locLsnr, rmtFilter, types);
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> UUID remoteListen(int bufSize, long interval,
boolean autoUnsubscribe, @Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
@Nullable int... types) {
@@ -128,6 +153,32 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<UUID> remoteListenAsync(int bufSize, long interval,
+ boolean autoUnsubscribe, @Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types) throws IgniteException {
+ A.ensure(bufSize > 0, "bufSize > 0");
+ A.ensure(interval >= 0, "interval >= 0");
+
+ guard();
+
+ try {
+ GridEventConsumeHandler hnd = new GridEventConsumeHandler((IgniteBiPredicate<UUID, Event>)locLsnr,
+ (IgnitePredicate<Event>)rmtFilter, types);
+
+ return new IgniteFutureImpl<>(ctx.continuous().startRoutine(
+ hnd,
+ false,
+ bufSize,
+ interval,
+ autoUnsubscribe,
+ prj.predicate()));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void stopRemoteListen(UUID opId) {
A.notNull(opId, "consumeId");
@@ -145,6 +196,21 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException {
+ A.notNull(opId, "consumeId");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.continuous().stopRoutine(opId));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> T waitForLocal(@Nullable IgnitePredicate<T> filter,
@Nullable int... types) {
guard();
@@ -161,6 +227,19 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
}
/** {@inheritDoc} */
+ @Override public <T extends Event> IgniteFuture<T> waitForLocalAsync(@Nullable IgnitePredicate<T> filter,
+ @Nullable int... types) throws IgniteException {
+ guard();
+
+ try {
+ return new IgniteFutureImpl<>(ctx.event().waitForEvent(filter, types));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <T extends Event> Collection<T> localQuery(IgnitePredicate<T> p, @Nullable int... types) {
A.notNull(p, "p");
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
index 541fad4..4c23dd5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
@@ -25,15 +25,18 @@ import java.io.ObjectStreamException;
import java.util.Collection;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteMessaging;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteFuture;
import org.jetbrains.annotations.Nullable;
/**
@@ -76,6 +79,17 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
/** {@inheritDoc} */
@Override public void send(@Nullable Object topic, Object msg) {
+ send0(topic, msg, isAsync());
+ }
+
+ /**
+ * Implementation of send.
+ * @param topic Topic.
+ * @param msg Message.
+ * @param async Async flag.
+ * @throws IgniteException On error.
+ */
+ private void send0(@Nullable Object topic, Object msg, boolean async) throws IgniteException {
A.notNull(msg, "msg");
guard();
@@ -86,7 +100,7 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
if (snapshot.isEmpty())
throw U.emptyTopologyException();
- ctx.io().sendUserMessage(snapshot, msg, topic, false, 0, isAsync());
+ ctx.io().sendUserMessage(snapshot, msg, topic, false, 0, async);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -98,6 +112,17 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
/** {@inheritDoc} */
@Override public void send(@Nullable Object topic, Collection<?> msgs) {
+ send0(topic, msgs, isAsync());
+ }
+
+ /**
+ * Implementation of send.
+ * @param topic Topic.
+ * @param msgs Messages.
+ * @param async Async flag.
+ * @throws IgniteException On error.
+ */
+ private void send0(@Nullable Object topic, Collection<?> msgs, boolean async) throws IgniteException {
A.ensure(!F.isEmpty(msgs), "msgs cannot be null or empty");
guard();
@@ -111,7 +136,7 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
for (Object msg : msgs) {
A.notNull(msg, "msg");
- ctx.io().sendUserMessage(snapshot, msg, topic, false, 0, isAsync());
+ ctx.io().sendUserMessage(snapshot, msg, topic, false, 0, async);
}
}
catch (IgniteCheckedException e) {
@@ -200,6 +225,28 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<UUID> remoteListenAsync(@Nullable Object topic,
+ IgniteBiPredicate<UUID, ?> p) throws IgniteException {
+ A.notNull(p, "p");
+
+ guard();
+
+ try {
+ GridContinuousHandler hnd = new GridMessageListenHandler(topic, (IgniteBiPredicate<UUID, Object>)p);
+
+ return new IgniteFutureImpl<>(ctx.continuous().startRoutine(hnd,
+ false,
+ 1,
+ 0,
+ false,
+ prj.predicate()));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void stopRemoteListen(UUID opId) {
A.notNull(opId, "opId");
@@ -216,6 +263,20 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
}
}
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException {
+ A.notNull(opId, "opId");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.continuous().stopRoutine(opId));
+ }
+ finally {
+ unguard();
+ }
+ }
+
/**
* <tt>ctx.gateway().readLock()</tt>
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
index df6e5df..607dccc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
@@ -28,8 +28,10 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceConfiguration;
import org.apache.ignite.services.ServiceDescriptor;
@@ -38,6 +40,7 @@ import org.jetbrains.annotations.Nullable;
/**
* {@link org.apache.ignite.IgniteServices} implementation.
*/
+@SuppressWarnings("unchecked")
public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteServices, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -91,6 +94,21 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> deployNodeSingletonAsync(String name, Service svc) throws IgniteException {
+ A.notNull(name, "name");
+ A.notNull(svc, "svc");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().deployNodeSingleton(prj, name, svc));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void deployClusterSingleton(String name, Service svc) {
A.notNull(name, "name");
A.notNull(svc, "svc");
@@ -109,6 +127,21 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> deployClusterSingletonAsync(String name, Service svc) throws IgniteException {
+ A.notNull(name, "name");
+ A.notNull(svc, "svc");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().deployClusterSingleton(prj, name, svc));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void deployMultiple(String name, Service svc, int totalCnt, int maxPerNodeCnt) {
A.notNull(name, "name");
A.notNull(svc, "svc");
@@ -127,6 +160,23 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> deployMultipleAsync(String name, Service svc, int totalCnt,
+ int maxPerNodeCnt) throws IgniteException {
+ A.notNull(name, "name");
+ A.notNull(svc, "svc");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().deployMultiple(prj, name, svc,
+ totalCnt, maxPerNodeCnt));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void deployKeyAffinitySingleton(String name, Service svc, @Nullable String cacheName,
Object affKey) {
A.notNull(name, "name");
@@ -147,6 +197,24 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> deployKeyAffinitySingletonAsync(String name, Service svc,
+ @Nullable String cacheName, Object affKey) throws IgniteException {
+ A.notNull(name, "name");
+ A.notNull(svc, "svc");
+ A.notNull(affKey, "affKey");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().deployKeyAffinitySingleton(name, svc,
+ cacheName, affKey));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void deploy(ServiceConfiguration cfg) {
A.notNull(cfg, "cfg");
@@ -164,6 +232,20 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> deployAsync(ServiceConfiguration cfg) throws IgniteException {
+ A.notNull(cfg, "cfg");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().deploy(cfg));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void cancel(String name) {
A.notNull(name, "name");
@@ -181,6 +263,20 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> cancelAsync(String name) throws IgniteException {
+ A.notNull(name, "name");
+
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().cancel(name));
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void cancelAll() {
guard();
@@ -196,6 +292,18 @@ public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteSer
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> cancelAllAsync() throws IgniteException {
+ guard();
+
+ try {
+ return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().cancelAll());
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<ServiceDescriptor> serviceDescriptors() {
guard();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index 5d5c06f..75c9a71 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -212,7 +212,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
if (compute == null) {
assert ctx != null;
- compute = new IgniteComputeImpl(ctx, this, subjId, false);
+ compute = new IgniteComputeImpl(ctx, this, subjId);
}
return compute;
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index fb9b190..d392813 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -22,7 +22,6 @@ import java.io.File;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import java.io.ObjectStreamException;
import java.util.Collection;
import java.util.Map;
import java.util.UUID;
@@ -30,6 +29,7 @@ import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
@@ -115,7 +115,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
int maxConn)
{
try {
- return saveOrGet(cluster.startNodesAsync(file, restart, timeout, maxConn));
+ return saveOrGet(cluster.startNodesAsync0(file, restart, timeout, maxConn));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -123,6 +123,12 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file, boolean restart,
+ int timeout, int maxConn) throws IgniteException {
+ return cluster.startNodesAsync(file, restart, timeout, maxConn);
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<ClusterStartNodeResult> startNodes(
Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
@@ -131,7 +137,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
int maxConn)
{
try {
- return saveOrGet(cluster.startNodesAsync(hosts, dflts, restart, timeout, maxConn));
+ return saveOrGet(cluster.startNodesAsync0(hosts, dflts, restart, timeout, maxConn));
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -139,6 +145,13 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(
+ Collection<Map<String, Object>> hosts, @Nullable Map<String, Object> dflts,
+ boolean restart, int timeout, int maxConn) throws IgniteException {
+ return cluster.startNodesAsync(hosts, dflts, restart, timeout, maxConn);
+ }
+
+ /** {@inheritDoc} */
@Override public void stopNodes() {
cluster.stopNodes();
}
@@ -312,13 +325,4 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(cluster);
}
-
- /**
- * @return Cluster async instance.
- *
- * @throws ObjectStreamException If failed.
- */
- protected Object readResolve() throws ObjectStreamException {
- return cluster.withAsync();
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
index 58a2128..e429547 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.nodestart.IgniteRemoteStartSpecification;
import org.apache.ignite.internal.util.nodestart.IgniteSshHelper;
import org.apache.ignite.internal.util.nodestart.StartNodeCallable;
@@ -222,7 +223,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
throws IgniteException
{
try {
- return startNodesAsync(file, restart, timeout, maxConn).get();
+ return startNodesAsync0(file, restart, timeout, maxConn).get();
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -230,6 +231,12 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file, boolean restart,
+ int timeout, int maxConn) throws IgniteException {
+ return new IgniteFutureImpl<>(startNodesAsync0(file, restart, timeout, maxConn));
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<ClusterStartNodeResult> startNodes(Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
boolean restart,
@@ -238,7 +245,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
throws IgniteException
{
try {
- return startNodesAsync(hosts, dflts, restart, timeout, maxConn).get();
+ return startNodesAsync0(hosts, dflts, restart, timeout, maxConn).get();
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -246,6 +253,13 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(
+ Collection<Map<String, Object>> hosts, @Nullable Map<String, Object> dflts,
+ boolean restart, int timeout, int maxConn) throws IgniteException {
+ return new IgniteFutureImpl<>(startNodesAsync0(hosts, dflts, restart, timeout, maxConn));
+ }
+
+ /** {@inheritDoc} */
@Override public void stopNodes() throws IgniteException {
guard();
@@ -330,7 +344,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
* @return Future with results.
* @see IgniteCluster#startNodes(java.io.File, boolean, int, int)
*/
- IgniteInternalFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file,
+ IgniteInternalFuture<Collection<ClusterStartNodeResult>> startNodesAsync0(File file,
boolean restart,
int timeout,
int maxConn)
@@ -342,7 +356,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
try {
IgniteBiTuple<Collection<Map<String, Object>>, Map<String, Object>> t = parseFile(file);
- return startNodesAsync(t.get1(), t.get2(), restart, timeout, maxConn);
+ return startNodesAsync0(t.get1(), t.get2(), restart, timeout, maxConn);
}
catch (IgniteCheckedException e) {
return new GridFinishedFuture<>(e);
@@ -358,7 +372,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
* @return Future with results.
* @see IgniteCluster#startNodes(java.util.Collection, java.util.Map, boolean, int, int)
*/
- IgniteInternalFuture<Collection<ClusterStartNodeResult>> startNodesAsync(
+ IgniteInternalFuture<Collection<ClusterStartNodeResult>> startNodesAsync0(
Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
boolean restart,
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
index 2220bfe..5ee28f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
@@ -623,11 +623,7 @@ public class JdbcConnection implements Connection {
throw new SQLException("Failed to establish connection with node (is it a server node?): " +
nodeId);
- IgniteCompute compute = ignite.compute(grp).withAsync();
-
- compute.call(task);
-
- return compute.<Boolean>future().get(timeout, SECONDS);
+ return ignite.compute(grp).callAsync(task).get(timeout, SECONDS);
}
else
return task.call();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 0e8c263..28cf0db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -93,6 +93,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Cache proxy.
*/
+@SuppressWarnings("unchecked")
public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V>>
implements IgniteCache<K, V>, Externalizable {
/** */
@@ -378,10 +379,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
try {
if (isAsync()) {
- if (ctx.cache().isLocal())
- setFuture(ctx.cache().localLoadCacheAsync(p, args));
- else
- setFuture(ctx.cache().globalLoadCacheAsync(p, args));
+ setFuture(ctx.cache().isLocal() ?
+ ctx.cache().localLoadCacheAsync(p, args)
+ : ctx.cache().globalLoadCacheAsync(p, args));
}
else {
if (ctx.cache().isLocal())
@@ -400,6 +400,27 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> loadCacheAsync(@Nullable IgniteBiPredicate<K, V> p,
+ @Nullable Object... args) throws CacheException {
+ try {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(ctx.cache().isLocal() ?
+ ctx.cache().localLoadCacheAsync(p, args) : ctx.cache().globalLoadCacheAsync(p, args));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+ catch (IgniteCheckedException e) {
+ throw cacheException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void localLoadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -422,6 +443,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> localLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p,
+ @Nullable Object... args) throws CacheException {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.localLoadCacheAsync(p, args));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public V getAndPutIfAbsent(K key, V val) throws CacheException {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -447,6 +483,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws CacheException {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAndPutIfAbsentAsync(key, val));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public Lock lock(K key) throws CacheException {
return lockAll(Collections.singleton(key));
}
@@ -475,6 +525,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
* @param transformer Transformer
* @param grp Optional cluster group.
* @return Cursor.
+ * @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
private <T, R> QueryCursor<R> query(
@@ -535,6 +586,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
* @param filter Filter.
* @param grp Optional cluster group.
* @return Cursor.
+ * @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
private QueryCursor<Cache.Entry<K, V>> query(final Query filter, @Nullable ClusterGroup grp)
@@ -643,6 +695,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
*
* @param qry Query.
* @param loc Local flag.
+ * @param keepBinary Keep binary flag.
* @return Initial iteration cursor.
*/
@SuppressWarnings("unchecked")
@@ -1004,6 +1057,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Integer> sizeAsync(CachePeekMode... peekModes) throws CacheException {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.sizeAsync(peekModes));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public long sizeLong(CachePeekMode... peekModes) throws CacheException {
GridCacheGateway<K, V> gate = this.gate;
@@ -1027,6 +1094,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Long> sizeLongAsync(CachePeekMode... peekModes) throws CacheException {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.sizeLongAsync(peekModes));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public long sizeLong(int part, CachePeekMode... peekModes) throws CacheException {
GridCacheGateway<K, V> gate = this.gate;
@@ -1050,6 +1131,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Long> sizeLongAsync(int part, CachePeekMode... peekModes) throws CacheException {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.sizeLongAsync(part, peekModes));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public int localSize(CachePeekMode... peekModes) {
GridCacheGateway<K, V> gate = this.gate;
@@ -1126,6 +1221,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAsync(K key) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAsync(key));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public CacheEntry<K, V> getEntry(K key) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1151,6 +1260,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<CacheEntry<K, V>> getEntryAsync(K key) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getEntryAsync(key));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public Map<K, V> getAll(Set<? extends K> keys) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1176,6 +1299,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Map<K, V>> getAllAsync(Set<? extends K> keys) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAllAsync(keys));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<CacheEntry<K, V>> getEntries(Set<? extends K> keys) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1201,6 +1338,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Collection<CacheEntry<K, V>>> getEntriesAsync(Set<? extends K> keys) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getEntriesAsync(keys));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public Map<K, V> getAllOutTx(Set<? extends K> keys) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1225,6 +1376,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<Map<K, V>> getAllOutTxAsync(Set<? extends K> keys) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAllOutTxAsync(keys));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
/**
* @param keys Keys.
* @return Values map.
@@ -1293,6 +1458,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> containsKeyAsync(K key) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.containsKeyAsync(key));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public boolean containsKeys(Set<? extends K> keys) {
GridCacheGateway<K, V> gate = this.gate;
@@ -1313,6 +1492,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.containsKeysAsync(keys));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void loadAll(
Set<? extends K> keys,
boolean replaceExisting,
@@ -1353,24 +1546,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
CacheOperationContext prev = onEnter(gate, opCtx);
try {
- if (isAsync()) {
- IgniteInternalFuture<Boolean> fut = delegate.putAsync(key, val);
-
- IgniteInternalFuture<Void> fut0 = fut.chain(new CX1<IgniteInternalFuture<Boolean>, Void>() {
- @Override public Void applyx(IgniteInternalFuture<Boolean> fut) throws IgniteCheckedException {
- try {
- fut.get();
- }
- catch (RuntimeException e) {
- throw new GridClosureException(e);
- }
-
- return null;
- }
- });
-
- setFuture(fut0);
- }
+ if (isAsync())
+ setFuture(putAsync0(key, val));
else
delegate.put(key, val);
}
@@ -1384,6 +1561,44 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> putAsync(K key, V val) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(putAsync0(key, val));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /**
+ * Put async internal operation implementation.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @return Internal future.
+ */
+ private IgniteInternalFuture<Void> putAsync0(K key, V val) {
+ IgniteInternalFuture<Boolean> fut = delegate.putAsync(key, val);
+
+ return fut.chain(new CX1<IgniteInternalFuture<Boolean>, Void>() {
+ @Override public Void applyx(IgniteInternalFuture<Boolean> fut1) throws IgniteCheckedException {
+ try {
+ fut1.get();
+ }
+ catch (RuntimeException e) {
+ throw new GridClosureException(e);
+ }
+
+ return null;
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndPut(K key, V val) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1409,6 +1624,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndPutAsync(K key, V val) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAndPutAsync(key, val));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void putAll(Map<? extends K, ? extends V> map) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1431,6 +1660,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> putAllAsync(Map<? extends K, ? extends V> map) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.putAllAsync(map));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1456,6 +1699,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> putIfAbsentAsync(K key, V val) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.putIfAbsentAsync(key, val));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public boolean remove(K key) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1481,6 +1738,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> removeAsync(K key) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.removeAsync(key));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public boolean remove(K key, V oldVal) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1506,6 +1777,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> removeAsync(K key, V oldVal) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.removeAsync(key, oldVal));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndRemove(K key) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1531,6 +1816,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndRemoveAsync(K key) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAndRemoveAsync(key));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public boolean replace(K key, V oldVal, V newVal) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1556,6 +1855,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.replaceAsync(key, oldVal, newVal));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public boolean replace(K key, V val) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1581,6 +1894,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Boolean> replaceAsync(K key, V val) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.replaceAsync(key, val));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public V getAndReplace(K key, V val) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1606,6 +1933,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<V> getAndReplaceAsync(K key, V val) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.getAndReplaceAsync(key, val));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void removeAll(Set<? extends K> keys) {
try {
GridCacheGateway<K, V> gate = this.gate;
@@ -1628,6 +1969,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> removeAllAsync(Set<? extends K> keys) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.removeAllAsync(keys));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void removeAll() {
GridCacheGateway<K, V> gate = this.gate;
@@ -1648,6 +2003,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> removeAllAsync() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.removeAllAsync());
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void clear(K key) {
GridCacheGateway<K, V> gate = this.gate;
@@ -1668,6 +2037,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> clearAsync(K key) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.clearAsync(key));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void clearAll(Set<? extends K> keys) {
GridCacheGateway<K, V> gate = this.gate;
@@ -1688,6 +2071,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> clearAllAsync(Set<? extends K> keys) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.clearAllAsync(keys));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void clear() {
GridCacheGateway<K, V> gate = this.gate;
@@ -1708,6 +2105,20 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> clearAsync() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return (IgniteFuture<Void>)createFuture(delegate.clearAsync());
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void localClear(K key) {
GridCacheGateway<K, V> gate = this.gate;
@@ -1746,23 +2157,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
try {
if (isAsync()) {
- IgniteInternalFuture<EntryProcessorResult<T>> fut = delegate.invokeAsync(key, entryProcessor, args);
-
- IgniteInternalFuture<T> fut0 = fut.chain(new CX1<IgniteInternalFuture<EntryProcessorResult<T>>, T>() {
- @Override public T applyx(IgniteInternalFuture<EntryProcessorResult<T>> fut)
- throws IgniteCheckedException {
- try {
- EntryProcessorResult<T> res = fut.get();
-
- return res != null ? res.get() : null;
- }
- catch (RuntimeException e) {
- throw new GridClosureException(e);
- }
- }
- });
-
- setFuture(fut0);
+ setFuture(invokeAsync0(key, entryProcessor, args));
return null;
}
@@ -1782,11 +2177,59 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<T> invokeAsync(K key, EntryProcessor<K, V, T> entryProcessor,
+ Object... args) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(invokeAsync0(key, entryProcessor, args));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /**
+ * Invoke async operation internal implementation.
+ *
+ * @param key Key.
+ * @param entryProcessor Processor.
+ * @param args Arguments.
+ * @return Internal future.
+ */
+ private <T> IgniteInternalFuture<T> invokeAsync0(K key, EntryProcessor<K, V, T> entryProcessor, Object[] args) {
+ IgniteInternalFuture<EntryProcessorResult<T>> fut = delegate.invokeAsync(key, entryProcessor, args);
+
+ return fut.chain(new CX1<IgniteInternalFuture<EntryProcessorResult<T>>, T>() {
+ @Override public T applyx(IgniteInternalFuture<EntryProcessorResult<T>> fut1)
+ throws IgniteCheckedException {
+ try {
+ EntryProcessorResult<T> res = fut1.get();
+
+ return res != null ? res.get() : null;
+ }
+ catch (RuntimeException e) {
+ throw new GridClosureException(e);
+ }
+ }
+ });
+ }
+
+
+ /** {@inheritDoc} */
@Override public <T> T invoke(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... args)
throws EntryProcessorException {
return invoke(key, (EntryProcessor<K, V, T>)entryProcessor, args);
}
+ /** {@inheritDoc} */
+ @Override public <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K, V, T> entryProcessor,
+ Object... args) {
+ return invokeAsync(key, (EntryProcessor<K, V, T>)entryProcessor, args);
+ }
+
/**
* @param topVer Locked topology version.
* @param key Key.
@@ -1849,6 +2292,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
+ EntryProcessor<K, V, T> entryProcessor, Object... args) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.invokeAllAsync(keys, entryProcessor, args));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
CacheEntryProcessor<K, V, T> entryProcessor,
Object... args) {
@@ -1876,6 +2334,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
+ CacheEntryProcessor<K, V, T> entryProcessor, Object... args) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.invokeAllAsync(keys, entryProcessor, args));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(
Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
Object... args) {
@@ -1903,6 +2376,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
+ Map<? extends K, ? extends EntryProcessor<K, V, T>> map, Object... args) {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return createFuture(delegate.invokeAllAsync(map, args));
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public String getName() {
return delegate.name();
}
@@ -2109,6 +2597,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/**
+ * @param dataCenterId Data center ID.
* @return Projection for data center id.
*/
@SuppressWarnings("unchecked")
@@ -2186,7 +2675,12 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
* @param fut Future for async operation.
*/
private <R> void setFuture(IgniteInternalFuture<R> fut) {
- curFut.set(new IgniteCacheFutureImpl<>(fut));
+ curFut.set(createFuture(fut));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <R> IgniteFuture<R> createFuture(IgniteInternalFuture<R> fut) {
+ return new IgniteCacheFutureImpl<>(fut);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index 7a69a6f..ca4edb6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -1394,6 +1394,11 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> commitAsync() throws IgniteException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
@Override public void close() throws IgniteException {
throw new UnsupportedOperationException();
}
@@ -1404,6 +1409,11 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> rollbackAsync() throws IgniteException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
@Override public IgniteAsyncSupport withAsync() {
throw new UnsupportedOperationException();
}
[11/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now
all async methods are defined explicitly,
IgniteAsyncSupport is deprecated. This closes #1648.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/IgniteComputeConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/IgniteComputeConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/IgniteComputeConfigVariationsFullApiTest.java
index 485e811..231fc9e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/IgniteComputeConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/IgniteComputeConfigVariationsFullApiTest.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
@@ -43,6 +44,7 @@ import org.apache.ignite.compute.ComputeTaskSplitAdapter;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteReducer;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.testframework.junits.IgniteConfigVariationsAbstractTest;
@@ -199,6 +201,30 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testExecuteTaskClassAsync() throws Exception {
+ runTest(jobFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ // Begin with negative to check 'null' value in the test.
+ final int[] i = {-1};
+
+ ComputeTaskFuture<List<Object>> fut = ignite.compute().executeAsync(
+ TestTask.class,
+ new T2<>((Factory<ComputeJobAdapter>)factory,
+ (Factory<Object>)new Factory<Object>() {
+ @Override public Object create() {
+ return value(i[0]++);
+ }
+ }));
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, fut.get(), value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), fut.get());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testExecuteTask() throws Exception {
runTest(jobFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -222,6 +248,29 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testExecuteTaskAsync() throws Exception {
+ runTest(jobFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ // Begin with negative to check 'null' value in the test.
+ final int[] i = {-1};
+
+ ComputeTaskFuture<List<Object>> fut = ignite.compute().executeAsync(new TestTask(),
+ new T2<>((Factory<ComputeJobAdapter>)factory,
+ (Factory<Object>)new Factory<Object>() {
+ @Override public Object create() {
+ return value(i[0]++);
+ }
+ }));
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, fut.get(), value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), fut.get());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testBroadcastClosure() throws Exception {
runTest(closureFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -245,6 +294,29 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testBroadcastClosureAsync() throws Exception {
+ runTest(closureFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ final Collection<Object> resultsAllNull = ignite.compute()
+ .broadcast((IgniteClosure<Object, Object>)factory.create(), null);
+
+ assertEquals("Result's size mismatch: job must be run on all server nodes",
+ gridCount() - clientsCount(), resultsAllNull.size());
+
+ for (Object o : resultsAllNull)
+ assertNull("All results must be null", o);
+
+ IgniteFuture<Collection<Object>> fut = ignite.compute()
+ .broadcastAsync((IgniteClosure<Object, Object>)factory.create(), value(0));
+
+ checkResultsClassCount(gridCount() - clientsCount(), fut.get(), value(0).getClass());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testBroadcastCallable() throws Exception {
runTest(callableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -274,6 +346,35 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testBroadcastCallableAsync() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ EchoCallable job = (EchoCallable)factory.create();
+ job.setArg(null);
+
+ final IgniteFuture<Collection<Object>> futAllNull = ignite.compute()
+ .broadcastAsync(job);
+
+ assertEquals("Result's size mismatch: job must be run on all server nodes",
+ gridCount() - clientsCount(), futAllNull.get().size());
+
+ for (Object o : futAllNull.get())
+ assertNull("All results must be null", o);
+
+ job.setArg(value(0));
+ IgniteFuture<Collection<Object>> futNotNull = ignite.compute()
+ .broadcastAsync(job);
+
+ checkResultsClassCount(gridCount() - clientsCount(), futNotNull.get(), value(0).getClass());
+ for (Object o : futNotNull.get())
+ assertEquals("Invalid broadcast results", value(0), o);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testBroadcastRunnable() throws Exception {
runTest(runnableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -288,6 +389,22 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testBroadcastRunnableAsync() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ IgniteFuture<Void> fut = ignite.compute().broadcastAsync(job);
+
+ fut.get();
+ // All checks are inside the run() method of the job.
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testRun() throws Exception {
runTest(runnableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -310,24 +427,48 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testRunAsync() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ IgniteFuture<Void> fut0 = ignite.compute().runAsync(job);
+
+ fut0.get();
+ // All checks are inside the run() method of the job.
+
+ Collection<IgniteRunnable> jobs = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i)
+ jobs.add((IgniteRunnable)factory.create());
+
+ IgniteFuture<Void> fut1 = ignite.compute().runAsync(jobs);
+
+ fut1.get();
+ // All checks are inside the run() method of the job.
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testApplyAsync() throws Exception {
runTest(closureFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
- final IgniteCompute comp = ignite.compute().withAsync();
+ final IgniteCompute comp = ignite.compute();
- Collection<ComputeTaskFuture<Object>> futures = new ArrayList<>(MAX_JOB_COUNT);
+ Collection<IgniteFuture<Object>> futures = new ArrayList<>(MAX_JOB_COUNT);
for (int i = 0; i < MAX_JOB_COUNT; ++i) {
// value(i - 1): use negative argument of the value method to generate nullong value.
- comp.apply((IgniteClosure<Object, Object>)factory.create(), value(i - 1));
-
- futures.add(comp.future());
+ futures.add(comp.applyAsync((IgniteClosure<Object, Object>)factory.create(), value(i - 1)));
}
// Wait for results.
Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
- for (ComputeTaskFuture<Object> future : futures)
+ for (IgniteFuture<Object> future : futures)
results.add(future.get());
checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
@@ -339,7 +480,7 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
- public void testApplySync() throws Exception {
+ public void testApply() throws Exception {
runTest(closureFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
@@ -383,6 +524,32 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testApplyForCollectionAsync() throws Exception {
+ runTest(closureFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ Collection params = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ // value(i - 1): use negative argument of the value method to generate nullong value.
+ params.add(value(i - 1));
+ }
+
+ IgniteClosure c = (IgniteClosure)factory.create();
+
+ // Use type casting to avoid ambiguous for apply(Callable, Object) vs apply(Callable, Collection<Object>).
+ IgniteFuture<Collection<Object>> fut = ignite.compute().applyAsync(
+ (IgniteClosure<TestObject, Object>)c,
+ (Collection<TestObject>)params);
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, fut.get(), value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), fut.get());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testApplyForCollectionWithReducer() throws Exception {
runTest(closureFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -409,6 +576,7 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
return true;
}
});
+
assertTrue(res);
}
});
@@ -417,24 +585,58 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testApplyForCollectionWithReducerAsync() throws Exception {
+ runTest(closureFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ Collection<Object> params = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ // value(i - 1): use negative argument of the value method to generate nullong value.
+ params.add(value(i - 1));
+ }
+
+ IgniteFuture<Boolean> fut = ignite.compute()
+ .applyAsync((IgniteClosure<Object, Object>)factory.create(), params, new IgniteReducer<Object, Boolean>() {
+
+ private Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ @Override public boolean collect(@Nullable Object o) {
+ results.add(o);
+ return true;
+ }
+
+ @Override public Boolean reduce() {
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ return true;
+ }
+ });
+
+ assertTrue(fut.get());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCallAsync() throws Exception {
runTest(callableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
- final IgniteCompute comp = ignite.compute().withAsync();
+ final IgniteCompute comp = ignite.compute();
- Collection<ComputeTaskFuture<Object>> futures = new ArrayList<>(MAX_JOB_COUNT);
+ Collection<IgniteFuture<Object>> futures = new ArrayList<>(MAX_JOB_COUNT);
for (int i = 0; i < MAX_JOB_COUNT; ++i) {
EchoCallable job = (EchoCallable)factory.create();
job.setArg(value(i - 1));
- comp.call(job);
- futures.add(comp.future());
+ futures.add(comp.callAsync(job));
}
// Wait for results.
Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
- for (ComputeTaskFuture<Object> future : futures)
+ for (IgniteFuture<Object> future : futures)
results.add(future.get());
checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
@@ -446,7 +648,7 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
- public void testCallSync() throws Exception {
+ public void testCall() throws Exception {
runTest(callableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
@@ -488,6 +690,28 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testCallCollectionAsync() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ Collection<EchoCallable> jobs = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+ job.setArg(value(i - 1));
+ jobs.add(job);
+ }
+
+ IgniteFuture<Collection<Object>> fut = ignite.compute().callAsync(jobs);
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, fut.get(), value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), fut.get());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCallCollectionWithReducer() throws Exception {
runTest(callableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
@@ -522,7 +746,41 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
- public void testDummyAffinityCall() throws Exception {
+ public void testCallCollectionWithReducerAsync() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ Collection<EchoCallable> jobs = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+ job.setArg(value(i - 1));
+ jobs.add(job);
+ }
+
+ IgniteFuture<Boolean> fut = ignite.compute().callAsync(jobs, new IgniteReducer<Object, Boolean>() {
+ private Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ @Override public boolean collect(@Nullable Object o) {
+ results.add(o);
+ return true;
+ }
+
+ @Override public Boolean reduce() {
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ return true;
+ }
+ });
+
+ assertTrue(fut.get());
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAffinityCall() throws Exception {
runTest(callableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
ignite.getOrCreateCache(CACHE_NAME);
@@ -548,7 +806,147 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
- public void testDummyAffinityRun() throws Exception {
+ public void testAffinityCallAsync() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache(CACHE_NAME);
+
+ final IgniteCompute comp = ignite.compute();
+
+ Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+
+ job.setArg(value(i - 1));
+
+ IgniteFuture<Object> fut = comp.affinityCallAsync("test", key(0), job);
+
+ results.add(fut.get());
+ }
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheAffinityCall() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+
+ job.setArg(value(i - 1));
+
+ results.add(comp.affinityCall(Arrays.asList("test0", "test1"), key(0), job));
+ }
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheAffinityCallAsync() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+
+ job.setArg(value(i - 1));
+
+ IgniteFuture<Object> fut = comp.affinityCallAsync(Arrays.asList("test0", "test1"), key(0), job);
+
+ results.add(fut.get());
+ }
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheByPartIdAffinityCall() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+
+ job.setArg(value(i - 1));
+
+ results.add(comp.affinityCall(Arrays.asList("test0", "test1"), 0, job));
+ }
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheByPartIdAffinityCallAsync() throws Exception {
+ runTest(callableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ Collection<Object> results = new ArrayList<>(MAX_JOB_COUNT);
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ EchoCallable job = (EchoCallable)factory.create();
+
+ job.setArg(value(i - 1));
+
+ IgniteFuture fut = comp.affinityCallAsync(Arrays.asList("test0", "test1"), 0, job);
+
+ results.add(fut.get());
+ }
+
+ checkResultsClassCount(MAX_JOB_COUNT - 1, results, value(0).getClass());
+ assertCollectionsEquals("Results value mismatch", createGoldenResults(), results);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAffinityRun() throws Exception {
runTest(runnableFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
ignite.getOrCreateCache(CACHE_NAME);
@@ -567,6 +965,111 @@ public class IgniteComputeConfigVariationsFullApiTest extends IgniteConfigVariat
/**
* @throws Exception If failed.
*/
+ public void testAffinityRunAsync() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache(CACHE_NAME);
+
+ final IgniteCompute comp = ignite.compute();
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ IgniteFuture<Void> fut = comp.affinityRunAsync("test", key(0), job);
+
+ fut.get();
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheAffinityRun() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ comp.affinityRun(Arrays.asList("test0", "test1"), key(0), job);
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheAffinityRunAsync() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ IgniteFuture<Void> fut = comp.affinityRunAsync(Arrays.asList("test0", "test1"), key(0), job);
+
+ fut.get();
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheByPartIdAffinityRun() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ comp.affinityRun(Arrays.asList("test0", "test1"), 0, job);
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultiCacheByPartIdAffinityRunAsync() throws Exception {
+ runTest(runnableFactories, new ComputeTest() {
+ @Override public void test(Factory factory, Ignite ignite) throws Exception {
+ ignite.getOrCreateCache("test0");
+ ignite.getOrCreateCache("test1");
+
+ final IgniteCompute comp = ignite.compute();
+
+ for (int i = 0; i < MAX_JOB_COUNT; ++i) {
+ IgniteRunnable job = (IgniteRunnable)factory.create();
+
+ IgniteFuture<Void> fut = comp.affinityRunAsync(Arrays.asList("test0", "test1"), 0, job);
+
+ fut.get();
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testDeployExecuteByName() throws Exception {
runTest(jobFactories, new ComputeTest() {
@Override public void test(Factory factory, Ignite ignite) throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index b50dfb7..1ee4744 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -29,7 +29,6 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteEvents;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
@@ -251,6 +250,175 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testApiAsyncOld() throws Exception {
+ IgniteEvents evtAsync = grid(0).events().withAsync();
+
+ try {
+ evtAsync.stopRemoteListen(null);
+ evtAsync.future().get();
+ }
+ catch (NullPointerException ignored) {
+ // No-op.
+ }
+
+ evtAsync.stopRemoteListen(UUID.randomUUID());
+ evtAsync.future().get();
+
+ UUID consumeId = null;
+
+ try {
+ evtAsync.remoteListen(
+ new P2<UUID, DiscoveryEvent>() {
+ @Override public boolean apply(UUID uuid, DiscoveryEvent evt) {
+ return false;
+ }
+ },
+ new P1<DiscoveryEvent>() {
+ @Override public boolean apply(DiscoveryEvent e) {
+ return false;
+ }
+ },
+ EVTS_DISCOVERY
+ );
+
+ consumeId = (UUID)evtAsync.future().get();
+
+ assertNotNull(consumeId);
+ }
+ finally {
+ evtAsync.stopRemoteListen(consumeId);
+ evtAsync.future().get();
+ }
+
+ try {
+ evtAsync.remoteListen(
+ new P2<UUID, DiscoveryEvent>() {
+ @Override public boolean apply(UUID uuid, DiscoveryEvent evt) {
+ return false;
+ }
+ },
+ new P1<DiscoveryEvent>() {
+ @Override public boolean apply(DiscoveryEvent e) {
+ return false;
+ }
+ }
+ );
+
+ consumeId = (UUID)evtAsync.future().get();
+
+ assertNotNull(consumeId);
+ }
+ finally {
+ evtAsync.stopRemoteListen(consumeId);
+ evtAsync.future().get();
+ }
+
+ try {
+ evtAsync.remoteListen(
+ new P2<UUID, Event>() {
+ @Override public boolean apply(UUID uuid, Event evt) {
+ return false;
+ }
+ },
+ new P1<Event>() {
+ @Override public boolean apply(Event e) {
+ return false;
+ }
+ }
+ );
+
+ consumeId = (UUID)evtAsync.future().get();
+
+ assertNotNull(consumeId);
+ }
+ finally {
+ evtAsync.stopRemoteListen(consumeId);
+ evtAsync.future().get();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testApiAsync() throws Exception {
+ IgniteEvents evt = grid(0).events();
+
+ try {
+ evt.stopRemoteListenAsync(null).get();
+ }
+ catch (NullPointerException ignored) {
+ // No-op.
+ }
+
+ evt.stopRemoteListenAsync(UUID.randomUUID()).get();
+
+ UUID consumeId = null;
+
+ try {
+ consumeId = evt.remoteListenAsync(
+ new P2<UUID, DiscoveryEvent>() {
+ @Override public boolean apply(UUID uuid, DiscoveryEvent evt) {
+ return false;
+ }
+ },
+ new P1<DiscoveryEvent>() {
+ @Override public boolean apply(DiscoveryEvent e) {
+ return false;
+ }
+ },
+ EVTS_DISCOVERY
+ ).get();
+
+ assertNotNull(consumeId);
+ }
+ finally {
+ evt.stopRemoteListenAsync(consumeId).get();
+ }
+
+ try {
+ consumeId = evt.remoteListenAsync(
+ new P2<UUID, DiscoveryEvent>() {
+ @Override public boolean apply(UUID uuid, DiscoveryEvent evt) {
+ return false;
+ }
+ },
+ new P1<DiscoveryEvent>() {
+ @Override public boolean apply(DiscoveryEvent e) {
+ return false;
+ }
+ }
+ ).get();
+
+ assertNotNull(consumeId);
+ }
+ finally {
+ evt.stopRemoteListenAsync(consumeId).get();
+ }
+
+ try {
+ consumeId = evt.remoteListenAsync(
+ new P2<UUID, Event>() {
+ @Override public boolean apply(UUID uuid, Event evt) {
+ return false;
+ }
+ },
+ new P1<Event>() {
+ @Override public boolean apply(Event e) {
+ return false;
+ }
+ }
+ ).get();
+
+ assertNotNull(consumeId);
+ }
+ finally {
+ evt.stopRemoteListenAsync(consumeId).get();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testAllEvents() throws Exception {
final Collection<UUID> nodeIds = new HashSet<>();
final AtomicInteger cnt = new AtomicInteger();
@@ -990,15 +1158,13 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
int idx = rnd.nextInt(GRID_CNT);
try {
- IgniteEvents evts = grid(idx).events().withAsync();
+ IgniteEvents evts = grid(idx).events();
- evts.remoteListen(new P2<UUID, Event>() {
+ UUID consumeId = evts.remoteListenAsync(new P2<UUID, Event>() {
@Override public boolean apply(UUID uuid, Event evt) {
return true;
}
- }, null, EVT_JOB_STARTED);
-
- UUID consumeId = evts.<UUID>future().get(3000);
+ }, null, EVT_JOB_STARTED).get(3000);
started.add(consumeId);
@@ -1029,11 +1195,9 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
UUID consumeId = t.get2();
try {
- IgniteEvents evts = grid(idx).events().withAsync();
-
- evts.stopRemoteListen(consumeId);
+ IgniteEvents evts = grid(idx).events();
- evts.future().get(3000);
+ evts.stopRemoteListenAsync(consumeId).get(3000);
stopped.add(consumeId);
}
@@ -1063,11 +1227,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
int idx = rnd.nextInt(GRID_CNT);
try {
- IgniteCompute comp = grid(idx).compute().withAsync();
-
- comp.run(F.noop());
-
- comp.future().get(3000);
+ grid(idx).compute().runAsync(F.noop()).get(3000);
}
catch (IgniteException ignored) {
// Ignore all job execution related errors.
@@ -1089,11 +1249,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
int idx = t.get1();
UUID consumeId = t.get2();
- IgniteEvents evts = grid(idx).events().withAsync();
-
- evts.stopRemoteListen(consumeId);
-
- evts.future().get(3000);
+ grid(idx).events().stopRemoteListenAsync(consumeId).get(3000);
stopped.add(consumeId);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
index 04c67dc..1217005 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
@@ -266,6 +266,13 @@ public class IgfsMock implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public IgniteFuture<Void> formatAsync() throws IgniteException {
+ throwUnsupported();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
throwUnsupported();
@@ -274,6 +281,14 @@ public class IgfsMock implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
+ throwUnsupported();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
throws IgniteException {
@@ -283,6 +298,15 @@ public class IgfsMock implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen,
+ @Nullable T arg) throws IgniteException {
+ throwUnsupported();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
throwUnsupported();
@@ -291,6 +315,14 @@ public class IgfsMock implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException {
+ throwUnsupported();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
throws IgniteException {
@@ -300,6 +332,15 @@ public class IgfsMock implements IgfsEx {
}
/** {@inheritDoc} */
+ @Override public <T, R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen,
+ @Nullable T arg) throws IgniteException {
+ throwUnsupported();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public boolean exists(IgfsPath path) {
throwUnsupported();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
index 0d468b4..36c99dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
@@ -168,6 +168,25 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * Test task.
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("ConstantConditions")
+ public void testTaskAsync() throws Exception {
+ String arg = DICTIONARY[new Random(System.currentTimeMillis()).nextInt(DICTIONARY.length)];
+
+ generateFile(TOTAL_WORDS);
+ Long genLen = igfs.info(FILE).length();
+
+ IgniteBiTuple<Long, Integer> taskRes = igfs.executeAsync(new Task(),
+ new IgfsStringDelimiterRecordResolver(" "), Collections.singleton(FILE), arg).get();
+
+ assert F.eq(genLen, taskRes.getKey());
+ assert F.eq(TOTAL_WORDS, taskRes.getValue());
+ }
+
+ /**
* Generate file with random data and provided argument.
*
* @param wordCnt Word count.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
index 3e90a52..3e547d0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
@@ -186,18 +186,7 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
public void testOrderedMessage() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- orderedMessage(false);
- }
- });
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOrderedMessageAsync() throws Exception {
- runInAllDataModes(new TestRunnable() {
- @Override public void run() throws Exception {
- orderedMessage(true);
+ orderedMessage();
}
});
}
@@ -211,26 +200,11 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- clientServerOrderedMessage(false);
- }
- });
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClientServerOrderedMessageAsync() throws Exception {
- if (!testsCfg.withClients())
- return;
-
- runInAllDataModes(new TestRunnable() {
- @Override public void run() throws Exception {
- clientServerOrderedMessage(true);
+ clientServerOrderedMessage();
}
});
}
-
/**
* @throws Exception If failed.
*/
@@ -240,21 +214,7 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- clientClientOrderedMessage(false);
- }
- });
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClientClientOrderedMessageAsync() throws Exception {
- if (!testsCfg.withClients())
- return;
-
- runInAllDataModes(new TestRunnable() {
- @Override public void run() throws Exception {
- clientClientOrderedMessage(true);
+ clientClientOrderedMessage();
}
});
}
@@ -268,21 +228,7 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- serverClientOrderedMessage(false);
- }
- });
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testServerClientOrderedMessageAsync() throws Exception {
- if (!testsCfg.withClients())
- return;
-
- runInAllDataModes(new TestRunnable() {
- @Override public void run() throws Exception {
- serverClientOrderedMessage(true);
+ serverClientOrderedMessage();
}
});
}
@@ -451,68 +397,63 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
}
/**
- * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void orderedMessage(boolean async) throws Exception {
+ private void orderedMessage() throws Exception {
Ignite ignite = grid(SERVER_NODE_IDX);
ClusterGroup grp = gridCount() > 1 ? ignite.cluster().forRemotes() : ignite.cluster().forLocal();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp, async);
+ registerListenerAndSendOrderedMessages(ignite, grp);
}
/**
- * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void clientServerOrderedMessage(boolean async) throws Exception {
+ private void clientServerOrderedMessage() throws Exception {
Ignite ignite = grid(CLIENT_NODE_IDX);
ClusterGroup grp = ignite.cluster().forServers();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp, async);
+ registerListenerAndSendOrderedMessages(ignite, grp);
}
/**
- * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void clientClientOrderedMessage(boolean async) throws Exception {
+ private void clientClientOrderedMessage() throws Exception {
Ignite ignite = grid(CLIENT_NODE_IDX);
ClusterGroup grp = ignite.cluster().forClients();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp, async);
+ registerListenerAndSendOrderedMessages(ignite, grp);
}
/**
- * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void serverClientOrderedMessage(boolean async) throws Exception {
+ private void serverClientOrderedMessage() throws Exception {
Ignite ignite = grid(SERVER_NODE_IDX);
ClusterGroup grp = ignite.cluster().forClients();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp, async);
+ registerListenerAndSendOrderedMessages(ignite, grp);
}
/**
* @param ignite Ignite.
* @param grp Cluster group.
- * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void registerListenerAndSendOrderedMessages(Ignite ignite, ClusterGroup grp, boolean async) throws Exception {
+ private void registerListenerAndSendOrderedMessages(Ignite ignite, ClusterGroup grp) throws Exception {
int messages = MSGS;
LATCH = new CountDownLatch(grp.nodes().size() * messages);
@@ -520,12 +461,8 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
UUID opId = ignite.message(grp).remoteListen(MESSAGE_TOPIC, new OrderedMessageListener());
try {
- for (int i=0; i < messages; i++){
- if (async)
- ignite.message(grp).withAsync().sendOrdered(MESSAGE_TOPIC, value(i), 2000);
- else
- ignite.message(grp).sendOrdered(MESSAGE_TOPIC, value(i), 2000);
- }
+ for (int i=0; i < messages; i++)
+ ignite.message(grp).sendOrdered(MESSAGE_TOPIC, value(i), 2000);
assertTrue(LATCH.await(10, TimeUnit.SECONDS));
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
index c6505ba..f9d1632 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
@@ -147,8 +147,8 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testSameConfiguration() throws Exception {
- String name = "dupService";
+ public void testSameConfigurationOld() throws Exception {
+ String name = "dupServiceOld";
IgniteServices svcs1 = randomGrid().services().withAsync();
IgniteServices svcs2 = randomGrid().services().withAsync();
@@ -176,8 +176,33 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testDifferentConfiguration() throws Exception {
- String name = "dupService";
+ public void testSameConfiguration() throws Exception {
+ String name = "dupServiceOld";
+
+ IgniteServices svcs1 = randomGrid().services();
+ IgniteServices svcs2 = randomGrid().services();
+
+ IgniteFuture<?> fut1 = svcs1.deployClusterSingletonAsync(name, new DummyService());
+
+ IgniteFuture<?> fut2 = svcs2.deployClusterSingletonAsync(name, new DummyService());
+
+ info("Deployed service: " + name);
+
+ fut1.get();
+
+ info("Finished waiting for service future1: " + name);
+
+ // This must succeed without exception because configuration is the same.
+ fut2.get();
+
+ info("Finished waiting for service future2: " + name);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDifferentConfigurationOld() throws Exception {
+ String name = "dupServiceOld";
IgniteServices svcs1 = randomGrid().services().withAsync();
IgniteServices svcs2 = randomGrid().services().withAsync();
@@ -209,6 +234,35 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
+ public void testDifferentConfiguration() throws Exception {
+ String name = "dupService";
+
+ IgniteServices svcs1 = randomGrid().services();
+ IgniteServices svcs2 = randomGrid().services();
+
+ IgniteFuture<?> fut1 = svcs1.deployClusterSingletonAsync(name, new DummyService());
+
+ IgniteFuture<?> fut2 = svcs2.deployNodeSingletonAsync(name, new DummyService());
+
+ info("Deployed service: " + name);
+
+ fut1.get();
+
+ info("Finished waiting for service future: " + name);
+
+ try {
+ fut2.get();
+
+ fail("Failed to receive mismatching configuration exception.");
+ }
+ catch (IgniteException e) {
+ info("Received mismatching configuration exception: " + e.getMessage());
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testGetServiceByName() throws Exception {
String name = "serviceByName";
@@ -255,10 +309,10 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testDeployOnEachNode() throws Exception {
+ public void testDeployOnEachNodeOld() throws Exception {
Ignite g = randomGrid();
- String name = "serviceOnEachNode";
+ String name = "serviceOnEachNodeOld";
CountDownLatch latch = new CountDownLatch(nodeCount());
@@ -287,10 +341,38 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testDeploySingleton() throws Exception {
+ public void testDeployOnEachNode() throws Exception {
Ignite g = randomGrid();
- String name = "serviceSingleton";
+ String name = "serviceOnEachNode";
+
+ CountDownLatch latch = new CountDownLatch(nodeCount());
+
+ DummyService.exeLatch(name, latch);
+
+ IgniteFuture<?> fut = g.services().deployNodeSingletonAsync(name, new DummyService());
+
+ info("Deployed service: " + name);
+
+ fut.get();
+
+ info("Finished waiting for service future: " + name);
+
+ latch.await();
+
+ assertEquals(name, nodeCount(), DummyService.started(name));
+ assertEquals(name, 0, DummyService.cancelled(name));
+
+ checkCount(name, g.services().serviceDescriptors(), nodeCount());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeploySingletonOld() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceSingletonOld";
CountDownLatch latch = new CountDownLatch(1);
@@ -319,7 +401,35 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testAffinityDeploy() throws Exception {
+ public void testDeploySingleton() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceSingleton";
+
+ CountDownLatch latch = new CountDownLatch(1);
+
+ DummyService.exeLatch(name, latch);
+
+ IgniteFuture<?> fut = g.services().deployClusterSingletonAsync(name, new DummyService());
+
+ info("Deployed service: " + name);
+
+ fut.get();
+
+ info("Finished waiting for service future: " + name);
+
+ latch.await();
+
+ assertEquals(name, 1, DummyService.started(name));
+ assertEquals(name, 0, DummyService.cancelled(name));
+
+ checkCount(name, g.services().serviceDescriptors(), 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAffinityDeployOld() throws Exception {
Ignite g = randomGrid();
final Integer affKey = 1;
@@ -327,7 +437,7 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
// Store a cache key.
g.cache(CACHE_NAME).put(affKey, affKey.toString());
- String name = "serviceAffinity";
+ String name = "serviceAffinityOld";
IgniteServices svcs = g.services().withAsync();
@@ -348,10 +458,35 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testDeployMultiple1() throws Exception {
+ public void testAffinityDeploy() throws Exception {
Ignite g = randomGrid();
- String name = "serviceMultiple1";
+ final Integer affKey = 1;
+
+ // Store a cache key.
+ g.cache(CACHE_NAME).put(affKey, affKey.toString());
+
+ String name = "serviceAffinity";
+
+ IgniteFuture<?> fut = g.services().deployKeyAffinitySingletonAsync(name, new AffinityService(affKey),
+ CACHE_NAME, affKey);
+
+ info("Deployed service: " + name);
+
+ fut.get();
+
+ info("Finished waiting for service future: " + name);
+
+ checkCount(name, g.services().serviceDescriptors(), 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeployMultiple1Old() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceMultiple1Old";
CountDownLatch latch = new CountDownLatch(nodeCount() * 2);
@@ -380,10 +515,38 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
- public void testDeployMultiple2() throws Exception {
+ public void testDeployMultiple1() throws Exception {
Ignite g = randomGrid();
- String name = "serviceMultiple2";
+ String name = "serviceMultiple1";
+
+ CountDownLatch latch = new CountDownLatch(nodeCount() * 2);
+
+ DummyService.exeLatch(name, latch);
+
+ IgniteFuture<?> fut = g.services().deployMultipleAsync(name, new DummyService(), nodeCount() * 2, 3);
+
+ info("Deployed service: " + name);
+
+ fut.get();
+
+ info("Finished waiting for service future: " + name);
+
+ latch.await();
+
+ assertEquals(name, nodeCount() * 2, DummyService.started(name));
+ assertEquals(name, 0, DummyService.cancelled(name));
+
+ checkCount(name, g.services().serviceDescriptors(), nodeCount() * 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeployMultiple2Old() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceMultiple2Old";
int cnt = nodeCount() * 2 + 1;
@@ -414,6 +577,36 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
+ public void testDeployMultiple2() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceMultiple2";
+
+ int cnt = nodeCount() * 2 + 1;
+
+ CountDownLatch latch = new CountDownLatch(cnt);
+
+ DummyService.exeLatch(name, latch);
+
+ IgniteFuture<?> fut = g.services().deployMultipleAsync(name, new DummyService(), cnt, 3);
+
+ info("Deployed service: " + name);
+
+ fut.get();
+
+ info("Finished waiting for service future: " + name);
+
+ latch.await();
+
+ assertEquals(name, cnt, DummyService.started(name));
+ assertEquals(name, 0, DummyService.cancelled(name));
+
+ checkCount(name, g.services().serviceDescriptors(), cnt);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCancelSingleton() throws Exception {
Ignite g = randomGrid();
@@ -449,6 +642,41 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
+ public void testCancelSingletonAsync() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceCancelAsync";
+
+ CountDownLatch latch = new CountDownLatch(1);
+
+ DummyService.exeLatch(name, latch);
+
+ g.services().deployClusterSingleton(name, new DummyService());
+
+ info("Deployed service: " + name);
+
+ latch.await();
+
+ assertEquals(name, 1, DummyService.started(name));
+ assertEquals(name, 0, DummyService.cancelled(name));
+
+ latch = new CountDownLatch(1);
+
+ DummyService.cancelLatch(name, latch);
+
+ g.services().cancelAsync(name).get();
+
+ info("Cancelled service: " + name);
+
+ latch.await();
+
+ assertEquals(name, 1, DummyService.started(name));
+ assertEquals(name, 1, DummyService.cancelled(name));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCancelEachNode() throws Exception {
Ignite g = randomGrid();
@@ -482,6 +710,41 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
}
/**
+ * @throws Exception If failed.
+ */
+ public void testCancelAsyncEachNode() throws Exception {
+ Ignite g = randomGrid();
+
+ String name = "serviceCancelEachNodeAsync";
+
+ CountDownLatch latch = new CountDownLatch(nodeCount());
+
+ DummyService.exeLatch(name, latch);
+
+ g.services().deployNodeSingleton(name, new DummyService());
+
+ info("Deployed service: " + name);
+
+ latch.await();
+
+ assertEquals(name, nodeCount(), DummyService.started(name));
+ assertEquals(name, 0, DummyService.cancelled(name));
+
+ latch = new CountDownLatch(nodeCount());
+
+ DummyService.cancelLatch(name, latch);
+
+ g.services().cancelAsync(name).get();
+
+ info("Cancelled service: " + name);
+
+ latch.await();
+
+ assertEquals(name, nodeCount(), DummyService.started(name));
+ assertEquals(name, nodeCount(), DummyService.cancelled(name));
+ }
+
+ /**
* @param svcName Service name.
* @param descs Descriptors.
* @param cnt Expected count.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
index 39336ef..9b787a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
@@ -44,11 +44,9 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
DummyService.exeLatch(name, latch);
- IgniteServices svcs = g.services().withAsync();
+ IgniteServices svcs = g.services();
- svcs.deployClusterSingleton(name, new DummyService());
-
- IgniteFuture<?> fut = svcs.future();
+ IgniteFuture<?> fut = svcs.deployClusterSingletonAsync(name, new DummyService());
info("Deployed service: " + name);
@@ -91,13 +89,11 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
String name = "serviceAffinityUpdateTopology";
- IgniteServices svcs = g.services().withAsync();
+ IgniteServices svcs = g.services();
- svcs.deployKeyAffinitySingleton(name, new AffinityService(affKey),
+ IgniteFuture<?> fut = svcs.deployKeyAffinitySingletonAsync(name, new AffinityService(affKey),
CACHE_NAME, affKey);
- IgniteFuture<?> fut = svcs.future();
-
info("Deployed service: " + name);
fut.get();
@@ -130,11 +126,9 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
DummyService.exeLatch(name, latch);
- IgniteServices svcs = g.services().withAsync();
-
- svcs.deployNodeSingleton(name, new DummyService());
+ IgniteServices svcs = g.services();
- IgniteFuture<?> fut = svcs.future();
+ IgniteFuture<?> fut = svcs.deployNodeSingletonAsync(name, new DummyService());
info("Deployed service: " + name);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
index 03b00f4..8eefa20 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
import org.apache.ignite.testframework.GridTestUtils;
@@ -62,14 +63,12 @@ public class GridServiceProcessorStopSelfTest extends GridCommonAbstractTest {
@Override public Void call() throws Exception {
IgniteServices svcs = ignite.services();
- IgniteServices services = svcs.withAsync();
-
- services.deployClusterSingleton("myClusterSingletonService", new TestServiceImpl());
+ IgniteFuture f = svcs.deployClusterSingletonAsync("myClusterSingletonService", new TestServiceImpl());
depLatch.countDown();
try {
- services.future().get();
+ f.get();
}
catch (IgniteException ignored) {
finishLatch.countDown();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
index 272c7ad..559cfc9 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.UUID;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.compute.ComputeJob;
@@ -89,9 +88,8 @@ public final class GridSingleExecutionTest {
System.exit(1);
}
else if (args.length >= 2) {
- for (IgniteConfiguration cfg: getConfigurations(args[1], args[0])) {
+ for (IgniteConfiguration cfg: getConfigurations(args[1], args[0]))
G.start(cfg);
- }
}
boolean useSes = false;
@@ -104,12 +102,8 @@ public final class GridSingleExecutionTest {
try {
Ignite ignite = G.ignite();
- IgniteCompute comp = ignite.compute().withAsync();
-
// Execute Hello World task.
- comp.execute(!useSes ? TestTask.class : TestSessionTask.class, null);
-
- ComputeTaskFuture<Object> fut = comp.future();
+ ComputeTaskFuture<Object> fut = ignite.compute().executeAsync(!useSes ? TestTask.class : TestSessionTask.class, null);
if (useSes) {
fut.getTaskSession().setAttribute("attr1", 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
index 6a43fee..bf34545 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
@@ -26,7 +26,6 @@ import java.util.concurrent.Executors;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -88,13 +87,11 @@ public class GridTestMain {
long start = System.currentTimeMillis();
- IgniteCompute comp = g.compute().withAsync();
-
// Collocate computations and data.
for (long i = 0; i < GridTestConstants.ENTRY_COUNT; i++) {
final long key = i;
- comp.affinityRun("partitioned", GridTestKey.affinityKey(key), new IgniteRunnable() {
+ final IgniteFuture<?> f = g.compute().affinityRunAsync("partitioned", GridTestKey.affinityKey(key), new IgniteRunnable() {
// This code will execute on remote nodes by collocating keys with cached data.
@Override public void run() {
Long val = cache.localPeek(new GridTestKey(key), CachePeekMode.ONHEAP);
@@ -104,8 +101,6 @@ public class GridTestMain {
}
});
- final IgniteFuture<?> f = comp.future();
-
q.put(f);
f.listen(new CI1<IgniteFuture<?>>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java
index ab6b272..c764f67 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.loadtests.direct.multisplit;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -106,8 +105,6 @@ public class GridMultiSplitsLoadTest extends GridCommonAbstractTest {
GridTestUtils.runMultiThreaded(new Runnable() {
/** {@inheritDoc} */
@Override public void run() {
- IgniteCompute comp = ignite.compute().withAsync();
-
while (end - System.currentTimeMillis() > 0) {
int levels = 3;
@@ -116,9 +113,7 @@ public class GridMultiSplitsLoadTest extends GridCommonAbstractTest {
long start = System.currentTimeMillis();
try {
- comp.execute(GridLoadTestTask.class, levels);
-
- ComputeTaskFuture<Integer> fut = comp.future();
+ ComputeTaskFuture<Integer> fut = ignite.compute().executeAsync(GridLoadTestTask.class, levels);
int res = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
index 5d909c9..6fb7cdf 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.loadtests.direct.newnodes;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.G;
@@ -141,8 +140,6 @@ public abstract class GridSingleSplitsNewNodesAbstractLoadTest extends GridCommo
GridTestUtils.runMultiThreaded(new Runnable() {
/** {@inheritDoc} */
@Override public void run() {
- IgniteCompute comp = ignite.compute().withAsync();
-
while (end - System.currentTimeMillis() > 0
&& !Thread.currentThread().isInterrupted()) {
long start = System.currentTimeMillis();
@@ -150,9 +147,8 @@ public abstract class GridSingleSplitsNewNodesAbstractLoadTest extends GridCommo
try {
int levels = 3;
- comp.execute(new GridSingleSplitNewNodesTestTask(), levels);
-
- ComputeTaskFuture<Integer> fut = comp.future();
+ ComputeTaskFuture<Integer> fut = ignite.compute().executeAsync(
+ new GridSingleSplitNewNodesTestTask(), levels);
int res = fut.get();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java b/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
index a065580..9662882 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
@@ -114,7 +114,7 @@ public class GridDsiClient implements Callable {
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "InfiniteLoopStatement"})
@Nullable @Override public Object call() throws Exception {
- IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode())).withAsync();
+ IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode()));
while (!finish.get()) {
try {
@@ -122,9 +122,8 @@ public class GridDsiClient implements Callable {
long submitTime1 = t0;
- comp.execute(GridDsiRequestTask.class, new GridDsiMessage(terminalId, nodeId));
-
- ComputeTaskFuture<T3<Long, Integer, Integer>> f1 = comp.future();
+ ComputeTaskFuture<T3<Long, Integer, Integer>> f1 = comp.executeAsync(
+ GridDsiRequestTask.class, new GridDsiMessage(terminalId, nodeId));
submitTime.setIfGreater(System.currentTimeMillis() - submitTime1);
@@ -132,9 +131,8 @@ public class GridDsiClient implements Callable {
submitTime1 = System.currentTimeMillis();
- comp.execute(GridDsiResponseTask.class, new GridDsiMessage(terminalId, nodeId));
-
- ComputeTaskFuture<T3<Long, Integer, Integer>> f2 = comp.future();
+ ComputeTaskFuture<T3<Long, Integer, Integer>> f2 = comp.executeAsync(
+ GridDsiResponseTask.class, new GridDsiMessage(terminalId, nodeId));
submitTime.setIfGreater(System.currentTimeMillis() - submitTime1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionLoadTestClientSemaphore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionLoadTestClientSemaphore.java b/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionLoadTestClientSemaphore.java
index 8e55ff9..53c6f50 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionLoadTestClientSemaphore.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionLoadTestClientSemaphore.java
@@ -29,7 +29,6 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.internal.util.lang.GridAbsClosure;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.G;
@@ -75,16 +74,10 @@ public class GridJobExecutionLoadTestClientSemaphore implements Callable<Object>
ClusterGroup rmts = g.cluster().forRemotes();
- IgniteCompute comp = g.compute(rmts).withAsync();
-
while (!finish) {
tasksSem.acquire();
- comp.execute(GridJobExecutionLoadTestTask.class, null);
-
- ComputeTaskFuture<Object> f = comp.future();
-
- f.listen(lsnr);
+ g.compute(rmts).executeAsync(GridJobExecutionLoadTestTask.class, null).listen(lsnr);
txCnt.increment();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionSingleNodeSemaphoreLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionSingleNodeSemaphoreLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionSingleNodeSemaphoreLoadTest.java
index 2e2ab20..2f94b48 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionSingleNodeSemaphoreLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobExecutionSingleNodeSemaphoreLoadTest.java
@@ -24,13 +24,11 @@ import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.Semaphore;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeJobResultPolicy;
import org.apache.ignite.compute.ComputeTask;
-import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.typedef.CI1;
@@ -188,13 +186,7 @@ public class GridJobExecutionSingleNodeSemaphoreLoadTest {
@Nullable @Override public Object call() throws Exception {
sem.acquire();
- IgniteCompute comp = g.compute().withAsync();
-
- comp.execute(GridJobExecutionLoadTestTask.class, null);
-
- ComputeTaskFuture<Object> f = comp.future();
-
- f.listen(lsnr);
+ g.compute().executeAsync(GridJobExecutionLoadTestTask.class, null).listen(lsnr);
iterCntr.increment();
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobLoadTestSubmitter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobLoadTestSubmitter.java b/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobLoadTestSubmitter.java
index 8dcd828..16a6af8 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobLoadTestSubmitter.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/job/GridJobLoadTestSubmitter.java
@@ -22,7 +22,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.lang.IgniteFutureCancelledException;
@@ -68,8 +67,6 @@ public class GridJobLoadTestSubmitter implements Runnable {
/** {@inheritDoc} */
@SuppressWarnings("BusyWait")
@Override public void run() {
- IgniteCompute comp = ignite.compute().withAsync();
-
while (true) {
checkCompletion();
@@ -83,9 +80,7 @@ public class GridJobLoadTestSubmitter implements Runnable {
}
try {
- comp.withTimeout(TIMEOUT).execute(GridJobLoadTestTask.class, params);
-
- futures.add(comp.<Integer>future());
+ futures.add(ignite.compute().withTimeout(TIMEOUT).executeAsync(GridJobLoadTestTask.class, params));
}
catch (IgniteException e) {
// Should not be thrown since uses asynchronous execution.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/loadtests/mergesort/GridMergeSortLoadTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/mergesort/GridMergeSortLoadTask.java b/modules/core/src/test/java/org/apache/ignite/loadtests/mergesort/GridMergeSortLoadTask.java
index 8c8f039..cb609ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/mergesort/GridMergeSortLoadTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/mergesort/GridMergeSortLoadTask.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobContext;
@@ -77,12 +76,8 @@ public class GridMergeSortLoadTask extends ComputeTaskSplitAdapter<int[], int[]>
// Future is null before holdcc() is called and
// not null after callcc() is called.
if (fut == null) {
- IgniteCompute comp = ignite.compute().withAsync();
-
// Launch the recursive child task asynchronously.
- comp.execute(new GridMergeSortLoadTask(), arr);
-
- fut = comp.future();
+ fut = ignite.compute().executeAsync(new GridMergeSortLoadTask(), arr);
// Add a listener to the future, that will resume the
// parent task once the child one is completed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
index 3f66c5d..b7ddc3e 100644
--- a/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
@@ -1031,7 +1031,7 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
/**
* @throws Exception If failed.
*/
- public void testAsync() throws Exception {
+ public void testAsyncOld() throws Exception {
final AtomicInteger msgCnt = new AtomicInteger();
TestTcpDiscoverySpi discoSpi = (TestTcpDiscoverySpi)ignite2.configuration().getDiscoverySpi();
@@ -1137,6 +1137,76 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
}
/**
+ * @throws Exception If failed.
+ */
+ public void testAsync() throws Exception {
+ final AtomicInteger msgCnt = new AtomicInteger();
+
+ TestTcpDiscoverySpi discoSpi = (TestTcpDiscoverySpi)ignite2.configuration().getDiscoverySpi();
+
+ discoSpi.blockCustomEvent();
+
+ final String topic = "topic";
+
+ IgniteFuture<UUID> starFut = ignite2.message().remoteListenAsync(topic, new P2<UUID, Object>() {
+ @Override public boolean apply(UUID nodeId, Object msg) {
+ System.out.println(Thread.currentThread().getName() +
+ " Listener received new message [msg=" + msg + ", senderNodeId=" + nodeId + ']');
+
+ msgCnt.incrementAndGet();
+
+ return true;
+ }
+ });
+
+ Assert.assertNotNull(starFut);
+
+ U.sleep(500);
+
+ Assert.assertFalse(starFut.isDone());
+
+ discoSpi.stopBlock();
+
+ UUID id = starFut.get();
+
+ Assert.assertNotNull(id);
+
+ Assert.assertTrue(starFut.isDone());
+
+ discoSpi.blockCustomEvent();
+
+ message(ignite1.cluster().forRemotes()).send(topic, "msg1");
+
+ GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ return msgCnt.get() > 0;
+ }
+ }, 5000);
+
+ assertEquals(1, msgCnt.get());
+
+ IgniteFuture<?> stopFut = ignite2.message().stopRemoteListenAsync(id);
+
+ Assert.assertNotNull(stopFut);
+
+ U.sleep(500);
+
+ Assert.assertFalse(stopFut.isDone());
+
+ discoSpi.stopBlock();
+
+ stopFut.get();
+
+ Assert.assertTrue(stopFut.isDone());
+
+ message(ignite1.cluster().forRemotes()).send(topic, "msg2");
+
+ U.sleep(1000);
+
+ assertEquals(1, msgCnt.get());
+ }
+
+ /**
*
*/
static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
@@ -1231,6 +1301,7 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
/**
* @param expOldestIgnite Expected oldest ignite.
+ * @throws InterruptedException If failed.
*/
private void remoteListenForOldest(Ignite expOldestIgnite) throws InterruptedException {
ClusterGroup grp = ignite1.cluster().forOldest();
[28/50] [abbrv] ignite git commit: .NET: Fix Affinity test failures
Posted by ag...@apache.org.
.NET: Fix Affinity test failures
Implement PlatformOutputStreamImpl.hasArray() and rawOffheapPointer()
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1308927a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1308927a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1308927a
Branch: refs/heads/ignite-4003
Commit: 1308927a61b0efcbe1f68fd894b91c33dba1cb77
Parents: cb5e9eb
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Mar 27 15:56:10 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Mar 27 15:56:10 2017 +0300
----------------------------------------------------------------------
.../processors/platform/memory/PlatformOutputStreamImpl.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1308927a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformOutputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformOutputStreamImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformOutputStreamImpl.java
index 334afb8..884e718 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformOutputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformOutputStreamImpl.java
@@ -209,16 +209,12 @@ public class PlatformOutputStreamImpl implements PlatformOutputStream {
/** {@inheritDoc} */
@Override public long rawOffheapPointer() {
- assert false;
-
- throw new UnsupportedOperationException("Should not be called.");
+ return data;
}
/** {@inheritDoc} */
@Override public boolean hasArray() {
- assert false;
-
- throw new UnsupportedOperationException("Should not be called.");
+ return false;
}
/** {@inheritDoc} */
[32/50] [abbrv] ignite git commit: .NET: Fix code analysis warning
Posted by ag...@apache.org.
.NET: Fix code analysis warning
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/858ed3a5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/858ed3a5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/858ed3a5
Branch: refs/heads/ignite-4003
Commit: 858ed3a557e5a7da8dada086721bfe90e9af96eb
Parents: 87477e0
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 28 10:27:41 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 28 10:27:41 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/858ed3a5/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
index ccc0808..7f8048a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryArrayEqualityComparer.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Binary
using System;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
@@ -32,6 +33,8 @@ namespace Apache.Ignite.Core.Binary
/// <summary>
/// Singleton instance.
/// </summary>
+ [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
+ Justification = "Type is immutable.")]
public static readonly BinaryArrayEqualityComparer Instance = new BinaryArrayEqualityComparer();
/// <summary>
[47/50] [abbrv] ignite git commit: IGNITE-3510 .NET: Fix namespaces
and access modifiers
Posted by ag...@apache.org.
IGNITE-3510 .NET: Fix namespaces and access modifiers
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/348b9efd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/348b9efd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/348b9efd
Branch: refs/heads/ignite-4003
Commit: 348b9efdf54d885573e5774a543fe46e62977b40
Parents: 3f8f4bd
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Mar 29 13:32:27 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Mar 29 13:32:27 2017 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs | 3 +--
.../Apache.Ignite.Core/Impl/Binary/Io/IBinaryStreamProcessor.cs | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/348b9efd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
index 80c1a74..09d0be7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
@@ -25,9 +25,8 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
/// <summary>
/// Stream capable of working with binary objects.
/// </summary>
- [CLSCompliant(false)]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
- public unsafe interface IBinaryStream : IDisposable
+ internal unsafe interface IBinaryStream : IDisposable
{
/// <summary>
/// Write bool.
http://git-wip-us.apache.org/repos/asf/ignite/blob/348b9efd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStreamProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStreamProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStreamProcessor.cs
index 3b8bd8b..1becf80 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStreamProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStreamProcessor.cs
@@ -22,8 +22,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
/// <summary>
/// Binary stream processor.
/// </summary>
- [CLSCompliant(false)]
- public unsafe interface IBinaryStreamProcessor<in TArg, out T>
+ internal unsafe interface IBinaryStreamProcessor<in TArg, out T>
{
/// <summary>
/// Invokes the processor.
[04/50] [abbrv] ignite git commit: IGNITE-4002: Fixed directory check
for the ODBC install script.
Posted by ag...@apache.org.
IGNITE-4002: Fixed directory check for the ODBC install script.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/927ead13
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/927ead13
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/927ead13
Branch: refs/heads/ignite-4003
Commit: 927ead13979937195aca6ffb717942fb477dc1b6
Parents: 1f4ed52
Author: Igor Sapego <is...@gridgain.com>
Authored: Thu Mar 23 18:13:33 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Thu Mar 23 18:13:33 2017 +0300
----------------------------------------------------------------------
modules/platforms/cpp/odbc/install/install_amd64.cmd | 4 ++--
modules/platforms/cpp/odbc/install/install_x86.cmd | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/927ead13/modules/platforms/cpp/odbc/install/install_amd64.cmd
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/install_amd64.cmd b/modules/platforms/cpp/odbc/install/install_amd64.cmd
index 2a2fff6..6c7de93 100644
--- a/modules/platforms/cpp/odbc/install/install_amd64.cmd
+++ b/modules/platforms/cpp/odbc/install/install_amd64.cmd
@@ -10,7 +10,7 @@ if [%ODBC_AMD64%] == [] (
)
if exist %ODBC_AMD64% (
- if exist %ODBC_AMD64%\ (
+ for %%i IN (%ODBC_AMD64%) DO IF EXIST %%~si\NUL (
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
)
echo Installing 64-bit driver: %ODBC_AMD64%
@@ -33,7 +33,7 @@ if [%ODBC_X86%] == [] (
)
if exist %ODBC_X86% (
- if exist %ODBC_X86%\ (
+ for %%i IN (%ODBC_X86%) DO IF EXIST %%~si\NUL (
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
)
echo Installing 32-bit driver: %ODBC_X86%
http://git-wip-us.apache.org/repos/asf/ignite/blob/927ead13/modules/platforms/cpp/odbc/install/install_x86.cmd
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/install_x86.cmd b/modules/platforms/cpp/odbc/install/install_x86.cmd
index 911dbdf..af0f815 100644
--- a/modules/platforms/cpp/odbc/install/install_x86.cmd
+++ b/modules/platforms/cpp/odbc/install/install_x86.cmd
@@ -9,7 +9,7 @@ if [%ODBC%] == [] (
)
if exist %ODBC% (
- if exist %ODBC%\ (
+ for %%i IN (%ODBC%) DO IF EXIST %%~si\NUL (
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
)
echo Installing driver: %ODBC%
[07/50] [abbrv] ignite git commit: IGNITE-3579: Changed communication
message type to short. This closes #1501.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
index 8cbb596..8d0dd0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
@@ -47,7 +47,10 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
private static final int SAMPLE_CNT = 1;
/** */
- private static final byte DIRECT_TYPE = -127;
+ private static final short DIRECT_TYPE = -127;
+
+ /** */
+ private static final short DIRECT_TYPE_OVER_BYTE = 1000;
/** */
private int bufSize;
@@ -58,6 +61,11 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
return new TestMessage();
}
});
+ GridIoMessageFactory.registerCustom(DIRECT_TYPE_OVER_BYTE, new CO<Message>() {
+ @Override public Message apply() {
+ return new TestOverByteIdMessage();
+ }
+ });
}
/** {@inheritDoc} */
@@ -86,7 +94,21 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
try {
startGridsMultiThreaded(2);
- doSend();
+ doSend(new TestMessage(), TestMessage.class);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendMessageOverByteId() throws Exception {
+ try {
+ startGridsMultiThreaded(2);
+
+ doSend(new TestOverByteIdMessage(), TestOverByteIdMessage.class);
}
finally {
stopAllGrids();
@@ -102,7 +124,7 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
try {
startGridsMultiThreaded(2);
- doSend();
+ doSend(new TestMessage(), TestMessage.class);
}
finally {
stopAllGrids();
@@ -110,11 +132,14 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
}
/**
+ * @param msg Message to send.
+ * @param msgCls Message class to check the received message.
+ *
* @throws Exception If failed.
*/
- private void doSend() throws Exception {
- GridIoManager mgr0 = ((IgniteKernal)grid(0)).context().io();
- GridIoManager mgr1 = ((IgniteKernal)grid(1)).context().io();
+ private void doSend(Message msg, final Class<?> msgCls) throws Exception {
+ GridIoManager mgr0 = grid(0).context().io();
+ GridIoManager mgr1 = grid(1).context().io();
String topic = "test-topic";
@@ -122,14 +147,15 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
mgr1.addMessageListener(topic, new GridMessageListener() {
@Override public void onMessage(UUID nodeId, Object msg) {
- latch.countDown();
+ if (msgCls.isInstance(msg))
+ latch.countDown();
}
});
long time = System.nanoTime();
for (int i = 1; i <= SAMPLE_CNT; i++) {
- mgr0.sendToCustomTopic(grid(1).localNode(), topic, new TestMessage(), GridIoPolicy.PUBLIC_POOL);
+ mgr0.sendToCustomTopic(grid(1).localNode(), topic, msg, GridIoPolicy.PUBLIC_POOL);
if (i % 500 == 0)
info("Sent messages count: " + i);
@@ -150,7 +176,10 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
- return writer.writeByte(null, directType());
+ if (!writer.writeHeader(directType(), (byte)0))
+ return false;
+
+ return true;
}
/** {@inheritDoc} */
@@ -164,7 +193,7 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return DIRECT_TYPE;
}
@@ -173,4 +202,38 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
return 0;
}
}
+
+ /** */
+ private static class TestOverByteIdMessage implements Message {
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.writeHeader(directType(), (byte)0))
+ return false;
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onAckReceived() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public short directType() {
+ return DIRECT_TYPE_OVER_BYTE;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 0;
+ }
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
index f4257a0..3f6318f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
@@ -234,7 +234,7 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
index 929d53a..8fdd752 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
@@ -173,9 +173,9 @@ public class GridCacheConditionalDeploymentSelfTest extends GridCommonAbstractTe
*/
public static class TestMessage extends GridCacheMessage implements GridCacheDeployable {
/** */
- public static final byte DIRECT_TYPE = (byte)302;
+ public static final short DIRECT_TYPE = 302;
- @Override public byte directType() {
+ @Override public short directType() {
return DIRECT_TYPE;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/internal/util/nio/IgniteExceptionInNioWorkerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/IgniteExceptionInNioWorkerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/IgniteExceptionInNioWorkerSelfTest.java
index e0540ec..9af3f8c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/IgniteExceptionInNioWorkerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/IgniteExceptionInNioWorkerSelfTest.java
@@ -92,7 +92,7 @@ public class IgniteExceptionInNioWorkerSelfTest extends GridCommonAbstractTest {
private boolean fail = true;
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
if (fail) {
fail = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
index 748ec4a..593acd4 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java
@@ -127,7 +127,7 @@ class GridTestMessage implements Message, Externalizable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return 0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
index 0a08b3a..f24881e 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
@@ -202,7 +202,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
/** */
private static class TestMessage extends GridCacheMessage {
/** */
- public static final byte DIRECT_TYPE = (byte)202;
+ public static final short DIRECT_TYPE = 202;
/** */
@GridDirectCollection(TestMessage1.class)
@@ -228,7 +228,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return DIRECT_TYPE;
}
@@ -293,7 +293,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
*/
static class TestMessage1 extends GridCacheMessage {
/** */
- public static final byte DIRECT_TYPE = (byte) 203;
+ public static final short DIRECT_TYPE = 203;
/** Body. */
private String body;
@@ -302,11 +302,11 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
private Message msg;
/**
- * @param mes Message.
+ * @param msg Message.
+ * @param body Message body.
*/
- public void init(Message mes, String body) {
- this.msg = mes;
-
+ public void init(Message msg, String body) {
+ this.msg = msg;
this.body = body;
}
@@ -330,7 +330,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return DIRECT_TYPE;
}
@@ -409,7 +409,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
*/
static class TestMessage2 extends GridCacheMessage {
/** */
- public static final byte DIRECT_TYPE = (byte) 205;
+ public static final short DIRECT_TYPE = 205;
/** Node id. */
private UUID nodeId;
@@ -467,7 +467,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return DIRECT_TYPE;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
index 808ff85..ee8a08f 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
@@ -29,7 +29,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
*/
public class GridTestMessage implements Message {
/** */
- public static final byte DIRECT_TYPE = (byte)200;
+ public static final short DIRECT_TYPE = 200;
/** */
private UUID srcNodeId;
@@ -181,7 +181,7 @@ public class GridTestMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return DIRECT_TYPE;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/core/src/test/java/org/apache/ignite/util/GridMessageCollectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridMessageCollectionTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridMessageCollectionTest.java
index 44df767..1353881 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/GridMessageCollectionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridMessageCollectionTest.java
@@ -112,7 +112,10 @@ public class GridMessageCollectionTest extends TestCase {
buf.flip();
- byte type = buf.get();
+ byte b0 = buf.get();
+ byte b1 = buf.get();
+
+ short type = (short)((b1 & 0xFF) << 8 | b0 & 0xFF);
assertEquals(m.directType(), type);
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
index 571f9ac..57d8de2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
@@ -119,7 +119,7 @@ public class GridH2Array extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -18;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
index edd404e..eaa2c69 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
@@ -103,7 +103,7 @@ public class GridH2Boolean extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -5;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
index 894794e..daf806a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
@@ -103,7 +103,7 @@ public class GridH2Byte extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -6;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
index 29a52be..ed3c528 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
@@ -105,7 +105,7 @@ public class GridH2Bytes extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -16;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
index 942ab7c..d0e8cb6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
@@ -138,7 +138,7 @@ public class GridH2CacheObject extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -22;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
index 8025257..a576b5c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
@@ -105,7 +105,7 @@ public class GridH2Date extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -14;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
index a3ad444..2faa3e1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
@@ -127,7 +127,7 @@ public class GridH2Decimal extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -10;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
index 2ceea8d..0dfa9f6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
@@ -103,7 +103,7 @@ public class GridH2Double extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -11;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
index 6923470..fb6e5e4 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
@@ -103,7 +103,7 @@ public class GridH2Float extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -12;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
index 88aba55..581e88f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
@@ -126,7 +126,7 @@ public class GridH2Geometry extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -21;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
index b2548cc..b030632 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
@@ -245,7 +245,7 @@ public class GridH2IndexRangeRequest implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -30;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeResponse.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeResponse.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeResponse.java
index 4d3db12..4fe660c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeResponse.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeResponse.java
@@ -318,7 +318,7 @@ public class GridH2IndexRangeResponse implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -31;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
index 7c6046c..a1a5ba3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
@@ -103,7 +103,7 @@ public class GridH2Integer extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -8;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
index b989171..16131d5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
@@ -105,7 +105,7 @@ public class GridH2JavaObject extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -19;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
index 3d360f0..466378d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
@@ -103,7 +103,7 @@ public class GridH2Long extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -9;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
index 50a49ba..38c4561 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
@@ -74,7 +74,7 @@ public class GridH2Null extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -4;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
index 0aa788b..f2f9a31 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
@@ -429,7 +429,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -33;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
index 59c548d..8aeb6c1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
@@ -95,7 +95,7 @@ public class GridH2RowMessage implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -32;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRange.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRange.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRange.java
index bc8aa75..3a7e6ac 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRange.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRange.java
@@ -160,7 +160,7 @@ public class GridH2RowRange implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -34;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
index e32e449..28dd124 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
@@ -167,7 +167,7 @@ public class GridH2RowRangeBounds implements Message {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -35;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
index ebeca9d..f8dca69 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
@@ -103,7 +103,7 @@ public class GridH2Short extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -7;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
index f2f9fdc..2f58d62 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
@@ -105,7 +105,7 @@ public class GridH2String extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -17;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
index 172d695..bc79e40 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
@@ -106,7 +106,7 @@ public class GridH2Time extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -13;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
index b020799..a07442b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
@@ -123,7 +123,7 @@ public class GridH2Timestamp extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -15;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
index fa9360b..4a6cc68 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
@@ -123,7 +123,7 @@ public class GridH2Uuid extends GridH2ValueMessage {
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
return -20;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
index aa84e4b..3a825f7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class GridH2ValueMessageFactory implements MessageFactory {
/** {@inheritDoc} */
- @Nullable @Override public Message create(byte type) {
+ @Nullable @Override public Message create(short type) {
switch (type) {
case -4:
return GridH2Null.INSTANCE;
http://git-wip-us.apache.org/repos/asf/ignite/blob/906b6926/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 2d99010..6b745ab 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -707,7 +707,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
}
/** {@inheritDoc} */
- @Override public byte directType() {
+ @Override public short directType() {
throw new UnsupportedOperationException();
}
[43/50] [abbrv] ignite git commit: Merge branch 'ignite-4826' of
https://github.com/gridgain/apache-ignite
Posted by ag...@apache.org.
Merge branch 'ignite-4826' of https://github.com/gridgain/apache-ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/118492d5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/118492d5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/118492d5
Branch: refs/heads/ignite-4003
Commit: 118492d57bba1dcdae740839977de61240fc3158
Parents: 8ae3d5b 088b3c0
Author: Sergi Vladykin <se...@gmail.com>
Authored: Tue Mar 28 18:11:05 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Tue Mar 28 18:11:05 2017 +0300
----------------------------------------------------------------------
.../query/h2/opt/GridH2TreeIndex.java | 4 +--
.../query/IgniteSqlSegmentedIndexSelfTest.java | 30 ++++++++++++++++++--
2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/118492d5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
[37/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ab516da1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ab516da1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ab516da1
Branch: refs/heads/ignite-4003
Commit: ab516da1acd1b220c0a50b05850535ed5712a033
Parents: 48701fb 738bb12
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 28 11:59:26 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 28 11:59:26 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 2 +
.../Cache/CacheConfigurationTest.cs | 2 +
.../Cache/Query/CacheLinqTest.cs | 16 ++-
.../Query/CacheQueriesCodeConfigurationTest.cs | 7 +
.../Apache.Ignite.Core.csproj | 3 +-
.../Binary/BinaryArrayEqualityComparer.cs | 3 +
.../Cache/Affinity/AffinityFunctionBase.cs | 139 ++++++++++++++++++
.../Cache/Configuration/QueryEntity.cs | 8 ++
.../Impl/Binary/Metadata/IBinaryTypeHandler.cs | 2 +-
.../Impl/Cache/Affinity/AffinityFunctionBase.cs | 140 -------------------
.../Impl/Collections/MultiValueDictionary.cs | 2 +-
.../Apache.Ignite.Core/Impl/Common/Future.cs | 3 +-
.../Impl/Common/IFutureConverter.cs | 4 +-
.../Impl/Common/IFutureInternal.cs | 3 +-
.../Impl/Common/LoadedAssembliesResolver.cs | 2 +-
.../Apache.Ignite.Core/Impl/Handle/Handle.cs | 2 +-
.../Impl/Handle/HandleRegistry.cs | 2 +-
.../Apache.Ignite.Core/Impl/Handle/IHandle.cs | 2 +-
.../Impl/Memory/IPlatformMemory.cs | 5 +-
.../Impl/Memory/PlatformMemory.cs | 3 +-
.../Impl/Memory/PlatformMemoryManager.cs | 4 +-
.../Impl/Memory/PlatformMemoryPool.cs | 3 +-
.../Impl/Memory/PlatformMemoryStream.cs | 3 +-
.../Impl/Memory/PlatformRawMemory.cs | 96 -------------
.../Impl/CacheFieldsQueryProvider.cs | 10 +-
25 files changed, 198 insertions(+), 268 deletions(-)
----------------------------------------------------------------------