You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/17 08:21:38 UTC
[16/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor
VisorXxx tasks and DTO for ignite-2.0
IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/12dfe9e8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/12dfe9e8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/12dfe9e8
Branch: refs/heads/ignite-1561-1
Commit: 12dfe9e8767020d9e9083f887717e5e63120880f
Parents: 8b56a43
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Apr 14 20:55:10 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 14 20:55:12 2017 +0700
----------------------------------------------------------------------
.../examples/ScalarCacheAffinityExample.scala | 2 +-
.../ignite/ignite-cassandra-server-template.xml | 6 -
.../tests/ignite-cassandra-client-template.xml | 6 -
.../JettyRestProcessorAbstractSelfTest.java | 12 +-
.../ignite/cache/PartitionLossPolicy.java | 16 +-
.../org/apache/ignite/cache/QueryIndexType.java | 17 +-
.../apache/ignite/internal/LessNamingBean.java | 28 --
.../cache/query/GridCacheSqlIndexMetadata.java | 3 +-
.../cache/query/GridCacheSqlMetadata.java | 3 +-
.../internal/util/IgniteExceptionRegistry.java | 3 +-
.../internal/visor/VisorDataTransferObject.java | 87 ++++++
.../visor/VisorDataTransferObjectInput.java | 156 ++++++++++
.../visor/VisorDataTransferObjectOutput.java | 141 +++++++++
.../ignite/internal/visor/VisorEither.java | 103 +++++++
.../internal/visor/VisorMultiNodeTask.java | 6 +-
.../ignite/internal/visor/VisorOneNodeTask.java | 5 +-
.../internal/visor/VisorTaskArgument.java | 51 +++-
.../visor/binary/VisorBinaryMetadata.java | 139 +++++++++
.../VisorBinaryMetadataCollectorTask.java | 70 +++++
.../VisorBinaryMetadataCollectorTaskResult.java | 87 ++++++
.../visor/binary/VisorBinaryMetadataField.java | 101 +++++++
.../ignite/internal/visor/cache/VisorCache.java | 124 +++++---
.../cache/VisorCacheAffinityConfiguration.java | 91 ++++--
.../visor/cache/VisorCacheAffinityNodeTask.java | 13 +-
.../cache/VisorCacheAffinityNodeTaskArg.java | 86 ++++++
.../cache/VisorCacheAggregatedMetrics.java | 205 ++++++++-----
.../visor/cache/VisorCacheClearTask.java | 100 ++-----
.../visor/cache/VisorCacheClearTaskResult.java | 85 ++++++
.../visor/cache/VisorCacheConfiguration.java | 283 +++++++++++++-----
.../VisorCacheConfigurationCollectorJob.java | 4 +-
.../cache/VisorCacheDefaultConfiguration.java | 58 ----
.../cache/VisorCacheEvictionConfiguration.java | 52 +++-
.../visor/cache/VisorCacheJdbcType.java | 189 ++++++++++++
.../visor/cache/VisorCacheJdbcTypeField.java | 117 ++++++++
.../visor/cache/VisorCacheLoadTask.java | 20 +-
.../visor/cache/VisorCacheLoadTaskArg.java | 101 +++++++
.../visor/cache/VisorCacheMetadataTask.java | 18 +-
.../internal/visor/cache/VisorCacheMetrics.java | 208 +++++++++----
.../cache/VisorCacheMetricsCollectorTask.java | 29 +-
.../VisorCacheMetricsCollectorTaskArg.java | 87 ++++++
.../cache/VisorCacheNearConfiguration.java | 59 ++--
.../visor/cache/VisorCachePartition.java | 57 ++--
.../visor/cache/VisorCachePartitions.java | 43 ++-
.../visor/cache/VisorCachePartitionsTask.java | 7 +-
.../cache/VisorCacheQueryConfiguration.java | 122 --------
.../cache/VisorCacheQueryDetailMetrics.java | 167 -----------
...sorCacheQueryDetailMetricsCollectorTask.java | 146 ---------
.../visor/cache/VisorCacheQueryMetrics.java | 102 -------
.../cache/VisorCacheRebalanceConfiguration.java | 71 +++--
.../VisorCacheResetQueryDetailMetricsTask.java | 71 -----
.../cache/VisorCacheResetQueryMetricsTask.java | 69 -----
.../visor/cache/VisorCacheSqlIndexMetadata.java | 115 ++++++++
.../visor/cache/VisorCacheSqlMetadata.java | 162 ++++++++++
.../visor/cache/VisorCacheStartArg.java | 100 +++++++
.../visor/cache/VisorCacheStartTask.java | 60 +---
.../cache/VisorCacheStoreConfiguration.java | 77 +++--
.../cache/VisorCacheTypeFieldMetadata.java | 92 ------
.../visor/cache/VisorCacheTypeMetadata.java | 294 -------------------
.../internal/visor/cache/VisorPartitionMap.java | 90 ++++++
.../compute/VisorComputeMonitoringHolder.java | 8 +-
.../VisorComputeToggleMonitoringTask.java | 52 ++--
.../VisorComputeToggleMonitoringTaskArg.java | 86 ++++++
.../visor/compute/VisorGatewayTask.java | 4 +-
.../visor/debug/VisorThreadDumpTask.java | 13 +-
.../visor/debug/VisorThreadDumpTaskResult.java | 88 ++++++
.../internal/visor/debug/VisorThreadInfo.java | 234 ++++++++-------
.../visor/debug/VisorThreadLockInfo.java | 51 +++-
.../visor/debug/VisorThreadMonitorInfo.java | 76 +++--
.../visor/event/VisorGridDeploymentEvent.java | 43 ++-
.../visor/event/VisorGridDiscoveryEvent.java | 59 +++-
.../internal/visor/event/VisorGridEvent.java | 66 +++--
.../visor/event/VisorGridEventsLost.java | 15 +-
.../internal/visor/event/VisorGridJobEvent.java | 61 +++-
.../visor/event/VisorGridTaskEvent.java | 61 +++-
.../internal/visor/file/VisorFileBlock.java | 60 +++-
.../internal/visor/file/VisorFileBlockArg.java | 114 +++++++
.../internal/visor/file/VisorFileBlockTask.java | 64 +---
.../visor/file/VisorLatestTextFilesTask.java | 17 +-
.../visor/file/VisorLatestTextFilesTaskArg.java | 86 ++++++
.../ignite/internal/visor/igfs/VisorIgfs.java | 76 +++--
.../internal/visor/igfs/VisorIgfsEndpoint.java | 72 +++--
.../internal/visor/igfs/VisorIgfsMetrics.java | 118 +++++---
.../internal/visor/igfs/VisorIgfsProfiler.java | 24 +-
.../visor/igfs/VisorIgfsProfilerClearTask.java | 11 +-
.../igfs/VisorIgfsProfilerClearTaskResult.java | 85 ++++++
.../visor/igfs/VisorIgfsProfilerEntry.java | 106 +++++--
.../visor/igfs/VisorIgfsProfilerTask.java | 31 +-
.../VisorIgfsProfilerUniformityCounters.java | 38 ++-
.../visor/igfs/VisorIgfsSamplingStateTask.java | 17 +-
.../igfs/VisorIgfsSamplingStateTaskArg.java | 86 ++++++
.../ignite/internal/visor/log/VisorLogFile.java | 43 ++-
.../internal/visor/log/VisorLogSearchArg.java | 114 +++++++
.../visor/log/VisorLogSearchResult.java | 80 +++--
.../internal/visor/log/VisorLogSearchTask.java | 74 +----
.../visor/log/VisorLogSearchTaskResult.java | 92 ++++++
.../visor/node/VisorAtomicConfiguration.java | 49 +++-
.../visor/node/VisorBasicConfiguration.java | 163 ++++++----
.../node/VisorExecutorServiceConfiguration.java | 81 +++--
.../visor/node/VisorGridConfiguration.java | 126 +++++---
.../visor/node/VisorIgfsConfiguration.java | 203 ++++++++-----
.../visor/node/VisorLifecycleConfiguration.java | 39 ++-
.../visor/node/VisorMemoryConfiguration.java | 60 ++--
.../node/VisorMemoryPolicyConfiguration.java | 37 ++-
.../visor/node/VisorMetricsConfiguration.java | 50 +++-
.../VisorNodeConfigurationCollectorJob.java | 4 +-
.../visor/node/VisorNodeDataCollectorJob.java | 63 ++--
.../node/VisorNodeDataCollectorJobResult.java | 109 +++++--
.../visor/node/VisorNodeDataCollectorTask.java | 40 +--
.../node/VisorNodeDataCollectorTaskArg.java | 54 +++-
.../node/VisorNodeDataCollectorTaskResult.java | 110 +++++--
.../node/VisorNodeEventsCollectorTask.java | 133 +--------
.../node/VisorNodeEventsCollectorTaskArg.java | 163 ++++++++++
.../internal/visor/node/VisorNodeGcTask.java | 18 +-
.../visor/node/VisorNodeGcTaskResult.java | 85 ++++++
.../internal/visor/node/VisorNodePingTask.java | 15 +-
.../visor/node/VisorNodePingTaskResult.java | 99 +++++++
.../visor/node/VisorNodeSuppressedErrors.java | 89 ++++++
.../node/VisorNodeSuppressedErrorsTask.java | 23 +-
.../node/VisorPeerToPeerConfiguration.java | 57 ++--
.../visor/node/VisorRestConfiguration.java | 93 +++---
.../node/VisorSegmentationConfiguration.java | 67 +++--
.../visor/node/VisorSpiDescription.java | 89 ++++++
.../visor/node/VisorSpisConfiguration.java | 128 ++++----
.../visor/node/VisorSuppressedError.java | 147 ++++++++++
.../node/VisorTransactionConfiguration.java | 104 +++++--
.../internal/visor/query/VisorQueryArg.java | 65 +++-
.../visor/query/VisorQueryCancelTask.java | 72 +++++
.../visor/query/VisorQueryCleanupTask.java | 6 +-
.../visor/query/VisorQueryConfiguration.java | 142 +++++++++
.../visor/query/VisorQueryDetailMetrics.java | 205 +++++++++++++
.../VisorQueryDetailMetricsCollectorTask.java | 146 +++++++++
.../internal/visor/query/VisorQueryEntity.java | 188 ++++++++++++
.../internal/visor/query/VisorQueryField.java | 42 ++-
.../internal/visor/query/VisorQueryIndex.java | 105 +++++++
.../visor/query/VisorQueryIndexField.java | 106 +++++++
.../internal/visor/query/VisorQueryJob.java | 275 -----------------
.../internal/visor/query/VisorQueryMetrics.java | 125 ++++++++
.../visor/query/VisorQueryNextPageTask.java | 33 ++-
.../visor/query/VisorQueryNextPageTaskArg.java | 86 ++++++
.../query/VisorQueryResetDetailMetricsTask.java | 71 +++++
.../visor/query/VisorQueryResetMetricsTask.java | 69 +++++
.../internal/visor/query/VisorQueryResult.java | 97 +++++-
.../visor/query/VisorQueryResultEx.java | 89 ------
.../visor/query/VisorQueryScanRegexFilter.java | 59 ++++
.../internal/visor/query/VisorQueryTask.java | 120 +++++++-
.../internal/visor/query/VisorQueryUtils.java | 43 ++-
.../query/VisorRunningQueriesCollectorTask.java | 96 ++++++
.../internal/visor/query/VisorRunningQuery.java | 47 ++-
.../internal/visor/query/VisorScanQueryArg.java | 157 ++++++++++
.../visor/query/VisorScanQueryTask.java | 185 ++++++++++++
.../visor/service/VisorServiceDescriptor.java | 31 +-
.../internal/visor/util/VisorTaskUtils.java | 38 ++-
.../plugin/security/SecurityPermissionSet.java | 3 +-
.../ignite/plugin/security/SecuritySubject.java | 3 +-
.../plugin/segmentation/SegmentationPolicy.java | 18 +-
.../resources/META-INF/classnames.properties | 236 +++++++--------
.../resources/META-INF/classnames.properties | 8 -
.../http/jetty/GridJettyObjectMapper.java | 119 ++------
.../commands/cache/VisorCacheClearCommand.scala | 2 +-
.../commands/cache/VisorCacheCommand.scala | 291 +++++++++---------
.../commands/cache/VisorCacheScanCommand.scala | 16 +-
.../config/VisorConfigurationCommand.scala | 183 ++++++------
.../commands/disco/VisorDiscoveryCommand.scala | 22 +-
.../commands/events/VisorEventsCommand.scala | 30 +-
.../visor/commands/gc/VisorGcCommand.scala | 4 +-
.../commands/tasks/VisorTasksCommand.scala | 61 ++--
.../scala/org/apache/ignite/visor/visor.scala | 34 +--
modules/web-console/backend/app/agent.js | 98 +++----
modules/web-console/backend/app/browser.js | 76 +++--
modules/web-console/backend/app/mongo.js | 21 +-
.../frontend/app/modules/agent/agent.module.js | 41 ++-
.../generator/AbstractTransformer.js | 5 -
.../generator/ConfigurationGenerator.js | 44 +--
.../generator/JavaTransformer.service.js | 3 +
.../generator/PlatformGenerator.js | 10 +-
.../defaults/Cache.platform.service.js | 5 -
.../generator/defaults/Cache.service.js | 10 +-
.../generator/defaults/Cluster.service.js | 1 -
.../generator/defaults/IGFS.service.js | 2 +-
.../frontend/app/modules/sql/sql.controller.js | 56 ++--
.../states/configuration/caches/affinity.pug | 2 +-
.../states/configuration/caches/general.pug | 25 ++
.../states/configuration/caches/memory.pug | 64 +---
.../states/configuration/caches/query.pug | 3 +
.../states/configuration/clusters/events.pug | 6 +-
.../configuration/clusters/marshaller.pug | 6 -
.../states/configuration/clusters/swap.pug | 72 -----
.../modules/states/configuration/igfs/misc.pug | 2 +-
.../frontend/controllers/caches-controller.js | 29 --
.../frontend/controllers/clusters-controller.js | 38 ---
.../views/configuration/clusters.tpl.pug | 1 -
.../ignite/console/demo/AgentClusterDemo.java | 2 +
.../src/main/resources/log4j.properties | 1 -
193 files changed, 9599 insertions(+), 4391 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
index 40b947d..fc06fbb 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
@@ -88,7 +88,7 @@ object ScalarCacheAffinityExample extends App {
val keys = (0 until KEY_CNT).toSeq
// Map all keys to nodes.
- val mappings = ignite$.cluster().mapKeysToNodes(NAME, keys)
+ val mappings = ignite$.affinity(NAME).mapKeysToNodes(keys)
mappings.foreach(mapping => {
val node = mapping._1
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml b/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
index 03b3346..01000d2 100644
--- a/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
+++ b/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
@@ -118,8 +118,6 @@
<property name="startSize" value="1000000"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="0"/>
- <property name="offHeapMaxMemory" value="0"/>
- <property name="swapEnabled" value="false"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
@@ -137,8 +135,6 @@
<property name="startSize" value="1000000"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="0"/>
- <property name="offHeapMaxMemory" value="0"/>
- <property name="swapEnabled" value="false"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
@@ -156,8 +152,6 @@
<property name="startSize" value="1000000"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="0"/>
- <property name="offHeapMaxMemory" value="0"/>
- <property name="swapEnabled" value="false"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml b/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
index 77ffb9e..c5a9c9a 100644
--- a/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
+++ b/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
@@ -121,8 +121,6 @@
<property name="startSize" value="1000000"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="0"/>
- <property name="offHeapMaxMemory" value="0"/>
- <property name="swapEnabled" value="false"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
@@ -140,8 +138,6 @@
<property name="startSize" value="1000000"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="0"/>
- <property name="offHeapMaxMemory" value="0"/>
- <property name="swapEnabled" value="false"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
@@ -159,8 +155,6 @@
<property name="startSize" value="1000000"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="0"/>
- <property name="offHeapMaxMemory" value="0"/>
- <property name="swapEnabled" value="false"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index a71737f..e2dddd1 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -70,6 +70,7 @@ import org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask;
import org.apache.ignite.internal.visor.cache.VisorCacheNodesTask;
import org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask;
import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask;
+import org.apache.ignite.internal.visor.cache.VisorCacheStartArg;
import org.apache.ignite.internal.visor.cache.VisorCacheStartTask;
import org.apache.ignite.internal.visor.cache.VisorCacheStopTask;
import org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask;
@@ -77,6 +78,7 @@ import org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask;
import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask;
import org.apache.ignite.internal.visor.compute.VisorGatewayTask;
import org.apache.ignite.internal.visor.debug.VisorThreadDumpTask;
+import org.apache.ignite.internal.visor.file.VisorFileBlockArg;
import org.apache.ignite.internal.visor.file.VisorFileBlockTask;
import org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask;
@@ -84,6 +86,7 @@ import org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask;
+import org.apache.ignite.internal.visor.log.VisorLogSearchArg;
import org.apache.ignite.internal.visor.log.VisorLogSearchTask;
import org.apache.ignite.internal.visor.misc.VisorAckTask;
import org.apache.ignite.internal.visor.misc.VisorLatestVersionTask;
@@ -92,6 +95,7 @@ import org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask
import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTask;
import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskArg;
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask;
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg;
import org.apache.ignite.internal.visor.node.VisorNodeGcTask;
import org.apache.ignite.internal.visor.node.VisorNodePingTask;
import org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask;
@@ -1373,7 +1377,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
ret = content(new VisorGatewayArgument(VisorFileBlockTask.class)
.forNode(locNode)
- .argument(VisorFileBlockTask.VisorFileBlockArg.class, "", 0L, 1, 0L));
+ .argument(VisorFileBlockArg.class, "", 0L, 1, 0L));
info("VisorFileBlockTask result: " + ret);
@@ -1456,7 +1460,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jsonTaskResult(ret);
ret = content(new VisorGatewayArgument(VisorLogSearchTask.class)
- .argument(VisorLogSearchTask.VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
+ .argument(VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
info("VisorLogSearchTask result: " + ret);
@@ -1476,7 +1480,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jsonTaskResult(ret);
ret = content(new VisorGatewayArgument(VisorNodeEventsCollectorTask.class)
- .argument(VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg.class,
+ .argument(VisorNodeEventsCollectorTaskArg.class,
"null", "null", "null", "taskName", "null"));
info("VisorNodeEventsCollectorTask result: " + ret);
@@ -1526,7 +1530,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
"</beans>";
ret = content(new VisorGatewayArgument(VisorCacheStartTask.class)
- .argument(VisorCacheStartTask.VisorCacheStartArg.class, false, "person2",
+ .argument(VisorCacheStartArg.class, false, "person2",
URLEncoder.encode(START_CACHE, CHARSET)));
info("VisorCacheStartTask result: " + ret);
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
index 1391e70..16608a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
@@ -19,6 +19,7 @@ package org.apache.ignite.cache;
import java.util.Collection;
import org.apache.ignite.Ignite;
+import org.jetbrains.annotations.Nullable;
/**
* Partition loss policy. Defines how cache will behave in a case when one or more partitions are lost
@@ -62,5 +63,18 @@ public enum PartitionLossPolicy {
* a previously lost and not cleared partition is undefined and may be different on different nodes in the
* cluster.
*/
- IGNORE
+ IGNORE;
+
+ /** Enumerated values. */
+ private static final PartitionLossPolicy[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static PartitionLossPolicy fromOrdinal(byte ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
index f9b544d..9d2851d 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
@@ -17,6 +17,8 @@
package org.apache.ignite.cache;
+import org.jetbrains.annotations.Nullable;
+
/**
* Index type.
*/
@@ -34,5 +36,18 @@ public enum QueryIndexType {
/**
* Geo-spatial index.
*/
- GEOSPATIAL
+ GEOSPATIAL;
+
+ /** Enum values. */
+ private static final QueryIndexType[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value.
+ */
+ @Nullable public static QueryIndexType fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java b/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
deleted file mode 100644
index 3b885f9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
+++ /dev/null
@@ -1,28 +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;
-
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-
-/**
- * Marker interface for beans with less naming conventions i.e., without "get" and "set" prefixes.
- */
-@GridToStringExclude
-public interface LessNamingBean {
- // No-op.
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
index 94602f7..539a156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.query;
import java.io.Externalizable;
import java.util.Collection;
-import org.apache.ignite.internal.LessNamingBean;
/**
* Ignite index descriptor.
@@ -28,7 +27,7 @@ import org.apache.ignite.internal.LessNamingBean;
* {@link GridCacheSqlMetadata#indexes(String)} method.
* @see GridCacheSqlMetadata
*/
-public interface GridCacheSqlIndexMetadata extends Externalizable, LessNamingBean {
+public interface GridCacheSqlIndexMetadata extends Externalizable {
/**
* Gets name of the index.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
index c82d2cb..724962e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.query;
import java.io.Externalizable;
import java.util.Collection;
import java.util.Map;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.spi.indexing.IndexingSpi;
import org.jetbrains.annotations.Nullable;
@@ -31,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
* can be used to gather information about what can
* be queried using Ignite cache queries feature.
*/
-public interface GridCacheSqlMetadata extends Externalizable, LessNamingBean {
+public interface GridCacheSqlMetadata extends Externalizable {
/**
* Cache name.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index b7bb07e..03eaaea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -157,7 +156,7 @@ public class IgniteExceptionRegistry {
* Detailed info about suppressed error.
*/
@SuppressWarnings("PublicInnerClass")
- public static class ExceptionInfo implements Serializable, LessNamingBean {
+ public static class ExceptionInfo implements Serializable {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
new file mode 100644
index 0000000..d8dcf4e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+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.List;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Base class for data transfer objects.
+ */
+public abstract class VisorDataTransferObject implements Externalizable {
+ /**
+ * @param col Source collection.
+ * @param <T> Collection type.
+ * @return List based on passed collection.
+ */
+ @Nullable protected static <T> List<T> toList(Collection<T> col) {
+ if (col != null)
+ return new ArrayList<>(col);
+
+ return null;
+ }
+
+ /**
+ * @return Transfer object version.
+ */
+ public byte getProtocolVersion() {
+ return 1;
+ }
+
+ /**
+ * Save object's specific data content.
+ *
+ * @param out Output object to write data content.
+ * @throws IOException If I/O errors occur.
+ */
+ protected abstract void writeExternalData(ObjectOutput out) throws IOException;
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeByte(getProtocolVersion());
+
+ try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+ writeExternalData(dtout);
+ }
+ }
+
+ /**
+ * Load object's specific data content.
+ *
+ * @param protoVer Input object version.
+ * @param in Input object to load data content.
+ * @throws IOException If I/O errors occur.
+ * @throws ClassNotFoundException If the class for an object being restored cannot be found.
+ */
+ protected abstract void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException;
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ byte ver = in.readByte();
+
+ try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+ readExternalData(ver, dtin);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java
new file mode 100644
index 0000000..16e9330
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java
@@ -0,0 +1,156 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayInputStream;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Wrapper for object input.
+ */
+public class VisorDataTransferObjectInput implements ObjectInput {
+ /** */
+ private final ObjectInputStream ois;
+
+ /**
+ * @param in Target input.
+ * @throws IOException If an I/O error occurs.
+ */
+ public VisorDataTransferObjectInput(ObjectInput in) throws IOException {
+ byte[] buf = U.readByteArray(in);
+
+ /* */
+ GridByteArrayInputStream bis = new GridByteArrayInputStream(buf);
+ ois = new ObjectInputStream(bis);
+ }
+
+
+ /** {@inheritDoc} */
+ @Override public Object readObject() throws ClassNotFoundException, IOException {
+ return ois.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int read() throws IOException {
+ return ois.read();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int read(byte[] b) throws IOException {
+ return ois.read(b);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int read(byte[] b, int off, int len) throws IOException {
+ return ois.read(b, off, len);
+ }
+
+ /** {@inheritDoc} */
+ @Override public long skip(long n) throws IOException {
+ return ois.skip(n);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int available() throws IOException {
+ return ois.available();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close() throws IOException {
+ ois.close();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readFully(@NotNull byte[] b) throws IOException {
+ ois.readFully(b);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readFully(@NotNull byte[] b, int off, int len) throws IOException {
+ ois.readFully(b, off, len);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int skipBytes(int n) throws IOException {
+ return ois.skipBytes(n);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readBoolean() throws IOException {
+ return ois.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte readByte() throws IOException {
+ return ois.readByte();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int readUnsignedByte() throws IOException {
+ return ois.readUnsignedByte();
+ }
+
+ /** {@inheritDoc} */
+ @Override public short readShort() throws IOException {
+ return ois.readShort();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int readUnsignedShort() throws IOException {
+ return ois.readUnsignedShort();
+ }
+
+ /** {@inheritDoc} */
+ @Override public char readChar() throws IOException {
+ return ois.readChar();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int readInt() throws IOException {
+ return ois.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long readLong() throws IOException {
+ return ois.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float readFloat() throws IOException {
+ return ois.readFloat();
+ }
+
+ /** {@inheritDoc} */
+ @Override public double readDouble() throws IOException {
+ return ois.readDouble();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String readLine() throws IOException {
+ return ois.readLine();
+ }
+
+ /** {@inheritDoc} */
+ @NotNull @Override public String readUTF() throws IOException {
+ return ois.readUTF();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java
new file mode 100644
index 0000000..7fa772e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java
@@ -0,0 +1,141 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Wrapper for object output.
+ */
+public class VisorDataTransferObjectOutput implements ObjectOutput {
+ /** */
+ private final ObjectOutput out;
+
+ /** */
+ private final GridByteArrayOutputStream bos;
+
+ /** */
+ private final ObjectOutputStream oos;
+
+ /**
+ * Constructor.
+ *
+ * @param out Target stream.
+ * @throws IOException If an I/O error occurs.
+ */
+ public VisorDataTransferObjectOutput(ObjectOutput out) throws IOException {
+ this.out = out;
+
+ bos = new GridByteArrayOutputStream();
+ oos = new ObjectOutputStream(bos);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeObject(Object obj) throws IOException {
+ oos.writeObject(obj);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(int b) throws IOException {
+ oos.write(b);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(byte[] b) throws IOException {
+ oos.write(b);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(byte[] b, int off, int len) throws IOException {
+ oos.write(b, off, len);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBoolean(boolean v) throws IOException {
+ oos.writeBoolean(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeByte(int v) throws IOException {
+ oos.writeByte(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeShort(int v) throws IOException {
+ oos.writeShort(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeChar(int v) throws IOException {
+ oos.writeChar(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeInt(int v) throws IOException {
+ oos.writeInt(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeLong(long v) throws IOException {
+ oos.writeLong(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeFloat(float v) throws IOException {
+ oos.writeFloat(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDouble(double v) throws IOException {
+ oos.writeDouble(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBytes(@NotNull String s) throws IOException {
+ oos.writeBytes(s);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeChars(@NotNull String s) throws IOException {
+ oos.writeChars(s);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeUTF(@NotNull String s) throws IOException {
+ oos.writeUTF(s);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void flush() throws IOException {
+ oos.flush();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close() throws IOException {
+ oos.flush();
+
+ U.writeByteArray(out, bos.internalArray(), bos.size());
+
+ oos.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java
new file mode 100644
index 0000000..f426e8a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java
@@ -0,0 +1,103 @@
+/*
+ * 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;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Base class for Visor result with error.
+ *
+ * @param <T> Result type.
+ */
+public class VisorEither<T> implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Exception on execution. */
+ private Throwable error;
+
+ /** Result. */
+ private T res;
+
+ /**
+ * Default constructor.
+ */
+ public VisorEither() {
+ // No-op.
+ }
+
+ /**
+ * @param error Exception on execution.
+ */
+ public VisorEither(Throwable error) {
+ this.error = error;
+ }
+
+ /**
+ * @param res Result.
+ */
+ public VisorEither(T res) {
+ this.res = res;
+ }
+
+ /**
+ * @return {@code true} If failed on execution.
+ */
+ public boolean failed() {
+ return error != null;
+ }
+
+ /**
+ * @return Exception on execution.
+ */
+ public Throwable getError() {
+ return error;
+ }
+
+ /**
+ * @return Result.
+ */
+ public T getResult() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ boolean failed = failed();
+
+ out.writeBoolean(failed);
+ out.writeObject(failed ? error : res);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ if (in.readBoolean())
+ error = (Throwable)in.readObject();
+ else
+ res = (T)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorEither.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
index ece1a17..563a236 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
@@ -69,9 +69,9 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
start = U.currentTimeMillis();
- debug = arg.debug();
+ debug = arg.isDebug();
- taskArg = arg.argument();
+ taskArg = arg.getArgument();
if (debug)
logStart(ignite.log(), getClass(), start);
@@ -88,7 +88,7 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
* @throws IgniteException If mapping could not complete successfully.
*/
protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode> subgrid, VisorTaskArgument<A> arg) {
- Collection<UUID> nodeIds = arg.nodes();
+ Collection<UUID> nodeIds = arg.getNodes();
Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
index e4880a8..e992875 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor;
import java.util.List;
import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.util.typedef.F;
import org.jetbrains.annotations.Nullable;
/**
@@ -30,11 +29,11 @@ public abstract class VisorOneNodeTask<A, R> extends VisorMultiNodeTask<A, R, R>
@Nullable @Override protected R reduce0(List<ComputeJobResult> results) {
assert results.size() == 1;
- ComputeJobResult res = F.first(results);
+ ComputeJobResult res = results.get(0);
if (res.getException() == null)
return res.getData();
throw res.getException();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
index b28ebbe..05d999d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
@@ -17,26 +17,38 @@
package org.apache.ignite.internal.visor;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Visor tasks argument.
*/
-public class VisorTaskArgument<A> implements Serializable {
+public class VisorTaskArgument<A> extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Node IDs task should be mapped to. */
- private final Collection<UUID> nodes;
+ private List<UUID> nodes;
/** Task argument. */
- private final A arg;
+ private A arg;
/** Debug flag. */
- private final boolean debug;
+ private boolean debug;
+
+ /**
+ * Default constructor.
+ */
+ public VisorTaskArgument() {
+ // No-op.
+ }
/**
* Create Visor task argument.
@@ -49,7 +61,7 @@ public class VisorTaskArgument<A> implements Serializable {
assert nodes != null;
assert !nodes.isEmpty();
- this.nodes = nodes;
+ this.nodes = toList(nodes);
this.arg = arg;
this.debug = debug;
}
@@ -72,7 +84,7 @@ public class VisorTaskArgument<A> implements Serializable {
* @param debug Debug flag.
*/
public VisorTaskArgument(UUID node, A arg, boolean debug) {
- this(Collections.singleton(node), arg, debug);
+ this(Collections.singletonList(node), arg, debug);
}
/**
@@ -88,21 +100,40 @@ public class VisorTaskArgument<A> implements Serializable {
/**
* @return Node IDs task should be mapped to.
*/
- public Collection<UUID> nodes() {
+ public List<UUID> getNodes() {
return nodes;
}
/**
* @return Task argument.
*/
- public A argument() {
+ public A getArgument() {
return arg;
}
/**
* @return Debug flag.
*/
- public boolean debug() {
+ public boolean isDebug() {
return debug;
}
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, nodes);
+ out.writeObject(arg);
+ out.writeBoolean(debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ nodes = U.readList(in);
+ arg = (A)in.readObject();
+ debug = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorTaskArgument.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
new file mode 100644
index 0000000..5e948c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
@@ -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.
+ */
+
+package org.apache.ignite.internal.visor.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary object metadata to show in Visor.
+ */
+public class VisorBinaryMetadata extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Type name */
+ private String typeName;
+
+ /** Type Id */
+ private Integer typeId;
+
+ /** Affinity key field name. */
+ private String affinityKeyFieldName;
+
+ /** Filed list */
+ private List<VisorBinaryMetadataField> fields;
+
+ /**
+ * @param binary Binary objects.
+ * @return List of data transfer objects for binary objects metadata.
+ */
+ public static List<VisorBinaryMetadata> list(IgniteBinary binary) {
+ List<VisorBinaryMetadata> res = new ArrayList<>();
+
+ if (binary != null) {
+ for (BinaryType binaryType : binary.types())
+ res.add(new VisorBinaryMetadata(binary, binaryType));
+ }
+
+ return res;
+ }
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadata() {
+ // No-op.
+ }
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadata(IgniteBinary binary, BinaryType binaryType) {
+ typeName = binaryType.typeName();
+ typeId = binary.typeId(typeName);
+ affinityKeyFieldName = binaryType.affinityKeyFieldName();
+
+ Collection<String> binaryTypeFields = binaryType.fieldNames();
+
+ fields = new ArrayList<>(binaryTypeFields.size());
+
+ for (String metaField : binaryTypeFields)
+ fields.add(new VisorBinaryMetadataField(metaField, binaryType.fieldTypeName(metaField), null));
+ }
+
+ /**
+ * @return Type name.
+ */
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
+ * @return Type Id.
+ */
+ public Integer getTypeId() {
+ return typeId;
+ }
+
+ /**
+ * @return Fields list.
+ */
+ public Collection<VisorBinaryMetadataField> getFields() {
+ return fields;
+ }
+
+ /**
+ * @return Affinity key field name.
+ */
+ @Nullable public String getAffinityKeyFieldName() {
+ return affinityKeyFieldName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, typeName);
+ out.writeObject(typeId);
+ U.writeString(out, affinityKeyFieldName);
+ U.writeCollection(out, fields);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer,
+ ObjectInput in) throws IOException, ClassNotFoundException {
+ typeName = U.readString(in);
+ typeId = (Integer)in.readObject();
+ affinityKeyFieldName = U.readString(in);
+ fields = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryMetadata.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
new file mode 100644
index 0000000..de67805
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
@@ -0,0 +1,70 @@
+/*
+ * 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.binary;
+
+import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.marshaller.Marshaller;
+
+/**
+ * Task that collects binary metadata.
+ */
+@GridInternal
+public class VisorBinaryMetadataCollectorTask extends VisorOneNodeTask<Long, VisorBinaryMetadataCollectorTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorBinaryCollectMetadataJob job(Long lastUpdate) {
+ return new VisorBinaryCollectMetadataJob(lastUpdate, debug);
+ }
+
+ /** Job that collect portables metadata on node. */
+ private static class VisorBinaryCollectMetadataJob extends VisorJob<Long, VisorBinaryMetadataCollectorTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with given argument.
+ *
+ * @param lastUpdate Time data was collected last time.
+ * @param debug Debug flag.
+ */
+ private VisorBinaryCollectMetadataJob(Long lastUpdate, boolean debug) {
+ super(lastUpdate, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorBinaryMetadataCollectorTaskResult run(Long lastUpdate) {
+ Marshaller marsh = ignite.configuration().getMarshaller();
+
+ IgniteBinary binary = marsh == null || marsh instanceof BinaryMarshaller ? ignite.binary() : null;
+
+ return new VisorBinaryMetadataCollectorTaskResult(0L, VisorBinaryMetadata.list(binary));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryCollectMetadataJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
new file mode 100644
index 0000000..e96b7ef
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
@@ -0,0 +1,87 @@
+/*
+ * 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.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for {@link VisorBinaryMetadataCollectorTask}
+ */
+public class VisorBinaryMetadataCollectorTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Last binary metadata update date. */
+ private Long lastUpdate;
+
+ /** Remote data center IDs for which full state transfer was requested. */
+ private List<VisorBinaryMetadata> binary;
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadataCollectorTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param lastUpdate Last binary metadata update date.
+ * @param binary Remote data center IDs for which full state transfer was requested.
+ */
+ public VisorBinaryMetadataCollectorTaskResult(Long lastUpdate, List<VisorBinaryMetadata> binary) {
+ this.lastUpdate = lastUpdate;
+ this.binary = binary;
+ }
+
+ /**
+ * @return Last binary metadata update date.
+ */
+ public Long getLastUpdate() {
+ return lastUpdate;
+ }
+
+ /**
+ * @return Remote data center IDs for which full state transfer was requested.
+ */
+ public List<VisorBinaryMetadata> getBinary() {
+ return binary;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(lastUpdate);
+ U.writeCollection(out, binary);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ lastUpdate = in.readLong();
+ binary = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryMetadataCollectorTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
new file mode 100644
index 0000000..69c880c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
@@ -0,0 +1,101 @@
+/*
+ * 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.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary object metadata field information.
+ */
+public class VisorBinaryMetadataField extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Field name. */
+ private String fieldName;
+
+ /** Field type name. */
+ private String fieldTypeName;
+
+ /** Field id. */
+ private Integer fieldId;
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadataField() {
+ // No-op.
+ }
+
+ /**
+ * @param fieldName Field name.
+ * @param fieldTypeName Field type name.
+ * @param fieldId Field id.
+ */
+ public VisorBinaryMetadataField(String fieldName, String fieldTypeName, Integer fieldId) {
+ this.fieldName = fieldName;
+ this.fieldTypeName = fieldTypeName;
+ this.fieldId = fieldId;
+ }
+
+ /**
+ * @return Field name.
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * @return Field type name.
+ */
+ @Nullable public String getFieldTypeName() {
+ return fieldTypeName;
+ }
+
+ /**
+ * @return Field id.
+ */
+ public Integer getFieldId() {
+ return fieldId;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, fieldName);
+ U.writeString(out, fieldTypeName);
+ out.writeObject(fieldId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ fieldName = U.readString(in);
+ fieldTypeName = U.readString(in);
+ fieldId = (Integer)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryMetadataField.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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 f239ed9..4a35795 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
@@ -17,37 +17,36 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
-import java.util.Iterator;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
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.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
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.near.GridNearCacheAdapter;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
/**
* Data transfer object for {@link IgniteCache}.
*/
-public class VisorCache implements Serializable, LessNamingBean {
+public class VisorCache extends VisorDataTransferObject {
/** */
- private static final CachePeekMode[] PEEK_NO_NEAR =
- new CachePeekMode[] {CachePeekMode.PRIMARY, CachePeekMode.BACKUP};
+ private static final long serialVersionUID = 0L;
/** */
- private static final long serialVersionUID = 0L;
+ private static final CachePeekMode[] PEEK_NO_NEAR =
+ new CachePeekMode[] {CachePeekMode.PRIMARY, CachePeekMode.BACKUP};
/** Default cache size sampling. */
private static final int DFLT_CACHE_SIZE_SAMPLING = 10;
@@ -92,28 +91,29 @@ public class VisorCache implements Serializable, LessNamingBean {
private VisorCacheMetrics metrics;
/** Cache partitions states. */
- private GridDhtPartitionMap partitionsMap;
+ private VisorPartitionMap parts;
+
+ /**
+ * Create data transfer object for given cache.
+ */
+ public VisorCache() {
+ // No-op.
+ }
/**
- * @param ignite Grid.
- * @param cacheName Cache name.
+ * Create data transfer object for given cache.
+ *
+ * @param ca Internal cache.
* @param sample Sample size.
- * @return Data transfer object for given cache.
* @throws IgniteCheckedException If failed to create data transfer object.
*/
- public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
- assert ignite != null;
-
- GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
+ public VisorCache(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
+ assert ca != null;
- // Cache was not started.
- if (ca == null || !ca.context().started())
- return null;
+ name = ca.name();
GridCacheContext cctx = ca.context();
- name = cacheName;
-
CacheConfiguration cfg = ca.configuration();
mode = cfg.getCacheMode();
@@ -133,7 +133,7 @@ public class VisorCache implements Serializable, LessNamingBean {
GridDhtPartitionTopology top = dca.topology();
if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0)
- partitionsMap = top.localPartitionMap();
+ parts = new VisorPartitionMap(top.localPartitionMap());
}
}
@@ -144,23 +144,19 @@ public class VisorCache implements Serializable, LessNamingBean {
nearSize = ca.nearSize();
onHeapEntriesCnt = 0; // TODO GG-11148 Need to rename on ON-heap entries count, see
partitions = ca.affinity().partitions();
- metrics = new VisorCacheMetrics().from(ignite, cacheName);
+ metrics = new VisorCacheMetrics(ignite, name); // TODO: GG-11683 Move to separate thing
near = cctx.isNear();
estimateMemorySize(ignite, ca, sample);
-
- return this;
}
/**
* Estimate memory size used by cache.
*
- * @param ignite Ignite.
* @param ca Cache adapter.
* @param sample Sample size.
- * @throws IgniteCheckedException If estimation failed.
*/
- protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
+ protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) {
/* TODO Fix after GG-11739 implemented.
int size = ca.size();
@@ -215,7 +211,7 @@ public class VisorCache implements Serializable, LessNamingBean {
/**
* @return Cache name.
*/
- public String name() {
+ public String getName() {
return name;
}
@@ -224,102 +220,138 @@ public class VisorCache implements Serializable, LessNamingBean {
*
* @param name New cache name.
*/
- public void name(String name) {
+ public void setName(String name) {
this.name = name;
}
/**
* @return Dynamic deployment ID.
*/
- public IgniteUuid dynamicDeploymentId() {
+ public IgniteUuid getDynamicDeploymentId() {
return dynamicDeploymentId;
}
/**
* @return Cache mode.
*/
- public CacheMode mode() {
+ public CacheMode getMode() {
return mode;
}
/**
* @return Cache size in bytes.
*/
- public long memorySize() {
+ public long getMemorySize() {
return memorySize;
}
/**
* @return Indexes size in bytes.
*/
- public long indexesSize() {
+ public long getIndexesSize() {
return indexesSize;
}
/**
* @return Number of all entries in cache.
*/
- public long size() {
+ public long getSize() {
return size;
}
/**
* @return Number of all entries in near cache.
*/
- public int nearSize() {
+ public int getNearSize() {
return nearSize;
}
/**
* @return Number of backup entries in cache.
*/
- public long backupSize() {
+ public long getBackupSize() {
return backupSize;
}
/**
* @return Number of primary entries in cache.
*/
- public long primarySize() {
+ public long getPrimarySize() {
return primarySize;
}
/**
* @return Number of cache entries stored in heap memory.
*/
- public long onHeapEntriesCount() {
+ public long getOnHeapEntriesCount() {
return onHeapEntriesCnt;
}
/**
* @return Number of partitions.
*/
- public int partitions() {
+ public int getPartitions() {
return partitions;
}
/**
* @return Cache metrics.
*/
- public VisorCacheMetrics metrics() {
+ public VisorCacheMetrics getMetrics() {
return metrics;
}
/**
* @return Cache partitions states.
*/
- @Nullable public GridDhtPartitionMap partitionMap() {
- return partitionsMap;
+ @Nullable public VisorPartitionMap getPartitionMap() {
+ return parts;
}
/**
* @return {@code true} if cache has near cache.
*/
- public boolean near() {
+ public boolean isNear() {
return near;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ U.writeGridUuid(out, dynamicDeploymentId);
+ U.writeEnum(out, mode);
+ out.writeLong(memorySize);
+ out.writeLong(indexesSize);
+ out.writeLong(size);
+ out.writeInt(nearSize);
+ out.writeLong(primarySize);
+ out.writeLong(backupSize);
+ out.writeLong(onHeapEntriesCnt);
+ out.writeInt(partitions);
+ out.writeBoolean(near);
+ out.writeObject(metrics);
+ out.writeObject(parts);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ dynamicDeploymentId = U.readGridUuid(in);
+ mode = CacheMode.fromOrdinal(in.readByte());
+ memorySize = in.readLong();
+ indexesSize = in.readLong();
+ size = in.readLong();
+ nearSize = in.readInt();
+ primarySize = in.readLong();
+ backupSize = in.readLong();
+ onHeapEntriesCnt = in.readLong();
+ partitions = in.readInt();
+ near = in.readBoolean();
+ metrics = (VisorCacheMetrics)in.readObject();
+ parts = (VisorPartitionMap)in.readObject();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCache.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
index 371a514..d8616d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
@@ -17,20 +17,25 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import org.apache.ignite.cache.affinity.AffinityFunction;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.internal.util.IgniteUtils.findNonPublicMethod;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
/**
* Data transfer object for affinity configuration properties.
*/
-public class VisorCacheAffinityConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheAffinityConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -40,74 +45,98 @@ public class VisorCacheAffinityConfiguration implements Serializable, LessNaming
/** Cache affinity mapper. */
private String mapper;
- /** Count of key backups. */
+ /** Number of backup nodes for one partition. */
private int partitionedBackups;
- /** Cache affinity partitions. */
+ /** Total partition count. */
private Integer partitions;
/** Cache partitioned affinity exclude neighbors. */
- private Boolean excludeNeighbors;
+ private Boolean exclNeighbors;
/**
+ * Default constructor
+ */
+ public VisorCacheAffinityConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for affinity configuration properties.
+ *
* @param ccfg Cache configuration.
- * @return Data transfer object for affinity configuration properties.
*/
- public static VisorCacheAffinityConfiguration from(CacheConfiguration ccfg) {
+ public VisorCacheAffinityConfiguration(CacheConfiguration ccfg) {
AffinityFunction aff = ccfg.getAffinity();
- Boolean excludeNeighbors = null;
+ function = compactClass(aff);
+ mapper = compactClass(ccfg.getAffinityMapper());
+ partitions = aff.partitions();
+ partitionedBackups = ccfg.getBackups();
- if (aff instanceof RendezvousAffinityFunction) {
- RendezvousAffinityFunction hashAffFunc = (RendezvousAffinityFunction)aff;
+ Method mthd = findNonPublicMethod(aff.getClass(), "isExcludeNeighbors");
- excludeNeighbors = hashAffFunc.isExcludeNeighbors();
+ if (mthd != null) {
+ try {
+ exclNeighbors = (Boolean)mthd.invoke(aff);
+ }
+ catch (InvocationTargetException | IllegalAccessException ignored) {
+ // No-op.
+ }
}
-
- VisorCacheAffinityConfiguration cfg = new VisorCacheAffinityConfiguration();
-
- cfg.function = compactClass(aff);
- cfg.mapper = compactClass(ccfg.getAffinityMapper());
- cfg.partitions = aff.partitions();
- cfg.partitionedBackups = ccfg.getBackups();
- cfg.excludeNeighbors = excludeNeighbors;
-
- return cfg;
}
/**
* @return Cache affinity.
*/
- public String function() {
+ public String getFunction() {
return function;
}
/**
* @return Cache affinity mapper.
*/
- public String mapper() {
+ public String getMapper() {
return mapper;
}
/**
- * @return Count of key backups.
+ * @return Number of backup nodes for one partition.
*/
- public int partitionedBackups() {
+ public int getPartitionedBackups() {
return partitionedBackups;
}
/**
- * @return Cache affinity partitions.
+ * @return Total partition count.
*/
- public Integer partitions() {
+ public Integer getPartitions() {
return partitions;
}
/**
* @return Cache partitioned affinity exclude neighbors.
*/
- @Nullable public Boolean excludeNeighbors() {
- return excludeNeighbors;
+ @Nullable public Boolean isExcludeNeighbors() {
+ return exclNeighbors;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, function);
+ U.writeString(out, mapper);
+ out.writeInt(partitionedBackups);
+ out.writeObject(partitions);
+ out.writeObject(exclNeighbors);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ function = U.readString(in);
+ mapper = U.readString(in);
+ partitionedBackups = in.readInt();
+ partitions = (Integer)in.readObject();
+ exclNeighbors = (Boolean)in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
index 83d421a..447cc11 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
@@ -24,24 +24,23 @@ import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
/**
* Task that will find affinity node for key.
*/
@GridInternal
-public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<IgniteBiTuple<String, Object>, UUID> {
+public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<VisorCacheAffinityNodeTaskArg, UUID> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorCacheAffinityNodeJob job(IgniteBiTuple<String, Object> arg) {
+ @Override protected VisorCacheAffinityNodeJob job(VisorCacheAffinityNodeTaskArg arg) {
return new VisorCacheAffinityNodeJob(arg, debug);
}
/** Job that will find affinity node for key. */
- private static class VisorCacheAffinityNodeJob extends VisorJob<IgniteBiTuple<String, Object>, UUID> {
+ private static class VisorCacheAffinityNodeJob extends VisorJob<VisorCacheAffinityNodeTaskArg, UUID> {
/** */
private static final long serialVersionUID = 0L;
@@ -49,15 +48,15 @@ public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<IgniteBiTuple<S
* @param arg Cache name and key to find affinity node.
* @param debug Debug flag.
*/
- private VisorCacheAffinityNodeJob(IgniteBiTuple<String, Object> arg, boolean debug) {
+ private VisorCacheAffinityNodeJob(VisorCacheAffinityNodeTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected UUID run(@Nullable IgniteBiTuple<String, Object> arg) throws IgniteException {
+ @Override protected UUID run(@Nullable VisorCacheAffinityNodeTaskArg arg) throws IgniteException {
assert arg != null;
- ClusterNode node = ignite.affinity(arg.getKey()).mapKeyToNode(arg.getValue());
+ ClusterNode node = ignite.affinity(arg.getCacheName()).mapKeyToNode(arg.getKey());
return node != null ? node.id() : null;
}