From b53f2b842c800b78aa63c438cd7a7140a7eba601 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 2 Dec 2022 15:23:50 +0300 Subject: [PATCH] IGNITE-18301 Removal of visor console (#10411) --- assembly/dependencies-apache-ignite-lgpl.xml | 3 - assembly/dependencies-apache-ignite-slim.xml | 3 - assembly/dependencies-apache-ignite.xml | 3 - assembly/dependencies-visor-console.xml | 132 - assembly/release-apache-ignite-hadoop.xml | 9 - assembly/release-base.xml | 4 - assembly/release-scala.xml | 51 - bin/ignitevisorcmd.bat | 173 -- bin/ignitevisorcmd.sh | 144 - bin/setup-hadoop.bat | 28 - bin/setup-hadoop.sh | 63 - .../visor-cmd/node_startup_by_ssh.sample.ini | 79 - examples/pom.xml | 19 - .../JettyRestProcessorAbstractSelfTest.java | 564 ---- .../plugin/IgniteLogInfoProviderImpl.java | 8 - .../processors/rest/GridRestProcessor.java | 5 - .../visor/VisorCoordinatorNodeTask.java | 39 - .../ignite/internal/visor/VisorEither.java | 103 - .../visor/binary/VisorBinaryMetadata.java | 138 - .../VisorBinaryMetadataCollectorTask.java | 74 - .../VisorBinaryMetadataCollectorTaskArg.java | 71 - ...isorBinaryMetadataCollectorTaskResult.java | 87 - .../binary/VisorBinaryMetadataField.java | 101 - .../internal/visor/cache/VisorCache.java | 341 -- .../cache/VisorCacheAffinityNodeTask.java | 71 - .../cache/VisorCacheAffinityNodeTaskArg.java | 86 - .../cache/VisorCacheAggregatedMetrics.java | 628 ---- .../visor/cache/VisorCacheClearTask.java | 146 - .../visor/cache/VisorCacheClearTaskArg.java | 72 - .../cache/VisorCacheClearTaskResult.java | 85 - .../visor/cache/VisorCacheLoadTask.java | 102 - .../visor/cache/VisorCacheLoadTaskArg.java | 101 - .../cache/VisorCacheLostPartitionsTask.java | 88 - .../VisorCacheLostPartitionsTaskArg.java | 81 - .../VisorCacheLostPartitionsTaskResult.java | 74 - .../visor/cache/VisorCacheMetadataTask.java | 87 - .../cache/VisorCacheMetadataTaskArg.java | 72 - .../visor/cache/VisorCacheMetrics.java | 812 ----- .../cache/VisorCacheMetricsCollectorTask.java | 136 - .../VisorCacheMetricsCollectorTaskArg.java | 87 - .../visor/cache/VisorCacheModifyTask.java | 115 - .../visor/cache/VisorCacheModifyTaskArg.java | 120 - .../cache/VisorCacheModifyTaskResult.java | 101 - .../cache/VisorCacheNamesCollectorTask.java | 90 - .../VisorCacheNamesCollectorTaskResult.java | 88 - .../visor/cache/VisorCacheNodesTask.java | 76 - .../visor/cache/VisorCacheNodesTaskArg.java | 72 - .../visor/cache/VisorCachePartitions.java | 100 - .../visor/cache/VisorCachePartitionsTask.java | 147 - .../cache/VisorCachePartitionsTaskArg.java | 72 - .../visor/cache/VisorCacheRebalanceTask.java | 86 - .../cache/VisorCacheRebalanceTaskArg.java | 73 - .../VisorCacheResetLostPartitionsTask.java | 67 - .../VisorCacheResetLostPartitionsTaskArg.java | 81 - .../cache/VisorCacheResetMetricsTask.java | 69 - .../cache/VisorCacheResetMetricsTaskArg.java | 72 - .../cache/VisorCacheSqlIndexMetadata.java | 115 - .../visor/cache/VisorCacheSqlMetadata.java | 162 - .../visor/cache/VisorCacheStartTask.java | 112 - .../visor/cache/VisorCacheStartTaskArg.java | 100 - .../cache/VisorCacheToggleStatisticsTask.java | 72 - .../VisorCacheToggleStatisticsTaskArg.java | 87 - .../visor/cache/VisorMemoryMetrics.java | 352 --- .../visor/cache/VisorModifyCacheMode.java | 47 - .../visor/cache/VisorPartitionMap.java | 110 - .../compute/VisorComputeMonitoringHolder.java | 121 - .../compute/VisorComputeResetMetricsTask.java | 67 - .../VisorComputeToggleMonitoringTask.java | 112 - .../VisorComputeToggleMonitoringTaskArg.java | 86 - .../visor/compute/VisorGatewayTask.java | 475 --- .../visor/debug/VisorThreadDumpTask.java | 77 - .../debug/VisorThreadDumpTaskResult.java | 88 - .../internal/visor/debug/VisorThreadInfo.java | 348 --- .../visor/debug/VisorThreadLockInfo.java | 93 - .../visor/debug/VisorThreadMonitorInfo.java | 100 - .../visor/event/VisorGridDeploymentEvent.java | 106 - .../visor/event/VisorGridDiscoveryEvent.java | 152 - .../internal/visor/event/VisorGridEvent.java | 162 - .../visor/event/VisorGridEventsLost.java | 54 - .../visor/event/VisorGridJobEvent.java | 151 - .../visor/event/VisorGridTaskEvent.java | 151 - .../internal/visor/file/VisorFileBlock.java | 144 - .../visor/file/VisorFileBlockTask.java | 89 - .../visor/file/VisorFileBlockTaskArg.java | 114 - .../visor/file/VisorFileBlockTaskResult.java | 87 - .../visor/file/VisorLatestTextFilesTask.java | 97 - .../file/VisorLatestTextFilesTaskArg.java | 86 - .../ignite/internal/visor/igfs/VisorIgfs.java | 117 - .../visor/igfs/VisorIgfsEndpoint.java | 134 - .../visor/igfs/VisorIgfsFormatTask.java | 67 - .../visor/igfs/VisorIgfsFormatTaskArg.java | 73 - .../internal/visor/igfs/VisorIgfsMetrics.java | 270 -- .../internal/visor/igfs/VisorIgfsMode.java | 72 - .../visor/igfs/VisorIgfsProfiler.java | 88 - .../igfs/VisorIgfsProfilerClearTask.java | 70 - .../igfs/VisorIgfsProfilerClearTaskArg.java | 73 - .../VisorIgfsProfilerClearTaskResult.java | 86 - .../visor/igfs/VisorIgfsProfilerEntry.java | 284 -- .../visor/igfs/VisorIgfsProfilerTask.java | 71 - .../visor/igfs/VisorIgfsProfilerTaskArg.java | 73 - .../VisorIgfsProfilerUniformityCounters.java | 233 -- .../visor/igfs/VisorIgfsResetMetricsTask.java | 67 - .../igfs/VisorIgfsResetMetricsTaskArg.java | 74 - .../igfs/VisorIgfsSamplingStateTask.java | 67 - .../igfs/VisorIgfsSamplingStateTaskArg.java | 87 - .../internal/visor/log/VisorLogFile.java | 112 - .../visor/log/VisorLogSearchResult.java | 192 -- .../visor/log/VisorLogSearchTask.java | 239 -- .../visor/log/VisorLogSearchTaskArg.java | 114 - .../visor/log/VisorLogSearchTaskResult.java | 92 - .../internal/visor/misc/VisorAckTask.java | 75 - .../internal/visor/misc/VisorAckTaskArg.java | 72 - .../misc/VisorChangeGridActiveStateTask.java | 67 - .../VisorChangeGridActiveStateTaskArg.java | 71 - .../visor/misc/VisorLatestVersionTask.java | 63 - .../internal/visor/misc/VisorNopTask.java | 98 - .../visor/misc/VisorResolveHostNameTask.java | 107 - .../node/VisorAffinityTopologyVersion.java | 87 - .../visor/node/VisorAtomicConfiguration.java | 101 - .../visor/node/VisorBasicConfiguration.java | 551 ---- .../visor/node/VisorBinaryConfiguration.java | 131 - .../node/VisorBinaryTypeConfiguration.java | 150 - .../node/VisorCacheKeyConfiguration.java | 108 - ...VisorCacheRebalanceCollectorJobResult.java | 91 - .../VisorCacheRebalanceCollectorTask.java | 199 -- .../VisorCacheRebalanceCollectorTaskArg.java | 54 - ...isorCacheRebalanceCollectorTaskResult.java | 92 - .../VisorClientConnectorConfiguration.java | 281 -- .../node/VisorDataRegionConfiguration.java | 238 -- .../node/VisorDataStorageConfiguration.java | 478 --- .../node/VisorExecutorConfiguration.java | 108 - .../VisorExecutorServiceConfiguration.java | 269 -- .../visor/node/VisorGridConfiguration.java | 470 --- .../visor/node/VisorHadoopConfiguration.java | 127 - .../visor/node/VisorIgfsConfiguration.java | 320 -- .../node/VisorLifecycleConfiguration.java | 78 - .../visor/node/VisorMemoryConfiguration.java | 167 - .../node/VisorMemoryPolicyConfiguration.java | 159 - .../visor/node/VisorMetricsConfiguration.java | 100 - .../visor/node/VisorMvccConfiguration.java | 94 - .../visor/node/VisorNodeBaselineStatus.java | 47 - .../VisorNodeConfigurationCollectorJob.java | 47 - .../VisorNodeConfigurationCollectorTask.java | 35 - .../visor/node/VisorNodeDataCollectorJob.java | 289 -- .../node/VisorNodeDataCollectorJobResult.java | 335 -- .../node/VisorNodeDataCollectorTask.java | 130 - .../node/VisorNodeDataCollectorTaskArg.java | 238 -- .../VisorNodeDataCollectorTaskResult.java | 346 --- .../node/VisorNodeEventsCollectorTask.java | 220 -- .../node/VisorNodeEventsCollectorTaskArg.java | 163 - .../internal/visor/node/VisorNodeGcTask.java | 102 - .../visor/node/VisorNodeGcTaskResult.java | 85 - .../visor/node/VisorNodePingTask.java | 81 - .../visor/node/VisorNodePingTaskArg.java | 73 - .../visor/node/VisorNodePingTaskResult.java | 99 - .../visor/node/VisorNodeRestartTask.java | 80 - .../visor/node/VisorNodeStopTask.java | 80 - .../visor/node/VisorNodeSuppressedErrors.java | 89 - .../node/VisorNodeSuppressedErrorsTask.java | 110 - .../VisorNodeSuppressedErrorsTaskArg.java | 74 - .../node/VisorPeerToPeerConfiguration.java | 104 - .../VisorPersistentStoreConfiguration.java | 293 -- .../visor/node/VisorRestConfiguration.java | 366 --- .../node/VisorSegmentationConfiguration.java | 144 - .../visor/node/VisorServiceConfiguration.java | 175 -- .../visor/node/VisorSpiDescription.java | 89 - .../visor/node/VisorSpisConfiguration.java | 256 -- .../node/VisorSqlConnectorConfiguration.java | 170 - .../visor/node/VisorSuppressedError.java | 147 - .../node/VisorTransactionConfiguration.java | 159 - .../visor/query/VisorQueryCancelTask.java | 74 - .../visor/query/VisorQueryCancelTaskArg.java | 71 - .../visor/query/VisorQueryCleanupTask.java | 134 - .../visor/query/VisorQueryCleanupTaskArg.java | 75 - .../visor/query/VisorQueryDetailMetrics.java | 205 -- .../VisorQueryDetailMetricsCollectorTask.java | 145 - ...sorQueryDetailMetricsCollectorTaskArg.java | 71 - .../query/VisorQueryFetchFirstPageTask.java | 107 - .../internal/visor/query/VisorQueryField.java | 132 - .../visor/query/VisorQueryHolder.java | 171 - .../visor/query/VisorQueryMetrics.java | 125 - .../visor/query/VisorQueryNextPageTask.java | 91 - .../query/VisorQueryNextPageTaskArg.java | 86 - .../visor/query/VisorQueryPingTask.java | 88 - .../visor/query/VisorQueryPingTaskResult.java | 50 - .../VisorQueryResetDetailMetricsTask.java | 73 - .../query/VisorQueryResetMetricsTask.java | 75 - .../query/VisorQueryResetMetricsTaskArg.java | 72 - .../visor/query/VisorQueryResult.java | 152 - .../query/VisorQueryScanRegexFilter.java | 60 - .../internal/visor/query/VisorQueryTask.java | 91 - .../visor/query/VisorQueryTaskArg.java | 249 -- .../internal/visor/query/VisorQueryUtils.java | 519 ---- .../VisorRunningQueriesCollectorTask.java | 101 - .../VisorRunningQueriesCollectorTaskArg.java | 71 - .../visor/query/VisorRunningQuery.java | 175 -- .../visor/query/VisorScanQueryTask.java | 83 - .../visor/query/VisorScanQueryTaskArg.java | 157 - .../visor/service/VisorServiceDescriptor.java | 166 - .../visor/service/VisorServiceTask.java | 77 - .../internal/visor/util/VisorEventMapper.java | 147 - .../internal/visor/util/VisorMimeTypes.java | 1019 ------ .../internal/visor/util/VisorTaskUtils.java | 920 ------ .../visor/verify/VisorIdleAnalyzeTask.java | 124 - .../visor/verify/VisorIdleAnalyzeTaskArg.java | 88 - .../verify/VisorIdleAnalyzeTaskResult.java | 76 - .../resources/META-INF/classnames.properties | 899 +++--- ...ConfigurationCustomSerializerSelfTest.java | 10 +- .../CacheGroupsMetricsRebalanceTest.java | 17 - ...ridInternalTasksLoadBalancingSelfTest.java | 23 - modules/visor-console-2.10/README.txt | 4 - modules/visor-console-2.10/pom.xml | 180 -- modules/visor-console/licenses/apache-2.0.txt | 202 -- modules/visor-console/pom.xml | 170 - .../ignite/visor/commands/VisorConsole.scala | 473 --- .../visor/commands/ack/VisorAckCommand.scala | 143 - .../commands/alert/VisorAlertCommand.scala | 938 ------ .../cache/VisorCacheClearCommand.scala | 131 - .../commands/cache/VisorCacheCommand.scala | 1032 ------- .../VisorCacheLostPartitionsCommand.scala | 170 - .../cache/VisorCacheModifyCommand.scala | 413 --- .../cache/VisorCacheRebalanceCommand.scala | 134 - .../cache/VisorCacheResetCommand.scala | 129 - ...VisorCacheResetLostPartitionsCommand.scala | 132 - .../cache/VisorCacheScanCommand.scala | 237 -- .../cache/VisorCacheStopCommand.scala | 136 - .../VisorCacheToggleStatisticsCommand.scala | 152 - .../commands/common/VisorConsoleCommand.scala | 104 - .../commands/common/VisorTextTable.scala | 541 ---- .../config/VisorConfigurationCommand.scala | 461 --- .../commands/deploy/VisorDeployCommand.scala | 582 ---- .../disco/VisorDiscoveryCommand.scala | 301 -- .../commands/events/VisorEventsCommand.scala | 474 --- .../visor/commands/gc/VisorGcCommand.scala | 196 -- .../commands/kill/VisorKillCommand.scala | 431 --- .../commands/node/VisorNodeCommand.scala | 379 --- .../commands/open/VisorOpenCommand.scala | 307 -- .../commands/ping/VisorPingCommand.scala | 217 -- .../commands/start/VisorStartCommand.scala | 425 --- .../commands/tasks/VisorTasksCommand.scala | 1445 --------- .../commands/top/VisorTopologyCommand.scala | 449 --- .../visor/commands/vvm/VisorVvmCommand.scala | 301 -- .../scala/org/apache/ignite/visor/visor.scala | 2747 ----------------- .../ignite/visor/VisorRuntimeBaseSpec.scala | 82 - .../ignite/visor/VisorTextTableSpec.scala | 45 - .../visor/commands/VisorArgListSpec.scala | 72 - .../commands/VisorFileNameCompleterSpec.scala | 58 - .../commands/ack/VisorAckCommandSpec.scala | 40 - .../alert/VisorAlertCommandSpec.scala | 153 - .../cache/VisorCacheClearCommandSpec.scala | 101 - .../cache/VisorCacheCommandSpec.scala | 164 - .../cache/VisorCacheResetCommandSpec.scala | 114 - .../VisorConfigurationCommandSpec.scala | 50 - .../deploy/VisorDeployCommandSpec.scala | 34 - .../disco/VisorDiscoveryCommandSpec.scala | 85 - .../events/VisorEventsCommandSpec.scala | 62 - .../commands/gc/VisorGcCommandSpec.scala | 61 - .../commands/help/VisorHelpCommandSpec.scala | 73 - .../commands/kill/VisorKillCommandSpec.scala | 59 - .../commands/log/VisorLogCommandSpec.scala | 32 - .../commands/mem/VisorMemoryCommandSpec.scala | 115 - .../commands/node/VisorNodeCommandSpec.scala | 42 - .../commands/open/VisorOpenCommandSpec.scala | 36 - .../commands/ping/VisorPingCommandSpec.scala | 38 - .../start/VisorStartCommandSpec.scala | 124 - .../tasks/VisorTasksCommandSpec.scala | 221 -- .../top/VisorActivationCommandSpec.scala | 70 - .../top/VisorTopologyCommandSpec.scala | 62 - .../commands/vvm/VisorVvmCommandSpec.scala | 47 - .../VisorConsoleSelfTestSuite.scala | 93 - modules/visor-plugins/licenses/apache-2.0.txt | 202 -- modules/visor-plugins/pom.xml | 86 - .../src/main/java/log4j2.properties | 31 - .../visor/plugin/VisorExtensionPoint.java | 75 - .../visor/plugin/VisorPluggableTab.java | 64 - .../ignite/visor/plugin/VisorPlugin.java | 53 - .../visor/plugin/VisorPluginComponent.java | 30 - .../plugin/VisorPluginComponentsFactory.java | 49 - .../visor/plugin/VisorPluginLogPanel.java | 26 - .../ignite/visor/plugin/VisorPluginModel.java | 97 - .../visor/plugin/VisorPluginNodesPanel.java | 49 - .../visor/plugin/VisorSelectionListener.java | 32 - .../visor/plugin/VisorTopologyListener.java | 53 - .../ignite/visor/plugin/package-info.java | 23 - packaging/rpm/apache-ignite.spec | 5 - pom.xml | 67 - 286 files changed, 433 insertions(+), 46750 deletions(-) delete mode 100644 assembly/dependencies-visor-console.xml delete mode 100644 assembly/release-scala.xml delete mode 100644 bin/ignitevisorcmd.bat delete mode 100755 bin/ignitevisorcmd.sh delete mode 100644 bin/setup-hadoop.bat delete mode 100755 bin/setup-hadoop.sh delete mode 100644 config/visor-cmd/node_startup_by_ssh.sample.ini delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/VisorCoordinatorNodeTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeResetMetricsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMode.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorLatestVersionTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorNopTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAffinityTopologyVersion.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryTypeConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheKeyConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorClientConnectorConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorHadoopConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeRestartTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeStopTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorServiceConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryFetchFirstPageTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryHolder.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTaskResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java delete mode 100644 modules/visor-console-2.10/README.txt delete mode 100644 modules/visor-console-2.10/pom.xml delete mode 100644 modules/visor-console/licenses/apache-2.0.txt delete mode 100644 modules/visor-console/pom.xml delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ack/VisorAckCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala delete mode 100755 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheLostPartitionsCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheModifyCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheRebalanceCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetLostPartitionsCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheToggleStatisticsCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorConsoleCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorTextTable.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala delete mode 100644 modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorTextTableSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala delete mode 100644 modules/visor-console/src/test/scala/org/apache/ignite/visor/testsuites/VisorConsoleSelfTestSuite.scala delete mode 100644 modules/visor-plugins/licenses/apache-2.0.txt delete mode 100644 modules/visor-plugins/pom.xml delete mode 100644 modules/visor-plugins/src/main/java/log4j2.properties delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorExtensionPoint.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluggableTab.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPlugin.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponent.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponentsFactory.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginLogPanel.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginModel.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginNodesPanel.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorSelectionListener.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorTopologyListener.java delete mode 100644 modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/package-info.java diff --git a/assembly/dependencies-apache-ignite-lgpl.xml b/assembly/dependencies-apache-ignite-lgpl.xml index 44cd9ad26dd67..0e1ec42f4a8d0 100644 --- a/assembly/dependencies-apache-ignite-lgpl.xml +++ b/assembly/dependencies-apache-ignite-lgpl.xml @@ -123,9 +123,6 @@ ${project.groupId}:ignite-extdata-logo ${project.groupId}:ignite-examples ${project.groupId}:ignite-indexing - ${project.groupId}:ignite-visor-console - ${project.groupId}:ignite-visor-console_2.10 - ${project.groupId}:ignite-visor-plugins ${project.groupId}:ignite-codegen ${project.groupId}:ignite-appserver-test ${project.groupId}:ignite-websphere-test diff --git a/assembly/dependencies-apache-ignite-slim.xml b/assembly/dependencies-apache-ignite-slim.xml index 2e1faefd4142e..eb81a4cdbcbba 100644 --- a/assembly/dependencies-apache-ignite-slim.xml +++ b/assembly/dependencies-apache-ignite-slim.xml @@ -123,9 +123,6 @@ ${project.groupId}:ignite-extdata-logo ${project.groupId}:ignite-examples ${project.groupId}:ignite-indexing - ${project.groupId}:ignite-visor-console - ${project.groupId}:ignite-visor-console_2.10 - ${project.groupId}:ignite-visor-plugins ${project.groupId}:ignite-hadoop ${project.groupId}:ignite-codegen ${project.groupId}:ignite-schedule diff --git a/assembly/dependencies-apache-ignite.xml b/assembly/dependencies-apache-ignite.xml index d78936f1b87d8..695baee910826 100644 --- a/assembly/dependencies-apache-ignite.xml +++ b/assembly/dependencies-apache-ignite.xml @@ -124,9 +124,6 @@ ${project.groupId}:ignite-extdata-logo ${project.groupId}:ignite-examples ${project.groupId}:ignite-indexing - ${project.groupId}:ignite-visor-console - ${project.groupId}:ignite-visor-console_2.10 - ${project.groupId}:ignite-visor-plugins ${project.groupId}:ignite-codegen ${project.groupId}:ignite-schedule ${project.groupId}:ignite-appserver-test diff --git a/assembly/dependencies-visor-console.xml b/assembly/dependencies-visor-console.xml deleted file mode 100644 index 72cad404c4d3d..0000000000000 --- a/assembly/dependencies-visor-console.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - dependencies-visor-console - - - dir - - - false - - - - - ${project.groupId}:ignite-visor-console - - - false - - - ${basedir} - / - - licenses/** - - - - - ${basedir}/target/licenses - /licenses - - - - target/libs - /visorcmd - - scala-*.jar - spring-*.jar - - - - - target/libs - /visor-common - - scala-*.jar - spring-*.jar - - - - - target - /visorcmd - - *.jar - - - *-tests.jar - *-javadoc.jar - *-sources.jar - - - - - - - - - ${project.groupId}:ignite-ssh - ${project.groupId}:ignite-spring - - - false - - - ${basedir} - / - - licenses/** - - - - - ${basedir}/target/licenses - /licenses - - - - target/libs - /visor-common - - spring-jdbc-*.jar - - - - - target - /visor-common - - *.jar - - - *-tests.jar - *-javadoc.jar - *-sources.jar - - - - - - - diff --git a/assembly/release-apache-ignite-hadoop.xml b/assembly/release-apache-ignite-hadoop.xml index 3f61ec927b64f..940babbdc0ea8 100644 --- a/assembly/release-apache-ignite-hadoop.xml +++ b/assembly/release-apache-ignite-hadoop.xml @@ -74,20 +74,11 @@ - - bin - /bin - - **/*hadoop*.bat - - - bin /bin 0755 - **/*hadoop*.sh **/service.sh diff --git a/assembly/release-base.xml b/assembly/release-base.xml index e3bdffe1b155f..f2a05ecd840ae 100644 --- a/assembly/release-base.xml +++ b/assembly/release-base.xml @@ -59,10 +59,8 @@ **/*.txt - **/*hadoop*.bat igniterouter.bat **/build-classpath.bat - ignitevisorcmd.bat @@ -74,11 +72,9 @@ **/*.sh - **/*hadoop*.sh igniterouter.sh **/build-classpath.sh **/service.sh - ignitevisorcmd.sh diff --git a/assembly/release-scala.xml b/assembly/release-scala.xml deleted file mode 100644 index 0164fec3f53e5..0000000000000 --- a/assembly/release-scala.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - scala - - false - - - dir - - - - - bin - / - - **/ignitevisorcmd.bat - **/include/visorcmd/node_startup_by_ssh.sample.ini - - - - - bin - / - 0755 - - **/ignitevisorcmd.sh - - - - diff --git a/bin/ignitevisorcmd.bat b/bin/ignitevisorcmd.bat deleted file mode 100644 index 062f819f2c281..0000000000000 --- a/bin/ignitevisorcmd.bat +++ /dev/null @@ -1,173 +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. -:: - -:: -:: Starts Ignite Visor Console. -:: - -@echo off -Setlocal EnableDelayedExpansion - -if "%OS%" == "Windows_NT" setlocal - -:: Check JAVA_HOME. -if defined JAVA_HOME goto checkJdk - echo %0, ERROR: - echo JAVA_HOME environment variable is not found. - echo Please point JAVA_HOME variable to location of JDK 1.8 or later. - echo You can also download latest JDK at http://java.com/download. -goto error_finish - -:checkJdk -:: Check that JDK is where it should be. -if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion - echo %0, ERROR: - echo JAVA is not found in JAVA_HOME=%JAVA_HOME%. - echo Please point JAVA_HOME variable to installation of JDK 1.8 or later. - echo You can also download latest JDK at http://java.com/download. -goto error_finish - -:checkJdkVersion -set cmd="%JAVA_HOME%\bin\java.exe" -for /f "tokens=* USEBACKQ" %%f in (`%cmd% -version 2^>^&1`) do ( - set var=%%f - goto :LoopEscape -) -:LoopEscape - -for /f "tokens=1-3 delims= " %%a in ("%var%") do set JAVA_VER_STR=%%c -set JAVA_VER_STR=%JAVA_VER_STR:"=% - -for /f "tokens=1,2 delims=." %%a in ("%JAVA_VER_STR%.x") do set MAJOR_JAVA_VER=%%a& set MINOR_JAVA_VER=%%b -if %MAJOR_JAVA_VER% == 1 set MAJOR_JAVA_VER=%MINOR_JAVA_VER% - -if %MAJOR_JAVA_VER% LSS 8 ( - echo %0, ERROR: - echo The version of JAVA installed in %JAVA_HOME% is incorrect. - echo Please point JAVA_HOME variable to installation of JDK 1.8 or later. - echo You can also download latest JDK at http://java.com/download. - goto error_finish -) - -:: Check IGNITE_HOME. -:checkIgniteHome1 -if defined IGNITE_HOME goto checkIgniteHome2 - pushd "%~dp0"/.. - set IGNITE_HOME=%CD% - popd - -:checkIgniteHome2 -:: Strip double quotes from IGNITE_HOME -set IGNITE_HOME=%IGNITE_HOME:"=% - -:: remove all trailing slashes from IGNITE_HOME. -if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash -if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash -goto checkIgniteHome3 - -:removeTrailingSlash -set IGNITE_HOME=%IGNITE_HOME:~0,-1% -goto checkIgniteHome2 - -:checkIgniteHome3 -if exist "%IGNITE_HOME%\config" goto checkIgniteHome4 - echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid. - echo Please create IGNITE_HOME environment variable pointing to location of - echo Ignite installation folder. - goto error_finish - -:checkIgniteHome4 - -:: -:: Set SCRIPTS_HOME - base path to scripts. -:: -set SCRIPTS_HOME=%IGNITE_HOME%\bin - -:: Remove trailing spaces -for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1% - -if /i "%SCRIPTS_HOME%\" == "%~dp0" goto setProgName - echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME% - -:setProgName -:: -:: Set program name. -:: -set PROG_NAME=ignitevisorcmd.bat -if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0% - -:: -:: Set IGNITE_LIBS -:: -call "%SCRIPTS_HOME%\include\setenv.bat" -call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release. -set CP=%IGNITE_HOME%\bin\include\visor-common\*;%IGNITE_HOME%\bin\include\visorcmd\*;%IGNITE_LIBS% - -:: -:: Parse command line parameters. -:: -call "%SCRIPTS_HOME%\include\parseargs.bat" %* -if %ERRORLEVEL% neq 0 ( - echo Arguments parsing failed - exit /b %ERRORLEVEL% -) - -:: -:: JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details. -:: -:: ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE -:: -if "%JVM_OPTS_VISOR%" == "" set JVM_OPTS_VISOR=-Xms1g -Xmx1g - -:: -:: Uncomment to set preference to IPv4 stack. -:: -:: set JVM_OPTS_VISOR=%JVM_OPTS_VISOR% -Djava.net.preferIPv4Stack=true - -:: -:: Assertions are disabled by default since version 3.5. -:: If you want to enable them - set 'ENABLE_ASSERTIONS' flag to '1'. -:: -set ENABLE_ASSERTIONS=1 - -:: -:: Set '-ea' options if assertions are enabled. -:: -if %ENABLE_ASSERTIONS% == 1 set JVM_OPTS_VISOR=%JVM_OPTS_VISOR% -ea - -:: -:: Program args. -:: -if "%ARGS%" == "" set ARGS=%* - -:: -:: Final JVM_OPTS for Java 9+ compatibility -:: -call "%SCRIPTS_HOME%\include\jvmdefaults.bat" %MAJOR_JAVA_VER% "%JVM_OPTS%" JVM_OPTS - -:: -:: Starts Visor console. -:: -"%JAVA_HOME%\bin\java.exe" %JVM_OPTS_VISOR% -DIGNITE_PROG_NAME="%PROG_NAME%" ^ --DIGNITE_DEPLOYMENT_MODE_OVERRIDE=ISOLATED %QUIET% %JVM_XOPTS% -cp "%CP%" ^ - org.apache.ignite.visor.commands.VisorConsole %ARGS% - -:error_finish - -if not "%NO_PAUSE%" == "1" pause - -goto :eof diff --git a/bin/ignitevisorcmd.sh b/bin/ignitevisorcmd.sh deleted file mode 100755 index 75433089556a6..0000000000000 --- a/bin/ignitevisorcmd.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env bash -if [ ! -z "${IGNITE_SCRIPT_STRICT_MODE:-}" ] -then - set -o nounset - set -o errexit - set -o pipefail - set -o errtrace - set -o functrace -fi - -# -# 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. -# - -# Remember command line parameters -ARGS=$@ - -# -# Import common functions. -# -if [ "${IGNITE_HOME:-}" = "" ]; - then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")"; - else IGNITE_HOME_TMP=${IGNITE_HOME}; -fi - -# -# Set SCRIPTS_HOME - base path to scripts. -# -SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin" - -source "${SCRIPTS_HOME}"/include/functions.sh -source "${SCRIPTS_HOME}"/include/jvmdefaults.sh - -# -# Discover path to Java executable and check it's version. -# -checkJava - -# -# Discover IGNITE_HOME environment variable. -# -setIgniteHome - -# -# Parse command line parameters. -# -. "${SCRIPTS_HOME}"/include/parseargs.sh - -# -# Set IGNITE_LIBS. -# -. "${SCRIPTS_HOME}"/include/setenv.sh -. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release. -CP="${IGNITE_HOME}/bin/include/visor-common/*${SEP}${IGNITE_HOME}/bin/include/visorcmd/*${SEP}${IGNITE_LIBS}" - -# -# JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details. -# -# ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE -# -JVM_OPTS="-Xms1g -Xmx1g -server ${JVM_OPTS}" - -# Mac OS specific support to display correct name in the dock. -osname=`uname` - -if [ "${DOCK_OPTS:-}" == "" ]; then - DOCK_OPTS="-Xdock:name=Visor - Ignite Shell Console" -fi - -# -# Uncomment to set preference for IPv4 stack. -# -# JVM_OPTS="${JVM_OPTS} -Djava.net.preferIPv4Stack=true" - -# -# Assertions are disabled by default since version 3.5. -# If you want to enable them - set 'ENABLE_ASSERTIONS' flag to '1'. -# -ENABLE_ASSERTIONS="1" - -# -# Set '-ea' options if assertions are enabled. -# -if [ "${ENABLE_ASSERTIONS}" = "1" ]; then - JVM_OPTS="${JVM_OPTS} -ea" -fi - -# -# Save terminal setting. Used to restore terminal on finish. -# -SAVED_STTY=`stty -g 2>/dev/null` - -# -# Restores terminal. -# -function restoreSttySettings() { - stty ${SAVED_STTY} -} - -# -# Trap that restores terminal in case script execution is interrupted. -# -trap restoreSttySettings INT - -# -# Final JVM_OPTS for Java 9+ compatibility -# -JVM_OPTS=$(getJavaSpecificOpts $version "$JVM_OPTS") - -# -# Start Visor console. -# -case $osname in - Darwin*) - "$JAVA" ${JVM_OPTS} ${QUIET} "${DOCK_OPTS}" \ - -DIGNITE_UPDATE_NOTIFIER=false -DIGNITE_HOME="${IGNITE_HOME}" -DIGNITE_PROG_NAME="$0" \ - -DIGNITE_DEPLOYMENT_MODE_OVERRIDE=ISOLATED ${JVM_XOPTS} -cp "${CP}" \ - org.apache.ignite.visor.commands.VisorConsole ${ARGS} - ;; - *) - "$JAVA" ${JVM_OPTS} ${QUIET} -DIGNITE_UPDATE_NOTIFIER=false \ - -DIGNITE_HOME="${IGNITE_HOME}" -DIGNITE_PROG_NAME="$0" -DIGNITE_DEPLOYMENT_MODE_OVERRIDE=ISOLATED \ - ${JVM_XOPTS} -cp "${CP}" \ - org.apache.ignite.visor.commands.VisorConsole ${ARGS} - ;; -esac - -# -# Restore terminal. -# -restoreSttySettings diff --git a/bin/setup-hadoop.bat b/bin/setup-hadoop.bat deleted file mode 100644 index a11ef8c7c6ff3..0000000000000 --- a/bin/setup-hadoop.bat +++ /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. -:: - -:: -:: Run this script to configure Hadoop client to work with Ignite. -:: - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -set MAIN_CLASS=org.apache.ignite.internal.processors.hadoop.HadoopSetup - -call "%~dp0\ignite.bat" %* diff --git a/bin/setup-hadoop.sh b/bin/setup-hadoop.sh deleted file mode 100755 index 8870c750ac663..0000000000000 --- a/bin/setup-hadoop.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# 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. -# - -# -# Run this script to configure Hadoop client to work with Ignite. -# - -HADOOP_COMMON_HOME= - -if [ "$HADOOP_HOME" == "" ]; then - #Try get all variables from /etc/default - HADOOP_DEFAULTS=/etc/default/hadoop - - if [ -f $HADOOP_DEFAULTS ]; then - . $HADOOP_DEFAULTS - fi -fi - -# -# Import common functions. -# -if [ "${IGNITE_HOME}" = "" ]; then - IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")" -else - IGNITE_HOME_TMP=${IGNITE_HOME} -fi - -# -# Set SCRIPTS_HOME - base path to scripts. -# -SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin" - -source "${SCRIPTS_HOME}"/include/functions.sh - -# -# Discover IGNITE_HOME environment variable. -# -setIgniteHome - -# -# Set utility environment. -# -export MAIN_CLASS=org.apache.ignite.internal.processors.hadoop.HadoopSetup - -# -# Start utility. -# -. "${SCRIPTS_HOME}/ignite.sh" $@ diff --git a/config/visor-cmd/node_startup_by_ssh.sample.ini b/config/visor-cmd/node_startup_by_ssh.sample.ini deleted file mode 100644 index 649e0c7ec5c85..0000000000000 --- a/config/visor-cmd/node_startup_by_ssh.sample.ini +++ /dev/null @@ -1,79 +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. - -# ================================================================== -# This is a sample file for Visor CMD to use with "start" command. -# More info: https://ignite.apache.org/docs/latest/tools/visor-cmd -# ================================================================== - -# Section with settings for host1: -[host1] -# IP address or host name: -host=192.168.1.1 - -# SSH port: -port=2200 - -# SSH login: -uname=userName - -# SSH password: -passwd=password - -# SSH key path: -key=~/.ssh/id_rsa - -# Number of nodes to start: -nodes=1 - -# Ignite home path: -igniteHome=/usr/lib/ignite - -# Ignite config path: -cfg=examples/example-ignite.xml - -# Ignite node start script: -script=bin/ignite.sh - -# Section with settings for host2: -[host2] -# IP address or host name: -host=192.168.1.2 - -# Section with default settings. Used if value not defined in host section. -[defaults] -# SSH port: -port=22 - -# SSH login: -uname=userName - -# SSH password: -passwd=password - -# SSH key path: -key=~/.ssh/id_rsa - -# Number of nodes to start: -nodes=3 - -# Ignite home path: -igniteHome=/usr/lib/ignite - -# Ignite config path: -cfg=examples/example-ignite.xml - -# Ignite node start script: -script=bin/ignite.sh diff --git a/examples/pom.xml b/examples/pom.xml index 488478c512c0c..730ba8e1203c6 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -211,25 +211,6 @@ - - scala - - - - org.scalatest - scalatest_2.11 - ${scala.test.version} - test - - - org.scala-lang - scala-library - - - - - - lgpl 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 f04687ba65299..76f6588e81e99 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 @@ -19,7 +19,6 @@ import java.io.IOException; import java.io.Serializable; -import java.io.UnsupportedEncodingException; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; @@ -64,77 +63,11 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata; import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata; import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler; -import org.apache.ignite.internal.util.typedef.C1; 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.SB; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.cache.VisorCacheClearTask; -import org.apache.ignite.internal.visor.cache.VisorCacheClearTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorTask; -import org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheLoadTask; -import org.apache.ignite.internal.visor.cache.VisorCacheLoadTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask; -import org.apache.ignite.internal.visor.cache.VisorCacheMetadataTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask; -import org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheNodesTask; -import org.apache.ignite.internal.visor.cache.VisorCacheNodesTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask; -import org.apache.ignite.internal.visor.cache.VisorCachePartitionsTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask; -import org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask; -import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheStartTask; -import org.apache.ignite.internal.visor.cache.VisorCacheStartTaskArg; -import org.apache.ignite.internal.visor.cache.VisorCacheStopTask; -import org.apache.ignite.internal.visor.cache.VisorCacheStopTaskArg; -import org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask; -import org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTaskArg; -import org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask; -import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask; -import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTaskArg; -import org.apache.ignite.internal.visor.compute.VisorGatewayTask; -import org.apache.ignite.internal.visor.debug.VisorThreadDumpTask; -import org.apache.ignite.internal.visor.file.VisorFileBlockTask; -import org.apache.ignite.internal.visor.file.VisorFileBlockTaskArg; -import org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask; -import org.apache.ignite.internal.visor.file.VisorLatestTextFilesTaskArg; -import org.apache.ignite.internal.visor.log.VisorLogSearchTask; -import org.apache.ignite.internal.visor.log.VisorLogSearchTaskArg; -import org.apache.ignite.internal.visor.misc.VisorAckTask; -import org.apache.ignite.internal.visor.misc.VisorAckTaskArg; -import org.apache.ignite.internal.visor.misc.VisorChangeGridActiveStateTask; -import org.apache.ignite.internal.visor.misc.VisorChangeGridActiveStateTaskArg; -import org.apache.ignite.internal.visor.misc.VisorLatestVersionTask; -import org.apache.ignite.internal.visor.misc.VisorResolveHostNameTask; -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.VisorNodePingTaskArg; -import org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask; -import org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTaskArg; -import org.apache.ignite.internal.visor.query.VisorQueryCancelTask; -import org.apache.ignite.internal.visor.query.VisorQueryCancelTaskArg; -import org.apache.ignite.internal.visor.query.VisorQueryCleanupTask; -import org.apache.ignite.internal.visor.query.VisorQueryCleanupTaskArg; -import org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTask; -import org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTaskArg; -import org.apache.ignite.internal.visor.query.VisorQueryNextPageTask; -import org.apache.ignite.internal.visor.query.VisorQueryNextPageTaskArg; -import org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTask; -import org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTaskArg; -import org.apache.ignite.internal.visor.query.VisorQueryTask; -import org.apache.ignite.internal.visor.query.VisorQueryTaskArg; -import org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTask; -import org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTaskArg; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.lang.IgniteUuid; @@ -2093,324 +2026,6 @@ public void testExe() throws Exception { assertResponseContainsError(ret, "Failed to find mandatory parameter in request: id"); } - /** - * Tests execution of Visor tasks via {@link VisorGatewayTask}. - * - * @throws Exception If failed. - */ - @Test - public void testVisorGateway() throws Exception { - ClusterNode locNode = grid(1).localNode(); - - final IgniteUuid cid = grid(1).context().cache().internalCache("person").context().dynamicDeploymentId(); - - String ret = content(new VisorGatewayArgument(VisorCacheConfigurationCollectorTask.class) - .forNode(locNode) - .argument(VisorCacheConfigurationCollectorTaskArg.class) - .collection(IgniteUuid.class, cid)); - - info("VisorCacheConfigurationCollectorTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheNodesTask.class) - .forNode(locNode) - .argument(VisorCacheNodesTaskArg.class, "person")); - - info("VisorCacheNodesTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCachePartitionsTask.class) - .forNode(locNode) - .argument(VisorCachePartitionsTaskArg.class, "person")); - - info("VisorCachePartitionsTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheLoadTask.class) - .forNode(locNode) - .argument(VisorCacheLoadTaskArg.class) - .set(String.class, "person") - .arguments(0, "null")); - - info("VisorCacheLoadTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheRebalanceTask.class) - .forNode(locNode) - .argument(VisorCacheRebalanceTaskArg.class) - .set(String.class, "person")); - - info("VisorCacheRebalanceTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheMetadataTask.class) - .forNode(locNode) - .argument(VisorCacheMetadataTaskArg.class, "person")); - - info("VisorCacheMetadataTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheResetMetricsTask.class) - .forNode(locNode) - .argument(VisorCacheResetMetricsTaskArg.class, "person")); - - info("VisorCacheResetMetricsTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorThreadDumpTask.class) - .forNode(locNode)); - - info("VisorThreadDumpTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorLatestTextFilesTask.class) - .forNode(locNode) - .argument(VisorLatestTextFilesTaskArg.class, "", "")); - - info("VisorLatestTextFilesTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorLatestVersionTask.class) - .forNode(locNode)); - - info("VisorLatestVersionTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorFileBlockTask.class) - .forNode(locNode) - .argument(VisorFileBlockTaskArg.class, "", 0L, 1, 0L)); - - info("VisorFileBlockTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorNodePingTask.class) - .forNode(locNode) - .argument(VisorNodePingTaskArg.class, locNode.id())); - - info("VisorNodePingTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorNodeConfigurationCollectorTask.class) - .forNode(locNode)); - - info("VisorNodeConfigurationCollectorTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorComputeResetMetricsTask.class) - .forNode(locNode)); - - info("VisorComputeResetMetricsTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryTask.class) - .forNode(locNode) - .argument(VisorQueryTaskArg.class, "person", "select * from Person", - false, false, false, false, 1)); - - info("VisorQueryTask result: " + ret); - - JsonNode res = jsonTaskResult(ret); - - final String qryId = res.get("result").get("queryId").asText(); - - ret = content(new VisorGatewayArgument(VisorQueryNextPageTask.class) - .forNode(locNode) - .argument(VisorQueryNextPageTaskArg.class, qryId, 1)); - - info("VisorQueryNextPageTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryCleanupTask.class) - .argument(VisorQueryCleanupTaskArg.class) - .map(UUID.class, Set.class, F.asMap(locNode.id(), qryId))); - - info("VisorQueryCleanupTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorResolveHostNameTask.class) - .forNode(locNode)); - - info("VisorResolveHostNameTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryCancelTask.class) - .argument(VisorQueryCancelTaskArg.class, 0L)); - - info("VisorResolveHostNameTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryResetMetricsTask.class) - .argument(VisorQueryResetMetricsTaskArg.class, "person")); - - info("VisorResolveHostNameTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryCancelTask.class) - .argument(VisorQueryCancelTaskArg.class, 0L)); - - info("VisorResolveHostNameTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryResetMetricsTask.class) - .argument(VisorQueryResetMetricsTaskArg.class, "person")); - - info("VisorResolveHostNameTask result: " + ret); - - jsonTaskResult(ret); - - // Multinode tasks - - ret = content(new VisorGatewayArgument(VisorComputeCancelSessionsTask.class) - .argument(VisorComputeCancelSessionsTaskArg.class) - .set(IgniteUuid.class, IgniteUuid.randomUuid())); - - info("VisorComputeCancelSessionsTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheMetricsCollectorTask.class) - .argument(VisorCacheMetricsCollectorTaskArg.class, false) - .collection(String.class, "person")); - - info("VisorCacheMetricsCollectorTask result: " + ret); - - ret = content(new VisorGatewayArgument(VisorCacheMetricsCollectorTask.class) - .forNodes(grid(1).cluster().nodes()) - .argument(VisorCacheMetricsCollectorTaskArg.class, false) - .collection(String.class, "person")); - - info("VisorCacheMetricsCollectorTask (with nodes) result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorLogSearchTask.class) - .argument(VisorLogSearchTaskArg.class, ".", ".", "abrakodabra.txt", 1)); - - info("VisorLogSearchTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorNodeGcTask.class)); - - info("VisorNodeGcTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorAckTask.class) - .argument(VisorAckTaskArg.class, "MSG")); - - info("VisorAckTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorNodeEventsCollectorTask.class) - .argument(VisorNodeEventsCollectorTaskArg.class, - "null", "null", "null", "taskName", "null")); - - info("VisorNodeEventsCollectorTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorNodeDataCollectorTask.class) - .argument(VisorNodeDataCollectorTaskArg.class, false, - "CONSOLE_" + UUID.randomUUID(), UUID.randomUUID(), false)); - - info("VisorNodeDataCollectorTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorComputeToggleMonitoringTask.class) - .argument(VisorComputeToggleMonitoringTaskArg.class, UUID.randomUUID(), false)); - - info("VisorComputeToggleMonitoringTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorNodeSuppressedErrorsTask.class) - .argument(VisorNodeSuppressedErrorsTaskArg.class) - .map(UUID.class, Long.class, new HashMap())); - - info("VisorNodeSuppressedErrorsTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheClearTask.class) - .forNode(locNode) - .argument(VisorCacheClearTaskArg.class, "person")); - - info("VisorCacheClearTask result: " + ret); - - jsonTaskResult(ret); - - // Spring XML to start cache via Visor task. - final String START_CACHE = - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - - ret = content(new VisorGatewayArgument(VisorCacheStartTask.class) - .argument(VisorCacheStartTaskArg.class, false, "person2", START_CACHE)); - - info("VisorCacheStartTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorCacheStopTask.class) - .forNode(locNode) - .argument(VisorCacheStopTaskArg.class, "c")); - - info("VisorCacheStopTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorQueryDetailMetricsCollectorTask.class) - .argument(VisorQueryDetailMetricsCollectorTaskArg.class, 0)); - - info("VisorQueryDetailMetricsCollectorTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorRunningQueriesCollectorTask.class) - .argument(VisorRunningQueriesCollectorTaskArg.class, 0L)); - - info("VisorQueryDetailMetricsCollectorTask result: " + ret); - - jsonTaskResult(ret); - - ret = content(new VisorGatewayArgument(VisorChangeGridActiveStateTask.class) - .argument(VisorChangeGridActiveStateTaskArg.class, true)); - - info("VisorQueryDetailMetricsCollectorTask result: " + ret); - - jsonTaskResult(ret); - } - /** * @throws Exception If failed. */ @@ -3896,185 +3511,6 @@ private static class NodeIdFilter implements IgnitePredicate { } } - /** - * Helper for build {@link VisorGatewayTask} arguments. - */ - public static class VisorGatewayArgument extends HashMap { - /** Latest argument index. */ - private int idx = 3; - - /** - * Construct helper object. - * - * @param cls Class of executed task. - */ - public VisorGatewayArgument(Class cls) { - super(F.asMap( - "cmd", GridRestCommand.EXE.key(), - "name", VisorGatewayTask.class.getName(), - "p1", "null", - "p2", cls.getName() - )); - } - - /** - * Execute task on node. - * - * @param node Node. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument forNode(ClusterNode node) { - put("p1", node != null ? node.id().toString() : null); - - return this; - } - - /** - * Prepare list of node IDs. - * - * @param nodes Collection of nodes. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument forNodes(Collection nodes) { - put("p1", concat(F.transform(nodes, new C1() { - /** {@inheritDoc} */ - @Override public UUID apply(ClusterNode node) { - return node.id(); - } - }).toArray(), ";")); - - return this; - } - - /** - * Add custom argument. - * - * @param vals Values. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument arguments(Object... vals) { - for (Object val : vals) - put("p" + idx++, String.valueOf(val)); - - return this; - } - - /** - * Add string argument. - * - * @param val Value. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument argument(String val) { - put("p" + idx++, String.class.getName()); - put("p" + idx++, val); - - return this; - } - - /** - * Add custom class argument. - * - * @param cls Class. - * @param vals Values. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument argument(Class cls, Object... vals) { - put("p" + idx++, cls.getName()); - - for (Object val : vals) - put("p" + idx++, val != null ? val.toString() : null); - - return this; - } - - /** - * Add collection argument. - * - * @param cls Class. - * @param vals Values. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument collection(Class cls, Object... vals) { - put("p" + idx++, Collection.class.getName()); - put("p" + idx++, cls.getName()); - put("p" + idx++, concat(vals, ";")); - - return this; - } - - /** - * Add set argument. - * - * @param cls Class. - * @param vals Values. - * @return This helper for chaining method calls. - */ - public VisorGatewayArgument set(Class cls, Object... vals) { - put("p" + idx++, Set.class.getName()); - put("p" + idx++, cls.getName()); - put("p" + idx++, concat(vals, ";")); - - return this; - } - - /** - * Add map argument. - * - * @param keyCls Key class. - * @param valCls Value class. - * @param map Map. - */ - public VisorGatewayArgument map(Class keyCls, Class valCls, Map map) throws UnsupportedEncodingException { - put("p" + idx++, Map.class.getName()); - put("p" + idx++, keyCls.getName()); - put("p" + idx++, valCls.getName()); - - SB sb = new SB(); - - boolean first = true; - - for (Map.Entry entry : map.entrySet()) { - if (!first) - sb.a(";"); - - sb.a(entry.getKey()); - - if (entry.getValue() != null) - sb.a("=").a(entry.getValue()); - - first = false; - } - - put("p" + idx++, sb.toString()); - - return this; - } - - /** - * Concat object with delimiter. - * - * @param vals Values. - * @param delim Delimiter. - */ - private static String concat(Object[] vals, String delim) { - SB sb = new SB(); - - boolean first = true; - - for (Object val : vals) { - if (!first) - sb.a(delim); - - sb.a(val); - - first = false; - } - - return sb.toString(); - } - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/plugin/IgniteLogInfoProviderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/plugin/IgniteLogInfoProviderImpl.java index 27fed709e3b27..b87877188103f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/plugin/IgniteLogInfoProviderImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/plugin/IgniteLogInfoProviderImpl.java @@ -144,7 +144,6 @@ public class IgniteLogInfoProviderImpl implements IgniteLogInfoProvider { ackSecurity(log, ignite); ackPerformanceSuggestions(log, igEx); - ackVisorConsole(log); ackClassPathContent(log); ackNodeInfo(log, igEx); } @@ -533,13 +532,6 @@ void ackPerformanceSuggestions(IgniteLogger log, IgniteEx ignite) { ctx.performance().logSuggestions(log, ignite.name()); } - /** - * Print info about visor commandline console. - */ - void ackVisorConsole(IgniteLogger log) { - U.quietAndInfo(log, "To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}"); - } - /** * Prints the list of {@code *.jar} and {@code *.class} files containing in the classpath. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index b3221f7212fb0..8af0c7831b3f7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -83,7 +83,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.internal.util.worker.GridWorker; import org.apache.ignite.internal.util.worker.GridWorkerFuture; -import org.apache.ignite.internal.visor.compute.VisorGatewayTask; import org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgniteInClosure; @@ -904,10 +903,6 @@ private void authorize(GridRestRequest req) throws SecurityException { GridRestTaskRequest taskReq = (GridRestTaskRequest)req; name = taskReq.taskName(); - // We should extract task name wrapped by VisorGatewayTask. - if (VisorGatewayTask.class.getName().equals(name)) - name = (String)taskReq.params().get(WRAPPED_TASK_IDX); - break; case GET_OR_CREATE_CACHE: diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorCoordinatorNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorCoordinatorNodeTask.java deleted file mode 100644 index f744e9ead376d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorCoordinatorNodeTask.java +++ /dev/null @@ -1,39 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; - -/** - * Base class for Visor tasks intended to execute job on coordinator node. - */ -public abstract class VisorCoordinatorNodeTask extends VisorOneNodeTask { - /** {@inheritDoc} */ - @Override protected Collection jobNodes(VisorTaskArgument arg) { - ClusterNode crd = ignite.context().discovery().discoCache().oldestAliveServerNode(); - - Collection nids = new ArrayList<>(1); - - nids.add(crd == null ? ignite.localNode().id() : crd.id()); - - return nids; - } -} 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 deleted file mode 100644 index f426e8aaea105..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java +++ /dev/null @@ -1,103 +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; - -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 Result type. - */ -public class VisorEither 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); - } -} 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 deleted file mode 100644 index 6f7e625574546..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java +++ /dev/null @@ -1,138 +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.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 int typeId; - - /** Affinity key field name. */ - private String affinityKeyFieldName; - - /** Filed list */ - private List fields; - - /** - * @param binary Binary objects. - * @return List of data transfer objects for binary objects metadata. - */ - public static List list(IgniteBinary binary) { - List 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 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 int getTypeId() { - return typeId; - } - - /** - * @return Fields list. - */ - public Collection 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.writeInt(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 = in.readInt(); - affinityKeyFieldName = U.readString(in); - fields = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorBinaryMetadata.class, this); - } -} 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 deleted file mode 100644 index f210f0db0a016..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java +++ /dev/null @@ -1,74 +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.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.processors.task.GridVisorManagementTask; -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 -@GridVisorManagementTask -public class VisorBinaryMetadataCollectorTask - extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorBinaryCollectMetadataJob job(VisorBinaryMetadataCollectorTaskArg lastUpdate) { - return new VisorBinaryCollectMetadataJob(lastUpdate, debug); - } - - /** Job that collect portables metadata on node. */ - private static class VisorBinaryCollectMetadataJob - extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Task argument. - * @param debug Debug flag. - */ - private VisorBinaryCollectMetadataJob(VisorBinaryMetadataCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorBinaryMetadataCollectorTaskResult run(VisorBinaryMetadataCollectorTaskArg arg) { - 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); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskArg.java deleted file mode 100644 index 84ff96a7fefaf..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskArg.java +++ /dev/null @@ -1,71 +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.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.visor.VisorDataTransferObject; - -/** - * Arguments for {@link VisorBinaryMetadataCollectorTask}. - */ -public class VisorBinaryMetadataCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Time data was collected last time. */ - private long lastUpdate; - - /** - * Default constructor. - */ - public VisorBinaryMetadataCollectorTaskArg() { - // No-op. - } - - /** - * @param lastUpdate Time data was collected last time. - */ - public VisorBinaryMetadataCollectorTaskArg(long lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * @return Time data was collected last time. - */ - public long getMessage() { - return lastUpdate; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(lastUpdate); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - lastUpdate = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorBinaryMetadataCollectorTaskArg.class, this); - } -} 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 deleted file mode 100644 index b31897c4fe416..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java +++ /dev/null @@ -1,87 +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.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 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 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 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); - } -} 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 deleted file mode 100644 index 69c880c16768d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java +++ /dev/null @@ -1,101 +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.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); - } -} 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 deleted file mode 100644 index 0d239546f2603..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java +++ /dev/null @@ -1,341 +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.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.processors.cache.GridCacheAdapter; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -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 static org.apache.ignite.cache.CachePeekMode.BACKUP; -import static org.apache.ignite.cache.CachePeekMode.ONHEAP; -import static org.apache.ignite.cache.CachePeekMode.PRIMARY; - -/** - * Data transfer object for {@link IgniteCache}. - */ -public class VisorCache extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private static final CachePeekMode[] PEEK_ONHEAP_PRIMARY = - new CachePeekMode[] {ONHEAP, PRIMARY}; - - /** */ - private static final CachePeekMode[] PEEK_ONHEAP_BACKUP = - new CachePeekMode[] {ONHEAP, BACKUP}; - - /** Cache name. */ - private String name; - - /** Cache deployment ID. */ - private IgniteUuid dynamicDeploymentId; - - /** Cache mode. */ - private CacheMode mode; - - /** Cache size in bytes. */ - private long memorySize; - - /** Cache size in bytes. */ - private long indexesSize; - - /** Number of all entries in cache. */ - private long size; - - /** Number of all entries in near cache. */ - private int nearSize; - - /** Number of primary entries in cache. */ - private long primarySize; - - /** Number of backup entries in cache. */ - private long backupSize; - - /** Number of partitions. */ - private int partitions; - - /** Flag indicating that cache has near cache. */ - private boolean near; - - /** Cache metrics. */ - private VisorCacheMetrics metrics; - - /** Cache system state. */ - private boolean sys; - - /** Checks whether statistics collection is enabled in this cache. */ - private boolean statisticsEnabled; - - /** - * Create data transfer object for given cache. - */ - public VisorCache() { - // No-op. - } - - /** - * Create data transfer object for given cache. - * - * @param ca Internal cache. - * @param collectMetrics Collect cache metrics flag. - * @throws IgniteCheckedException If failed to create data transfer object. - */ - public VisorCache(IgniteEx ignite, GridCacheAdapter ca, boolean collectMetrics) throws IgniteCheckedException { - assert ca != null; - - GridCacheContext cctx = ca.context(); - CacheConfiguration cfg = ca.configuration(); - - name = ca.name(); - dynamicDeploymentId = cctx.dynamicDeploymentId(); - mode = cfg.getCacheMode(); - - primarySize = ca.localSizeLong(PEEK_ONHEAP_PRIMARY); - backupSize = ca.localSizeLong(PEEK_ONHEAP_BACKUP); - nearSize = ca.nearSize(); - size = primarySize + backupSize + nearSize; - - partitions = ca.affinity().partitions(); - near = cctx.isNear(); - - if (collectMetrics) - metrics = new VisorCacheMetrics(ignite, name); - - sys = ignite.context().cache().systemCache(name); - - statisticsEnabled = ca.clusterMetrics().isStatisticsEnabled(); - } - - /** - * @return Cache name. - */ - public String getName() { - return name; - } - - /** - * Sets new value for cache name. - * - * @param name New cache name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return Dynamic deployment ID. - */ - public IgniteUuid getDynamicDeploymentId() { - return dynamicDeploymentId; - } - - /** - * @return Cache mode. - */ - public CacheMode getMode() { - return mode; - } - - /** - * @return Cache size in bytes. - */ - public long getMemorySize() { - return memorySize; - } - - /** - * @return Indexes size in bytes. - */ - public long getIndexesSize() { - return indexesSize; - } - - /** - * @return Number of all entries in cache. - */ - public long getSize() { - return size; - } - - /** - * @return Number of all entries in near cache. - */ - public int getNearSize() { - return nearSize; - } - - /** - * @return Number of backup entries in cache. - */ - public long getBackupSize() { - return backupSize; - } - - /** - * @return Number of primary entries in cache. - */ - public long getPrimarySize() { - return primarySize; - } - - /** - * @return Number of partitions. - */ - public int getPartitions() { - return partitions; - } - - /** - * @return Cache metrics. - */ - public VisorCacheMetrics getMetrics() { - return metrics; - } - - /** - * @param metrics Cache metrics. - */ - public void setMetrics(VisorCacheMetrics metrics) { - this.metrics = metrics; - } - - /** - * @return {@code true} if cache has near cache. - */ - public boolean isNear() { - return near; - } - - /** - * @return System cache flag. - */ - public boolean isSystem() { - return sys; - } - - /** - * @return Number of entries in cache in heap and off-heap. - */ - public long size() { - return size + (metrics != null ? metrics.getOffHeapEntriesCount() : 0L); - } - - /** - * @return Memory size allocated in off-heap. - */ - public long offHeapAllocatedSize() { - return metrics != null ? metrics.getOffHeapAllocatedSize() : 0L; - } - - /** - * @return Number of entries in heap memory. - */ - public long heapEntriesCount() { - return metrics != null ? metrics.getHeapEntriesCount() : 0L; - } - - /** - * @return Number of primary cache entries stored in off-heap memory. - */ - public long offHeapPrimaryEntriesCount() { - return metrics != null ? metrics.getOffHeapPrimaryEntriesCount() : 0L; - } - - /** - * @return Number of backup cache entries stored in off-heap memory. - */ - public long offHeapBackupEntriesCount() { - return metrics != null ? metrics.getOffHeapBackupEntriesCount() : 0L; - } - - /** - * @return Number of cache entries stored in off-heap memory. - */ - public long offHeapEntriesCount() { - return metrics != null ? metrics.getOffHeapEntriesCount() : 0L; - } - - /** - * @return Checks whether statistics collection is enabled in this cache. - */ - public boolean isStatisticsEnabled() { - return statisticsEnabled; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V3; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - U.writeIgniteUuid(out, dynamicDeploymentId); - out.writeByte(CacheMode.toCode(mode)); - out.writeLong(memorySize); - out.writeLong(indexesSize); - out.writeLong(size); - out.writeInt(nearSize); - out.writeLong(primarySize); - out.writeLong(backupSize); - out.writeInt(partitions); - out.writeBoolean(near); - out.writeObject(metrics); - out.writeBoolean(sys); - out.writeBoolean(statisticsEnabled); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - dynamicDeploymentId = U.readIgniteUuid(in); - mode = CacheMode.fromCode(in.readByte()); - memorySize = in.readLong(); - indexesSize = in.readLong(); - size = in.readLong(); - nearSize = in.readInt(); - primarySize = in.readLong(); - backupSize = in.readLong(); - partitions = in.readInt(); - near = in.readBoolean(); - metrics = (VisorCacheMetrics)in.readObject(); - - sys = protoVer > V1 ? in.readBoolean() : metrics != null && metrics.isSystem(); - - if (protoVer > V2) - statisticsEnabled = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCache.class, this); - } -} 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 deleted file mode 100644 index 439b8d3edcd7b..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java +++ /dev/null @@ -1,71 +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.UUID; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.jetbrains.annotations.Nullable; - -/** - * Task that will find affinity node for key. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheAffinityNodeTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @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 { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Cache name and key to find affinity node. - * @param debug Debug flag. - */ - private VisorCacheAffinityNodeJob(VisorCacheAffinityNodeTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected UUID run(@Nullable VisorCacheAffinityNodeTaskArg arg) throws IgniteException { - assert arg != null; - - ClusterNode node = ignite.affinity(arg.getCacheName()).mapKeyToNode(arg.getKey()); - - return node != null ? node.id() : null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheAffinityNodeJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java deleted file mode 100644 index ec057339f4b27..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java +++ /dev/null @@ -1,86 +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.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; - -/** - * Argument for {@link VisorCacheAffinityNodeTask}. - */ -public class VisorCacheAffinityNodeTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** Key to map to a node. */ - private Object key; - - /** - * Default constructor. - */ - public VisorCacheAffinityNodeTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - * @param key Object. - */ - public VisorCacheAffinityNodeTaskArg(String cacheName, Object key) { - this.cacheName = cacheName; - this.key = key; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return Key to map to a node. - */ - public Object getKey() { - return key; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - out.writeObject(key); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - key = in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheAffinityNodeTaskArg.class, this); - } -} 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 deleted file mode 100644 index 8bcb5de4ab61a..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java +++ /dev/null @@ -1,628 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.cache.CacheMode; -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; - -/** - * Data transfer object for aggregated cache metrics. - */ -public class VisorCacheAggregatedMetrics extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String name; - - /** Cache mode. */ - private CacheMode mode; - - /** Cache system state. */ - private boolean sys; - - /** Node IDs with cache metrics. */ - private Map metrics = new HashMap<>(); - - /** Total number of entries in heap. */ - private transient Long totalHeapSize; - - /** Minimum number of entries in heap. */ - private transient Long minHeapSize; - - /** Average number of entries in heap. */ - private transient Double avgHeapSize; - - /** Maximum number of entries in heap. */ - private transient Long maxHeapSize; - - /** Total number of entries in off heap. */ - private transient Long totalOffHeapSize; - - /** Minimum number of entries in off heap. */ - private transient Long minOffHeapSize; - - /** Average number of entries in off heap. */ - private transient Double avgOffHeapSize; - - /** Maximum number of entries in off heap. */ - private transient Long maxOffHeapSize; - - /** Minimum hits of the owning cache. */ - private transient Long minHits; - - /** Average hits of the owning cache. */ - private transient Double avgHits; - - /** Maximum hits of the owning cache. */ - private transient Long maxHits; - - /** Minimum misses of the owning cache. */ - private transient Long minMisses; - - /** Average misses of the owning cache. */ - private transient Double avgMisses; - - /** Maximum misses of the owning cache. */ - private transient Long maxMisses; - - /** Minimum total number of reads of the owning cache. */ - private transient Long minReads; - - /** Average total number of reads of the owning cache. */ - private transient Double avgReads; - - /** Maximum total number of reads of the owning cache. */ - private transient Long maxReads; - - /** Minimum total number of writes of the owning cache. */ - private transient Long minWrites; - - /** Average total number of writes of the owning cache. */ - private transient Double avgWrites; - - /** Maximum total number of writes of the owning cache. */ - private transient Long maxWrites; - - /** Minimum execution time of query. */ - private transient Long minQryTime; - - /** Average execution time of query. */ - private transient Double avgQryTime; - - /** Maximum execution time of query. */ - private transient Long maxQryTime; - - /** Total execution time of query. */ - private transient Long totalQryTime; - - /** Number of executions. */ - private transient Integer execsQry; - - /** Total number of times a query execution failed. */ - private transient Integer failsQry; - - /** - * Default constructor. - */ - public VisorCacheAggregatedMetrics() { - // No-op. - } - - /** - * Create data transfer object for aggregated cache metrics. - * - * @param cm Source cache metrics. - */ - public VisorCacheAggregatedMetrics(VisorCacheMetrics cm) { - name = cm.getName(); - mode = cm.getMode(); - sys = cm.isSystem(); - } - - /** - * @return Cache name. - */ - public String getName() { - return name; - } - - /** @return Cache mode. */ - public CacheMode getMode() { - return mode; - } - - /** @return Cache system state. */ - public boolean isSystem() { - return sys; - } - - /** - * @return Nodes. - */ - public Collection getNodes() { - return metrics.keySet(); - } - - /** - * @return Total number of entries in heap. - */ - public long getTotalHeapSize() { - if (totalHeapSize == null) { - totalHeapSize = 0L; - - for (VisorCacheMetrics metric : metrics.values()) - totalHeapSize += metric.getHeapEntriesCount(); - } - - return totalHeapSize; - } - - /** - * @return Minimum number of entries in heap. - */ - public long getMinimumHeapSize() { - if (minHeapSize == null) { - minHeapSize = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minHeapSize = Math.min(minHeapSize, metric.getHeapEntriesCount()); - } - - return minHeapSize; - } - - /** - * @return Average number of entries in heap. - */ - public double getAverageHeapSize() { - if (avgHeapSize == null) { - avgHeapSize = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgHeapSize += metric.getHeapEntriesCount(); - - avgHeapSize /= metrics.size(); - } - - return avgHeapSize; - } - - /** - * @return Maximum number of entries in heap. - */ - public long getMaximumHeapSize() { - if (maxHeapSize == null) { - maxHeapSize = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxHeapSize = Math.max(maxHeapSize, metric.getHeapEntriesCount()); - } - - return maxHeapSize; - } - - /** - * @param metric Metrics to process. - * @return Off heap primary entries count. - */ - private long getOffHeapPrimaryEntriesCount(VisorCacheMetrics metric) { - return metric.getOffHeapPrimaryEntriesCount(); - } - - /** - * @return Total number of entries in off-heap. - */ - public long getTotalOffHeapSize() { - if (totalOffHeapSize == null) { - totalOffHeapSize = 0L; - - for (VisorCacheMetrics metric : metrics.values()) - totalOffHeapSize += metric.getOffHeapPrimaryEntriesCount(); - } - - return totalOffHeapSize; - } - - /** - * @return Minimum number of primary entries in off heap. - */ - public long getMinimumOffHeapPrimarySize() { - if (minOffHeapSize == null) { - minOffHeapSize = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minOffHeapSize = Math.min(minOffHeapSize, getOffHeapPrimaryEntriesCount(metric)); - } - - return minOffHeapSize; - } - - /** - * @return Average number of primary entries in off heap. - */ - public double getAverageOffHeapPrimarySize() { - if (avgOffHeapSize == null) { - avgOffHeapSize = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgOffHeapSize += getOffHeapPrimaryEntriesCount(metric); - - avgOffHeapSize /= metrics.size(); - } - - return avgOffHeapSize; - } - - /** - * @return Maximum number of primary entries in off heap. - */ - public long getMaximumOffHeapPrimarySize() { - if (maxOffHeapSize == null) { - maxOffHeapSize = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxOffHeapSize = Math.max(maxOffHeapSize, getOffHeapPrimaryEntriesCount(metric)); - } - - return maxOffHeapSize; - } - - /** - * @return Minimum hits of the owning cache. - */ - public long getMinimumHits() { - if (minHits == null) { - minHits = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minHits = Math.min(minHits, metric.getHits()); - } - - return minHits; - } - - /** - * @return Average hits of the owning cache. - */ - public double getAverageHits() { - if (avgHits == null) { - avgHits = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgHits += metric.getHits(); - - avgHits /= metrics.size(); - } - - return avgHits; - } - - /** - * @return Maximum hits of the owning cache. - */ - public long getMaximumHits() { - if (maxHits == null) { - maxHits = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxHits = Math.max(maxHits, metric.getHits()); - } - - return maxHits; - } - - /** - * @return Minimum misses of the owning cache. - */ - public long getMinimumMisses() { - if (minMisses == null) { - minMisses = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minMisses = Math.min(minMisses, metric.getMisses()); - } - - return minMisses; - } - - /** - * @return Average misses of the owning cache. - */ - public double getAverageMisses() { - if (avgMisses == null) { - avgMisses = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgMisses += metric.getMisses(); - - avgMisses /= metrics.size(); - } - - return avgMisses; - } - - /** - * @return Maximum misses of the owning cache. - */ - public long getMaximumMisses() { - if (maxMisses == null) { - maxMisses = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxMisses = Math.max(maxMisses, metric.getMisses()); - } - - return maxMisses; - } - - /** - * @return Minimum total number of reads of the owning cache. - */ - public long getMinimumReads() { - if (minReads == null) { - minReads = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minReads = Math.min(minReads, metric.getReads()); - } - - return minReads; - } - - /** - * @return Average total number of reads of the owning cache. - */ - public double getAverageReads() { - if (avgReads == null) { - avgReads = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgReads += metric.getReads(); - - avgReads /= metrics.size(); - } - - return avgReads; - } - - /** - * @return Maximum total number of reads of the owning cache. - */ - public long getMaximumReads() { - if (maxReads == null) { - maxReads = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxReads = Math.max(maxReads, metric.getReads()); - } - - return maxReads; - } - - /** - * @return Minimum total number of writes of the owning cache. - */ - public long getMinimumWrites() { - if (minWrites == null) { - minWrites = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minWrites = Math.min(minWrites, metric.getWrites()); - } - - return minWrites; - } - - /** - * @return Average total number of writes of the owning cache. - */ - public double getAverageWrites() { - if (avgWrites == null) { - avgWrites = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgWrites += metric.getWrites(); - - avgWrites /= metrics.size(); - } - - return avgWrites; - } - - /** - * @return Maximum total number of writes of the owning cache. - */ - public long getMaximumWrites() { - if (maxWrites == null) { - maxWrites = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxWrites = Math.max(maxWrites, metric.getWrites()); - } - - return maxWrites; - } - - /** - * @return Minimum execution time of query. - */ - public long getMinimumQueryTime() { - if (minQryTime == null) { - minQryTime = Long.MAX_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - minQryTime = Math.min(minQryTime, metric.getQueryMetrics().getMinimumTime()); - } - - return minQryTime; - } - - /** - * @return Average execution time of query. - */ - public double getAverageQueryTime() { - if (avgQryTime == null) { - avgQryTime = 0.0d; - - for (VisorCacheMetrics metric : metrics.values()) - avgQryTime += metric.getQueryMetrics().getAverageTime(); - - avgQryTime /= metrics.size(); - } - - return avgQryTime; - } - - /** - * @return Maximum execution time of query. - */ - public long getMaximumQueryTime() { - if (maxQryTime == null) { - maxQryTime = Long.MIN_VALUE; - - for (VisorCacheMetrics metric : metrics.values()) - maxQryTime = Math.max(maxQryTime, metric.getQueryMetrics().getMaximumTime()); - } - - return maxQryTime; - } - - /** - * @return Total execution time of query. - */ - public long getTotalQueryTime() { - if (totalQryTime == null) - totalQryTime = (long)(getAverageQueryTime() * getQueryExecutions()); - - return totalQryTime; - } - - /** - * @return Number of executions. - */ - public int getQueryExecutions() { - if (execsQry == null) { - execsQry = 0; - - for (VisorCacheMetrics metric : metrics.values()) - execsQry += metric.getQueryMetrics().getExecutions(); - } - - return execsQry; - } - - /** - * @return Total number of times a query execution failed. - */ - public int getQueryFailures() { - if (failsQry == null) { - failsQry = 0; - - for (VisorCacheMetrics metric : metrics.values()) - failsQry += metric.getQueryMetrics().getFailures(); - } - - return failsQry; - } - - /** - * @return Map of Node IDs to cache metrics. - */ - public Map getMetrics() { - return metrics; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeByte(CacheMode.toCode(mode)); - out.writeBoolean(sys); - U.writeMap(out, metrics); - out.writeObject(minHeapSize); - out.writeObject(avgHeapSize); - out.writeObject(maxHeapSize); - out.writeObject(minOffHeapSize); - out.writeObject(avgOffHeapSize); - out.writeObject(maxOffHeapSize); - out.writeObject(minHits); - out.writeObject(avgHits); - out.writeObject(maxHits); - out.writeObject(minMisses); - out.writeObject(avgMisses); - out.writeObject(maxMisses); - out.writeObject(minReads); - out.writeObject(avgReads); - out.writeObject(maxReads); - out.writeObject(minWrites); - out.writeObject(avgWrites); - out.writeObject(maxWrites); - out.writeObject(minQryTime); - out.writeObject(avgQryTime); - out.writeObject(maxQryTime); - out.writeObject(totalQryTime); - out.writeObject(execsQry); - out.writeObject(failsQry); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - mode = CacheMode.fromCode(in.readByte()); - sys = in.readBoolean(); - metrics = U.readMap(in); - minHeapSize = (Long)in.readObject(); - avgHeapSize = (Double)in.readObject(); - maxHeapSize = (Long)in.readObject(); - minOffHeapSize = (Long)in.readObject(); - avgOffHeapSize = (Double)in.readObject(); - maxOffHeapSize = (Long)in.readObject(); - minHits = (Long)in.readObject(); - avgHits = (Double)in.readObject(); - maxHits = (Long)in.readObject(); - minMisses = (Long)in.readObject(); - avgMisses = (Double)in.readObject(); - maxMisses = (Long)in.readObject(); - minReads = (Long)in.readObject(); - avgReads = (Double)in.readObject(); - maxReads = (Long)in.readObject(); - minWrites = (Long)in.readObject(); - avgWrites = (Double)in.readObject(); - maxWrites = (Long)in.readObject(); - minQryTime = (Long)in.readObject(); - avgQryTime = (Double)in.readObject(); - maxQryTime = (Long)in.readObject(); - totalQryTime = (Long)in.readObject(); - execsQry = (Integer)in.readObject(); - failsQry = (Integer)in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheAggregatedMetrics.class, this); - } -} 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 deleted file mode 100644 index 68142b97aad60..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java +++ /dev/null @@ -1,146 +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.cache.CachePeekMode; -import org.apache.ignite.compute.ComputeJobContext; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.IgniteFuture; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.resources.JobContextResource; - -/** - * Task that clears specified caches on specified node. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheClearTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheClearJob job(VisorCacheClearTaskArg arg) { - return new VisorCacheClearJob(arg, debug); - } - - /** - * Job that clear specified caches. - */ - private static class VisorCacheClearJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgniteInClosure lsnr; - - /** */ - private IgniteFuture[] futs; - - /** */ - @JobContextResource - private ComputeJobContext jobCtx; - - /** - * Create job. - * - * @param arg Task argument. - * @param debug Debug flag. - */ - private VisorCacheClearJob(VisorCacheClearTaskArg arg, boolean debug) { - super(arg, debug); - - lsnr = new IgniteInClosure() { - /** */ - private static final long serialVersionUID = 0L; - - @Override public void apply(IgniteFuture f) { - assert futs[0].isDone(); - assert futs[1] == null || futs[1].isDone(); - assert futs[2] == null || futs[2].isDone(); - - jobCtx.callcc(); - } - }; - } - - /** - * @param fut Future to listen. - * @return {@code true} If future was not completed and this job should holdCC. - */ - private boolean callAsync(IgniteFuture fut) { - if (fut.isDone()) - return false; - - jobCtx.holdcc(); - - fut.listen(lsnr); - - return true; - } - - /** {@inheritDoc} */ - @Override protected VisorCacheClearTaskResult run(final VisorCacheClearTaskArg arg) { - if (futs == null) - futs = new IgniteFuture[3]; - - if (futs[0] == null || futs[1] == null || futs[2] == null) { - String cacheName = arg.getCacheName(); - - IgniteCache cache = ignite.cache(cacheName); - - if (cache == null) - throw new IllegalStateException("Failed to find cache for name: " + cacheName); - - if (futs[0] == null) { - futs[0] = cache.sizeLongAsync(CachePeekMode.PRIMARY); - - if (callAsync(futs[0])) - return null; - } - - if (futs[1] == null) { - futs[1] = cache.clearAsync(); - - if (callAsync(futs[1])) - return null; - } - - if (futs[2] == null) { - futs[2] = cache.sizeLongAsync(CachePeekMode.PRIMARY); - - if (callAsync(futs[2])) - return null; - } - } - - assert futs[0].isDone() && futs[1].isDone() && futs[2].isDone(); - - return new VisorCacheClearTaskResult(futs[0].get(), futs[2].get()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheClearJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskArg.java deleted file mode 100644 index ade2e12684599..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskArg.java +++ /dev/null @@ -1,72 +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.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; - -/** - * Argument for {@link VisorCacheClearTask}. - */ -public class VisorCacheClearTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** - * Default constructor. - */ - public VisorCacheClearTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - */ - public VisorCacheClearTaskArg(String cacheName) { - this.cacheName = cacheName; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheClearTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java deleted file mode 100644 index c7249f75eb2ff..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java +++ /dev/null @@ -1,85 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Result for {@link VisorCacheClearTask}. - */ -public class VisorCacheClearTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache size before clearing. */ - private long sizeBefore; - - /** Cache size after clearing. */ - private long sizeAfter; - - /** - * Default constructor. - */ - public VisorCacheClearTaskResult() { - // No-op. - } - - /** - * @param sizeBefore Cache size before clearing. - * @param sizeAfter Cache size after clearing. - */ - public VisorCacheClearTaskResult(long sizeBefore, long sizeAfter) { - this.sizeBefore = sizeBefore; - this.sizeAfter = sizeAfter; - } - - /** - * @return Cache size before clearing. - */ - public long getSizeBefore() { - return sizeBefore; - } - - /** - * @return Cache size after clearing. - */ - public long getSizeAfter() { - return sizeAfter; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(sizeBefore); - out.writeLong(sizeAfter); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - sizeBefore = in.readLong(); - sizeAfter = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheClearTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java deleted file mode 100644 index 5d1bccd06f3bf..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java +++ /dev/null @@ -1,102 +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.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import javax.cache.expiry.CreatedExpiryPolicy; -import javax.cache.expiry.Duration; -import javax.cache.expiry.ExpiryPolicy; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.VisorOneNodeTask; - -/** - * Task to loads caches. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheLoadTask extends - VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCachesLoadJob job(VisorCacheLoadTaskArg arg) { - return new VisorCachesLoadJob(arg, debug); - } - - /** Job that load caches. */ - private static class VisorCachesLoadJob extends - VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Cache names, ttl and loader arguments. - * @param debug Debug flag. - */ - private VisorCachesLoadJob(VisorCacheLoadTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Map run(VisorCacheLoadTaskArg arg) { - Set cacheNames = arg.getCacheNames(); - long ttl = arg.getTtl(); - Object[] ldrArgs = arg.getLoaderArguments(); - - assert cacheNames != null && !cacheNames.isEmpty(); - - Map res = U.newHashMap(cacheNames.size()); - - ExpiryPolicy plc = null; - - for (String cacheName : cacheNames) { - IgniteCache cache = ignite.cache(cacheName); - - if (cache == null) - throw new IllegalStateException("Failed to find cache for name: " + cacheName); - - if (ttl > 0) { - if (plc == null) - plc = new CreatedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl)); - - cache = cache.withExpiryPolicy(plc); - } - - cache.loadCache(null, ldrArgs); - - res.put(cacheName, cache.size(CachePeekMode.PRIMARY)); - } - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCachesLoadJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java deleted file mode 100644 index b5da99322de64..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java +++ /dev/null @@ -1,101 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Set; -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; - -/** - * Arguments for {@link VisorCacheLoadTask}. - */ -public class VisorCacheLoadTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache names to load data. */ - private Set cacheNames; - - /** Duration a Cache Entry should exist be before it expires after being modified. */ - private long ttl; - - /** Optional user arguments to be passed into CacheStore.loadCache(IgniteBiInClosure, Object...) method. */ - private Object[] ldrArgs; - - /** - * Default constructor. - */ - public VisorCacheLoadTaskArg() { - // No-op. - } - - /** - * @param cacheNames Cache names to load data. - * @param ttl Duration a Cache Entry should exist be before it expires after being modified. - * @param ldrArgs Optional user arguments to be passed into CacheStore.loadCache(IgniteBiInClosure, Object...) method. - */ - public VisorCacheLoadTaskArg(Set cacheNames, long ttl, Object[] ldrArgs) { - this.cacheNames = cacheNames; - this.ttl = ttl; - this.ldrArgs = ldrArgs; - } - - /** - * @return Cache names to load data. - */ - public Set getCacheNames() { - return cacheNames; - } - - /** - * @return Duration a Cache Entry should exist be before it expires after being modified. - */ - public long getTtl() { - return ttl; - } - - /** - * @return Optional user arguments to be passed into CacheStore.loadCache(IgniteBiInClosure, Object...) method. - */ - public Object[] getLoaderArguments() { - return ldrArgs; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeCollection(out, cacheNames); - out.writeLong(ttl); - U.writeArray(out, ldrArgs); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheNames = U.readSet(in); - ttl = in.readLong(); - ldrArgs = U.readArray(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheLoadTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTask.java deleted file mode 100644 index daa4af7bec8ae..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTask.java +++ /dev/null @@ -1,88 +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.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.ignite.internal.processors.cache.IgniteInternalCache; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Collect list of lost partitions. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheLostPartitionsTask - extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheLostPartitionsJob job(VisorCacheLostPartitionsTaskArg arg) { - return new VisorCacheLostPartitionsJob(arg, debug); - } - - /** - * Job that collect list of lost partitions. - */ - private static class VisorCacheLostPartitionsJob - extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Object with list of cache names to collect lost partitions. - * @param debug Debug flag. - */ - private VisorCacheLostPartitionsJob(VisorCacheLostPartitionsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorCacheLostPartitionsTaskResult run(VisorCacheLostPartitionsTaskArg arg) { - Map> res = new HashMap<>(); - - for (String cacheName: arg.getCacheNames()) { - IgniteInternalCache cache = ignite.cachex(cacheName); - - if (cache != null) { - GridDhtPartitionTopology top = cache.context().topology(); - - List lostPartitions = new ArrayList<>(top.lostPartitions()); - - if (!lostPartitions.isEmpty()) - res.put(cacheName, lostPartitions); - } - } - - return new VisorCacheLostPartitionsTaskResult(res); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheLostPartitionsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskArg.java deleted file mode 100644 index a937ce483b4ea..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskArg.java +++ /dev/null @@ -1,81 +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.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; - -/** - * Argument for {@link VisorCacheLostPartitionsTask}. - */ -public class VisorCacheLostPartitionsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** List of cache names. */ - private List cacheNames; - - /** Created for toString method because Collection can't be printed. */ - private String modifiedCaches; - - /** - * Default constructor. - */ - public VisorCacheLostPartitionsTaskArg() { - // No-op. - } - - /** - * @param cacheNames List of cache names. - */ - public VisorCacheLostPartitionsTaskArg(List cacheNames) { - this.cacheNames = cacheNames; - - if (cacheNames != null) - modifiedCaches = cacheNames.toString(); - } - - /** - * @return List of cache names. - */ - public List getCacheNames() { - return cacheNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeCollection(out, cacheNames); - U.writeString(out, modifiedCaches); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheNames = U.readList(in); - modifiedCaches = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheLostPartitionsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskResult.java deleted file mode 100644 index b9a0e6b13ad81..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLostPartitionsTaskResult.java +++ /dev/null @@ -1,74 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import java.util.Map; -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 VisorCacheLostPartitionsTask}. - */ -public class VisorCacheLostPartitionsTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** List of lost partitions by caches. */ - private Map> lostPartitions; - - /** - * Default constructor. - */ - public VisorCacheLostPartitionsTaskResult() { - // No-op. - } - - /** - * @param lostPartitions List of lost partitions by caches. - */ - public VisorCacheLostPartitionsTaskResult(Map> lostPartitions) { - this.lostPartitions = lostPartitions; - } - - /** - * @return List of lost partitions by caches. - */ - public Map> getLostPartitions() { - return lostPartitions; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, lostPartitions); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - lostPartitions = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheLostPartitionsTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java deleted file mode 100644 index 033087599e76d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java +++ /dev/null @@ -1,87 +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.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.processors.cache.IgniteInternalCache; -import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata; -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; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName; - -/** - * Task to get cache SQL metadata. - */ -@GridInternal -public class VisorCacheMetadataTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheMetadataJob job(VisorCacheMetadataTaskArg arg) { - return new VisorCacheMetadataJob(arg, debug); - } - - /** - * Job to get cache SQL metadata. - */ - private static class VisorCacheMetadataJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Cache name to take metadata. - * @param debug Debug flag. - */ - private VisorCacheMetadataJob(VisorCacheMetadataTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorCacheSqlMetadata run(VisorCacheMetadataTaskArg arg) { - try { - IgniteInternalCache cache = ignite.cachex(arg.getCacheName()); - - if (cache != null) { - GridCacheSqlMetadata meta = F.first(cache.context().queries().sqlMetadata()); - - if (meta != null) - return new VisorCacheSqlMetadata(meta); - - return null; - } - - throw new IgniteException("Cache not found: " + escapeName(arg.getCacheName())); - } - catch (IgniteCheckedException e) { - throw U.convertException(e); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheMetadataJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTaskArg.java deleted file mode 100644 index 99ee350b63f2f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTaskArg.java +++ /dev/null @@ -1,72 +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.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; - -/** - * Argument for {@link VisorCacheMetadataTask}. - */ -public class VisorCacheMetadataTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** - * Default constructor. - */ - public VisorCacheMetadataTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - */ - public VisorCacheMetadataTaskArg(String cacheName) { - this.cacheName = cacheName; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheMetadataTaskArg.class, this); - } -} 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 deleted file mode 100644 index 378de7a5e9832..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java +++ /dev/null @@ -1,812 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMetrics; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; -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.internal.visor.query.VisorQueryMetrics; - -/** - * Data transfer object for {@link CacheMetrics}. - */ -public class VisorCacheMetrics extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private static final float MICROSECONDS_IN_SECOND = 1_000_000; - - /** Cache name. */ - private String name; - - /** Cache mode. */ - private CacheMode mode; - - /** Cache system state. */ - private boolean sys; - - /** Number of non-{@code null} values in the cache. */ - private int size; - - /** Gets number of keys in the cache, possibly with {@code null} values. */ - private int keySize; - - /** Number of non-{@code null} values in the cache as a long value. */ - private long cacheSize; - - /** Total number of reads of the owning entity (either cache or entry). */ - private long reads; - - /** The mean time to execute gets. */ - private float avgReadTime; - - /** Total number of writes of the owning entity (either cache or entry). */ - private long writes; - - /** Total number of hits for the owning entity (either cache or entry). */ - private long hits; - - /** Total number of misses for the owning entity (either cache or entry). */ - private long misses; - - /** Total number of transaction commits. */ - private long txCommits; - - /** The mean time to execute tx commit. */ - private float avgTxCommitTime; - - /** Total number of transaction rollbacks. */ - private long txRollbacks; - - /** The mean time to execute tx rollbacks. */ - private float avgTxRollbackTime; - - /** The total number of puts to the cache. */ - private long puts; - - /** The mean time to execute puts. */ - private float avgPutTime; - - /** The total number of removals from the cache. */ - private long removals; - - /** The mean time to execute removes. */ - private float avgRemovalTime; - - /** The total number of evictions from the cache. */ - private long evictions; - - /** Reads per second. */ - private int readsPerSec; - - /** Puts per second. */ - private int putsPerSec; - - /** Removes per second. */ - private int removalsPerSec; - - /** Commits per second. */ - private int commitsPerSec; - - /** Rollbacks per second. */ - private int rollbacksPerSec; - - /** Current size of evict queue used to batch up evictions. */ - private int dhtEvictQueueCurrSize; - - /** Gets transaction per-thread map size. */ - private int txThreadMapSize; - - /** Transaction per-Xid map size. */ - private int txXidMapSize; - - /** Committed transaction queue size. */ - private int txCommitQueueSize; - - /** Prepared transaction queue size. */ - private int txPrepareQueueSize; - - /** Start version counts map size. */ - private int txStartVerCountsSize; - - /** Number of cached committed transaction IDs. */ - private int txCommittedVersionsSize; - - /** Number of cached rolled back transaction IDs. */ - private int txRolledbackVersionsSize; - - /** DHT thread map size */ - private int txDhtThreadMapSize; - - /** Transaction DHT per-Xid map size. */ - private int txDhtXidMapSize; - - /** Committed DHT transaction queue size. */ - private int txDhtCommitQueueSize; - - /** Prepared DHT transaction queue size. */ - private int txDhtPrepareQueueSize; - - /** DHT start version counts map size. */ - private int txDhtStartVerCountsSize; - - /** Number of cached committed DHT transaction IDs. */ - private int txDhtCommittedVersionsSize; - - /** Number of cached rolled back DHT transaction IDs. */ - private int txDhtRolledbackVersionsSize; - - /** Number of cache entries stored in heap memory. */ - private long heapEntriesCnt; - - /** Memory size allocated in off-heap. */ - private long offHeapAllocatedSize; - - /** Number of cache entries stored in off-heap memory. */ - private long offHeapEntriesCnt; - - /** Number of primary cache entries stored in off-heap memory. */ - private long offHeapPrimaryEntriesCnt; - - /** Total number of partitions on current node. */ - private int totalPartsCnt; - - /** Number of already rebalanced keys. */ - private long rebalancedKeys; - - /** Number estimated to rebalance keys. */ - private long estimatedRebalancingKeys; - - /** Number of currently rebalancing partitions on current node. */ - private int rebalancingPartsCnt; - - /** Estimated number of keys to be rebalanced on current node. */ - private long keysToRebalanceLeft; - - /** Estimated rebalancing speed in keys. */ - private long rebalancingKeysRate; - - /** Estimated rebalancing speed in bytes. */ - private long rebalancingBytesRate; - - /** Gets query metrics for cache. */ - private VisorQueryMetrics qryMetrics; - - /** - * Calculate rate of metric per second. - * - * @param meanTime Metric mean time. - * @return Metric per second. - */ - private static int perSecond(float meanTime) { - return (meanTime > 0) ? (int)(MICROSECONDS_IN_SECOND / meanTime) : 0; - } - - /** - * Default constructor. - */ - public VisorCacheMetrics() { - // No-op. - } - - /** - * Create data transfer object for given cache metrics. - * - * @param ignite Ignite. - * @param cacheName Cache name. - */ - public VisorCacheMetrics(IgniteEx ignite, String cacheName) { - GridCacheProcessor cacheProcessor = ignite.context().cache(); - - IgniteCache c = cacheProcessor.jcache(cacheName); - - name = cacheName; - mode = cacheProcessor.cacheMode(cacheName); - sys = cacheProcessor.systemCache(cacheName); - - CacheMetrics m = c.localMetrics(); - - size = m.getSize(); - keySize = m.getKeySize(); - - cacheSize = m.getCacheSize(); - - reads = m.getCacheGets(); - writes = m.getCachePuts() + m.getCacheRemovals(); - hits = m.getCacheHits(); - misses = m.getCacheMisses(); - - txCommits = m.getCacheTxCommits(); - txRollbacks = m.getCacheTxRollbacks(); - - avgTxCommitTime = m.getAverageTxCommitTime(); - avgTxRollbackTime = m.getAverageTxRollbackTime(); - - puts = m.getCachePuts(); - removals = m.getCacheRemovals(); - evictions = m.getCacheEvictions(); - - avgReadTime = m.getAverageGetTime(); - avgPutTime = m.getAveragePutTime(); - avgRemovalTime = m.getAverageRemoveTime(); - - readsPerSec = perSecond(m.getAverageGetTime()); - putsPerSec = perSecond(m.getAveragePutTime()); - removalsPerSec = perSecond(m.getAverageRemoveTime()); - commitsPerSec = perSecond(m.getAverageTxCommitTime()); - rollbacksPerSec = perSecond(m.getAverageTxRollbackTime()); - - dhtEvictQueueCurrSize = m.getDhtEvictQueueCurrentSize(); - txThreadMapSize = m.getTxThreadMapSize(); - txXidMapSize = m.getTxXidMapSize(); - txCommitQueueSize = m.getTxCommitQueueSize(); - txPrepareQueueSize = m.getTxPrepareQueueSize(); - txStartVerCountsSize = m.getTxStartVersionCountsSize(); - txCommittedVersionsSize = m.getTxCommittedVersionsSize(); - txRolledbackVersionsSize = m.getTxRolledbackVersionsSize(); - txDhtThreadMapSize = m.getTxDhtThreadMapSize(); - txDhtXidMapSize = m.getTxDhtXidMapSize(); - txDhtCommitQueueSize = m.getTxDhtCommitQueueSize(); - txDhtPrepareQueueSize = m.getTxDhtPrepareQueueSize(); - txDhtStartVerCountsSize = m.getTxDhtStartVersionCountsSize(); - txDhtCommittedVersionsSize = m.getTxDhtCommittedVersionsSize(); - txDhtRolledbackVersionsSize = m.getTxDhtRolledbackVersionsSize(); - - heapEntriesCnt = m.getHeapEntriesCount(); - offHeapAllocatedSize = m.getOffHeapAllocatedSize(); - offHeapEntriesCnt = m.getOffHeapEntriesCount(); - offHeapPrimaryEntriesCnt = m.getOffHeapPrimaryEntriesCount(); - - totalPartsCnt = m.getTotalPartitionsCount(); - rebalancedKeys = m.getRebalancedKeys(); - estimatedRebalancingKeys = m.getEstimatedRebalancingKeys(); - rebalancingPartsCnt = m.getRebalancingPartitionsCount(); - keysToRebalanceLeft = m.getKeysToRebalanceLeft(); - rebalancingKeysRate = m.getRebalancingKeysRate(); - rebalancingBytesRate = m.getRebalancingBytesRate(); - - qryMetrics = new VisorQueryMetrics(c.queryMetrics()); - } - - /** - * @return Cache name. - */ - public String getName() { - return name; - } - - /** - * Sets cache name. - * - * @param name New value for cache name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return Cache mode. - */ - public CacheMode getMode() { - return mode; - } - - /** - * @return Cache system state. - */ - public boolean isSystem() { - return sys; - } - - /** - * @return Total number of reads of the owning entity (either cache or entry). - */ - public long getReads() { - return reads; - } - - /** - * @return The mean time to execute gets - */ - public float getAvgReadTime() { - return avgReadTime; - } - - /** - * @return Total number of writes of the owning entity (either cache or entry). - */ - public long getWrites() { - return writes; - } - - /** - * @return Total number of hits for the owning entity (either cache or entry). - */ - public long getHits() { - return hits; - } - - /** - * @return Total number of misses for the owning entity (either cache or entry). - */ - public long getMisses() { - return misses; - } - - /** - * @return Total number of transaction commits. - */ - public long getTxCommits() { - return txCommits; - } - - /** - * @return avgTxCommitTime - */ - public float getAvgTxCommitTime() { - return avgTxCommitTime; - } - - /** - * @return The mean time to execute tx rollbacks. - */ - public float getAvgTxRollbackTime() { - return avgTxRollbackTime; - } - - /** - * @return The total number of puts to the cache. - */ - public long getPuts() { - return puts; - } - - /** - * @return The mean time to execute puts. - */ - public float getAvgPutTime() { - return avgPutTime; - } - - /** - * @return The total number of removals from the cache. - */ - public long getRemovals() { - return removals; - } - - /** - * @return The mean time to execute removes. - */ - public float getAvgRemovalTime() { - return avgRemovalTime; - } - - /** - * @return The total number of evictions from the cache. - */ - public long getEvictions() { - return evictions; - } - - /** - * @return Total number of transaction rollbacks. - */ - public long getTxRollbacks() { - return txRollbacks; - } - - /** - * @return Reads per second. - */ - public int getReadsPerSecond() { - return readsPerSec; - } - - /** - * @return Puts per second. - */ - public int getPutsPerSecond() { - return putsPerSec; - } - - /** - * @return Removes per second. - */ - public int getRemovalsPerSecond() { - return removalsPerSec; - } - - /** - * @return Commits per second. - */ - public int getCommitsPerSecond() { - return commitsPerSec; - } - - /** - * @return Rollbacks per second. - */ - public int getRollbacksPerSecond() { - return rollbacksPerSec; - } - - /** - * @return Number of non-{@code null} values in the cache. - */ - public int getSize() { - return size; - } - - /** - * @return Gets number of keys in the cache, possibly with {@code null} values. - */ - public int getKeySize() { - return keySize; - } - - /** - * @return Number of non-{@code null} values in the cache as a long value. - */ - public long getCacheSize() { - return cacheSize; - } - - /** - * @return Gets query metrics for cache. - */ - public VisorQueryMetrics getQueryMetrics() { - return qryMetrics; - } - - /** - * @return Current size of evict queue used to batch up evictions. - */ - public int getDhtEvictQueueCurrentSize() { - return dhtEvictQueueCurrSize; - } - - /** - * @return Gets transaction per-thread map size. - */ - public int getTxThreadMapSize() { - return txThreadMapSize; - } - - /** - * @return Transaction per-Xid map size. - */ - public int getTxXidMapSize() { - return txXidMapSize; - } - - /** - * @return Committed transaction queue size. - */ - public int getTxCommitQueueSize() { - return txCommitQueueSize; - } - - /** - * @return Prepared transaction queue size. - */ - public int getTxPrepareQueueSize() { - return txPrepareQueueSize; - } - - /** - * @return Start version counts map size. - */ - public int getTxStartVersionCountsSize() { - return txStartVerCountsSize; - } - - /** - * @return Number of cached committed transaction IDs. - */ - public int getTxCommittedVersionsSize() { - return txCommittedVersionsSize; - } - - /** - * @return Number of cached rolled back transaction IDs. - */ - public int getTxRolledbackVersionsSize() { - return txRolledbackVersionsSize; - } - - /** - * @return DHT thread map size - */ - public int getTxDhtThreadMapSize() { - return txDhtThreadMapSize; - } - - /** - * @return Transaction DHT per-Xid map size. - */ - public int getTxDhtXidMapSize() { - return txDhtXidMapSize; - } - - /** - * @return Committed DHT transaction queue size. - */ - public int getTxDhtCommitQueueSize() { - return txDhtCommitQueueSize; - } - - /** - * @return Prepared DHT transaction queue size. - */ - public int getTxDhtPrepareQueueSize() { - return txDhtPrepareQueueSize; - } - - /** - * @return DHT start version counts map size. - */ - public int getTxDhtStartVersionCountsSize() { - return txDhtStartVerCountsSize; - } - - /** - * @return Number of cached committed DHT transaction IDs. - */ - public int getTxDhtCommittedVersionsSize() { - return txDhtCommittedVersionsSize; - } - - /** - * @return Number of cached rolled back DHT transaction IDs. - */ - public int getTxDhtRolledbackVersionsSize() { - return txDhtRolledbackVersionsSize; - } - - /** - * @return Number of entries in heap memory. - */ - public long getHeapEntriesCount() { - return heapEntriesCnt; - } - - /** - * @return Memory size allocated in off-heap. - */ - public long getOffHeapAllocatedSize() { - return offHeapAllocatedSize; - } - - /** - * @return Number of cache entries stored in off-heap memory. - */ - public long getOffHeapEntriesCount() { - return offHeapEntriesCnt; - } - - /** - * @return Number of primary cache entries stored in off-heap memory. - */ - public long getOffHeapPrimaryEntriesCount() { - return offHeapPrimaryEntriesCnt; - } - - /** - * @return Number of backup cache entries stored in off-heap memory. - */ - public long getOffHeapBackupEntriesCount() { - return offHeapEntriesCnt - offHeapPrimaryEntriesCnt; - } - - /** - * @return Total number of partitions on current node. - */ - public int getTotalPartitionsCount() { - return totalPartsCnt; - } - - /** - * @return Number of already rebalanced keys. - */ - public long getRebalancedKeys() { - return rebalancedKeys; - } - - /** - * @return Number estimated to rebalance keys. - */ - public long getEstimatedRebalancingKeys() { - return estimatedRebalancingKeys; - } - - /** - * @return Number of currently rebalancing partitions on current node. - */ - public int getRebalancingPartitionsCount() { - return rebalancingPartsCnt; - } - - /** - * @return Estimated number of keys to be rebalanced on current node. - */ - public long getKeysToRebalanceLeft() { - return keysToRebalanceLeft; - } - - /** - * @return Estimated rebalancing speed in keys. - */ - public long getRebalancingKeysRate() { - return rebalancingKeysRate; - } - - /** - * @return Estimated rebalancing speed in bytes. - */ - public long getRebalancingBytesRate() { - return rebalancingBytesRate; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V2; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeByte(CacheMode.toCode(mode)); - - out.writeBoolean(sys); - out.writeInt(size); - out.writeInt(keySize); - out.writeLong(reads); - out.writeFloat(avgReadTime); - out.writeLong(writes); - out.writeLong(hits); - out.writeLong(misses); - out.writeLong(txCommits); - out.writeFloat(avgTxCommitTime); - out.writeLong(txRollbacks); - out.writeFloat(avgTxRollbackTime); - out.writeLong(puts); - out.writeFloat(avgPutTime); - out.writeLong(removals); - out.writeFloat(avgRemovalTime); - out.writeLong(evictions); - out.writeInt(readsPerSec); - out.writeInt(putsPerSec); - out.writeInt(removalsPerSec); - out.writeInt(commitsPerSec); - out.writeInt(rollbacksPerSec); - out.writeInt(dhtEvictQueueCurrSize); - - out.writeInt(txThreadMapSize); - out.writeInt(txXidMapSize); - out.writeInt(txCommitQueueSize); - out.writeInt(txPrepareQueueSize); - out.writeInt(txStartVerCountsSize); - out.writeInt(txCommittedVersionsSize); - out.writeInt(txRolledbackVersionsSize); - out.writeInt(txDhtThreadMapSize); - out.writeInt(txDhtXidMapSize); - out.writeInt(txDhtCommitQueueSize); - out.writeInt(txDhtPrepareQueueSize); - out.writeInt(txDhtStartVerCountsSize); - out.writeInt(txDhtCommittedVersionsSize); - out.writeInt(txDhtRolledbackVersionsSize); - - out.writeLong(heapEntriesCnt); - out.writeLong(offHeapAllocatedSize); - out.writeLong(offHeapEntriesCnt); - out.writeLong(offHeapPrimaryEntriesCnt); - - out.writeInt(totalPartsCnt); - out.writeInt(rebalancingPartsCnt); - out.writeLong(keysToRebalanceLeft); - out.writeLong(rebalancingKeysRate); - out.writeLong(rebalancingBytesRate); - - out.writeObject(qryMetrics); - - out.writeLong(cacheSize); - - out.writeLong(rebalancedKeys); - out.writeLong(estimatedRebalancingKeys); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - mode = CacheMode.fromCode(in.readByte()); - sys = in.readBoolean(); - size = in.readInt(); - keySize = in.readInt(); - reads = in.readLong(); - avgReadTime = in.readFloat(); - writes = in.readLong(); - hits = in.readLong(); - misses = in.readLong(); - txCommits = in.readLong(); - avgTxCommitTime = in.readFloat(); - txRollbacks = in.readLong(); - avgTxRollbackTime = in.readFloat(); - puts = in.readLong(); - avgPutTime = in.readFloat(); - removals = in.readLong(); - avgRemovalTime = in.readFloat(); - evictions = in.readLong(); - readsPerSec = in.readInt(); - putsPerSec = in.readInt(); - removalsPerSec = in.readInt(); - commitsPerSec = in.readInt(); - rollbacksPerSec = in.readInt(); - dhtEvictQueueCurrSize = in.readInt(); - - txThreadMapSize = in.readInt(); - txXidMapSize = in.readInt(); - txCommitQueueSize = in.readInt(); - txPrepareQueueSize = in.readInt(); - txStartVerCountsSize = in.readInt(); - txCommittedVersionsSize = in.readInt(); - txRolledbackVersionsSize = in.readInt(); - txDhtThreadMapSize = in.readInt(); - txDhtXidMapSize = in.readInt(); - txDhtCommitQueueSize = in.readInt(); - txDhtPrepareQueueSize = in.readInt(); - txDhtStartVerCountsSize = in.readInt(); - txDhtCommittedVersionsSize = in.readInt(); - txDhtRolledbackVersionsSize = in.readInt(); - - heapEntriesCnt = in.readLong(); - offHeapAllocatedSize = in.readLong(); - offHeapEntriesCnt = in.readLong(); - offHeapPrimaryEntriesCnt = in.readLong(); - - totalPartsCnt = in.readInt(); - rebalancingPartsCnt = in.readInt(); - keysToRebalanceLeft = in.readLong(); - rebalancingKeysRate = in.readLong(); - rebalancingBytesRate = in.readLong(); - - qryMetrics = (VisorQueryMetrics)in.readObject(); - - if (in.available() > 0) - cacheSize = in.readLong(); - - if (protoVer > V1) { - rebalancedKeys = in.readLong(); - estimatedRebalancingKeys = in.readLong(); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheMetrics.class, this); - } -} 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 deleted file mode 100644 index 4c18ba3c78247..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java +++ /dev/null @@ -1,136 +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.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.internal.processors.task.GridInternal; -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.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.util.VisorTaskUtils; -import org.jetbrains.annotations.Nullable; - -/** - * Task that collect cache metrics from all nodes. - */ -@GridInternal -public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask, Collection> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheMetricsCollectorJob job(VisorCacheMetricsCollectorTaskArg arg) { - return new VisorCacheMetricsCollectorJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Iterable reduce0(List results) { - Map grpAggrMetrics = U.newHashMap(results.size()); - - for (ComputeJobResult res : results) { - if (res.getException() == null) { - Collection cms = res.getData(); - - for (VisorCacheMetrics cm : cms) { - VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.getName()); - - if (am == null) { - am = new VisorCacheAggregatedMetrics(cm); - - grpAggrMetrics.put(cm.getName(), am); - } - - am.getMetrics().put(res.getNode().id(), cm); - } - } - } - - // Create serializable result. - return new ArrayList<>(grpAggrMetrics.values()); - } - - /** - * Job that collect cache metrics from node. - */ - private static class VisorCacheMetricsCollectorJob - extends VisorJob> { - - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Whether to collect metrics for all caches or for specified cache name only. - * @param debug Debug flag. - */ - private VisorCacheMetricsCollectorJob(VisorCacheMetricsCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Collection run(final VisorCacheMetricsCollectorTaskArg arg) { - assert arg != null; - - boolean showSysCaches = arg.isShowSystemCaches(); - - Collection cacheNames = arg.getCacheNames(); - - assert cacheNames != null; - - GridCacheProcessor cacheProcessor = ignite.context().cache(); - - Collection> caches = cacheProcessor.jcaches(); - - Collection res = new ArrayList<>(caches.size()); - - boolean allCaches = cacheNames.isEmpty(); - - for (IgniteCacheProxy ca : caches) { - String cacheName = ca.getName(); - - if (!VisorTaskUtils.isRestartingCache(ignite, cacheName)) { - GridCacheContext ctx = ca.context(); - - if (ctx.started() && (ctx.affinityNode() || ctx.isNear())) { - VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName); - - if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem())) - res.add(cm); - } - } - } - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheMetricsCollectorJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java deleted file mode 100644 index 9529ab4d0a346..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java +++ /dev/null @@ -1,87 +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.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; - -/** - * Cache start arguments. - */ -public class VisorCacheMetricsCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Collect metrics for system caches. */ - private boolean showSysCaches; - - /** Cache names to collect metrics. */ - private List cacheNames; - - /** - * Default constructor. - */ - public VisorCacheMetricsCollectorTaskArg() { - // No-op. - } - - /** - * @param showSysCaches Collect metrics for system caches. - * @param cacheNames Cache names to collect metrics. - */ - public VisorCacheMetricsCollectorTaskArg(boolean showSysCaches, List cacheNames) { - this.showSysCaches = showSysCaches; - this.cacheNames = cacheNames; - } - - /** - * @return Collect metrics for system caches - */ - public boolean isShowSystemCaches() { - return showSysCaches; - } - - /** - * @return Cache names to collect metrics - */ - public List getCacheNames() { - return cacheNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(showSysCaches); - U.writeCollection(out, cacheNames); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - showSysCaches = in.readBoolean(); - cacheNames = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheMetricsCollectorTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java deleted file mode 100644 index f68efa8622e1b..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java +++ /dev/null @@ -1,115 +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.UUID; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.internal.visor.query.VisorQueryUtils; -import org.apache.ignite.internal.visor.util.VisorTaskUtils; - -/** - * Task that modify value in specified cache. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheModifyTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheModifyJob job(VisorCacheModifyTaskArg arg) { - return new VisorCacheModifyJob(arg, debug); - } - - /** - * Job that modify value in specified cache. - */ - private static class VisorCacheModifyJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job. - * - * @param arg Task argument. - * @param debug Debug flag. - */ - private VisorCacheModifyJob(VisorCacheModifyTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorCacheModifyTaskResult run(final VisorCacheModifyTaskArg arg) { - assert arg != null; - - VisorModifyCacheMode mode = arg.getMode(); - String cacheName = arg.getCacheName(); - Object key = arg.getKey(); - - assert mode != null; - assert cacheName != null; - assert key != null; - - IgniteCache cache = ignite.cache(cacheName); - - if (cache == null) - throw new IllegalArgumentException("Failed to find cache with specified name [cacheName=" + arg.getCacheName() + "]"); - - ClusterNode node = ignite.affinity(cacheName).mapKeyToNode(key); - - UUID nid = node != null ? node.id() : null; - - switch (mode) { - case PUT: - Object old = cache.get(key); - - cache.put(key, arg.getValue()); - - return new VisorCacheModifyTaskResult(nid, VisorTaskUtils.compactClass(old), - VisorQueryUtils.convertValue(old)); - - case GET: - Object val = cache.get(key); - - return new VisorCacheModifyTaskResult(nid, VisorTaskUtils.compactClass(val), - VisorQueryUtils.convertValue(val)); - - case REMOVE: - Object rmv = cache.get(key); - - cache.remove(key); - - return new VisorCacheModifyTaskResult(nid, VisorTaskUtils.compactClass(rmv), - VisorQueryUtils.convertValue(rmv)); - } - - return new VisorCacheModifyTaskResult(nid, null, null); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheModifyJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java deleted file mode 100644 index 3948a2f086672..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java +++ /dev/null @@ -1,120 +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.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; - -/** - * Argument for {@link VisorCacheModifyTask}. - */ -public class VisorCacheModifyTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** Modification mode. */ - private VisorModifyCacheMode mode; - - /** Specified key. */ - private Object key; - - /** Specified value. */ - private Object val; - - /** Created for toString method because Object can't be printed. */ - private String modifiedValues; - - /** - * Default constructor. - */ - public VisorCacheModifyTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - * @param mode Modification mode. - * @param key Specified key. - * @param val Specified value. - */ - public VisorCacheModifyTaskArg(String cacheName, VisorModifyCacheMode mode, Object key, Object val) { - this.cacheName = cacheName; - this.mode = mode; - this.key = key; - this.val = val; - this.modifiedValues = "[Key=" + key + ", Value=" + val + "]"; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return Modification mode. - */ - public VisorModifyCacheMode getMode() { - return mode; - } - - /** - * @return Specified key. - */ - public Object getKey() { - return key; - } - - /** - * @return Specified value. - */ - public Object getValue() { - return val; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - U.writeEnum(out, mode); - out.writeObject(key); - out.writeObject(val); - U.writeString(out, modifiedValues); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - mode = VisorModifyCacheMode.fromOrdinal(in.readByte()); - key = in.readObject(); - val = in.readObject(); - modifiedValues = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheModifyTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java deleted file mode 100644 index 8d0152af57631..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java +++ /dev/null @@ -1,101 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -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 VisorCacheModifyTask}. - */ -public class VisorCacheModifyTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Node ID where modified data contained. */ - private UUID affinityNode; - - /** Result type name. */ - private String resType; - - /** Value for specified key or number of modified rows. */ - private Object res; - - /** - * Default constructor. - */ - public VisorCacheModifyTaskResult() { - // No-op. - } - - /** - * @param affinityNode Node ID where modified data contained. - * @param resType Result type name. - * @param res Value for specified key or number of modified rows. - */ - public VisorCacheModifyTaskResult(UUID affinityNode, String resType, Object res) { - this.affinityNode = affinityNode; - this.resType = resType; - this.res = res; - } - - /** - * @return Node ID where modified data contained. - */ - public UUID getAffinityNode() { - return affinityNode; - } - - /** - * @return Result type name. - */ - public String getResultType() { - return resType; - } - - /** - * @return Value for specified key or number of modified rows. - */ - public Object getResult() { - return res; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeUuid(out, affinityNode); - U.writeString(out, resType); - out.writeObject(res); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - affinityNode = U.readUuid(in); - resType = U.readString(in); - res = in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheModifyTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTask.java deleted file mode 100644 index 7d934d14339e0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTask.java +++ /dev/null @@ -1,90 +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.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; -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.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.apache.ignite.lang.IgniteUuid; - -/** - * Task that collect cache names and deployment IDs. - */ -@GridInternal -public class VisorCacheNamesCollectorTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheNamesCollectorJob job(Void arg) { - return new VisorCacheNamesCollectorJob(arg, debug); - } - - /** - * Job that collect cache names and deployment IDs. - */ - private static class VisorCacheNamesCollectorJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job. - * - * @param arg Task argument. - * @param debug Debug flag. - */ - private VisorCacheNamesCollectorJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorCacheNamesCollectorTaskResult run(Void arg) { - GridCacheProcessor cacheProc = ignite.context().cache(); - - Map caches = new HashMap<>(); - Set groups = new HashSet<>(); - - for (Map.Entry item : cacheProc.cacheDescriptors().entrySet()) { - DynamicCacheDescriptor cd = item.getValue(); - - caches.put(item.getKey(), cd.deploymentId()); - - String grp = cd.groupDescriptor().groupName(); - - if (!F.isEmpty(grp)) - groups.add(grp); - } - - return new VisorCacheNamesCollectorTaskResult(caches, groups); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheNamesCollectorJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTaskResult.java deleted file mode 100644 index a2e0908f3e9ff..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNamesCollectorTaskResult.java +++ /dev/null @@ -1,88 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Map; -import java.util.Set; -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; - -/** - * Result for {@link VisorCacheNamesCollectorTask}. - */ -public class VisorCacheNamesCollectorTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache names and deployment IDs. */ - private Map caches; - - /** Cache groups. */ - private Set groups; - - /** - * Default constructor. - */ - public VisorCacheNamesCollectorTaskResult() { - // No-op. - } - - /** - * @param caches Cache names and deployment IDs. - */ - public VisorCacheNamesCollectorTaskResult(Map caches, Set groups) { - this.caches = caches; - this.groups = groups; - } - - /** - * @return Value for specified key or number of modified rows.. - */ - public Map getCaches() { - return caches; - } - - /** - * @return Value for specified key or number of modified rows.. - */ - public Set getGroups() { - return groups; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, caches); - U.writeCollection(out, groups); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - caches = U.readMap(in); - groups = U.readSet(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheNamesCollectorTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTask.java deleted file mode 100644 index a8ed0a4fd13b6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTask.java +++ /dev/null @@ -1,76 +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.ArrayList; -import java.util.Collection; -import java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -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; - -/** - * Task that returns collection of cache data nodes IDs. - */ -@GridInternal -public class VisorCacheNodesTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheNodesJob job(VisorCacheNodesTaskArg arg) { - return new VisorCacheNodesJob(arg, debug); - } - - /** - * Job that collects cluster group for specified cache. - */ - private static class VisorCacheNodesJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job. - * - * @param cacheName Cache name to clear. - * @param debug Debug flag. - */ - private VisorCacheNodesJob(VisorCacheNodesTaskArg cacheName, boolean debug) { - super(cacheName, debug); - } - - /** {@inheritDoc} */ - @Override protected Collection run(VisorCacheNodesTaskArg arg) { - Collection nodes = ignite.cluster().forDataNodes(arg.getCacheName()).nodes(); - - Collection res = new ArrayList<>(nodes.size()); - - for (ClusterNode node : nodes) - res.add(node.id()); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheNodesJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTaskArg.java deleted file mode 100644 index 29e00e5b96df0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNodesTaskArg.java +++ /dev/null @@ -1,72 +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.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; - -/** - * Argument for {@link VisorCacheNodesTask}. - */ -public class VisorCacheNodesTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** - * Default constructor. - */ - public VisorCacheNodesTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - */ - public VisorCacheNodesTaskArg(String cacheName) { - this.cacheName = cacheName; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheNodesTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java deleted file mode 100644 index 99feb23177a7b..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java +++ /dev/null @@ -1,100 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.HashMap; -import java.util.Map; -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; - -/** - * Data transfer object for information about cache partitions. - */ -public class VisorCachePartitions extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private Map primary; - - /** */ - private Map backup; - - /** - * Default constructor. - */ - public VisorCachePartitions() { - primary = new HashMap<>(); - backup = new HashMap<>(); - } - - /** - * Add primary partition descriptor. - * - * @param partId Partition id. - * @param cnt Number of primary keys in partition. - */ - public void addPrimary(int partId, long cnt) { - primary.put(partId, cnt); - } - - /** - * Add backup partition descriptor. - * - * @param partId Partition id. - * @param cnt Number of backup keys in partition. - */ - public void addBackup(int partId, long cnt) { - backup.put(partId, cnt); - } - - /** - * @return Get list of primary partitions. - */ - public Map getPrimary() { - return primary; - } - - /** - * @return Get list of backup partitions. - */ - public Map getBackup() { - return backup; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, primary); - U.writeMap(out, backup); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - primary = U.readMap(in); - backup = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCachePartitions.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java deleted file mode 100644 index 11ae18de754f8..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java +++ /dev/null @@ -1,147 +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.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; -import org.apache.ignite.internal.processors.cache.GridCacheAdapter; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; -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.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.util.VisorTaskUtils; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log; - -/** - * Task that collect keys distribution in partitions. - */ -@GridInternal -public class VisorCachePartitionsTask extends VisorMultiNodeTask, VisorCachePartitions> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCachePartitionsJob job(VisorCachePartitionsTaskArg arg) { - return new VisorCachePartitionsJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Map reduce0(List results) { - Map parts = new HashMap<>(); - - for (ComputeJobResult res : results) { - if (res.getException() != null) - throw res.getException(); - - parts.put(res.getNode().id(), res.getData()); - } - - return parts; - } - - /** - * Job that collect cache metrics from node. - */ - private static class VisorCachePartitionsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Tasks arguments. - * @param debug Debug flag. - */ - private VisorCachePartitionsJob(VisorCachePartitionsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorCachePartitions run(VisorCachePartitionsTaskArg arg) throws IgniteException { - String cacheName = arg.getCacheName(); - - if (debug) - log(ignite.log(), "Collecting partitions for cache: " + escapeName(cacheName)); - - VisorCachePartitions parts = new VisorCachePartitions(); - - GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName); - - // Cache was not started. - if (ca == null || !ca.context().started() || VisorTaskUtils.isRestartingCache(ignite, cacheName)) - return parts; - - CacheConfiguration cfg = ca.configuration(); - - CacheMode mode = cfg.getCacheMode(); - - boolean partitioned = (mode == CacheMode.PARTITIONED || mode == CacheMode.REPLICATED) - && ca.context().affinityNode(); - - if (partitioned) { - GridDhtCacheAdapter dca = null; - - if (ca instanceof GridNearCacheAdapter) - dca = ((GridNearCacheAdapter)ca).dht(); - else if (ca instanceof GridDhtCacheAdapter) - dca = (GridDhtCacheAdapter)ca; - - if (dca != null) { - GridDhtPartitionTopology top = dca.topology(); - - List locParts = top.localPartitions(); - - for (GridDhtLocalPartition part : locParts) { - int p = part.id(); - - long sz = part.dataStore().cacheSize(ca.context().cacheId()); - - // Pass NONE as topology version in order not to wait for topology version. - if (part.primary(AffinityTopologyVersion.NONE)) - parts.addPrimary(p, sz); - else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE)) - parts.addBackup(p, sz); - } - } - } - - return parts; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCachePartitionsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTaskArg.java deleted file mode 100644 index 957f0718b8ca7..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTaskArg.java +++ /dev/null @@ -1,72 +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.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; - -/** - * Arguments for {@link VisorCachePartitionsTask}. - */ -public class VisorCachePartitionsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String cacheName; - - /** - * Default constructor. - */ - public VisorCachePartitionsTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - */ - public VisorCachePartitionsTaskArg(String cacheName) { - this.cacheName = cacheName; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCachePartitionsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTask.java deleted file mode 100644 index 58f8596bca410..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTask.java +++ /dev/null @@ -1,86 +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.ArrayList; -import java.util.Collection; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.processors.cache.IgniteInternalCache; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.VisorOneNodeTask; - -/** - * Pre-loads caches. Made callable just to conform common pattern. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheRebalanceTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCachesRebalanceJob job(VisorCacheRebalanceTaskArg arg) { - return new VisorCachesRebalanceJob(arg, debug); - } - - /** - * Job that rebalance caches. - */ - private static class VisorCachesRebalanceJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Caches names. - * @param debug Debug flag. - */ - private VisorCachesRebalanceJob(VisorCacheRebalanceTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorCacheRebalanceTaskArg arg) { - try { - Collection> futs = new ArrayList<>(); - - for (IgniteInternalCache c : ignite.cachesx()) { - if (arg.getCacheNames().contains(c.name())) - futs.add(c.rebalance()); - } - - for (IgniteInternalFuture f : futs) - f.get(); - - return null; - } - catch (IgniteCheckedException e) { - throw U.convertException(e); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCachesRebalanceJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTaskArg.java deleted file mode 100644 index 0bf420c52fbca..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceTaskArg.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 java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Set; -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; - -/** - * Argument for {@link VisorCacheRebalanceTask}. - */ -public class VisorCacheRebalanceTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache names. */ - private Set cacheNames; - - /** - * Default constructor. - */ - public VisorCacheRebalanceTaskArg() { - // No-op. - } - - /** - * @param cacheNames Cache names. - */ - public VisorCacheRebalanceTaskArg(Set cacheNames) { - this.cacheNames = cacheNames; - } - - /** - * @return Cache names. - */ - public Set getCacheNames() { - return cacheNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeCollection(out, cacheNames); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheNames = U.readSet(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheRebalanceTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTask.java deleted file mode 100644 index aa90d3e52a77d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTask.java +++ /dev/null @@ -1,67 +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.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Reset lost partitions for caches. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheResetLostPartitionsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheResetLostPartitionsJob job(VisorCacheResetLostPartitionsTaskArg arg) { - return new VisorCacheResetLostPartitionsJob(arg, debug); - } - - /** - * Job that reset lost partitions for caches. - */ - private static class VisorCacheResetLostPartitionsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Object with list cache names to reset lost partitions. - * @param debug Debug flag. - */ - private VisorCacheResetLostPartitionsJob(VisorCacheResetLostPartitionsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorCacheResetLostPartitionsTaskArg arg) { - ignite.resetLostPartitions(arg.getCacheNames()); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheResetLostPartitionsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTaskArg.java deleted file mode 100644 index c69e79db6d51c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetLostPartitionsTaskArg.java +++ /dev/null @@ -1,81 +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.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; - -/** - * Argument for {@link VisorCacheResetLostPartitionsTask}. - */ -public class VisorCacheResetLostPartitionsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** List of cache names. */ - private List cacheNames; - - /** Created for toString method because Collection can't be printed. */ - private String modifiedCaches; - - /** - * Default constructor. - */ - public VisorCacheResetLostPartitionsTaskArg() { - // No-op. - } - - /** - * @param cacheNames List of cache names. - */ - public VisorCacheResetLostPartitionsTaskArg(List cacheNames) { - this.cacheNames = cacheNames; - - if (cacheNames != null) - modifiedCaches = cacheNames.toString(); - } - - /** - * @return List of cache names. - */ - public List getCacheNames() { - return cacheNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeCollection(out, cacheNames); - U.writeString(out, modifiedCaches); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheNames = U.readList(in); - modifiedCaches = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheResetLostPartitionsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java deleted file mode 100644 index bc6698de3bac0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java +++ /dev/null @@ -1,69 +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.internal.processors.cache.IgniteInternalCache; -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; - -/** - * Reset compute grid metrics. - */ -@GridInternal -public class VisorCacheResetMetricsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheResetMetricsJob job(VisorCacheResetMetricsTaskArg arg) { - return new VisorCacheResetMetricsJob(arg, debug); - } - - /** - * Job that reset cache metrics. - */ - private static class VisorCacheResetMetricsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Cache name to reset metrics for. - * @param debug Debug flag. - */ - private VisorCacheResetMetricsJob(VisorCacheResetMetricsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorCacheResetMetricsTaskArg arg) { - IgniteInternalCache cache = ignite.cachex(arg.getCacheName()); - - if (cache != null) - cache.localMxBean().clear(); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheResetMetricsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTaskArg.java deleted file mode 100644 index 3a9d8aef0b532..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTaskArg.java +++ /dev/null @@ -1,72 +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.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; - -/** - * Argument for {@link VisorCacheResetMetricsTask}. - */ -public class VisorCacheResetMetricsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** - * Default constructor. - */ - public VisorCacheResetMetricsTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - */ - public VisorCacheResetMetricsTaskArg(String cacheName) { - this.cacheName = cacheName; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheResetMetricsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java deleted file mode 100644 index cd4c95cc3affc..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java +++ /dev/null @@ -1,115 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata; -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; - -/** - * Data transfer object for cache SQL index metadata. - */ -public class VisorCacheSqlIndexMetadata extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String name; - - /** */ - private List fields; - - /** */ - private List descendings; - - /** */ - private boolean unique; - - /** - * Default constructor. - */ - public VisorCacheSqlIndexMetadata() { - // No-op. - } - - /** - * Create data transfer object. - * - * @param meta SQL index metadata. - */ - public VisorCacheSqlIndexMetadata(GridCacheSqlIndexMetadata meta) { - name = meta.name(); - fields = toList(meta.fields()); - descendings = toList(meta.descendings()); - unique = meta.unique(); - } - - /** - * @return Index name. - */ - public String getName() { - return name; - } - - /** - * @return Indexed fields names. - */ - public List getFields() { - return fields; - } - - /** - * @return Descendings. - */ - public List getDescendings() { - return descendings; - } - - /** - * @return {@code True} if index is unique, {@code false} otherwise. - */ - public boolean isUnique() { - return unique; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - U.writeCollection(out, fields); - U.writeCollection(out, descendings); - out.writeBoolean(unique); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - fields = U.readList(in); - descendings = U.readList(in); - unique = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheSqlIndexMetadata.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java deleted file mode 100644 index 7da9c975836a9..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java +++ /dev/null @@ -1,162 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata; -import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata; -import org.apache.ignite.internal.util.IgniteUtils; -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; - -/** - * Data transfer object for cache SQL metadata. - */ -public class VisorCacheSqlMetadata extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String cacheName; - - /** */ - private List types; - - /** */ - private Map keyClasses; - - /** */ - private Map valClasses; - - /** */ - private Map> fields; - - /** */ - private Map> indexes; - - /** - * Default constructor. - */ - public VisorCacheSqlMetadata() { - // No-op. - } - - /** - * Create data transfer object. - * - * @param meta Cache SQL metadata. - */ - public VisorCacheSqlMetadata(GridCacheSqlMetadata meta) { - cacheName = meta.cacheName(); - types = toList(meta.types()); - keyClasses = meta.keyClasses(); - valClasses = meta.valClasses(); - fields = meta.fields(); - indexes = new HashMap<>(); - - Map> src = meta.indexes(); - - if (src != null) { - for (Map.Entry> entry: src.entrySet()) { - Collection idxs = entry.getValue(); - - List res = new ArrayList<>(idxs.size()); - - for (GridCacheSqlIndexMetadata idx : idxs) - res.add(new VisorCacheSqlIndexMetadata(idx)); - - indexes.put(entry.getKey(), res); - } - } - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return Collection of available types. - */ - public List getTypes() { - return types; - } - - /** - * @return Key classes. - */ - public Map getKeyClasses() { - return keyClasses; - } - - /** - * @return Value classes. - */ - public Map getValueClasses() { - return valClasses; - } - - /** - * @return Fields. - */ - public Map> getFields() { - return fields; - } - - /** - * @return Indexes. - */ - public Map> getIndexes() { - return indexes; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - U.writeCollection(out, types); - IgniteUtils.writeStringMap(out, keyClasses); - IgniteUtils.writeStringMap(out, valClasses); - U.writeMap(out, fields); - U.writeMap(out, indexes); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - types = U.readList(in); - keyClasses = IgniteUtils.readStringMap(in); - valClasses = IgniteUtils.readStringMap(in); - fields = U.readMap(in); - indexes = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheSqlMetadata.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java deleted file mode 100644 index 2e96a4b2139d5..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java +++ /dev/null @@ -1,112 +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.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.util.VisorTaskUtils; -import org.jetbrains.annotations.Nullable; - -/** - * Task that start cache or near cache with specified configuration. - */ -@GridInternal -@GridVisorManagementTask -public class VisorCacheStartTask extends VisorMultiNodeTask, Void> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheStartJob job(VisorCacheStartTaskArg arg) { - return new VisorCacheStartJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Map reduce0(List results) throws IgniteException { - Map map = new HashMap<>(); - - for (ComputeJobResult res : results) - if (res.getException() != null) - map.put(res.getNode().id(), res.getException()); - - return map; - } - - /** - * Job that start cache or near cache with specified configuration. - */ - private static class VisorCacheStartJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job. - * - * @param arg Contains cache name and XML configurations of cache. - * @param debug Debug flag. - */ - private VisorCacheStartJob(VisorCacheStartTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorCacheStartTaskArg arg) throws IgniteException { - String cfg = arg.getConfiguration(); - - assert !F.isEmpty(cfg); - - try (ByteArrayInputStream bais = new ByteArrayInputStream(cfg.getBytes())) { - if (arg.isNear()) { - NearCacheConfiguration nearCfg = Ignition.loadSpringBean(bais, "nearCacheConfiguration"); - - ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.getName()), nearCfg); - } - else { - CacheConfiguration cacheCfg = Ignition.loadSpringBean(bais, "cacheConfiguration"); - - ignite.getOrCreateCache(cacheCfg); - } - } - catch (IOException e) { - throw new IgniteException(e); - } - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheStartJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTaskArg.java deleted file mode 100644 index 0b058aea525c8..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTaskArg.java +++ /dev/null @@ -1,100 +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.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; - -/** - * Cache start arguments. - */ -public class VisorCacheStartTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private boolean near; - - /** */ - private String name; - - /** */ - private String cfg; - - /** - * Default constructor. - */ - public VisorCacheStartTaskArg() { - // No-op. - } - - /** - * @param near {@code true} if near cache should be started. - * @param name Name for near cache. - * @param cfg Cache XML configuration. - */ - public VisorCacheStartTaskArg(boolean near, String name, String cfg) { - this.near = near; - this.name = name; - this.cfg = cfg; - } - - /** - * @return {@code true} if near cache should be started. - */ - public boolean isNear() { - return near; - } - - /** - * @return Name for near cache. - */ - public String getName() { - return name; - } - - /** - * @return Cache XML configuration. - */ - public String getConfiguration() { - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(near); - U.writeString(out, name); - U.writeString(out, cfg); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - near = in.readBoolean(); - name = U.readString(in); - cfg = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheStartTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTask.java deleted file mode 100644 index aebed810d2cc0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTask.java +++ /dev/null @@ -1,72 +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.IgniteCheckedException; -import org.apache.ignite.internal.processors.task.GridInternal; -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.VisorOneNodeTask; - -/** - * Switch statisticsEnabled flag for specified caches to specified state. - */ -@GridInternal -public class VisorCacheToggleStatisticsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCachesToggleStatisticsJob job(VisorCacheToggleStatisticsTaskArg arg) { - return new VisorCachesToggleStatisticsJob(arg, debug); - } - - /** - * Job that switch statisticsEnabled flag for specified caches to specified state. - */ - private static class VisorCachesToggleStatisticsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Job argument object. - * @param debug Debug flag. - */ - private VisorCachesToggleStatisticsJob(VisorCacheToggleStatisticsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorCacheToggleStatisticsTaskArg arg) { - try { - ignite.context().cache().enableStatistics(arg.getCacheNames(), arg.getState()); - } - catch (IgniteCheckedException e) { - throw U.convertException(e); - } - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCachesToggleStatisticsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTaskArg.java deleted file mode 100644 index 34359daeacf6c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheToggleStatisticsTaskArg.java +++ /dev/null @@ -1,87 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Set; -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; - -/** - * Argument for {@link VisorCacheToggleStatisticsTask}. - */ -public class VisorCacheToggleStatisticsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** State to set to statisticsEnabled flag. */ - private boolean state; - - /** Cache names to toggle statisticsEnabled flag. */ - private Set cacheNames; - - /** - * Default constructor. - */ - public VisorCacheToggleStatisticsTaskArg() { - // No-op. - } - - /** - * @param state State to set to statisticsEnabled flag. - * @param cacheNames Collection of cache names to toggle statisticsEnabled flag. - */ - public VisorCacheToggleStatisticsTaskArg(boolean state, Set cacheNames) { - this.state = state; - this.cacheNames = cacheNames; - } - - /** - * @return State to set to statisticsEnabled flag. - */ - public boolean getState() { - return state; - } - - /** - * @return Cache names to toggle statisticsEnabled flag. - */ - public Set getCacheNames() { - return cacheNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(state); - U.writeCollection(out, cacheNames); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - state = in.readBoolean(); - cacheNames = U.readSet(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheToggleStatisticsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java deleted file mode 100644 index d9ac08a8e3529..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java +++ /dev/null @@ -1,352 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.DataRegionMetrics; -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; - -/** - * Data transfer object for {@link DataRegionMetrics} - */ -public class VisorMemoryMetrics extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String name; - - /** */ - private long totalAllocatedPages; - - /** */ - private float allocationRate; - - /** */ - private float evictionRate; - - /** */ - private float largeEntriesPagesPercentage; - - /** */ - private float pagesFillFactor; - - /** */ - private long dirtyPages; - - /** */ - private float pagesReplaceRate; - - /** */ - private long physicalMemoryPages; - - /** */ - private long totalAllocatedSz; - - /** */ - private long physicalMemSz; - - /** */ - private int pageSize; - - /** */ - private long cpBufSz; - - /** */ - private long cpUsedBufPages; - - /** */ - private long cpUsedBufSz; - - /** */ - private long pagesRead; - - /** */ - private long pagesWritten; - - /** */ - private long pagesReplaced; - - /** */ - private long offHeapSz; - - /** */ - private long offHeapUsedSz; - - /** - * Default constructor. - */ - public VisorMemoryMetrics() { - // No-op. - } - - /** - * @param m Metrics instance to create DTO. - */ - public VisorMemoryMetrics(DataRegionMetrics m) { - name = m.getName(); - totalAllocatedPages = m.getTotalAllocatedPages(); - allocationRate = m.getAllocationRate(); - evictionRate = m.getEvictionRate(); - largeEntriesPagesPercentage = m.getLargeEntriesPagesPercentage(); - pagesFillFactor = m.getPagesFillFactor(); - dirtyPages = m.getDirtyPages(); - pagesReplaceRate = m.getPagesReplaceRate(); - physicalMemoryPages = m.getPhysicalMemoryPages(); - totalAllocatedSz = m.getTotalAllocatedSize(); - physicalMemSz = m.getPhysicalMemorySize(); - - pageSize = m.getPageSize(); - - cpBufSz = m.getCheckpointBufferSize(); - cpUsedBufPages = m.getUsedCheckpointBufferPages(); - cpUsedBufSz = m.getUsedCheckpointBufferSize(); - - pagesRead = m.getPagesRead(); - pagesWritten = m.getPagesWritten(); - pagesReplaced = m.getPagesReplaced(); - - offHeapSz = m.getOffHeapSize(); - offHeapUsedSz = m.getOffheapUsedSize(); - } - - /** - * @return Name of the memory region. - */ - public String getName() { - return name; - } - - /** - * @return Total number of allocated pages. - */ - public long getTotalAllocatedPages() { - return totalAllocatedPages; - } - - /** - * @return Number of allocated pages per second. - */ - public float getAllocationRate() { - return allocationRate; - } - - /** - * @return Eviction rate. - */ - public float getEvictionRate() { - return evictionRate; - } - - /** - * @return Number of evicted pages per second. - */ - public float getLargeEntriesPagesPercentage() { - return largeEntriesPagesPercentage; - } - - /** - * @return Percentage of pages fully occupied by large entities. - */ - public float getPagesFillFactor() { - return pagesFillFactor; - } - - /** - * @return Current number of dirty pages. - */ - public long getDirtyPages() { - return dirtyPages; - } - - /** - * @return Pages per second replace rate. - */ - public float getPagesReplaceRate() { - return pagesReplaceRate; - } - - /** - * @return Total number of pages loaded to RAM. - */ - public long getPhysicalMemoryPages() { - return physicalMemoryPages; - } - - /** - * @return Total size of memory allocated, in bytes. - */ - public long getTotalAllocatedSize() { - return totalAllocatedSz; - } - - /** - * @return Total size of pages loaded to RAM in bytes. - */ - public long getPhysicalMemorySize() { - return physicalMemSz; - } - - /** - * This method needed for compatibility with V2. - * - * @return Used checkpoint buffer size in pages. - */ - public long getCheckpointBufferPages() { - return cpUsedBufPages; - } - - /** - * @return @return Checkpoint buffer size in bytes. - */ - public long getCheckpointBufferSize() { - return cpBufSz; - } - - /** - * @return Used checkpoint buffer size in pages. - */ - public long getUsedCheckpointBufferPages() { - return cpUsedBufPages; - } - - /** - * @return Used checkpoint buffer size in bytes. - */ - public long getUsedCheckpointBufferSize() { - return cpUsedBufSz; - } - - /** - * @return Page size in bytes. - */ - public int getPageSize() { - return pageSize; - } - - /** - * @return The number of read pages from last restart. - */ - public long getPagesRead() { - return pagesRead; - } - - /** - * @return The number of written pages from last restart. - */ - public long getPagesWritten() { - return pagesWritten; - } - - /** - * @return The number of replaced pages from last restart . - */ - public long getPagesReplaced() { - return pagesReplaced; - } - - /** - * @return Total offheap size in bytes. - */ - public long getOffHeapSize() { - return offHeapSz; - } - - /** - * @return Total used offheap size in bytes. - */ - public long getOffheapUsedSize() { - return offHeapUsedSz; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V3; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeLong(totalAllocatedPages); - out.writeFloat(allocationRate); - out.writeFloat(evictionRate); - out.writeFloat(largeEntriesPagesPercentage); - out.writeFloat(pagesFillFactor); - out.writeLong(dirtyPages); - out.writeFloat(pagesReplaceRate); - out.writeLong(physicalMemoryPages); - - // V2 - out.writeLong(totalAllocatedSz); - out.writeLong(physicalMemSz); - out.writeLong(cpUsedBufPages); - out.writeLong(cpBufSz); - out.writeInt(pageSize); - - // V3 - out.writeLong(cpUsedBufSz); - - out.writeLong(pagesRead); - out.writeLong(pagesWritten); - out.writeLong(pagesReplaced); - - out.writeLong(offHeapSz); - out.writeLong(offHeapUsedSz); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - totalAllocatedPages = in.readLong(); - allocationRate = in.readFloat(); - evictionRate = in.readFloat(); - largeEntriesPagesPercentage = in.readFloat(); - pagesFillFactor = in.readFloat(); - dirtyPages = in.readLong(); - pagesReplaceRate = in.readFloat(); - physicalMemoryPages = in.readLong(); - - if (protoVer > V1) { - totalAllocatedSz = in.readLong(); - physicalMemSz = in.readLong(); - cpUsedBufPages = in.readLong(); - cpBufSz = in.readLong(); - pageSize = in.readInt(); - } - - if (protoVer > V2) { - cpUsedBufSz = in.readLong(); - - pagesRead = in.readLong(); - pagesWritten = in.readLong(); - pagesReplaced = in.readLong(); - - offHeapSz = in.readLong(); - offHeapUsedSz = in.readLong(); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorMemoryMetrics.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java deleted file mode 100644 index bd47f66c0af11..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.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.jetbrains.annotations.Nullable; - -/** - * Enumeration of all supported cache modify modes. - */ -public enum VisorModifyCacheMode { - /** Put new value into cache. */ - PUT, - - /** Get value from cache. */ - GET, - - /** Remove value from cache. */ - REMOVE; - - /** Enumerated values. */ - private static final VisorModifyCacheMode[] 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 VisorModifyCacheMode fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java deleted file mode 100644 index 17c91a70f338f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.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.visor.cache; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.HashMap; -import java.util.Map; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState; -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; - -/** - * Data transfer object for partitions map. - */ -public class VisorPartitionMap extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Map of partition states. */ - private Map parts; - - /** - * Default constructor. - */ - public VisorPartitionMap() { - // No-op. - } - - /** - * @param map Partitions map. - */ - public VisorPartitionMap(GridDhtPartitionMap map) { - parts = map.map(); - } - - /** - * @return Partitions map. - */ - public Map getPartitions() { - return parts; - } - - /** - * @return Partitions map size. - */ - public int size() { - return parts.size(); - } - - /** - * @param part Partition. - * @return Partition state. - */ - public GridDhtPartitionState get(Integer part) { - return parts.get(part); - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - if (parts != null) { - out.writeInt(parts.size()); - - for (Map.Entry e : parts.entrySet()) { - out.writeInt(e.getKey()); - U.writeEnum(out, e.getValue()); - } - } - else - out.writeInt(-1); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - int size = in.readInt(); - - // Check null flag. - if (size == -1) - parts = null; - else { - parts = new HashMap<>(size, 1.0f); - - for (int i = 0; i < size; i++) - parts.put(in.readInt(), GridDhtPartitionState.fromOrdinal(in.readByte())); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorPartitionMap.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java deleted file mode 100644 index 42eb4f5ba80bf..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java +++ /dev/null @@ -1,121 +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.compute; - -import java.util.HashMap; -import java.util.Map; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter; -import org.apache.ignite.internal.util.typedef.internal.S; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.VISOR_TASK_EVTS; - -/** - * Holder class to store information in node local map between data collector task executions. - */ -public class VisorComputeMonitoringHolder { - /** Task monitoring events holder key. */ - public static final String COMPUTE_MONITORING_HOLDER_KEY = "VISOR_COMPUTE_MONITORING_KEY"; - - /** Visors that collect events (Visor instance key -> collect events since last cleanup check) */ - private final Map listenVisor = new HashMap<>(); - - /** If cleanup process not scheduled. */ - private boolean cleanupStopped = true; - - /** Timeout between disable events check. */ - protected static final int CLEANUP_TIMEOUT = 2 * 60 * 1000; - - /** - * Start collect events for Visor instance. - * - * @param ignite Grid. - * @param visorKey unique Visor instance key. - */ - public void startCollect(IgniteEx ignite, String visorKey) { - synchronized (listenVisor) { - if (cleanupStopped) { - scheduleCleanupJob(ignite); - - cleanupStopped = false; - } - - listenVisor.put(visorKey, Boolean.TRUE); - - ignite.events().enableLocal(VISOR_TASK_EVTS); - } - } - - /** - * Check if collect events may be disable. - * - * @param ignite Grid. - * @return {@code true} if task events should remain enabled. - */ - private boolean tryDisableEvents(IgniteEx ignite) { - if (!listenVisor.values().contains(Boolean.TRUE)) { - listenVisor.clear(); - - ignite.events().disableLocal(VISOR_TASK_EVTS); - } - - // Return actual state. It could stay the same if events explicitly enabled in configuration. - return ignite.allEventsUserRecordable(VISOR_TASK_EVTS); - } - - /** - * Disable collect events for Visor instance. - * - * @param g Grid. - * @param visorKey Unique Visor instance key. - */ - public void stopCollect(IgniteEx g, String visorKey) { - synchronized (listenVisor) { - listenVisor.remove(visorKey); - - tryDisableEvents(g); - } - } - - /** - * Schedule cleanup process for events monitoring. - * - * @param ignite grid. - */ - private void scheduleCleanupJob(final IgniteEx ignite) { - ignite.context().timeout().addTimeoutObject(new GridTimeoutObjectAdapter(CLEANUP_TIMEOUT) { - @Override public void onTimeout() { - synchronized (listenVisor) { - if (tryDisableEvents(ignite)) { - for (String visorKey : listenVisor.keySet()) - listenVisor.put(visorKey, Boolean.FALSE); - - scheduleCleanupJob(ignite); - } - else - cleanupStopped = true; - } - } - }); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorComputeMonitoringHolder.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeResetMetricsTask.java deleted file mode 100644 index f9bc6248f9028..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeResetMetricsTask.java +++ /dev/null @@ -1,67 +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.compute; - -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Reset compute grid metrics task. - */ -@GridInternal -@GridVisorManagementTask -public class VisorComputeResetMetricsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorComputeResetMetricsJob job(Void arg) { - return new VisorComputeResetMetricsJob(arg, debug); - } - - /** - * Reset compute grid metrics job. - */ - private static class VisorComputeResetMetricsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Formal job argument. - * @param debug Debug flag. - */ - private VisorComputeResetMetricsJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(Void arg) { - ignite.cluster().resetMetrics(); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorComputeResetMetricsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java deleted file mode 100644 index e9bd940d3ccc8..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java +++ /dev/null @@ -1,112 +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.compute; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.ConcurrentMap; -import org.apache.ignite.compute.ComputeJobResult; -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.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder.COMPUTE_MONITORING_HOLDER_KEY; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.VISOR_TASK_EVTS; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.checkExplicitTaskMonitoring; - -/** - * Task to run gc on nodes. - */ -@GridInternal -public class VisorComputeToggleMonitoringTask extends - VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Nullable @Override protected Boolean reduce0(List results) { - Collection toggles = new HashSet<>(); - - for (ComputeJobResult res : results) - toggles.add(res.getData()); - - // If all nodes return same result. - return toggles.size() == 1; - } - - /** {@inheritDoc} */ - @Override protected VisorComputeToggleMonitoringJob job(VisorComputeToggleMonitoringTaskArg arg) { - return new VisorComputeToggleMonitoringJob(arg, debug); - } - - /** - * Job to toggle task monitoring on node. - */ - private static class VisorComputeToggleMonitoringJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Visor ID key and monitoring state flag. - * @param debug Debug flag. - */ - private VisorComputeToggleMonitoringJob(VisorComputeToggleMonitoringTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Boolean run(VisorComputeToggleMonitoringTaskArg arg) { - if (checkExplicitTaskMonitoring(ignite)) - return Boolean.TRUE; - - ConcurrentMap storage = ignite.cluster().nodeLocalMap(); - - VisorComputeMonitoringHolder holder = storage.get(COMPUTE_MONITORING_HOLDER_KEY); - - if (holder == null) { - VisorComputeMonitoringHolder holderNew = new VisorComputeMonitoringHolder(); - - VisorComputeMonitoringHolder holderOld = - storage.putIfAbsent(COMPUTE_MONITORING_HOLDER_KEY, holderNew); - - holder = holderOld == null ? holderNew : holderOld; - } - - String visorKey = arg.getVisorKey(); - - boolean state = arg.isEnabled(); - - // Set task monitoring state. - if (state) - holder.startCollect(ignite, visorKey); - else - holder.stopCollect(ignite, visorKey); - - // Return actual state. It could stay the same if events explicitly enabled in configuration. - return ignite.allEventsUserRecordable(VISOR_TASK_EVTS); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorComputeToggleMonitoringJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java deleted file mode 100644 index e17379a08f8fc..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java +++ /dev/null @@ -1,86 +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.compute; - -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; - -/** - * Toggle compute monitoring arguments. - */ -public class VisorComputeToggleMonitoringTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Visor monitoring id */ - private String visorKey; - - /** Enable state of compute monitoring */ - private boolean enabled; - - /** - * Default constructor. - */ - public VisorComputeToggleMonitoringTaskArg() { - // No-op. - } - - /** - * @param visorKey Visor monitoring id. - * @param enabled Enable state of compute monitoring. - */ - public VisorComputeToggleMonitoringTaskArg(String visorKey, boolean enabled) { - this.visorKey = visorKey; - this.enabled = enabled; - } - - /** - * @return Visor monitoring id. - */ - public String getVisorKey() { - return visorKey; - } - - /** - * @return Enable state of compute monitoring. - */ - public boolean isEnabled() { - return enabled; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, visorKey); - out.writeBoolean(enabled); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - visorKey = U.readString(in); - enabled = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorComputeToggleMonitoringTaskArg.class, this); - } -} 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 deleted file mode 100644 index 8af62879f81c2..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java +++ /dev/null @@ -1,475 +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.compute; - -import java.lang.reflect.Constructor; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import org.apache.ignite.IgniteCompute; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobContext; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeJobResultPolicy; -import org.apache.ignite.compute.ComputeTask; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.lang.GridTuple3; -import org.apache.ignite.internal.util.typedef.CI1; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.visor.VisorCoordinatorNodeTask; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.apache.ignite.internal.visor.VisorTaskArgument; -import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.lang.IgniteUuid; -import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.resources.JobContextResource; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Task to run Visor tasks through http REST. - */ -@GridInternal -public class VisorGatewayTask implements ComputeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private static final int JOB_ARG_IDX = 3; - - /** Array with additional length in arguments for specific nested types */ - private static final Map TYPE_ARG_LENGTH = new HashMap<>(4); - - static { - TYPE_ARG_LENGTH.put(Collection.class, 2); - TYPE_ARG_LENGTH.put(Set.class, 2); - TYPE_ARG_LENGTH.put(List.class, 2); - TYPE_ARG_LENGTH.put(Map.class, 3); - TYPE_ARG_LENGTH.put(IgniteBiTuple.class, 4); - TYPE_ARG_LENGTH.put(GridTuple3.class, 6); - } - - /** Auto-injected grid instance. */ - @IgniteInstanceResource - protected transient IgniteEx ignite; - - /** {@inheritDoc} */ - @NotNull @Override public Map map(List subgrid, - @Nullable Object[] args) throws IgniteException { - assert args != null; - assert args.length >= 2; - - return Collections.singletonMap(new VisorGatewayJob(args), ignite.localNode()); - } - - /** {@inheritDoc} */ - @Override public ComputeJobResultPolicy result(ComputeJobResult res, - List rcvd) throws IgniteException { - // Task should handle exceptions in reduce method. - return ComputeJobResultPolicy.WAIT; - } - - /** {@inheritDoc} */ - @Nullable @Override public Object reduce(List results) throws IgniteException { - assert results.size() == 1; - - ComputeJobResult res = F.first(results); - - assert res != null; - - IgniteException ex = res.getException(); - - if (ex != null) - throw ex; - - return res.getData(); - } - - /** - * Job to run Visor tasks through http REST. - */ - private static class VisorGatewayJob extends ComputeJobAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private static final byte[] ZERO_BYTES = new byte[0]; - - /** Auto-injected grid instance. */ - @IgniteInstanceResource - protected transient IgniteEx ignite; - - /** Auto-inject job context. */ - @JobContextResource - protected transient ComputeJobContext jobCtx; - - /** Arguments count. */ - private final int argsCnt; - - /** Future for spawned task. */ - private transient IgniteFuture fut; - - /** - * Create job with specified argument. - * - * @param args Job argument. - */ - VisorGatewayJob(@Nullable Object[] args) { - super(args); - - assert args != null; - - argsCnt = args.length; - } - - /** - * Construct job argument. - * - * @param cls Class. - * @param startIdx Index of first value argument. - */ - @Nullable private Object toJobArgument(Class cls, int startIdx) throws ClassNotFoundException { - String arg = argument(startIdx); - - boolean isList = cls == Collection.class || cls == List.class; - - if (isList || cls == Set.class) { - String items = argument(startIdx + 1); - - if (items == null || "null".equals(items)) - return null; - - Class itemsCls = Class.forName(arg); - - Collection res = isList ? new ArrayList<>() : new HashSet<>(); - - for (String item : items.split(";")) - res.add(toObject(itemsCls, item)); - - return res; - } - - if (cls == IgniteBiTuple.class) { - Class keyCls = Class.forName(arg); - - String valClsName = argument(startIdx + 1); - - assert valClsName != null; - - Class valCls = Class.forName(valClsName); - - return new IgniteBiTuple<>( - toObject(keyCls, argument(startIdx + 2)), - toObject(valCls, argument(startIdx + 3))); - } - - if (cls == Map.class) { - Class keyCls = Class.forName(arg); - - String valClsName = argument(startIdx + 1); - - assert valClsName != null; - - Class valCls = Class.forName(valClsName); - - Map res = new HashMap<>(); - - String entries = argument(startIdx + 2); - - if (entries != null) { - for (String entry : entries.split(";")) { - if (!entry.isEmpty()) { - String[] values = entry.split("="); - - assert values.length >= 1; - - res.put(toObject(keyCls, values[0]), - values.length > 1 ? toObject(valCls, values[1]) : null); - } - } - } - - return res; - } - - if (cls == GridTuple3.class) { - String v2ClsName = argument(startIdx + 1); - String v3ClsName = argument(startIdx + 2); - - assert v2ClsName != null; - assert v3ClsName != null; - - Class v1Cls = Class.forName(arg); - Class v2Cls = Class.forName(v2ClsName); - Class v3Cls = Class.forName(v3ClsName); - - return new GridTuple3<>( - toObject(v1Cls, argument(startIdx + 3)), - toObject(v2Cls, argument(startIdx + 4)), - toObject(v3Cls, argument(startIdx + 5))); - } - - return toObject(cls, arg); - } - - /** - * Construct from string representation to target class. - * - * @param cls Target class. - * @return Object constructed from string. - */ - @Nullable private Object toObject(Class cls, String val) { - if (val == null || "null".equals(val) || "nil".equals(val)) - return null; - - if (String.class == cls) - return val; - - if (Boolean.class == cls || Boolean.TYPE == cls) - return Boolean.parseBoolean(val); - - if (Integer.class == cls || Integer.TYPE == cls) - return Integer.parseInt(val); - - if (Long.class == cls || Long.TYPE == cls) - return Long.parseLong(val); - - if (UUID.class == cls) - return UUID.fromString(val); - - if (IgniteUuid.class == cls) - return IgniteUuid.fromString(val); - - if (Byte.class == cls || Byte.TYPE == cls) - return Byte.parseByte(val); - - if (Short.class == cls || Short.TYPE == cls) - return Short.parseShort(val); - - if (Float.class == cls || Float.TYPE == cls) - return Float.parseFloat(val); - - if (Double.class == cls || Double.TYPE == cls) - return Double.parseDouble(val); - - if (BigDecimal.class == cls) - return new BigDecimal(val); - - if (Collection.class == cls || List.class == cls) - return Arrays.asList(val.split(";")); - - if (Set.class == cls) - return new HashSet<>(Arrays.asList(val.split(";"))); - - if (Object[].class == cls) - return val.split(";"); - - if (byte[].class == cls) { - String[] els = val.split(";"); - - if (els.length == 0 || (els.length == 1 && els[0].isEmpty())) - return ZERO_BYTES; - - byte[] res = new byte[els.length]; - - for (int i = 0; i < els.length; i++) - res[i] = Byte.valueOf(els[i]); - - return res; - } - - if (cls.isEnum()) - return Enum.valueOf(cls, val); - - return val; - } - - /** - * Check if class is not a complex bean. - * - * @param cls Target class. - * @return {@code True} if class is primitive or build-in java type or IgniteUuid. - */ - private static boolean isBuildInObject(Class cls) { - return cls.isPrimitive() || cls.getName().startsWith("java.") || - IgniteUuid.class == cls || IgniteBiTuple.class == cls || GridTuple3.class == cls; - } - - /** - * Extract Class object from arguments. - * - * @param idx Index of argument. - */ - private Class toClass(int idx) throws ClassNotFoundException { - Object arg = argument(idx); // Workaround generics: extract argument as Object to use in String.valueOf(). - - return Class.forName(String.valueOf(arg)); - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override public Object execute() throws IgniteException { - if (fut != null) - return fut.get(); - - String nidsArg = argument(0); - String taskName = argument(1); - - Object jobArgs = null; - - if (argsCnt > 2) { - String argClsName = argument(2); - - assert argClsName != null; - - try { - Class argCls = Class.forName(argClsName); - - if (argCls == Void.class) - jobArgs = null; - else if (isBuildInObject(argCls)) - jobArgs = toJobArgument(argCls, JOB_ARG_IDX); - else { - int beanArgsCnt = argsCnt - JOB_ARG_IDX; - - for (Constructor ctor : argCls.getDeclaredConstructors()) { - Class[] types = ctor.getParameterTypes(); - - int args = types.length; - - // Length of arguments that required to constructor by influence of nested complex objects. - int needArgs = args; - - for (Class type: types) { - // When constructor required specified types increase length of required arguments. - if (TYPE_ARG_LENGTH.containsKey(type)) - needArgs += TYPE_ARG_LENGTH.get(type); - } - - if (needArgs == beanArgsCnt) { - Object[] initArgs = new Object[args]; - - for (int i = 0, ctrIdx = 0; i < beanArgsCnt; i++, ctrIdx++) { - Class type = types[ctrIdx]; - - // Parse nested complex objects from arguments for specified types. - if (TYPE_ARG_LENGTH.containsKey(type)) { - initArgs[ctrIdx] = toJobArgument(toClass(JOB_ARG_IDX + i), JOB_ARG_IDX + 1 + i); - - i += TYPE_ARG_LENGTH.get(type); - } - // In common case convert value to object. - else { - String val = argument(JOB_ARG_IDX + i); - - initArgs[ctrIdx] = toObject(type, val); - } - } - - ctor.setAccessible(true); - jobArgs = ctor.newInstance(initArgs); - - break; - } - } - - if (jobArgs == null) { - Object[] args = new Object[beanArgsCnt]; - - for (int i = 0; i < beanArgsCnt; i++) - args[i] = argument(i + JOB_ARG_IDX); - - throw new IgniteException("Failed to find constructor for task argument " + - "[taskName=" + taskName + ", argsCnt=" + args.length + - ", args=" + Arrays.toString(args) + "]"); - } - } - } - catch (Exception e) { - throw new IgniteException("Failed to construct job argument [taskName=" + taskName + "]", e); - } - } - - final List nids; - - if (F.isEmpty(nidsArg) || "null".equals(nidsArg)) { - try { - Class taskCls = Class.forName(taskName); - - if (VisorCoordinatorNodeTask.class.isAssignableFrom(taskCls)) { - ClusterNode crd = ignite.context().discovery().discoCache().oldestAliveServerNode(); - - nids = Collections.singletonList(crd.id()); - } - else if (VisorOneNodeTask.class.isAssignableFrom(taskCls)) - nids = Collections.singletonList(ignite.localNode().id()); - else { - Collection nodes = ignite.cluster().nodes(); - - nids = new ArrayList<>(nodes.size()); - - for (ClusterNode node : nodes) - nids.add(node.id()); - } - } - catch (ClassNotFoundException e) { - throw new IgniteException("Failed to find task class:" + taskName, e); - } - } - else { - String[] items = nidsArg.split(";"); - - nids = new ArrayList<>(items.length); - - for (String item : items) { - try { - nids.add(UUID.fromString(item)); - } - catch (IllegalArgumentException ignore) { - ignite.log().warning("Failed to parse node id [taskName=" + taskName + ", nid=" + item + "]"); - } - } - } - - IgniteCompute comp = ignite.compute(ignite.cluster().forNodeIds(nids)); - - fut = comp.executeAsync(taskName, new VisorTaskArgument<>(nids, jobArgs, false)); - - fut.listen(new CI1>() { - @Override public void apply(IgniteFuture f) { - jobCtx.callcc(); - } - }); - - return jobCtx.holdcc(); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java deleted file mode 100644 index f064028abcf29..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java +++ /dev/null @@ -1,77 +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.debug; - -import java.lang.management.ThreadInfo; -import java.lang.management.ThreadMXBean; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.VisorOneNodeTask; - -/** - * Creates thread dump. - */ -@GridInternal -@GridVisorManagementTask -public class VisorThreadDumpTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorDumpThreadJob job(Void arg) { - return new VisorDumpThreadJob(arg, debug); - } - - /** - * Job that take thread dump on node. - */ - private static class VisorDumpThreadJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Formal job argument. - * @param debug Debug flag. - */ - private VisorDumpThreadJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorThreadDumpTaskResult run(Void arg) { - ThreadMXBean mx = U.getThreadMx(); - - ThreadInfo[] info = mx.dumpAllThreads(true, true); - - VisorThreadInfo[] visorInfo = new VisorThreadInfo[info.length]; - - for (int i = 0; i < info.length; i++) - visorInfo[i] = new VisorThreadInfo(info[i]); - - return new VisorThreadDumpTaskResult(visorInfo, mx.findDeadlockedThreads()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorDumpThreadJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java deleted file mode 100644 index f6e016104e95c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java +++ /dev/null @@ -1,88 +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.debug; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.management.ThreadInfo; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for Visor {@link ThreadInfo}. - */ -public class VisorThreadDumpTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** List of information about threads. */ - private VisorThreadInfo[] threadInfo; - - /** List of deadlocked thread ids. */ - private long[] deadlockedThreads; - - /** - * Default constructor. - */ - public VisorThreadDumpTaskResult() { - // No-op. - } - - /** - * Create data transfer object for given thread info. - * - * @param threadInfo Thread info. - * @param deadlockedThreads Thread info. - */ - public VisorThreadDumpTaskResult(VisorThreadInfo[] threadInfo, long[] deadlockedThreads) { - this.threadInfo = threadInfo; - this.deadlockedThreads = deadlockedThreads; - } - - /** - * @return List of information about threads. - */ - public VisorThreadInfo[] getThreadInfo() { - return threadInfo; - } - - /** - * @return List of deadlocked thread ids. - */ - public long[] getDeadlockedThreads() { - return deadlockedThreads; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeObject(threadInfo); - out.writeObject(deadlockedThreads); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - threadInfo = (VisorThreadInfo[])in.readObject(); - deadlockedThreads = (long[])in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorThreadDumpTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java deleted file mode 100644 index c7c646bcecc01..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java +++ /dev/null @@ -1,348 +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.debug; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.management.ThreadInfo; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for Visor {@link ThreadInfo}. - */ -public class VisorThreadInfo extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Thread name. */ - private String name; - - /** Thread ID. */ - private long id; - - /** Thread state. */ - private Thread.State state; - - /** Lock information. */ - private VisorThreadLockInfo lock; - - /** Lock name. */ - private String lockName; - - /** Lock owner thread ID. */ - private long lockOwnerId; - - /** Lock owner name. */ - private String lockOwnerName; - - /** Thread executing native code. */ - private boolean inNative; - - /** Thread is suspended. */ - private boolean suspended; - - /** Waited count. */ - private long waitedCnt; - - /** Waited time. */ - private long waitedTime; - - /** Blocked count. */ - private long blockedCnt; - - /** Blocked time. */ - private long blockedTime; - - /** Stack trace. */ - private List stackTrace; - - /** Locks info. */ - private List locks; - - /** Locked monitors. */ - private List lockedMonitors; - - /** - * Default constructor. - */ - public VisorThreadInfo() { - // No-op. - } - - /** - * Create data transfer object for given thread info. - * - * @param ti Thread info. - */ - public VisorThreadInfo(ThreadInfo ti) { - assert ti != null; - - name = ti.getThreadName(); - id = ti.getThreadId(); - state = ti.getThreadState(); - lock = ti.getLockInfo() != null ? new VisorThreadLockInfo(ti.getLockInfo()) : null; - lockName = ti.getLockName(); - lockOwnerId = ti.getLockOwnerId(); - lockOwnerName = ti.getLockOwnerName(); - inNative = ti.isInNative(); - suspended = ti.isSuspended(); - waitedCnt = ti.getWaitedCount(); - waitedTime = ti.getWaitedTime(); - blockedCnt = ti.getBlockedCount(); - blockedTime = ti.getBlockedTime(); - stackTrace = Arrays.asList(ti.getStackTrace()); - - locks = ti.getLockedSynchronizers() != null ? - new ArrayList(ti.getLockedSynchronizers().length) : null; - - if (ti.getLockedSynchronizers() != null) - for (int i = 0; i < ti.getLockedSynchronizers().length; i++) - locks.add(new VisorThreadLockInfo(ti.getLockedSynchronizers()[i])); - - lockedMonitors = ti.getLockedMonitors() != null ? - new ArrayList(ti.getLockedMonitors().length) : null; - - if (ti.getLockedMonitors() != null) - for (int i = 0; i < ti.getLockedMonitors().length; i++) - lockedMonitors.add(new VisorThreadMonitorInfo(ti.getLockedMonitors()[i])); - } - - /** - * @return Thread name. - */ - public String getName() { - return name; - } - - /** - * @return Thread ID. - */ - public long getId() { - return id; - } - - /** - * @return Thread state. - */ - public Thread.State getState() { - return state; - } - - /** - * @return Lock information. - */ - public VisorThreadLockInfo getLock() { - return lock; - } - - /** - * @return Lock name. - */ - public String getLockName() { - return lockName; - } - - /** - * @return Lock owner thread ID. - */ - public long getLockOwnerId() { - return lockOwnerId; - } - - /** - * @return Lock owner name. - */ - public String getLockOwnerName() { - return lockOwnerName; - } - - /** - * @return Thread executing native code. - */ - public boolean isInNative() { - return inNative; - } - - /** - * @return Thread is suspended. - */ - public boolean isSuspended() { - return suspended; - } - - /** - * @return Waited count. - */ - public long getWaitedCount() { - return waitedCnt; - } - - /** - * @return Waited time. - */ - public long getWaitedTime() { - return waitedTime; - } - - /** - * @return Blocked count. - */ - public long getBlockedCount() { - return blockedCnt; - } - - /** - * @return Blocked time. - */ - public long getBlockedTime() { - return blockedTime; - } - - /** - * @return Stack trace. - */ - public List getStackTrace() { - return stackTrace; - } - - /** - * @return Locks info. - */ - public List getLocks() { - return locks; - } - - /** - * @return Locked monitors. - */ - public List getLockedMonitors() { - return lockedMonitors; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeLong(id); - U.writeString(out, state.toString()); - out.writeObject(lock); - U.writeString(out, lockName); - out.writeLong(lockOwnerId); - U.writeString(out, lockOwnerName); - out.writeBoolean(inNative); - out.writeBoolean(suspended); - out.writeLong(waitedCnt); - out.writeLong(waitedTime); - out.writeLong(blockedCnt); - out.writeLong(blockedTime); - U.writeCollection(out, stackTrace); - U.writeCollection(out, locks); - U.writeCollection(out, lockedMonitors); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - id = in.readLong(); - - String statePresentation = U.readString(in); - - if (statePresentation != null) - state = Enum.valueOf(Thread.State.class, statePresentation); - - lock = (VisorThreadLockInfo)in.readObject(); - lockName = U.readString(in); - lockOwnerId = in.readLong(); - lockOwnerName = U.readString(in); - inNative = in.readBoolean(); - suspended = in.readBoolean(); - waitedCnt = in.readLong(); - waitedTime = in.readLong(); - blockedCnt = in.readLong(); - blockedTime = in.readLong(); - stackTrace = U.readList(in); - locks = U.readList(in); - lockedMonitors = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - StringBuilder sb = new StringBuilder(512); - - sb.append('"').append(name).append('"').append(" Id=").append(id).append(' ').append(state); - - if (lockName != null) - sb.append(" on ").append(lockName); - - if (lockOwnerName != null) - sb.append(" owned by \"").append(lockOwnerName).append("\" Id=").append(lockOwnerId); - - if (suspended) - sb.append(" (suspended)"); - - if (inNative) - sb.append(" (in native)"); - - sb.append('\n'); - - for (int i = 0; i < stackTrace.size(); i++) { - StackTraceElement ste = stackTrace.get(i); - - sb.append("\tat ").append(ste).append('\n'); - - if (i == 0 && lock != null) { - switch (state) { - case BLOCKED: - sb.append("\t- blocked on ").append(lock).append('\n'); - break; - - case WAITING: - sb.append("\t- waiting on ").append(lock).append('\n'); - break; - - case TIMED_WAITING: - sb.append("\t- waiting on ").append(lock).append('\n'); - break; - - default: - } - } - - for (VisorThreadMonitorInfo mi : lockedMonitors) { - if (mi.getStackDepth() == i) - sb.append("\t- locked ").append(mi).append('\n'); - } - } - - if (!F.isEmpty(locks)) { - sb.append("\n\tNumber of locked synchronizers = ").append(locks.size()).append('\n'); - - for (VisorThreadLockInfo li : locks) - sb.append("\t- ").append(li).append('\n'); - } - - sb.append('\n'); - - return sb.toString(); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java deleted file mode 100644 index 4aab0e00bfcb2..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java +++ /dev/null @@ -1,93 +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.debug; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.management.LockInfo; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for {@link LockInfo}. - */ -public class VisorThreadLockInfo extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Fully qualified name of the class of the lock object. - */ - protected String clsName; - - /** - * Identity hash code of the lock object. - */ - protected Integer identityHashCode; - - /** - * Default constructor. - */ - public VisorThreadLockInfo() { - // No-op. - } - - /** - * Create data transfer object for given lock info. - * - * @param li Lock info. - */ - public VisorThreadLockInfo(LockInfo li) { - assert li != null; - - clsName = li.getClassName(); - identityHashCode = li.getIdentityHashCode(); - } - - /** - * @return Fully qualified name of the class of the lock object. - */ - public String getClassName() { - return clsName; - } - - /** - * @return Identity hash code of the lock object. - */ - public Integer getIdentityHashCode() { - return identityHashCode; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, clsName); - out.writeObject(identityHashCode); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - clsName = U.readString(in); - identityHashCode = (Integer)in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return clsName + '@' + Integer.toHexString(identityHashCode); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java deleted file mode 100644 index 189b8e3cdfba4..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java +++ /dev/null @@ -1,100 +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.debug; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.management.MonitorInfo; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObjectInput; -import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput; - -/** - * Data transfer object for {@link MonitorInfo}. - */ -public class VisorThreadMonitorInfo extends VisorThreadLockInfo { - /** */ - private static final long serialVersionUID = 0L; - - /** Stack depth. */ - private int stackDepth; - - /** Stack frame. */ - private StackTraceElement stackFrame; - - /** - * Default constructor. - */ - public VisorThreadMonitorInfo() { - // No-op. - } - - /** - * Create data transfer object for given monitor info. - * - * @param mi Monitoring info. - */ - public VisorThreadMonitorInfo(MonitorInfo mi) { - super(mi); - - stackDepth = mi.getLockedStackDepth(); - stackFrame = mi.getLockedStackFrame(); - } - - /** - * @return Stack depth. - */ - public int getStackDepth() { - return stackDepth; - } - - /** - * @return Stack frame. - */ - public StackTraceElement getStackFrame() { - return stackFrame; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) { - dtout.writeByte(super.getProtocolVersion()); - - super.writeExternalData(dtout); - } - - out.writeInt(stackDepth); - out.writeObject(stackFrame); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) { - super.readExternalData(dtin.readByte(), dtin); - } - - stackDepth = in.readInt(); - stackFrame = (StackTraceElement)in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorThreadMonitorInfo.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java deleted file mode 100644 index e74b54c896c34..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java +++ /dev/null @@ -1,106 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorDataTransferObjectInput; -import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput; -import org.apache.ignite.lang.IgniteUuid; -import org.jetbrains.annotations.Nullable; - -/** - * Lightweight counterpart for {@link org.apache.ignite.events.DeploymentEvent}. - */ -public class VisorGridDeploymentEvent extends VisorGridEvent { - /** */ - private static final long serialVersionUID = 0L; - - /** Deployment alias. */ - private String alias; - - /** - * Default constructor. - */ - public VisorGridDeploymentEvent() { - // No-op. - } - - /** - * 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 alias Deployment alias. - */ - public VisorGridDeploymentEvent( - int typeId, - IgniteUuid id, - String name, - UUID nid, - long ts, - @Nullable String msg, - String shortDisplay, - String alias - ) { - super(typeId, id, name, nid, ts, msg, shortDisplay); - - this.alias = alias; - } - - /** - * @return Deployment alias. - */ - public String getAlias() { - return alias; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) { - dtout.writeByte(super.getProtocolVersion()); - - super.writeExternalData(dtout); - } - - U.writeString(out, alias); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) { - super.readExternalData(dtin.readByte(), dtin); - } - - alias = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridDeploymentEvent.class, this); - } -} 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 deleted file mode 100644 index c5f1d30c53d92..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java +++ /dev/null @@ -1,152 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorDataTransferObjectInput; -import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput; -import org.apache.ignite.lang.IgniteUuid; -import org.jetbrains.annotations.Nullable; - -/** - * Lightweight counterpart for {@link org.apache.ignite.events.DiscoveryEvent}. - */ -public class VisorGridDiscoveryEvent extends VisorGridEvent { - /** */ - private static final long serialVersionUID = 0L; - - /** Node that caused this event to be generated. */ - private UUID evtNodeId; - - /** Node address that caused this event to be generated. */ - private String addr; - - /** If node that caused this event is daemon. */ - private boolean isDaemon; - - /** Topology version. */ - private long topVer; - - /** - * Default constructor. - */ - public VisorGridDiscoveryEvent() { - // No-op. - } - - /** - * 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 VisorGridDiscoveryEvent( - 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); - - this.evtNodeId = evtNodeId; - this.addr = addr; - this.isDaemon = isDaemon; - this.topVer = topVer; - } - - /** - * @return Event node ID. - */ - public UUID getEventNodeId() { - return evtNodeId; - } - - /** - * @return Node address that caused this event to be generated. - */ - public String getAddress() { - return addr; - } - - /** - * @return If node that caused this event is daemon. - */ - public boolean isDaemon() { - return isDaemon; - } - - /** - * @return Topology version or {@code 0} if configured discovery SPI implementation - * does not support versioning. - **/ - public long getTopologyVersion() { - return topVer; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) { - dtout.writeByte(super.getProtocolVersion()); - - super.writeExternalData(dtout); - } - - U.writeUuid(out, evtNodeId); - U.writeString(out, addr); - out.writeBoolean(isDaemon); - out.writeLong(topVer); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) { - super.readExternalData(dtin.readByte(), dtin); - } - - evtNodeId = U.readUuid(in); - addr = U.readString(in); - isDaemon = in.readBoolean(); - topVer = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridDiscoveryEvent.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java deleted file mode 100644 index c1e39988f1f37..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java +++ /dev/null @@ -1,162 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -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; - -/** - * Base class for lightweight counterpart for various {@link org.apache.ignite.events.Event}. - */ -public class VisorGridEvent extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Event type. */ - private int typeId; - - /** Globally unique ID of this event. */ - private IgniteUuid id; - - /** Name of this event. */ - private String name; - - /** Node Id where event occurred and was recorded. */ - private UUID nid; - - /** Event timestamp. */ - private long ts; - - /** Event message. */ - private String msg; - - /** Shortened version of {@code toString()} result. Suitable for humans to read. */ - private String shortDisplay; - - /** - * Default constructor. - */ - public VisorGridEvent() { - // No-op. - } - - /** - * 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. - */ - public VisorGridEvent(int typeId, IgniteUuid id, String name, UUID nid, long ts, @Nullable String msg, - String shortDisplay) { - this.typeId = typeId; - this.id = id; - this.name = name; - this.nid = nid; - this.ts = ts; - this.msg = msg; - this.shortDisplay = shortDisplay; - } - - /** - * @return Event type. - */ - public int getTypeId() { - return typeId; - } - - /** - * @return Globally unique ID of this event. - */ - public IgniteUuid getId() { - return id; - } - - /** - * @return Name of this event. - */ - public String getName() { - return name; - } - - /** - * @return Node Id where event occurred and was recorded. - */ - public UUID getNid() { - return nid; - } - - /** - * @return Event timestamp. - */ - public long getTimestamp() { - return ts; - } - - /** - * @return Event message. - */ - @Nullable public String getMessage() { - return msg; - } - - /** - * @return Shortened version of result. Suitable for humans to read. - */ - public String getShortDisplay() { - return shortDisplay; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeInt(typeId); - U.writeIgniteUuid(out, id); - U.writeString(out, name); - U.writeUuid(out, nid); - out.writeLong(ts); - U.writeString(out, msg); - U.writeString(out, shortDisplay); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - typeId = in.readInt(); - id = U.readIgniteUuid(in); - name = U.readString(in); - nid = U.readUuid(in); - ts = in.readLong(); - msg = U.readString(in); - shortDisplay = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridEvent.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java deleted file mode 100644 index e07a3a14a6fe0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java +++ /dev/null @@ -1,54 +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.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteUuid; - -/** - * Special event for events lost situations. - */ -public class VisorGridEventsLost extends VisorGridEvent { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Default constructor. - */ - public VisorGridEventsLost() { - // No-op. - } - - /** - * Create event with given parameters. - * - * @param nid Node where events were lost. - */ - public VisorGridEventsLost(UUID nid) { - super(0, IgniteUuid.randomUuid(), "EVT_VISOR_EVENTS_LOST", nid, U.currentTimeMillis(), - "Some Visor events were lost and Visor may show inconsistent results. " + - "Configure your grid to disable not important events.", ""); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridEventsLost.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java deleted file mode 100644 index 4d2fa79507937..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java +++ /dev/null @@ -1,151 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorDataTransferObjectInput; -import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput; -import org.apache.ignite.lang.IgniteUuid; -import org.jetbrains.annotations.Nullable; - -/** - * Lightweight counterpart for {@link org.apache.ignite.events.JobEvent} . - */ -public class VisorGridJobEvent extends VisorGridEvent { - /** */ - private static final long serialVersionUID = 0L; - - /** Name of the task that triggered the event. */ - private String taskName; - - /** Name of task class that triggered the event. */ - private String taskClsName; - - /** Task session ID of the task that triggered the event. */ - private IgniteUuid taskSesId; - - /** Job ID. */ - private IgniteUuid jobId; - - /** - * Default constructor. - */ - public VisorGridJobEvent() { - // No-op. - } - - /** - * 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 taskName Name of the task that triggered the event. - * @param taskClsName Name of task class that triggered the event. - * @param taskSesId Task session ID of the task that triggered the event. - * @param jobId Job ID. - */ - public VisorGridJobEvent( - int typeId, - IgniteUuid id, - String name, - UUID nid, - long ts, - @Nullable String msg, - String shortDisplay, - String taskName, - String taskClsName, - IgniteUuid taskSesId, - IgniteUuid jobId - ) { - super(typeId, id, name, nid, ts, msg, shortDisplay); - - this.taskName = taskName; - this.taskClsName = taskClsName; - this.taskSesId = taskSesId; - this.jobId = jobId; - } - - /** - * @return Name of the task that triggered the event. - */ - public String getTaskName() { - return taskName; - } - - /** - * @return Name of task class that triggered the event. - */ - public String getTaskClassName() { - return taskClsName; - } - - /** - * @return Task session ID of the task that triggered the event. - */ - public IgniteUuid getTaskSessionId() { - return taskSesId; - } - - /** - * @return Job ID. - */ - public IgniteUuid getJobId() { - return jobId; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) { - dtout.writeByte(super.getProtocolVersion()); - - super.writeExternalData(dtout); - } - - U.writeString(out, taskName); - U.writeString(out, taskClsName); - U.writeIgniteUuid(out, taskSesId); - U.writeIgniteUuid(out, jobId); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) { - super.readExternalData(dtin.readByte(), dtin); - } - - taskName = U.readString(in); - taskClsName = U.readString(in); - taskSesId = U.readIgniteUuid(in); - jobId = U.readIgniteUuid(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridJobEvent.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java deleted file mode 100644 index 0f23c974a338b..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java +++ /dev/null @@ -1,151 +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.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorDataTransferObjectInput; -import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput; -import org.apache.ignite.lang.IgniteUuid; -import org.jetbrains.annotations.Nullable; - -/** - * Lightweight counterpart for {@link org.apache.ignite.events.TaskEvent}. - */ -public class VisorGridTaskEvent extends VisorGridEvent { - /** */ - private static final long serialVersionUID = 0L; - - /** Name of the task that triggered the event. */ - private String taskName; - - /** Name of task class that triggered the event. */ - private String taskClsName; - - /** Task session ID. */ - private IgniteUuid taskSesId; - - /** Whether task was created for system needs. */ - private boolean internal; - - /** - * Default constructor. - */ - public VisorGridTaskEvent() { - // No-op. - } - - /** - * 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 taskName Name of the task that triggered the event. - * @param taskClsName Name of task class that triggered the event. - * @param taskSesId Task session ID of the task that triggered the event. - * @param internal Whether task was created for system needs. - */ - public VisorGridTaskEvent( - int typeId, - IgniteUuid id, - String name, - UUID nid, - long ts, - @Nullable String msg, - String shortDisplay, - String taskName, - String taskClsName, - IgniteUuid taskSesId, - boolean internal - ) { - super(typeId, id, name, nid, ts, msg, shortDisplay); - - this.taskName = taskName; - this.taskClsName = taskClsName; - this.taskSesId = taskSesId; - this.internal = internal; - } - - /** - * @return Name of the task that triggered the event. - */ - public String getTaskName() { - return taskName; - } - - /** - * @return Name of task class that triggered the event. - */ - public String getTaskClassName() { - return taskClsName; - } - - /** - * @return Task session ID. - */ - public IgniteUuid getTaskSessionId() { - return taskSesId; - } - - /** - * @return Whether task was created for system needs. - */ - public boolean isInternal() { - return internal; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) { - dtout.writeByte(super.getProtocolVersion()); - - super.writeExternalData(dtout); - } - - U.writeString(out, taskName); - U.writeString(out, taskClsName); - U.writeIgniteUuid(out, taskSesId); - out.writeBoolean(internal); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) { - super.readExternalData(dtin.readByte(), dtin); - } - - taskName = U.readString(in); - taskClsName = U.readString(in); - taskSesId = U.readIgniteUuid(in); - internal = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridTaskEvent.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java deleted file mode 100644 index 79d0e9315fa87..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java +++ /dev/null @@ -1,144 +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.file; - -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; - -/** - * Represents block of bytes from a file, could be optionally zipped. - */ -public class VisorFileBlock extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** File path. */ - private String path; - - /** Marker position. */ - private long off; - - /** File size. */ - private long size; - - /** Timestamp of last modification of the file. */ - private long lastModified; - - /** Whether data was zipped. */ - private boolean zipped; - - /** Data bytes. */ - private byte[] data; - - /** - * Default constructor. - */ - public VisorFileBlock() { - // No-op. - } - - /** - * Create file block with given parameters. - * - * @param path File path. - * @param off Marker position. - * @param size File size. - * @param lastModified Timestamp of last modification of the file. - * @param zipped Whether data was zipped. - * @param data Data bytes. - */ - public VisorFileBlock(String path, long off, long size, long lastModified, boolean zipped, byte[] data) { - this.path = path; - this.off = off; - this.size = size; - this.lastModified = lastModified; - this.zipped = zipped; - this.data = data; - } - - /** - * @return File path. - */ - public String getPath() { - return path; - } - - /** - * @return Marker position. - */ - public long getOffset() { - return off; - } - - /** - * @return File size. - */ - public long getSize() { - return size; - } - - /** - * @return Timestamp of last modification of the file. - */ - public long getLastModified() { - return lastModified; - } - - /** - * @return Whether data was zipped. - */ - public boolean isZipped() { - return zipped; - } - - /** - * @return Data bytes. - */ - public byte[] getData() { - return data; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, path); - out.writeLong(off); - out.writeLong(size); - out.writeLong(lastModified); - out.writeBoolean(zipped); - U.writeByteArray(out, data); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - path = U.readString(in); - off = in.readLong(); - size = in.readLong(); - lastModified = in.readLong(); - zipped = in.readBoolean(); - data = U.readByteArray(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorFileBlock.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java deleted file mode 100644 index ad851cf1babce..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java +++ /dev/null @@ -1,89 +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.file; - -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.NoSuchFileException; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorEither; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.readBlock; - -/** - * Task to read file block. - */ -@GridInternal -public class VisorFileBlockTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorFileBlockJob job(VisorFileBlockTaskArg arg) { - return new VisorFileBlockJob(arg, debug); - } - - /** - * Job that read file block on node. - */ - private static class VisorFileBlockJob - extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Descriptor of file block to read. - * @param debug Debug flag. - */ - private VisorFileBlockJob(VisorFileBlockTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorEither run(VisorFileBlockTaskArg arg) { - try { - URL url = U.resolveIgniteUrl(arg.getPath()); - - if (url == null) - return new VisorEither<>(new NoSuchFileException("File path not found: " + arg.getPath())); - - VisorFileBlock block = readBlock( - new File(url.toURI()), arg.getOffset(), arg.getBlockSize(), arg.getLastModified()); - - return new VisorEither<>(block); - } - catch (IOException e) { - return new VisorEither<>(e); - } - catch (URISyntaxException ignored) { - return new VisorEither<>(new NoSuchFileException("File path not found: " + arg.getPath())); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorFileBlockJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskArg.java deleted file mode 100644 index de41c4edada92..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskArg.java +++ /dev/null @@ -1,114 +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.file; - -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; - -/** - * Arguments for {@link VisorFileBlockTask} - */ -public class VisorFileBlockTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Log file path. */ - private String path; - - /** Log file offset. */ - private long off; - - /** Block size. */ - private int blockSz; - - /** Log file last modified timestamp. */ - private long lastModified; - - /** - * Default constructor. - */ - public VisorFileBlockTaskArg() { - // No-op. - } - - /** - * @param path Log file path. - * @param off Offset in file. - * @param blockSz Block size. - * @param lastModified Log file last modified timestamp. - */ - public VisorFileBlockTaskArg(String path, long off, int blockSz, long lastModified) { - this.path = path; - this.off = off; - this.blockSz = blockSz; - this.lastModified = lastModified; - } - - /** - * @return Log file path. - */ - public String getPath() { - return path; - } - - /** - * @return Log file offset. - */ - public long getOffset() { - return off; - } - - /** - * @return Block size - */ - public int getBlockSize() { - return blockSz; - } - - /** - * @return Log file last modified timestamp. - */ - public long getLastModified() { - return lastModified; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, path); - out.writeLong(off); - out.writeInt(blockSz); - out.writeLong(lastModified); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - path = U.readString(in); - off = in.readLong(); - blockSz = in.readInt(); - lastModified = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorFileBlockTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskResult.java deleted file mode 100644 index b888f6d17bbe6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskResult.java +++ /dev/null @@ -1,87 +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.file; - -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.visor.VisorDataTransferObject; - -/** - * Result for file block operation. - */ -public class VisorFileBlockTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Exception on reading of block. */ - private IOException ex; - - /** Read file block. */ - private VisorFileBlock block; - - /** - * Default constructor. - */ - public VisorFileBlockTaskResult() { - // No-op. - } - - /** - * Create log search result with given parameters. - * - * @param ex Exception on reading of block. - * @param block Read file block. - */ - public VisorFileBlockTaskResult(IOException ex, VisorFileBlock block) { - this.ex = ex; - this.block = block; - } - - /** - * @return Exception on reading of block. - */ - public IOException getException() { - return ex; - } - - /** - * @return Read file block. - */ - public VisorFileBlock getBlock() { - return block; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeObject(ex); - out.writeObject(block); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - ex = (IOException)in.readObject(); - block = (VisorFileBlock)in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorFileBlockTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java deleted file mode 100644 index 3b8defeb9145a..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java +++ /dev/null @@ -1,97 +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.file; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -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.internal.visor.log.VisorLogFile; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.LOG_FILES_COUNT_LIMIT; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.matchedFiles; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgnitePath; - -/** - * Get list files matching filter. - */ -@GridInternal -public class VisorLatestTextFilesTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorLatestTextFilesJob job(VisorLatestTextFilesTaskArg arg) { - return new VisorLatestTextFilesJob(arg, debug); - } - - /** - * Job that gets list of files. - */ - private static class VisorLatestTextFilesJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Folder and regexp. - * @param debug Debug flag. - */ - private VisorLatestTextFilesJob(VisorLatestTextFilesTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Collection run(final VisorLatestTextFilesTaskArg arg) { - String path = arg.getPath(); - String regexp = arg.getRegexp(); - - assert path != null; - assert regexp != null; - - try { - File folder = resolveIgnitePath(path); - - if (folder == null) - return null; - - List files = matchedFiles(folder, regexp); - - if (files.isEmpty()) - return null; - - if (files.size() > LOG_FILES_COUNT_LIMIT) - files = new ArrayList<>(files.subList(0, LOG_FILES_COUNT_LIMIT)); - - return files; - } - catch (Exception ignored) { - return null; - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLatestTextFilesJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java deleted file mode 100644 index d0bc99dadb765..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java +++ /dev/null @@ -1,86 +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.file; - -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; - -/** - * Arguments for {@link VisorLatestTextFilesTask} - */ -public class VisorLatestTextFilesTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Folder path to search files. */ - private String path; - - /** Pattern to match file names. */ - private String regexp; - - /** - * Default constructor. - */ - public VisorLatestTextFilesTaskArg() { - // No-op. - } - - /** - * @param path Folder path to search in files. - * @param regexp Pattern to match file names. - */ - public VisorLatestTextFilesTaskArg(String path, String regexp) { - this.path = path; - this.regexp = regexp; - } - - /** - * @return Folder path to search in files. - */ - public String getPath() { - return path; - } - - /** - * @return Pattern to match file names. - */ - public String getRegexp() { - return regexp; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, path); - U.writeString(out, regexp); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - path = U.readString(in); - regexp = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLatestTextFilesTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java deleted file mode 100644 index ef568d8129356..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java +++ /dev/null @@ -1,117 +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.igfs; - -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; - -/** - * Data transfer object. - */ -@Deprecated -public class VisorIgfs extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS instance name. */ - private String name; - - /** IGFS instance working mode. */ - private VisorIgfsMode mode; - - /** IGFS metrics. */ - private VisorIgfsMetrics metrics; - - /** Whether IGFS has configured secondary file system. */ - private boolean secondaryFsConfigured; - - /** - * Default constructor. - */ - public VisorIgfs() { - // No-op. - } - - /** - * Create IGFS configuration transfer object. - * - * @param name IGFS instance name. - * @param mode IGFS instance working mode. - * @param metrics IGFS metrics. - * @param secondaryFsConfigured Whether IGFS has configured secondary file system. - */ - public VisorIgfs(String name, VisorIgfsMode mode, VisorIgfsMetrics metrics, boolean secondaryFsConfigured) { - this.name = name; - this.mode = mode; - this.metrics = metrics; - this.secondaryFsConfigured = secondaryFsConfigured; - } - - /** - * @return IGFS instance name. - */ - public String getName() { - return name; - } - - /** - * @return IGFS instance working mode. - */ - public VisorIgfsMode getMode() { - return mode; - } - - /** - * @return IGFS metrics. - */ - public VisorIgfsMetrics getMetrics() { - return metrics; - } - - /** - * @return Whether IGFS has configured secondary file system. - */ - public boolean isSecondaryFileSystemConfigured() { - return secondaryFsConfigured; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - U.writeEnum(out, mode); - out.writeObject(metrics); - out.writeBoolean(secondaryFsConfigured); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - mode = VisorIgfsMode.fromOrdinal(in.readByte()); - metrics = (VisorIgfsMetrics)in.readObject(); - secondaryFsConfigured = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfs.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java deleted file mode 100644 index f0748caecdaf6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java +++ /dev/null @@ -1,134 +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.igfs; - -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; - -/** - * IGFS endpoint descriptor. - */ -@Deprecated -public class VisorIgfsEndpoint extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS name. */ - private String igfsName; - - /** Grid name. */ - private String gridName; - - /** Host address / name. */ - private String hostName; - - /** Port number. */ - private int port; - - /** - * Default constructor. - */ - public VisorIgfsEndpoint() { - // No-op. - } - - /** - * Create IGFS endpoint descriptor with given parameters. - * - * @param igfsName IGFS name. - * @param gridName Grid name. - * @param hostName Host address / name. - * @param port Port number. - */ - public VisorIgfsEndpoint(@Nullable String igfsName, String gridName, @Nullable String hostName, int port) { - this.igfsName = igfsName; - this.gridName = gridName; - this.hostName = hostName; - this.port = port; - } - - /** - * @return IGFS name. - */ - @Nullable public String getIgfsName() { - return igfsName; - } - - /** - * @return Grid name. - */ - public String getGridName() { - return gridName; - } - - /** - * @return Host address / name. - */ - @Nullable public String getHostName() { - return hostName; - } - - /** - * @return Port number. - */ - public int getPort() { - return port; - } - - /** - * @return URI Authority - */ - public String getAuthority() { - String addr = hostName + ":" + port; - - if (igfsName == null && gridName == null) - return addr; - else if (igfsName == null) - return gridName + "@" + addr; - else if (gridName == null) - return igfsName + "@" + addr; - else - return igfsName + ":" + gridName + "@" + addr; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, igfsName); - U.writeString(out, gridName); - U.writeString(out, hostName); - out.writeInt(port); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - igfsName = U.readString(in); - gridName = U.readString(in); - hostName = U.readString(in); - port = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsEndpoint.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java deleted file mode 100644 index 231c84598b0c0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java +++ /dev/null @@ -1,67 +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.igfs; - -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Format IGFS instance. - */ -@GridInternal -@GridVisorManagementTask -@Deprecated -public class VisorIgfsFormatTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorIgfsFormatJob job(VisorIgfsFormatTaskArg arg) { - return new VisorIgfsFormatJob(arg, debug); - } - - /** - * Job that format IGFS. - */ - private static class VisorIgfsFormatJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg IGFS name to format. - * @param debug Debug flag. - */ - private VisorIgfsFormatJob(VisorIgfsFormatTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorIgfsFormatTaskArg arg) { - throw new IgniteException("IGFS operations are not supported in current version of Ignite"); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsFormatJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java deleted file mode 100644 index c0a04fc55fcc8..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.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.igfs; - -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; - -/** - * Argument for {@link VisorIgfsFormatTask}. - */ -@Deprecated -public class VisorIgfsFormatTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS name. */ - private String igfsName; - - /** - * Default constructor. - */ - public VisorIgfsFormatTaskArg() { - // No-op. - } - - /** - * @param igfsName IGFS name. - */ - public VisorIgfsFormatTaskArg(String igfsName) { - this.igfsName = igfsName; - } - - /** - * @return IGFS name. - */ - public String getIgfsName() { - return igfsName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, igfsName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - igfsName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsFormatTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java deleted file mode 100644 index a412ecb2cdfd5..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java +++ /dev/null @@ -1,270 +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.igfs; - -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.visor.VisorDataTransferObject; - -/** - * Data transfer object. - */ -@Deprecated -public class VisorIgfsMetrics extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Maximum amount of data that can be stored on local node. */ - private long totalSpaceSz; - - /** Local used space in bytes on local node. */ - private long usedSpaceSz; - - /** Number of directories created in file system. */ - private int foldersCnt; - - /** Number of files stored in file system. */ - private int filesCnt; - - /** Number of files that are currently opened for reading on local node. */ - private int filesOpenedForRd; - - /** Number of files that are currently opened for writing on local node. */ - private int filesOpenedForWrt; - - /** Total blocks read, local and remote. */ - private long blocksRd; - - /** Total remote blocks read. */ - private long blocksRdRmt; - - /** Total blocks write, local and remote. */ - private long blocksWrt; - - /** Total remote blocks write. */ - private long blocksWrtRmt; - - /** Total bytes read. */ - private long bytesRd; - - /** Total bytes read time. */ - private long bytesRdTm; - - /** Total bytes write. */ - private long bytesWrt; - - /** Total bytes write time. */ - private long bytesWrtTm; - - /** - * Create data transfer object for given IGFS metrics. - */ - public VisorIgfsMetrics() { - // No-op. - } - - /** - * Add given metrics. - * - * @param m Metrics to add. - * @return Self for method chaining. - */ - public VisorIgfsMetrics add(VisorIgfsMetrics m) { - assert m != null; - - totalSpaceSz += m.totalSpaceSz; - usedSpaceSz += m.usedSpaceSz; - foldersCnt += m.foldersCnt; - filesCnt += m.filesCnt; - filesOpenedForRd += m.filesOpenedForRd; - filesOpenedForWrt += m.filesOpenedForWrt; - blocksRd += m.blocksRd; - blocksRdRmt += m.blocksRdRmt; - blocksWrt += m.blocksWrt; - blocksWrtRmt += m.blocksWrtRmt; - bytesRd += m.bytesRd; - bytesRdTm += m.bytesRdTm; - bytesWrt += m.bytesWrt; - bytesWrtTm += m.bytesWrtTm; - - return this; - } - - /** - * Aggregate metrics. - * - * @param n Nodes count. - * @return Self for method chaining. - */ - public VisorIgfsMetrics aggregate(int n) { - if (n > 0) { - foldersCnt /= n; - filesCnt /= n; - } - - return this; - } - - /** - * @return Maximum amount of data that can be stored on local node. - */ - public long getTotalSpaceSize() { - return totalSpaceSz; - } - - /** - * @return Local used space in bytes on local node. - */ - public long getUsedSpaceSize() { - return usedSpaceSz; - } - - /** - * @return Local free space in bytes on local node. - */ - public long getFreeSpaceSize() { - return totalSpaceSz - usedSpaceSz; - } - - /** - * @return Number of directories created in file system. - */ - public int getFoldersCount() { - return foldersCnt; - } - - /** - * @return Number of files stored in file system. - */ - public int getFilesCount() { - return filesCnt; - } - - /** - * @return Number of files that are currently opened for reading on local node. - */ - public int getFilesOpenedForRead() { - return filesOpenedForRd; - } - - /** - * @return Number of files that are currently opened for writing on local node. - */ - public int getFilesOpenedForWrite() { - return filesOpenedForWrt; - } - - /** - * @return Total blocks read, local and remote. - */ - public long getBlocksRead() { - return blocksRd; - } - - /** - * @return Total remote blocks read. - */ - public long getBlocksReadRemote() { - return blocksRdRmt; - } - - /** - * @return Total blocks write, local and remote. - */ - public long getBlocksWritten() { - return blocksWrt; - } - - /** - * @return Total remote blocks write. - */ - public long getBlocksWrittenRemote() { - return blocksWrtRmt; - } - - /** - * @return Total bytes read. - */ - public long getBytesRead() { - return bytesRd; - } - - /** - * @return Total bytes read time. - */ - public long getBytesReadTime() { - return bytesRdTm; - } - - /** - * @return Total bytes write. - */ - public long getBytesWritten() { - return bytesWrt; - } - - /** - * @return Total bytes write time. - */ - public long getBytesWriteTime() { - return bytesWrtTm; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(totalSpaceSz); - out.writeLong(usedSpaceSz); - out.writeInt(foldersCnt); - out.writeInt(filesCnt); - out.writeInt(filesOpenedForRd); - out.writeInt(filesOpenedForWrt); - out.writeLong(blocksRd); - out.writeLong(blocksRdRmt); - out.writeLong(blocksWrt); - out.writeLong(blocksWrtRmt); - out.writeLong(bytesRd); - out.writeLong(bytesRdTm); - out.writeLong(bytesWrt); - out.writeLong(bytesWrtTm); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - totalSpaceSz = in.readLong(); - usedSpaceSz = in.readLong(); - foldersCnt = in.readInt(); - filesCnt = in.readInt(); - filesOpenedForRd = in.readInt(); - filesOpenedForWrt = in.readInt(); - blocksRd = in.readLong(); - blocksRdRmt = in.readLong(); - blocksWrt = in.readLong(); - blocksWrtRmt = in.readLong(); - bytesRd = in.readLong(); - bytesRdTm = in.readLong(); - bytesWrt = in.readLong(); - bytesWrtTm = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsMetrics.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMode.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMode.java deleted file mode 100644 index b011dc6d2067f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMode.java +++ /dev/null @@ -1,72 +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.igfs; - -import org.jetbrains.annotations.Nullable; - -/** - * {@code IGFS} mode defining interactions with underlying secondary Hadoop file system. - * Secondary Hadoop file system is provided for pass-through, write-through, and - * read-through purposes. - */ -@Deprecated -public enum VisorIgfsMode { - /** - * In this mode IGFS will not delegate to secondary Hadoop file system and will - * cache all the files in memory only. - */ - PRIMARY, - - /** - * In this mode IGFS will not cache any files in memory and will only pass them - * through to secondary Hadoop file system. If this mode is enabled, then - * secondary Hadoop file system must be configured. - */ - PROXY, - - /** - * In this mode {@code IGFS} will cache files locally and also synchronously - * write them through to secondary Hadoop file system. - *

- * If secondary Hadoop file system is not configured, then this mode behaves like - * {@link #PRIMARY} mode. - */ - DUAL_SYNC, - - /** - * In this mode {@code IGFS} will cache files locally and also asynchronously - * write them through to secondary Hadoop file system. - *

- * If secondary Hadoop file system is not configured, then this mode behaves like - * {@link #PRIMARY} mode. - */ - DUAL_ASYNC; - - /** Enumerated values. */ - private static final VisorIgfsMode[] 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 VisorIgfsMode fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java deleted file mode 100644 index 8fbf5097eb002..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java +++ /dev/null @@ -1,88 +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.igfs; - -import java.util.Collections; -import java.util.List; -import org.apache.ignite.internal.util.typedef.F; - -/** - * Various global constants for IGFS profiler. - */ -@Deprecated -public class VisorIgfsProfiler { - /** Default file block size to calculate uniformity. */ - public static final int UNIFORMITY_DFLT_BLOCK_SIZE = 4096; - - /** Default number of blocks to split file for uniformity calculations. */ - public static final int UNIFORMITY_BLOCKS = 100; - - /** - * Aggregate IGFS profiler entries. - * - * @param entries Entries to sum. - * @return Single aggregated entry. - */ - public static VisorIgfsProfilerEntry aggregateIgfsProfilerEntries(List entries) { - assert !F.isEmpty(entries); - - if (entries.size() == 1) - return entries.get(0); // No need to aggregate. - else { - String path = entries.get(0).getPath(); - - Collections.sort(entries, VisorIgfsProfilerEntry.ENTRY_TIMESTAMP_COMPARATOR); - - long ts = 0; - long size = 0; - long bytesRead = 0; - long readTime = 0; - long userReadTime = 0; - long bytesWritten = 0; - long writeTime = 0; - long userWriteTime = 0; - VisorIgfsMode mode = null; - VisorIgfsProfilerUniformityCounters counters = new VisorIgfsProfilerUniformityCounters(); - - for (VisorIgfsProfilerEntry entry : entries) { - // Take last timestamp. - ts = entry.getTimestamp(); - - // Take last size. - size = entry.getSize(); - - // Take last mode. - mode = entry.getMode(); - - // Aggregate metrics. - bytesRead += entry.getBytesRead(); - readTime += entry.getReadTime(); - userReadTime += entry.getUserReadTime(); - bytesWritten += entry.getBytesWritten(); - writeTime += entry.getWriteTime(); - userWriteTime += entry.getUserWriteTime(); - - counters.aggregate(entry.getCounters()); - } - - return new VisorIgfsProfilerEntry(path, ts, mode, size, bytesRead, readTime, userReadTime, - bytesWritten, writeTime, userWriteTime, counters); - } - } - -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java deleted file mode 100644 index 2c24796ca3453..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java +++ /dev/null @@ -1,70 +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.igfs; - -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - - -/** - * Remove all IGFS profiler logs. - */ -@GridInternal -@GridVisorManagementTask -@Deprecated -public class VisorIgfsProfilerClearTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorIgfsProfilerClearJob job(VisorIgfsProfilerClearTaskArg arg) { - return new VisorIgfsProfilerClearJob(arg, debug); - } - - /** - * Job to clear profiler logs. - */ - private static class VisorIgfsProfilerClearJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorIgfsProfilerClearJob(VisorIgfsProfilerClearTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorIgfsProfilerClearTaskResult run(VisorIgfsProfilerClearTaskArg arg) { - throw new IgniteException("IGFS operations are not supported in current version of Ignite"); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerClearJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java deleted file mode 100644 index fab11886f4407..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.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.igfs; - -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; - -/** - * Argument for {@link VisorIgfsProfilerClearTask}. - */ -@Deprecated -public class VisorIgfsProfilerClearTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS name. */ - private String igfsName; - - /** - * Default constructor. - */ - public VisorIgfsProfilerClearTaskArg() { - // No-op. - } - - /** - * @param igfsName IGFS name. - */ - public VisorIgfsProfilerClearTaskArg(String igfsName) { - this.igfsName = igfsName; - } - - /** - * @return IGFS name. - */ - public String getIgfsName() { - return igfsName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, igfsName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - igfsName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerClearTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java deleted file mode 100644 index 97e2c22979834..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java +++ /dev/null @@ -1,86 +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.igfs; - -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.visor.VisorDataTransferObject; - -/** - * Result for {@link VisorIgfsProfilerClearTask}. - */ -@Deprecated -public class VisorIgfsProfilerClearTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Count of deleted files. */ - private int deleted; - - /** Count of not deleted files. */ - private int notDeleted; - - /** - * Default constructor. - */ - public VisorIgfsProfilerClearTaskResult() { - // No-op. - } - - /** - * @param deleted Count of deleted files. - * @param notDeleted Count of not deleted files. - */ - public VisorIgfsProfilerClearTaskResult(int deleted, int notDeleted) { - this.deleted = deleted; - this.notDeleted = notDeleted; - } - - /** - * @return Count of deleted files. - */ - public Integer getDeleted() { - return deleted; - } - - /** - * @return Count of not deleted files. - */ - public Integer getNotDeleted() { - return notDeleted; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeInt(deleted); - out.writeInt(notDeleted); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - deleted = in.readInt(); - notDeleted = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerClearTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java deleted file mode 100644 index ece22331b0f39..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java +++ /dev/null @@ -1,284 +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.igfs; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Comparator; -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; - -/** - * Visor IGFS profiler information about one file. - */ -@Deprecated -public class VisorIgfsProfilerEntry extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Timestamp comparator. */ - public static final Comparator ENTRY_TIMESTAMP_COMPARATOR = - new Comparator() { - @Override public int compare(VisorIgfsProfilerEntry a, VisorIgfsProfilerEntry b) { - return Long.compare(a.ts, b.ts); - } - }; - - /** Path to file. */ - private String path; - - /** Timestamp of last file operation. */ - private long ts; - - /** IGFS mode. */ - private VisorIgfsMode mode; - - /** File size. */ - private long size; - - /** How many bytes were read. */ - private long bytesRead; - - /** How long read take. */ - private long readTime; - - /** User read time. */ - private long userReadTime; - - /** How many bytes were written. */ - private long bytesWritten; - - /** How long write take. */ - private long writeTime; - - /** User write read time. */ - private long userWriteTime; - - /** Calculated uniformity. */ - private double uniformity = -1; - - /** Counters for uniformity calculation. */ - private VisorIgfsProfilerUniformityCounters counters; - - /** Read speed in bytes per second or {@code -1} if speed not available. */ - private long readSpeed; - - /** Write speed in bytes per second or {@code -1} if speed not available. */ - private long writeSpeed; - - /** - * Default constructor. - */ - public VisorIgfsProfilerEntry() { - // No-op. - } - - /** Create data transfer object with given parameters. */ - public VisorIgfsProfilerEntry( - String path, - long ts, - VisorIgfsMode mode, - long size, - long bytesRead, - long readTime, - long userReadTime, - long bytesWritten, - long writeTime, - long userWriteTime, - VisorIgfsProfilerUniformityCounters counters - ) { - assert counters != null; - - this.path = path; - this.ts = ts; - this.mode = mode; - this.size = size; - this.bytesRead = bytesRead; - this.readTime = readTime; - this.userReadTime = userReadTime; - this.bytesWritten = bytesWritten; - this.writeTime = writeTime; - this.userWriteTime = userWriteTime; - this.counters = counters; - - readSpeed = speed(bytesRead, readTime); - writeSpeed = speed(bytesWritten, writeTime); - } - - /** - * Calculate speed of bytes processing. - * - * @param bytes How many bytes were processed. - * @param time How long processing take (in nanoseconds). - * @return Speed of processing in bytes per second or {@code -1} if speed not available. - */ - private static long speed(long bytes, long time) { - if (time > 0) { - double bytesScaled = bytes * 100000d; - double timeScaled = time / 10000d; - - return (long)(bytesScaled / timeScaled); - } - else - return -1L; - } - - /** - * @return Path to file. - */ - public String getPath() { - return path; - } - - /** - * @return Timestamp of last file operation. - */ - public long getTimestamp() { - return ts; - } - - /** - * @return IGFS mode. - */ - public VisorIgfsMode getMode() { - return mode; - } - - /** - * @return File size. - */ - public long getSize() { - return size; - } - - /** - * @return How many bytes were read. - */ - public long getBytesRead() { - return bytesRead; - } - - /** - * @return How long read take. - */ - public long getReadTime() { - return readTime; - } - - /** - * @return User read time. - */ - public long getUserReadTime() { - return userReadTime; - } - - /** - * @return How many bytes were written. - */ - public long getBytesWritten() { - return bytesWritten; - } - - /** - * @return How long write take. - */ - public long getWriteTime() { - return writeTime; - } - - /** - * @return User write read time. - */ - public long getUserWriteTime() { - return userWriteTime; - } - - /** - * @return Calculated uniformity. - */ - public double getUniformity() { - if (uniformity < 0) - uniformity = counters.calc(); - - return uniformity; - } - - /** - * @return Counters for uniformity calculation. - */ - public VisorIgfsProfilerUniformityCounters getCounters() { - return counters; - } - - /** - * @return Read speed in bytes per second or {@code -1} if speed not available. - */ - public long getReadSpeed() { - return readSpeed; - } - - /** - * @return Write speed in bytes per second or {@code -1} if speed not available. - */ - public long getWriteSpeed() { - return writeSpeed; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, path); - out.writeLong(ts); - U.writeEnum(out, mode); - out.writeLong(size); - out.writeLong(bytesRead); - out.writeLong(readTime); - out.writeLong(userReadTime); - out.writeLong(bytesWritten); - out.writeLong(writeTime); - out.writeLong(userWriteTime); - out.writeDouble(uniformity); - out.writeObject(counters); - out.writeLong(readSpeed); - out.writeLong(writeSpeed); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - path = U.readString(in); - ts = in.readLong(); - mode = VisorIgfsMode.fromOrdinal(in.readByte()); - size = in.readLong(); - bytesRead = in.readLong(); - readTime = in.readLong(); - userReadTime = in.readLong(); - bytesWritten = in.readLong(); - writeTime = in.readLong(); - userWriteTime = in.readLong(); - uniformity = in.readDouble(); - counters = (VisorIgfsProfilerUniformityCounters)in.readObject(); - readSpeed = in.readLong(); - writeSpeed = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerEntry.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java deleted file mode 100644 index 187171aab5e0d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java +++ /dev/null @@ -1,71 +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.igfs; - -import java.util.List; -import org.apache.ignite.IgniteException; -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; - -/** - * Task that parse hadoop profiler logs. - */ -/** - * Task that parse hadoop profiler logs. - */ -@GridInternal -@Deprecated -public class VisorIgfsProfilerTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorIgfsProfilerJob job(VisorIgfsProfilerTaskArg arg) { - return new VisorIgfsProfilerJob(arg, debug); - } - - /** - * Job that do actual profiler work. - */ - private static class VisorIgfsProfilerJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg IGFS name. - * @param debug Debug flag. - */ - private VisorIgfsProfilerJob(VisorIgfsProfilerTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected List run(VisorIgfsProfilerTaskArg arg) { - throw new IgniteException("IGFS operations are not supported in current version of Ignite"); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java deleted file mode 100644 index dcb60bb348549..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.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.igfs; - -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; - -/** - * Argument for {@link VisorIgfsProfilerTask}. - */ -@Deprecated -public class VisorIgfsProfilerTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS name. */ - private String igfsName; - - /** - * Default constructor. - */ - public VisorIgfsProfilerTaskArg() { - // No-op. - } - - /** - * @param igfsName IGFS name. - */ - public VisorIgfsProfilerTaskArg(String igfsName) { - this.igfsName = igfsName; - } - - /** - * @return IGFS name. - */ - public String getIgfsName() { - return igfsName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, igfsName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - igfsName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java deleted file mode 100644 index 9a4f4fabbbcba..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java +++ /dev/null @@ -1,233 +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.igfs; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -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.internal.visor.VisorDataTransferObject; - -import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY_BLOCKS; -import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY_DFLT_BLOCK_SIZE; - -/** - * Class to support uniformity calculation. - *

- * Uniformity calculated as coefficient of variation. - *

- * Count read frequency for each file and compare with ideal uniform distribution. - */ -@Deprecated -public class VisorIgfsProfilerUniformityCounters extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Analyzed file size in bytes. */ - private long fileSize; - - /** Current block size to calculate uniformity. */ - private long blockSize = UNIFORMITY_DFLT_BLOCK_SIZE; - - /** Collection of calculated counters. */ - private ArrayList counters = new ArrayList<>(); - - /** - * Default constructor. - */ - public VisorIgfsProfilerUniformityCounters() { - // No-op. - } - - /** - * Calculate block size. - * - * @param fileSize File size in bytes. - * @return Block size. - */ - private long calcBlockSize(long fileSize) { - return Math.max(UNIFORMITY_DFLT_BLOCK_SIZE, fileSize / UNIFORMITY_BLOCKS); - } - - /** - * Check if counters and blockSize should be adjusted according to file size. - * - * @param newFileSize New size of file. - */ - public void invalidate(long newFileSize) { - if (newFileSize < fileSize) { // If newFileSize is less than current fileSize then clear counters. - fileSize = newFileSize; - - counters.clear(); - - blockSize = calcBlockSize(fileSize); - } - else if (newFileSize > fileSize) // If newFileSize is bigger then current fileSize then adjust counters and blockSize. - compact(newFileSize); - } - - /** - * Perform compacting counters if {@code newBlockSize} is great more than twice then compact previous counters. - * - * @param newFileSize New file size to check. - */ - private void compact(long newFileSize) { - long newBlockSize = calcBlockSize(newFileSize); - - if (counters.isEmpty()) - blockSize = newBlockSize; - else { - if (newBlockSize >= 2 * blockSize) { - int ratio = (int)(newBlockSize / blockSize); - - ArrayList compacted = new ArrayList<>(); - - int sum = 0; - int cnt = 0; - - for (Integer counter : counters) { - sum += counter; - cnt++; - - if (cnt >= ratio) { - compacted.add(sum); - - sum = 0; - cnt = 0; - } - } - - if (sum > 0) - compacted.add(sum); - - counters.clear(); - counters.addAll(compacted); - - blockSize = newBlockSize; - } - } - - fileSize = newFileSize; - } - - /** - * Ensure counters capacity and initial state. - * - * @param minCap Desired minimum capacity. - */ - private void capacity(int minCap) { - counters.ensureCapacity(minCap); - - while (counters.size() < minCap) - counters.add(0); - } - - /** - * Increment counters by given pos and length. - * - * @param pos Position in file. - * @param len Read data length. - */ - public void increment(long pos, long len) { - int blockFrom = (int)(pos / blockSize); - int blockTo = (int)((pos + len) / blockSize) + 1; - - capacity(blockTo); - - for (int i = blockFrom; i < blockTo; i++) - counters.set(i, counters.get(i) + 1); - } - - /** - * Add given counters. - * - * @param other Counters to add. - */ - public void aggregate(VisorIgfsProfilerUniformityCounters other) { - if (fileSize < other.fileSize) - compact(other.fileSize); - else if (fileSize > other.fileSize) - other.compact(fileSize); - - int cnt = other.counters.size(); - - if (counters.size() < cnt) - capacity(cnt); - - for (int i = 0; i < cnt; i++) - counters.set(i, counters.get(i) + other.counters.get(i)); - } - - /** - * Calculate uniformity as standard deviation. See: http://en.wikipedia.org/wiki/Standard_deviation. - * - * @return Uniformity value as number in {@code 0..1} range. - */ - public double calc() { - if (counters.isEmpty()) - return -1; - else { - int cap = (int)(fileSize / blockSize + (fileSize % blockSize > 0 ? 1 : 0)); - - capacity(cap); - - int sz = counters.size(); - - int n = F.sumInt(counters); - - double mean = 1.0 / sz; - - // Calc standard deviation for block read frequency: SQRT(SUM(Freq_i - Mean)^2 / K) - // where Mean = 1 / K - // K - Number of blocks - // Freq_i = Counter_i / N - // N - Sum of all counters - double sigma = 0; - - for (Integer counter : counters) - sigma += Math.pow(counter.doubleValue() / n - mean, 2); - - sigma = Math.sqrt(sigma / sz); - - // Calc uniformity coefficient. - return 1.0 - sigma; - } - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(fileSize); - out.writeLong(blockSize); - U.writeCollection(out, counters); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - fileSize = in.readLong(); - blockSize = in.readLong(); - counters = (ArrayList)U.readIntList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsProfilerUniformityCounters.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java deleted file mode 100644 index 54eb994eb6d87..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java +++ /dev/null @@ -1,67 +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.igfs; - -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Resets IGFS metrics. - */ -@GridInternal -@GridVisorManagementTask -@Deprecated -public class VisorIgfsResetMetricsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorIgfsResetMetricsJob job(VisorIgfsResetMetricsTaskArg arg) { - return new VisorIgfsResetMetricsJob(arg, debug); - } - - /** - * Job that reset IGFS metrics. - */ - private static class VisorIgfsResetMetricsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg IGFS names. - * @param debug Debug flag. - */ - private VisorIgfsResetMetricsJob(VisorIgfsResetMetricsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorIgfsResetMetricsTaskArg arg) { - throw new IgniteException("IGFS operations are not supported in current version of Ignite"); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsResetMetricsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java deleted file mode 100644 index 8631d8ef65dca..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java +++ /dev/null @@ -1,74 +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.igfs; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Set; -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; - -/** - * Argument for {@link VisorIgfsResetMetricsTask}. - */ -@Deprecated -public class VisorIgfsResetMetricsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS names. */ - private Set igfsNames; - - /** - * Default constructor. - */ - public VisorIgfsResetMetricsTaskArg() { - // No-op. - } - - /** - * @param igfsNames IGFS names. - */ - public VisorIgfsResetMetricsTaskArg(Set igfsNames) { - this.igfsNames = igfsNames; - } - - /** - * @return IGFS names. - */ - public Set getIgfsNames() { - return igfsNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeCollection(out, igfsNames); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - igfsNames = U.readSet(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsResetMetricsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java deleted file mode 100644 index dbbceb2a9ef2d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java +++ /dev/null @@ -1,67 +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.igfs; - -import org.apache.ignite.IgniteException; -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; - -/** - * Task to set IGFS instance sampling state. - */ -@GridInternal -@Deprecated -public class VisorIgfsSamplingStateTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Job that perform parsing of IGFS profiler logs. - */ - private static class VisorIgfsSamplingStateJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorIgfsSamplingStateJob(VisorIgfsSamplingStateTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorIgfsSamplingStateTaskArg arg) { - throw new IgniteException("IGFS operations are not supported in current version of Ignite"); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsSamplingStateJob.class, this); - } - } - - /** {@inheritDoc} */ - @Override protected VisorIgfsSamplingStateJob job(VisorIgfsSamplingStateTaskArg arg) { - return new VisorIgfsSamplingStateJob(arg, debug); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java deleted file mode 100644 index 85fcdb6dc5853..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java +++ /dev/null @@ -1,87 +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.igfs; - -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; - -/** - * Argument for task returns changing of sampling state result. - */ -@Deprecated -public class VisorIgfsSamplingStateTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS name. */ - private String name; - - /** {@code True} to turn on sampling, {@code false} to turn it off, {@code null} to clear sampling state. */ - private boolean enabled; - - /** - * Default constructor. - */ - public VisorIgfsSamplingStateTaskArg() { - // No-op. - } - - /** - * @param name IGFS name. - * @param enabled {@code True} to turn on sampling, {@code false} to turn it off, {@code null} to clear sampling state. - */ - public VisorIgfsSamplingStateTaskArg(String name, boolean enabled) { - this.name = name; - this.enabled = enabled; - } - - /** - * @return IGFS name. - */ - public String getName() { - return name; - } - - /** - * @return {@code True} to turn on sampling, {@code false} to turn it off, {@code null} to clear sampling state. - */ - public boolean isEnabled() { - return enabled; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeBoolean(enabled); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - enabled = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsSamplingStateTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java deleted file mode 100644 index 2c2ac21eaf81d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java +++ /dev/null @@ -1,112 +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.log; - -import java.io.File; -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; - -/** - * Visor log file. - */ -public class VisorLogFile extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** File path. */ - private String path; - - /** File size. */ - private long size; - - /** File last modified timestamp. */ - private long lastModified; - - /** - * Default constructor. - */ - public VisorLogFile() { - // No-op. - } - - /** - * Create log file for given file. - * - * @param file Log file. - */ - public VisorLogFile(File file) { - this(file.getAbsolutePath(), file.length(), file.lastModified()); - } - - /** - * Create log file with given parameters. - * - * @param path File path. - * @param size File size. - * @param lastModified File last modified date. - */ - public VisorLogFile(String path, long size, long lastModified) { - this.path = path; - this.size = size; - this.lastModified = lastModified; - } - - /** - * @return File path. - */ - public String getPath() { - return path; - } - - /** - * @return File size. - */ - public long getSize() { - return size; - } - - /** - * @return File last modified timestamp. - */ - public long getLastModified() { - return lastModified; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, path); - out.writeLong(size); - out.writeLong(lastModified); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - path = U.readString(in); - size = in.readLong(); - lastModified = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLogFile.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java deleted file mode 100644 index 4eee4580eb47f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java +++ /dev/null @@ -1,192 +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.log; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Arrays; -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; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Result for log search operation. - * Contains found line and several lines before and after, plus other info. - */ -public class VisorLogSearchResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Node ID. */ - private UUID nid; - - /** File path relative to the search folder. */ - private String filePath; - - /** File size. */ - private long fileSize; - - /** Timestamp of last modification of the file. */ - private long lastModified; - - /** Lines of text including found line and several lines before and after. */ - private List lines; - - /** Line number in the file, 1 based. */ - private int lineNum; - - /** Lines count in the file. */ - private int lineCnt; - - /** File content encoding. */ - private String encoding; - - /** - * Default constructor. - */ - public VisorLogSearchResult() { - // No-op. - } - - /** - * Create log search result with given parameters. - * - * @param nid Node ID. - * @param filePath File path relative to the search folder. - * @param fileSize File size. - * @param lastModified Timestamp of last modification of the file. - * @param lines Lines of text including found line and several lines before and after. - * @param lineNum Line number in the file, 1 based. - * @param lineCnt Lines count in the file. - * @param encoding File content encoding. - */ - public VisorLogSearchResult( - UUID nid, - String filePath, - long fileSize, - long lastModified, - String[] lines, - int lineNum, - int lineCnt, - String encoding - ) { - this.nid = nid; - this.filePath = filePath; - this.fileSize = fileSize; - this.lastModified = lastModified; - this.lines = Arrays.asList(lines); - this.lineNum = lineNum; - this.lineCnt = lineCnt; - this.encoding = encoding; - } - - /** - * @return Node ID. - */ - public UUID getNid() { - return nid; - } - - /** - * @return File path relative to the search folder. - */ - public String getFilePath() { - return filePath; - } - - /** - * @return File size. - */ - public long getFileSize() { - return fileSize; - } - - /** - * @return Timestamp of last modification of the file. - */ - public long getLastModified() { - return lastModified; - } - - /** - * @return Lines of text including found line and several lines before and after. - */ - public List getLines() { - return lines; - } - - /** - * @return Line number in the file, 1 based. - */ - public int getLineNumber() { - return lineNum; - } - - /** - * @return Lines count in the file. - */ - public int getLineCount() { - return lineCnt; - } - - /** - * @return File content encoding. - */ - public String getEncoding() { - return encoding; - } - - /** - * @return Found line. - */ - public String getLine() { - return lines.get(lines.size() / 2); - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeUuid(out, nid); - U.writeString(out, filePath); - out.writeLong(fileSize); - out.writeLong(lastModified); - U.writeCollection(out, lines); - out.writeInt(lineNum); - out.writeInt(lineCnt); - U.writeString(out, encoding); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - nid = U.readUuid(in); - filePath = U.readString(in); - fileSize = in.readLong(); - lastModified = in.readLong(); - lines = U.readList(in); - lineNum = in.readInt(); - lineCnt = in.readInt(); - encoding = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLogSearchResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java deleted file mode 100644 index 04ee29cda70bc..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java +++ /dev/null @@ -1,239 +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.log; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Deque; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.IgniteException; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.io.GridReversedLinesFileReader; -import org.apache.ignite.internal.util.lang.GridTuple3; -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.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.decode; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.matchedFiles; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgnitePath; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveSymbolicLink; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.textFile; - -/** - * Search text matching in logs - */ -@GridInternal -@GridVisorManagementTask -public class VisorLogSearchTask extends VisorMultiNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** How many lines to read around line with found text. */ - public static final int LINE_CNT = 21; - - /** How many lines should be read before and after line with found text. */ - public static final int HALF = LINE_CNT / 2; - - /** {@inheritDoc} */ - @Override protected VisorLogSearchJob job(VisorLogSearchTaskArg arg) { - return new VisorLogSearchJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected VisorLogSearchTaskResult reduce0(List results) { - List searchRes = new ArrayList<>(); - Map exRes = U.newHashMap(0); - - // Separate successfully executed results and exceptions. - for (ComputeJobResult result : results) { - if (result.getException() != null) - exRes.put(result.getException(), result.getNode().id()); - else if (result.getData() != null) { - Collection data = result.getData(); - - searchRes.addAll(data); - } - } - - return new VisorLogSearchTaskResult(exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes); - } - - /** - * Job to perform search on node. - */ - private static class VisorLogSearchJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Search descriptor. - * @param debug Debug flag. - */ - private VisorLogSearchJob(VisorLogSearchTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** - * @param f File to read. - * @param charset Text charset. - * @param searchStr Search string. - * @param limit Max number of search results. - * @return Collection of found descriptors. - * @throws IOException In case of I/O error. - */ - private List> searchInFile(File f, Charset charset, String searchStr, - int limit) throws IOException { - List> searched = new ArrayList<>(); - - int line = 0; - - try (GridReversedLinesFileReader reader = new GridReversedLinesFileReader(f, 4096, charset)) { - Deque lastLines = new LinkedList<>(); - - String s; - int lastFoundLine = 0, foundCnt = 0; - - while ((s = reader.readLine()) != null) { - line++; - - if (lastFoundLine > 0 && line - lastFoundLine <= HALF) { - for (int i = searched.size() - 1; i >= 0; i--) { - GridTuple3 tup = searched.get(i); - - int delta = line - tup.get2(); - - if (delta <= HALF && delta != 0) - tup.get1()[HALF - delta] = s; - else - break; - } - } - - if (foundCnt < limit) { - if (s.toLowerCase().contains(searchStr)) { - String[] buf = new String[LINE_CNT]; - - buf[HALF] = s; - - int i = 1; - - for (String l : lastLines) { - buf[HALF + i] = l; - - i++; - } - - lastFoundLine = line; - - searched.add(new GridTuple3<>(buf, line, 0)); - - foundCnt++; - } - } - - if (lastLines.size() >= HALF) - lastLines.removeFirst(); - - lastLines.add(s); - } - } - - for (GridTuple3 entry : searched) { - entry.set2(line - entry.get2() + 1); - entry.set3(line); - } - - return searched; - } - - /** {@inheritDoc} */ - @Override protected Collection run(VisorLogSearchTaskArg arg) { - try { - File folder = resolveIgnitePath(arg.getFolder()); - - if (folder == null) - return null; - - folder = resolveSymbolicLink(folder); - - UUID uuid = ignite.localNode().id(); - String nid = uuid.toString().toLowerCase(); - - String filePtrn = arg.getFilePattern().replace("@nid8", nid.substring(0, 8)).replace("@nid", nid); - - int pathIdx = (folder.isDirectory() ? folder : folder.getParentFile()).getAbsolutePath().length() + 1; - - List matchingFiles = matchedFiles(folder, filePtrn); - - Collection results = new ArrayList<>(arg.getLimit()); - - int resCnt = 0; - - for (VisorLogFile logFile : matchingFiles) { - try { - File f = new File(logFile.getPath()); - - if (textFile(f, false)) { - Charset charset = decode(f); - - if (resCnt == arg.getLimit()) - break; - - List> searched = - searchInFile(f, charset, arg.getSearchString(), arg.getLimit() - resCnt); - - resCnt += searched.size(); - - String path = f.getAbsolutePath().substring(pathIdx); - long sz = f.length(), lastModified = f.lastModified(); - - for (GridTuple3 e : searched) { - results.add(new VisorLogSearchResult(uuid, path, sz, lastModified, - e.get1(), e.get2(), e.get3(), charset.name())); - } - } - } - catch (IOException ignored) { - } - } - - return results.isEmpty() ? null : results; - } - catch (Exception e) { - throw new IgniteException(e); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLogSearchJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskArg.java deleted file mode 100644 index aa0597001056c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskArg.java +++ /dev/null @@ -1,114 +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.log; - -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; - -/** - * Arguments for {@link VisorLogSearchTask}. - */ -public class VisorLogSearchTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Searched string. */ - private String searchStr; - - /** Folder. */ - private String folder; - - /** File name search pattern. */ - private String filePtrn; - - /** Max number of results. */ - private int limit; - - /** - * Default constructor. - */ - public VisorLogSearchTaskArg() { - // No-op. - } - - /** - * @param searchStr Searched string. - * @param folder Folder. - * @param filePtrn File name search pattern. - * @param limit Max number of results. - */ - public VisorLogSearchTaskArg(String searchStr, String folder, String filePtrn, int limit) { - this.searchStr = searchStr; - this.folder = folder; - this.filePtrn = filePtrn; - this.limit = limit; - } - - /** - * @return Searched string. - */ - public String getSearchString() { - return searchStr; - } - - /** - * @return Folder. - */ - public String getFolder() { - return folder; - } - - /** - * @return File name search pattern. - */ - public String getFilePattern() { - return filePtrn; - } - - /** - * @return Max number of results. - */ - public int getLimit() { - return limit; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, searchStr); - U.writeString(out, folder); - U.writeString(out, filePtrn); - out.writeInt(limit); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - searchStr = U.readString(in); - folder = U.readString(in); - filePtrn = U.readString(in); - limit = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLogSearchTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java deleted file mode 100644 index 3104c3ab3edd9..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java +++ /dev/null @@ -1,92 +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.log; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import java.util.Map; -import java.util.UUID; -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 log search operation. - * Contains found line and several lines before and after, plus other info. - */ -public class VisorLogSearchTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** List of exceptions by node ID. */ - private Map exceptions; - - /** List of log search results. */ - private List results; - - /** - * Default constructor. - */ - public VisorLogSearchTaskResult() { - // No-op. - } - - /** - * Create log search result with given parameters. - * - * @param exceptions List of exceptions by node ID. - * @param results List of log search results. - */ - public VisorLogSearchTaskResult(Map exceptions, List results) { - this.exceptions = exceptions; - this.results = results; - } - - /** - * @return List of exceptions by node ID. - */ - public Map getExceptions() { - return exceptions; - } - - /** - * @return List of log search results. - */ - public List getResults() { - return results; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, exceptions); - U.writeCollection(out, results); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - exceptions = U.readMap(in); - results = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLogSearchTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java deleted file mode 100644 index eaa036cb2ae21..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java +++ /dev/null @@ -1,75 +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.misc; - -import java.util.List; -import org.apache.ignite.compute.ComputeJobResult; -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.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -/** - * Ack task to run on node. - */ -@GridInternal -public class VisorAckTask extends VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorAckJob job(VisorAckTaskArg arg) { - return new VisorAckJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Void reduce0(List results) { - return null; - } - - /** - * Ack job to run on node. - */ - private static class VisorAckJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Message to ack in node console. - * @param debug Debug flag. - */ - private VisorAckJob(VisorAckTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorAckTaskArg arg) { - System.out.println(": ack: " + (arg.getMessage() == null ? ignite.localNode().id() : arg.getMessage())); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorAckJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java deleted file mode 100644 index 93c4aef71a2d2..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java +++ /dev/null @@ -1,72 +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.misc; - -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; - -/** - * Arguments for {@link VisorAckTask}. - */ -public class VisorAckTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Message to show. */ - private String msg; - - /** - * Default constructor. - */ - public VisorAckTaskArg() { - // No-op. - } - - /** - * @param msg Message to show. - */ - public VisorAckTaskArg(String msg) { - this.msg = msg; - } - - /** - * @return Cache name. - */ - public String getMessage() { - return msg; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, msg); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - msg = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorAckTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java deleted file mode 100644 index 86aee0343202b..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java +++ /dev/null @@ -1,67 +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.misc; - -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Task for changing grid active state. - */ -@GridInternal -@GridVisorManagementTask -public class VisorChangeGridActiveStateTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorChangeGridActiveStateJob job(VisorChangeGridActiveStateTaskArg arg) { - return new VisorChangeGridActiveStateJob(arg, debug); - } - - /** - * Job for changing grid active state. - */ - private static class VisorChangeGridActiveStateJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg New state of grid. - * @param debug Debug flag. - */ - private VisorChangeGridActiveStateJob(VisorChangeGridActiveStateTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorChangeGridActiveStateTaskArg arg) { - ignite.active(arg.isActive()); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorChangeGridActiveStateJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java deleted file mode 100644 index 15e76fb98cc9c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java +++ /dev/null @@ -1,71 +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.misc; - -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.visor.VisorDataTransferObject; - -/** - * Argument for {@link VisorChangeGridActiveStateTask}. - */ -public class VisorChangeGridActiveStateTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** If True start activation process. If False start deactivation process. */ - private boolean active; - - /** - * Default constructor. - */ - public VisorChangeGridActiveStateTaskArg() { - // No-op. - } - - /** - * @param active If True start activation process. If False start deactivation process. - */ - public VisorChangeGridActiveStateTaskArg(boolean active) { - this.active = active; - } - - /** - * @return If True start activation process. If False start deactivation process. - */ - public boolean isActive() { - return active; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(active); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - active = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorChangeGridActiveStateTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorLatestVersionTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorLatestVersionTask.java deleted file mode 100644 index 8c250996f974f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorLatestVersionTask.java +++ /dev/null @@ -1,63 +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.misc; - -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; - -/** - * Task for collecting latest version. - */ -@GridInternal -public class VisorLatestVersionTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorLatestVersionJob job(Void arg) { - return new VisorLatestVersionJob(arg, debug); - } - - /** - * Job for collecting latest version. - */ - private static class VisorLatestVersionJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Formal job argument. - * @param debug Debug flag. - */ - private VisorLatestVersionJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected String run(Void arg) { - return ignite.latestVersion(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLatestVersionJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorNopTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorNopTask.java deleted file mode 100644 index aeca762a0f1a9..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorNopTask.java +++ /dev/null @@ -1,98 +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.misc; - -import java.util.List; -import java.util.Map; -import java.util.Random; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.compute.ComputeJobAdapter; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.compute.ComputeJobResultPolicy; -import org.apache.ignite.compute.ComputeTask; -import org.apache.ignite.internal.util.GridLeanMap; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Nop task with random timeout. - */ -public class VisorNopTask implements ComputeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @NotNull @Override public Map map(List subgrid, - @Nullable Integer arg) { - - Map map = new GridLeanMap<>(subgrid.size()); - - for (ClusterNode node : subgrid) - map.put(new VisorNopJob(arg), node); - - return map; - } - - /** {@inheritDoc} */ - @Override public ComputeJobResultPolicy result(ComputeJobResult res, - List rcvd) { - return ComputeJobResultPolicy.WAIT; - } - - /** {@inheritDoc} */ - @Nullable @Override public Void reduce(List results) { - return null; - } - - /** - * Nop job with random timeout. - */ - private static class VisorNopJob extends ComputeJobAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Job argument. - */ - private VisorNopJob(@Nullable Object arg) { - super(arg); - } - - /** {@inheritDoc} */ - @SuppressWarnings("ConstantConditions") - @Nullable @Override public Object execute() { - try { - Integer maxTimeout = argument(0); - - Thread.sleep(new Random().nextInt(maxTimeout)); - } - catch (InterruptedException ignored) { - Thread.currentThread().interrupt(); - } - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNopJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java deleted file mode 100644 index f851e262abe96..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java +++ /dev/null @@ -1,107 +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.misc; - -import java.net.InetAddress; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.IgniteUtils; -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; - -/** - * Task that resolve host name for specified IP address from node. - */ -@GridInternal -public class VisorResolveHostNameTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorResolveHostNameJob job(Void arg) { - return new VisorResolveHostNameJob(arg, debug); - } - - /** - * Job that resolve host name for specified IP address. - */ - private static class VisorResolveHostNameJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job. - * - * @param arg List of IP address for resolve. - * @param debug Debug flag. - */ - private VisorResolveHostNameJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Map run(Void arg) { - Map res = new HashMap<>(); - - try { - IgniteBiTuple, Collection> addrs = - IgniteUtils.resolveLocalAddresses(InetAddress.getByName("0.0.0.0"), true); - - assert (addrs.get1() != null); - assert (addrs.get2() != null); - - Iterator ipIt = addrs.get1().iterator(); - Iterator hostIt = addrs.get2().iterator(); - - while (ipIt.hasNext() && hostIt.hasNext()) { - String ip = ipIt.next(); - - String hostName = hostIt.next(); - - if (hostName == null || hostName.trim().isEmpty()) { - try { - if (InetAddress.getByName(ip).isLoopbackAddress()) - res.put(ip, "localhost"); - } - catch (Exception ignore) { - //no-op - } - } - else if (!hostName.equals(ip)) - res.put(ip, hostName); - } - } - catch (Exception e) { - throw new IgniteException("Failed to resolve host name", e); - } - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorResolveHostNameJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAffinityTopologyVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAffinityTopologyVersion.java deleted file mode 100644 index 83b2fb1e3b58c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAffinityTopologyVersion.java +++ /dev/null @@ -1,87 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for {@link AffinityTopologyVersion} - */ -public class VisorAffinityTopologyVersion extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private long topVer; - - /** */ - private int minorTopVer; - - /** - * Default constructor. - */ - public VisorAffinityTopologyVersion() { - // No-op. - } - - /** - * Create data transfer object for affinity topology version. - * - * @param affTopVer Affinity topology version. - */ - public VisorAffinityTopologyVersion(AffinityTopologyVersion affTopVer) { - topVer = affTopVer.topologyVersion(); - minorTopVer = affTopVer.minorTopologyVersion(); - } - - /** - * @return Topology version. - */ - public long getTopologyVersion() { - return topVer; - } - - /** - * @return Minor topology version. - */ - public int getMinorTopologyVersion() { - return minorTopVer; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(topVer); - out.writeInt(minorTopVer); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - topVer = in.readLong(); - minorTopVer = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorAffinityTopologyVersion.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java deleted file mode 100644 index 2c77d6ef11cdb..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java +++ /dev/null @@ -1,101 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.AtomicConfiguration; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for configuration of atomic data structures. - */ -public class VisorAtomicConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Atomic sequence reservation size. */ - private int seqReserveSize; - - /** Cache mode. */ - private CacheMode cacheMode; - - /** Number of backups. */ - private int backups; - - /** - * Default constructor. - */ - public VisorAtomicConfiguration() { - // No-op. - } - - /** - * Create data transfer object for atomic configuration. - * - * @param src Atomic configuration. - */ - public VisorAtomicConfiguration(AtomicConfiguration src) { - seqReserveSize = src.getAtomicSequenceReserveSize(); - cacheMode = src.getCacheMode(); - backups = src.getBackups(); - } - - /** - * @return Atomic sequence reservation size. - */ - public int getAtomicSequenceReserveSize() { - return seqReserveSize; - } - - /** - * @return Cache mode. - */ - public CacheMode getCacheMode() { - return cacheMode; - } - - /** - * @return Number of backup nodes. - */ - public int getBackups() { - return backups; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeInt(seqReserveSize); - out.writeByte(CacheMode.toCode(cacheMode)); - out.writeInt(backups); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - seqReserveSize = in.readInt(); - cacheMode = CacheMode.fromCode(in.readByte()); - backups = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorAtomicConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java deleted file mode 100644 index 209e1b63c4c16..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java +++ /dev/null @@ -1,551 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.DeploymentMode; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -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 java.lang.System.getProperty; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_DAEMON; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_HOME; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_LOCAL_HOST; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_ASCII; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_DISCO_ORDER; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_SHUTDOWN_HOOK; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_PROG_NAME; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_SUCCESS_FILE; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER; -import static org.apache.ignite.internal.processors.cluster.ClusterProcessor.DFLT_UPDATE_NOTIFIER; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.boolValue; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for node basic configuration properties. - */ -public class VisorBasicConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Ignite instance name. */ - private String igniteInstanceName; - - /** IGNITE_HOME determined at startup. */ - private String ggHome; - - /** Local host value used. */ - private String locHost; - - /** Marshaller used. */ - private String marsh; - - /** Deployment Mode. */ - private DeploymentMode deployMode; - - /** Client mode flag. */ - private Boolean clientMode; - - /** Whether this node daemon or not. */ - private boolean daemon; - - /** Whether remote JMX is enabled. */ - private boolean jmxRemote; - - /** Is node restart enabled. */ - private boolean restart; - - /** Network timeout. */ - private long netTimeout; - - /** Logger used on node. */ - private String log; - - /** Discovery startup delay. */ - private long discoStartupDelay; - - /** MBean server name */ - private String mBeanSrv; - - /** Whether ASCII logo is disabled. */ - private boolean noAscii; - - /** Whether no discovery order is allowed. */ - private boolean noDiscoOrder; - - /** Whether shutdown hook is disabled. */ - private boolean noShutdownHook; - - /** Name of command line program. */ - private String progName; - - /** Whether node is in quiet mode. */ - private boolean quiet; - - /** Success file name. */ - private String successFile; - - /** Whether update checker is enabled. */ - private boolean updateNtf; - - /** Active on start flag. */ - private boolean activeOnStart; - - /** Address resolver. */ - private String addrRslvr; - - /** Flag indicating whether cache sanity check is enabled. */ - private boolean cacheSanityCheckEnabled; - - /** User's class loader. */ - private String clsLdr; - - /** Consistent globally unique node ID which survives node restarts. */ - private String consistentId; - - /** Failure detection timeout. */ - private Long failureDetectionTimeout; - - /** Ignite work folder. */ - private String igniteWorkDir; - - /** */ - private boolean lateAffAssignment; - - /** Marshal local jobs. */ - private boolean marshLocJobs; - - /** Full metrics enabled flag. */ - private long metricsUpdateFreq; - - /** Failure detection timeout for client nodes. */ - private Long clientFailureDetectionTimeout; - - /** Message send retries delay. */ - private int sndRetryCnt; - - /** Interval between message send retries. */ - private long sndRetryDelay; - - /** Base port number for time server. */ - private int timeSrvPortBase; - - /** Port number range for time server. */ - private int timeSrvPortRange; - - /** Utility cache pool keep alive time. */ - private long utilityCacheKeepAliveTime; - - /** - * Default constructor. - */ - public VisorBasicConfiguration() { - // No-op. - } - - /** - * Create data transfer object for node basic configuration properties. - * - * @param ignite Grid. - * @param c Grid configuration. - */ - public VisorBasicConfiguration(IgniteEx ignite, IgniteConfiguration c) { - igniteInstanceName = c.getIgniteInstanceName(); - ggHome = getProperty(IGNITE_HOME, c.getIgniteHome()); - locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost()); - marsh = compactClass(c.getMarshaller()); - deployMode = c.getDeploymentMode(); - clientMode = c.isClientMode(); - daemon = boolValue(IGNITE_DAEMON, c.isDaemon()); - jmxRemote = ignite.isJmxRemoteEnabled(); - restart = ignite.isRestartEnabled(); - netTimeout = c.getNetworkTimeout(); - log = compactClass(c.getGridLogger()); - discoStartupDelay = c.getDiscoveryStartupDelay(); - mBeanSrv = compactClass(c.getMBeanServer()); - noAscii = boolValue(IGNITE_NO_ASCII, false); - noDiscoOrder = boolValue(IGNITE_NO_DISCO_ORDER, false); - noShutdownHook = boolValue(IGNITE_NO_SHUTDOWN_HOOK, false); - progName = getProperty(IGNITE_PROG_NAME); - quiet = boolValue(IGNITE_QUIET, true); - successFile = getProperty(IGNITE_SUCCESS_FILE); - updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, DFLT_UPDATE_NOTIFIER); - activeOnStart = c.isActiveOnStart(); - addrRslvr = compactClass(c.getAddressResolver()); - cacheSanityCheckEnabled = c.isCacheSanityCheckEnabled(); - clsLdr = compactClass(c.getClassLoader()); - consistentId = c.getConsistentId() != null ? String.valueOf(c.getConsistentId()) : null; - failureDetectionTimeout = c.getFailureDetectionTimeout(); - igniteWorkDir = c.getWorkDirectory(); - lateAffAssignment = c.isLateAffinityAssignment(); - marshLocJobs = c.isMarshalLocalJobs(); - metricsUpdateFreq = c.getMetricsUpdateFrequency(); - clientFailureDetectionTimeout = c.getClientFailureDetectionTimeout(); - sndRetryCnt = c.getNetworkSendRetryCount(); - sndRetryDelay = c.getNetworkSendRetryDelay(); - timeSrvPortBase = c.getTimeServerPortBase(); - timeSrvPortRange = c.getTimeServerPortRange(); - utilityCacheKeepAliveTime = c.getUtilityCacheKeepAliveTime(); - } - - /** - * @return Ignite instance name. - */ - @Nullable public String getIgniteInstanceName() { - return igniteInstanceName; - } - - /** - * @return IGNITE_HOME determined at startup. - */ - @Nullable public String getGgHome() { - return ggHome; - } - - /** - * @return Local host value used. - */ - @Nullable public String getLocalHost() { - return locHost; - } - - /** - * @return Marshaller used. - */ - public String getMarshaller() { - return marsh; - } - - /** - * @return Deployment Mode. - */ - public Object getDeploymentMode() { - return deployMode; - } - - /** - * @return Client mode flag. - */ - public Boolean isClientMode() { - return clientMode; - } - - /** - * @return Whether this node daemon or not. - */ - public boolean isDaemon() { - return daemon; - } - - /** - * @return Whether remote JMX is enabled. - */ - public boolean isJmxRemote() { - return jmxRemote; - } - - /** - * @return Is node restart enabled. - */ - public boolean isRestart() { - return restart; - } - - /** - * @return Network timeout. - */ - public long getNetworkTimeout() { - return netTimeout; - } - - /** - * @return Logger used on node. - */ - public String getLogger() { - return log; - } - - /** - * @return Discovery startup delay. - */ - public long getDiscoStartupDelay() { - return discoStartupDelay; - } - - /** - * @return MBean server name - */ - @Nullable public String getMBeanServer() { - return mBeanSrv; - } - - /** - * @return Whether ASCII logo is disabled. - */ - public boolean isNoAscii() { - return noAscii; - } - - /** - * @return Whether no discovery order is allowed. - */ - public boolean isNoDiscoOrder() { - return noDiscoOrder; - } - - /** - * @return Whether shutdown hook is disabled. - */ - public boolean isNoShutdownHook() { - return noShutdownHook; - } - - /** - * @return Name of command line program. - */ - public String getProgramName() { - return progName; - } - - /** - * @return Whether node is in quiet mode. - */ - public boolean isQuiet() { - return quiet; - } - - /** - * @return Success file name. - */ - public String getSuccessFile() { - return successFile; - } - - /** - * @return Whether update checker is enabled. - */ - public boolean isUpdateNotifier() { - return updateNtf; - } - - /** - * @return Active on start flag. - */ - public boolean isActiveOnStart() { - return activeOnStart; - } - - /** - * @return Class name of address resolver instance. - */ - public String getAddressResolver() { - return addrRslvr; - } - - /** - * @return Flag indicating whether cache sanity check is enabled. - */ - public boolean isCacheSanityCheckEnabled() { - return cacheSanityCheckEnabled; - } - - /** - * @return User's class loader. - */ - public String getClassLoader() { - return clsLdr; - } - - /** - * Gets consistent globally unique node ID which survives node restarts. - * - * @return Node consistent ID.a - */ - public String getConsistentId() { - return consistentId; - } - - /** - * @return Failure detection timeout in milliseconds. - */ - public Long getFailureDetectionTimeout() { - return failureDetectionTimeout; - } - - /** - * @return Ignite work directory. - */ - public String getWorkDirectory() { - return igniteWorkDir; - } - - /** - * @return Late affinity assignment flag. - */ - public boolean isLateAffinityAssignment() { - return lateAffAssignment; - } - - /** - * @return {@code True} if local jobs should be marshalled. - */ - public boolean isMarshalLocalJobs() { - return marshLocJobs; - } - - /** - * @return Job metrics update frequency in milliseconds. - */ - public long getMetricsUpdateFrequency() { - return metricsUpdateFreq; - } - - /** - * @return Failure detection timeout for client nodes in milliseconds. - */ - public Long getClientFailureDetectionTimeout() { - return clientFailureDetectionTimeout; - } - - /** - * @return Message send retries count. - */ - public int getNetworkSendRetryCount() { - return sndRetryCnt; - } - - /** - * @return Interval between message send retries. - */ - public long getNetworkSendRetryDelay() { - return sndRetryDelay; - } - - /** - * @return Base UPD port number for grid time server. - */ - public int getTimeServerPortBase() { - return timeSrvPortBase; - } - - /** - * @return Number of ports to try before server initialization fails. - */ - public int getTimeServerPortRange() { - return timeSrvPortRange; - } - - /** - * @return Thread pool keep alive time (in milliseconds) to be used in grid for utility cache messages. - */ - public long getUtilityCacheKeepAliveTime() { - return utilityCacheKeepAliveTime; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, igniteInstanceName); - U.writeString(out, ggHome); - U.writeString(out, locHost); - U.writeString(out, marsh); - U.writeEnum(out, deployMode); - out.writeObject(clientMode); - out.writeBoolean(daemon); - out.writeBoolean(jmxRemote); - out.writeBoolean(restart); - out.writeLong(netTimeout); - U.writeString(out, log); - out.writeLong(discoStartupDelay); - U.writeString(out, mBeanSrv); - out.writeBoolean(noAscii); - out.writeBoolean(noDiscoOrder); - out.writeBoolean(noShutdownHook); - U.writeString(out, progName); - out.writeBoolean(quiet); - U.writeString(out, successFile); - out.writeBoolean(updateNtf); - out.writeBoolean(activeOnStart); - U.writeString(out, addrRslvr); - out.writeBoolean(cacheSanityCheckEnabled); - U.writeString(out, clsLdr); - U.writeString(out, consistentId); - out.writeObject(failureDetectionTimeout); - U.writeString(out, igniteWorkDir); - out.writeBoolean(lateAffAssignment); - out.writeBoolean(marshLocJobs); - out.writeLong(metricsUpdateFreq); - out.writeObject(clientFailureDetectionTimeout); - out.writeInt(sndRetryCnt); - out.writeLong(sndRetryDelay); - out.writeInt(timeSrvPortBase); - out.writeInt(timeSrvPortRange); - out.writeLong(utilityCacheKeepAliveTime); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - igniteInstanceName = U.readString(in); - ggHome = U.readString(in); - locHost = U.readString(in); - marsh = U.readString(in); - deployMode = DeploymentMode.fromOrdinal(in.readByte()); - clientMode = (Boolean)in.readObject(); - daemon = in.readBoolean(); - jmxRemote = in.readBoolean(); - restart = in.readBoolean(); - netTimeout = in.readLong(); - log = U.readString(in); - discoStartupDelay = in.readLong(); - mBeanSrv = U.readString(in); - noAscii = in.readBoolean(); - noDiscoOrder = in.readBoolean(); - noShutdownHook = in.readBoolean(); - progName = U.readString(in); - quiet = in.readBoolean(); - successFile = U.readString(in); - updateNtf = in.readBoolean(); - activeOnStart = in.readBoolean(); - addrRslvr = U.readString(in); - cacheSanityCheckEnabled = in.readBoolean(); - clsLdr = U.readString(in); - consistentId = U.readString(in); - failureDetectionTimeout = (Long)in.readObject(); - igniteWorkDir = U.readString(in); - lateAffAssignment = in.readBoolean(); - marshLocJobs = in.readBoolean(); - metricsUpdateFreq = in.readLong(); - clientFailureDetectionTimeout = (Long)in.readObject(); - sndRetryCnt = in.readInt(); - sndRetryDelay = in.readLong(); - timeSrvPortBase = in.readInt(); - timeSrvPortRange = in.readInt(); - utilityCacheKeepAliveTime = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorBasicConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryConfiguration.java deleted file mode 100644 index f69caf19fd845..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryConfiguration.java +++ /dev/null @@ -1,131 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import org.apache.ignite.configuration.BinaryConfiguration; -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 static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for configuration of binary data structures. - */ -public class VisorBinaryConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** ID mapper. */ - private String idMapper; - - /** Name mapper. */ - private String nameMapper; - - /** Serializer. */ - private String serializer; - - /** Types. */ - private List typeCfgs; - - /** Compact footer flag. */ - private boolean compactFooter; - - /** - * Default constructor. - */ - public VisorBinaryConfiguration() { - // No-op. - } - - /** - * Create data transfer object for binary configuration. - * - * @param src Binary configuration. - */ - public VisorBinaryConfiguration(BinaryConfiguration src) { - idMapper = compactClass(src.getIdMapper()); - nameMapper = compactClass(src.getNameMapper()); - serializer = compactClass(src.getSerializer()); - compactFooter = src.isCompactFooter(); - - typeCfgs = VisorBinaryTypeConfiguration.list(src.getTypeConfigurations()); - } - - /** - * @return ID mapper. - */ - public String getIdMapper() { - return idMapper; - } - - /** - * @return Name mapper. - */ - public String getNameMapper() { - return nameMapper; - } - - /** - * @return Serializer. - */ - public String getSerializer() { - return serializer; - } - - /** - * @return Types. - */ - public List getTypeConfigurations() { - return typeCfgs; - } - - /** - * @return Compact footer flag. - */ - public boolean isCompactFooter() { - return compactFooter; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, idMapper); - U.writeString(out, nameMapper); - U.writeString(out, serializer); - U.writeCollection(out, typeCfgs); - out.writeBoolean(compactFooter); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - idMapper = U.readString(in); - nameMapper = U.readString(in); - serializer = U.readString(in); - typeCfgs = U.readList(in); - compactFooter = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorBinaryConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryTypeConfiguration.java deleted file mode 100644 index 3b575ee20c2b5..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBinaryTypeConfiguration.java +++ /dev/null @@ -1,150 +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.node; - -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.binary.BinaryTypeConfiguration; -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.internal.visor.VisorDataTransferObject; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for configuration of binary type structures. - */ -public class VisorBinaryTypeConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Class name. */ - private String typeName; - - /** ID mapper. */ - private String idMapper; - - /** Name mapper. */ - private String nameMapper; - - /** Serializer. */ - private String serializer; - - /** Enum flag. */ - private boolean isEnum; - - /** - * Construct data transfer object for Executor configurations properties. - * - * @param cfgs Executor configurations. - * @return Executor configurations properties. - */ - public static List list(Collection cfgs) { - List res = new ArrayList<>(); - - if (!F.isEmpty(cfgs)) { - for (BinaryTypeConfiguration cfg : cfgs) - res.add(new VisorBinaryTypeConfiguration(cfg)); - } - - return res; - } - - /** - * Default constructor. - */ - public VisorBinaryTypeConfiguration() { - // No-op. - } - - /** - * Create data transfer object for binary type configuration. - * - * @param src Binary type configuration. - */ - public VisorBinaryTypeConfiguration(BinaryTypeConfiguration src) { - typeName = src.getTypeName(); - idMapper = compactClass(src.getIdMapper()); - nameMapper = compactClass(src.getNameMapper()); - serializer = compactClass(src.getSerializer()); - isEnum = src.isEnum(); - } - - /** - * @return Class name. - */ - public String getTypeName() { - return typeName; - } - - /** - * @return ID mapper. - */ - public String getIdMapper() { - return idMapper; - } - - /** - * @return Name mapper. - */ - public String getNameMapper() { - return nameMapper; - } - - /** - * @return Serializer. - */ - public String getSerializer() { - return serializer; - } - - /** - * @return Enum flag. - */ - public boolean isEnum() { - return isEnum; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, typeName); - U.writeString(out, idMapper); - U.writeString(out, nameMapper); - U.writeString(out, serializer); - out.writeBoolean(isEnum); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - typeName = U.readString(in); - idMapper = U.readString(in); - nameMapper = U.readString(in); - serializer = U.readString(in); - isEnum = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorBinaryTypeConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheKeyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheKeyConfiguration.java deleted file mode 100644 index cbd7b55fbf7d6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheKeyConfiguration.java +++ /dev/null @@ -1,108 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.List; -import org.apache.ignite.cache.CacheKeyConfiguration; -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.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for configuration of cache key data structures. - */ -public class VisorCacheKeyConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Type name. */ - private String typeName; - - /** Affinity key field name. */ - private String affKeyFieldName; - - /** - * Construct data transfer object for cache key configurations properties. - * - * @param cfgs Cache key configurations. - * @return Cache key configurations properties. - */ - public static List list(CacheKeyConfiguration[] cfgs) { - List res = new ArrayList<>(); - - if (!F.isEmpty(cfgs)) { - for (CacheKeyConfiguration cfg : cfgs) - res.add(new VisorCacheKeyConfiguration(cfg)); - } - - return res; - } - - /** - * Default constructor. - */ - public VisorCacheKeyConfiguration() { - // No-op. - } - - /** - * Create data transfer object for cache key configuration. - * - * @param src Cache key configuration. - */ - public VisorCacheKeyConfiguration(CacheKeyConfiguration src) { - typeName = src.getTypeName(); - affKeyFieldName = src.getAffinityKeyFieldName(); - } - - /** - * @return Type name. - */ - public String getTypeName() { - return typeName; - } - - /** - * @return Affinity key field name. - */ - public String getAffinityKeyFieldName() { - return affKeyFieldName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, typeName); - U.writeString(out, affKeyFieldName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - typeName = U.readString(in); - affKeyFieldName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheKeyConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java deleted file mode 100644 index 5bd818d424848..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java +++ /dev/null @@ -1,91 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.dto.IgniteDataTransferObject; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; - -/** - * Result object for cache rebalance job. - */ -public class VisorCacheRebalanceCollectorJobResult extends IgniteDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Rebalance percent. */ - private double rebalance; - - /** Node baseline state. */ - private VisorNodeBaselineStatus baseline; - - /** - * Default constructor. - */ - public VisorCacheRebalanceCollectorJobResult() { - // No-op. - } - - /** - * @return Rebalance progress. - */ - public double getRebalance() { - return rebalance; - } - - /** - * @param rebalance Rebalance progress. - */ - public void setRebalance(double rebalance) { - this.rebalance = rebalance; - } - - /** - * @return Node baseline status. - */ - public VisorNodeBaselineStatus getBaseline() { - return baseline; - } - - /** - * @param baseline Node baseline status. - */ - public void setBaseline(VisorNodeBaselineStatus baseline) { - this.baseline = baseline; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeDouble(rebalance); - U.writeEnum(out, baseline); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - rebalance = in.readDouble(); - baseline = VisorNodeBaselineStatus.fromOrdinal(in.readByte()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheRebalanceCollectorJobResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java deleted file mode 100644 index 484150ecca08d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java +++ /dev/null @@ -1,199 +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.node; - -import java.util.Collection; -import java.util.List; -import org.apache.ignite.cache.CacheMetrics; -import org.apache.ignite.cluster.BaselineNode; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.cluster.IgniteClusterEx; -import org.apache.ignite.internal.processors.cache.CacheGroupContext; -import org.apache.ignite.internal.processors.cache.GridCacheAdapter; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; -import org.apache.ignite.internal.processors.cache.GridCacheUtils; -import org.apache.ignite.internal.processors.task.GridInternal; -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.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus.BASELINE_NOT_AVAILABLE; -import static org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus.NODE_IN_BASELINE; -import static org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus.NODE_NOT_IN_BASELINE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.MINIMAL_REBALANCE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.NOTHING_TO_REBALANCE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_COMPLETE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_NOT_AVAILABLE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isProxyCache; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isRestartingCache; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log; - -/** - * Collects topology rebalance metrics. - */ -@GridInternal -public class VisorCacheRebalanceCollectorTask extends VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheRebalanceCollectorJob job(VisorCacheRebalanceCollectorTaskArg arg) { - return new VisorCacheRebalanceCollectorJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected VisorCacheRebalanceCollectorTaskResult reduce0(List results) { - return reduce(new VisorCacheRebalanceCollectorTaskResult(), results); - } - - /** - * @param taskRes Task result. - * @param results Results. - * @return Topology rebalance metrics collector task result. - */ - protected VisorCacheRebalanceCollectorTaskResult reduce( - VisorCacheRebalanceCollectorTaskResult taskRes, - List results - ) { - for (ComputeJobResult res : results) { - VisorCacheRebalanceCollectorJobResult jobRes = res.getData(); - - if (jobRes != null) { - if (res.getException() == null) - taskRes.getRebalance().put(res.getNode().id(), jobRes.getRebalance()); - - taskRes.getBaseline().put(res.getNode().id(), jobRes.getBaseline()); - } - } - - return taskRes; - } - - /** - * Job that collects rebalance metrics. - */ - private static class VisorCacheRebalanceCollectorJob - extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorCacheRebalanceCollectorJob(VisorCacheRebalanceCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorCacheRebalanceCollectorJobResult run(VisorCacheRebalanceCollectorTaskArg arg) { - VisorCacheRebalanceCollectorJobResult res = new VisorCacheRebalanceCollectorJobResult(); - - long start0 = U.currentTimeMillis(); - - try { - int partitions = 0; - double total = 0; - double ready = 0; - - GridCacheProcessor cacheProc = ignite.context().cache(); - - boolean rebalanceInProgress = false; - - for (CacheGroupContext grp: cacheProc.cacheGroups()) { - String cacheName = grp.config().getName(); - - if (isProxyCache(ignite, cacheName) || isRestartingCache(ignite, cacheName)) - continue; - - try { - GridCacheAdapter ca = cacheProc.internalCache(cacheName); - - if (ca == null || !ca.context().started()) - continue; - - CacheMetrics cm = ca.localMetrics(); - - partitions += cm.getTotalPartitionsCount(); - - long keysTotal = cm.getEstimatedRebalancingKeys(); - long keysReady = cm.getRebalancedKeys(); - - if (keysReady >= keysTotal) - keysReady = Math.max(keysTotal - 1, 0); - - total += keysTotal; - ready += keysReady; - - if (cm.getRebalancingPartitionsCount() > 0) - rebalanceInProgress = true; - } - catch (IllegalStateException | IllegalArgumentException e) { - if (debug && ignite.log() != null) - ignite.log().error("Ignored cache group: " + grp.cacheOrGroupName(), e); - } - } - - if (partitions == 0) - res.setRebalance(NOTHING_TO_REBALANCE); - else if (total == 0 && rebalanceInProgress) - res.setRebalance(MINIMAL_REBALANCE); - else - res.setRebalance(total > 0 && rebalanceInProgress ? Math.max(ready / total, MINIMAL_REBALANCE) : REBALANCE_COMPLETE); - } - catch (Exception e) { - res.setRebalance(REBALANCE_NOT_AVAILABLE); - - ignite.log().error("Failed to collect rebalance metrics", e); - } - - if (GridCacheUtils.isPersistenceEnabled(ignite.configuration())) { - IgniteClusterEx cluster = ignite.cluster(); - - Object consistentId = ignite.localNode().consistentId(); - - Collection baseline = cluster.currentBaselineTopology(); - - if (baseline != null) { - boolean inBaseline = baseline.stream().anyMatch(n -> consistentId.equals(n.consistentId())); - - res.setBaseline(inBaseline ? NODE_IN_BASELINE : NODE_NOT_IN_BASELINE); - } - else - res.setBaseline(BASELINE_NOT_AVAILABLE); - } - else - res.setBaseline(BASELINE_NOT_AVAILABLE); - - if (debug) - log(ignite.log(), "Collected rebalance metrics", getClass(), start0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheRebalanceCollectorJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java deleted file mode 100644 index d97fd50192572..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java +++ /dev/null @@ -1,54 +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.node; - -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.visor.VisorDataTransferObject; - -/** - * Argument for {@link VisorCacheRebalanceCollectorTask} task. - */ -public class VisorCacheRebalanceCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Default constructor. - */ - public VisorCacheRebalanceCollectorTaskArg() { - // No-op. - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - // No-op. - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - // No-op. - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheRebalanceCollectorTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java deleted file mode 100644 index 1305cd2df87eb..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java +++ /dev/null @@ -1,92 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.internal.dto.IgniteDataTransferObject; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; - -/** - * Result object for {@link VisorCacheRebalanceCollectorTask} task. - */ -public class VisorCacheRebalanceCollectorTaskResult extends IgniteDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Rebalance state on nodes. */ - private Map rebalance = new HashMap<>(); - - /** Nodes baseline status. */ - private Map baseline = new HashMap<>(); - - /** - * Default constructor. - */ - public VisorCacheRebalanceCollectorTaskResult() { - // No-op. - } - - /** - * @return Rebalance on nodes. - */ - public Map getRebalance() { - return rebalance; - } - - /** - * @return Baseline. - */ - public Map getBaseline() { - return baseline; - } - - /** - * Add specified results. - * - * @param res Results to add. - */ - public void add(VisorCacheRebalanceCollectorTaskResult res) { - assert res != null; - - rebalance.putAll(res.getRebalance()); - baseline.putAll(res.getBaseline()); - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, rebalance); - U.writeMap(out, baseline); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - rebalance = U.readMap(in); - baseline = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheRebalanceCollectorTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorClientConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorClientConnectorConfiguration.java deleted file mode 100644 index 22704ab1fd071..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorClientConnectorConfiguration.java +++ /dev/null @@ -1,281 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.ClientConnectorConfiguration; -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.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for client connector configuration. - */ -public class VisorClientConnectorConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Host. */ - private String host; - - /** Port. */ - private int port; - - /** Port range. */ - private int portRange; - - /** Max number of opened cursors per connection. */ - private int maxOpenCursorsPerConn; - - /** Socket send buffer size. */ - private int sockSndBufSize; - - /** Socket receive buffer size. */ - private int sockRcvBufSize; - - /** TCP no delay. */ - private boolean tcpNoDelay; - - /** Thread pool size. */ - private int threadPoolSize; - - /** Idle timeout. */ - private long idleTimeout; - - /** JDBC connections enabled flag. */ - private boolean jdbcEnabled; - - /** ODBC connections enabled flag. */ - private boolean odbcEnabled; - - /** JDBC connections enabled flag. */ - private boolean thinCliEnabled; - - /** SSL enable flag, default is disabled. */ - private boolean sslEnabled; - - /** If to use SSL context factory from Ignite configuration. */ - private boolean useIgniteSslCtxFactory; - - /** SSL need client auth flag. */ - private boolean sslClientAuth; - - /** SSL connection factory class name. */ - private String sslCtxFactory; - - /** - * Default constructor. - */ - public VisorClientConnectorConfiguration() { - // No-op. - } - - /** - * Create data transfer object for Sql connector configuration. - * - * @param cfg Sql connector configuration. - */ - public VisorClientConnectorConfiguration(ClientConnectorConfiguration cfg) { - host = cfg.getHost(); - port = cfg.getPort(); - portRange = cfg.getPortRange(); - maxOpenCursorsPerConn = cfg.getMaxOpenCursorsPerConnection(); - sockSndBufSize = cfg.getSocketSendBufferSize(); - sockRcvBufSize = cfg.getSocketReceiveBufferSize(); - tcpNoDelay = cfg.isTcpNoDelay(); - threadPoolSize = cfg.getThreadPoolSize(); - idleTimeout = cfg.getIdleTimeout(); - jdbcEnabled = cfg.isJdbcEnabled(); - odbcEnabled = cfg.isOdbcEnabled(); - thinCliEnabled = cfg.isThinClientEnabled(); - sslEnabled = cfg.isSslEnabled(); - useIgniteSslCtxFactory = cfg.isUseIgniteSslContextFactory(); - sslClientAuth = cfg.isSslClientAuth(); - sslCtxFactory = compactClass(cfg.getSslContextFactory()); - } - - /** - * @return Host. - */ - @Nullable public String getHost() { - return host; - } - - /** - * @return Port. - */ - public int getPort() { - return port; - } - - /** - * @return Port range. - */ - public int getPortRange() { - return portRange; - } - - /** - * @return Maximum number of opened cursors. - */ - public int getMaxOpenCursorsPerConnection() { - return maxOpenCursorsPerConn; - } - - /** - * @return Socket send buffer size in bytes. - */ - public int getSocketSendBufferSize() { - return sockSndBufSize; - } - - /** - * @return Socket receive buffer size in bytes. - */ - public int getSocketReceiveBufferSize() { - return sockRcvBufSize; - } - - /** - * @return TCP NO_DELAY flag. - */ - public boolean isTcpNoDelay() { - return tcpNoDelay; - } - - /** - * @return Thread pool that is in charge of processing SQL requests. - */ - public int getThreadPoolSize() { - return threadPoolSize; - } - - /** - * @return Idle timeout. - */ - public long getIdleTimeout() { - return idleTimeout; - } - - /** - * @return JDBC connections enabled flag. - */ - public boolean isJdbcEnabled() { - return jdbcEnabled; - } - - /** - * @return ODBC connections enabled flag. - */ - public boolean isOdbcEnabled() { - return odbcEnabled; - } - - /** - * @return JDBC connections enabled flag. - */ - public boolean isThinClientEnabled() { - return thinCliEnabled; - } - - /** - * @return SSL enable flag, default is disabled. - */ - public boolean isSslEnabled() { - return sslEnabled; - } - - /** - * @return If to use SSL context factory from Ignite configuration. - */ - public boolean isUseIgniteSslContextFactory() { - return useIgniteSslCtxFactory; - } - - /** - * @return SSL need client auth flag. - */ - public boolean isSslClientAuth() { - return sslClientAuth; - } - - /** - * @return SSL connection factory. - */ - public String getSslContextFactory() { - return sslCtxFactory; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V2; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, host); - out.writeInt(port); - out.writeInt(portRange); - out.writeInt(maxOpenCursorsPerConn); - out.writeInt(sockSndBufSize); - out.writeInt(sockRcvBufSize); - out.writeBoolean(tcpNoDelay); - out.writeInt(threadPoolSize); - out.writeLong(idleTimeout); - out.writeBoolean(jdbcEnabled); - out.writeBoolean(odbcEnabled); - out.writeBoolean(thinCliEnabled); - out.writeBoolean(sslEnabled); - out.writeBoolean(useIgniteSslCtxFactory); - out.writeBoolean(sslClientAuth); - U.writeString(out, sslCtxFactory); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - host = U.readString(in); - port = in.readInt(); - portRange = in.readInt(); - maxOpenCursorsPerConn = in.readInt(); - sockSndBufSize = in.readInt(); - sockRcvBufSize = in.readInt(); - tcpNoDelay = in.readBoolean(); - threadPoolSize = in.readInt(); - - if (protoVer > V1) { - idleTimeout = in.readLong(); - jdbcEnabled = in.readBoolean(); - odbcEnabled = in.readBoolean(); - thinCliEnabled = in.readBoolean(); - sslEnabled = in.readBoolean(); - useIgniteSslCtxFactory = in.readBoolean(); - sslClientAuth = in.readBoolean(); - sslCtxFactory = U.readString(in); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorClientConnectorConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java deleted file mode 100644 index 179e7894fc0b8..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java +++ /dev/null @@ -1,238 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.List; -import org.apache.ignite.configuration.DataPageEvictionMode; -import org.apache.ignite.configuration.DataRegionConfiguration; -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; - -/** - * Data transfer object for data region configuration. - */ -public class VisorDataRegionConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Unique name of DataRegion. */ - private String name; - - /** Initial memory region size defined by this memory policy. */ - private long initSize; - - /** Maximum memory region size defined by this memory policy. */ - private long maxSize; - - /** Path for memory mapped file. */ - private String swapPath; - - /** An algorithm for memory pages eviction. */ - private DataPageEvictionMode pageEvictionMode; - - /** A threshold for memory pages eviction initiation. */ - private double evictionThreshold; - - /** Minimum number of empty pages in reuse lists. */ - private int emptyPagesPoolSize; - - /** Enable memory metrics collection for this data region. */ - private boolean metricsEnabled; - - /** Number of sub-intervals. */ - private int metricsSubIntervalCount; - - /** Time interval over which allocation rate is calculated. */ - private long metricsRateTimeInterval; - - /** Enable Ignite Native Persistence. */ - private boolean persistenceEnabled; - - /** Temporary buffer size for checkpoints in bytes. */ - private long checkpointPageBufSize; - - /** - * Default constructor. - */ - public VisorDataRegionConfiguration() { - // No-op. - } - - /** - * Constructor. - * - * @param plc Data region configuration. - */ - public VisorDataRegionConfiguration(DataRegionConfiguration plc) { - assert plc != null; - - name = plc.getName(); - initSize = plc.getInitialSize(); - maxSize = plc.getMaxSize(); - swapPath = plc.getSwapPath(); - pageEvictionMode = plc.getPageEvictionMode(); - evictionThreshold = plc.getEvictionThreshold(); - emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); - metricsEnabled = plc.isMetricsEnabled(); - metricsSubIntervalCount = plc.getMetricsSubIntervalCount(); - metricsRateTimeInterval = plc.getMetricsRateTimeInterval(); - persistenceEnabled = plc.isPersistenceEnabled(); - checkpointPageBufSize = plc.getCheckpointPageBufferSize(); - } - - /** - * @param regCfgs Array of data region configurations. - * @return Collection of DTO objects. - */ - public static List from(DataRegionConfiguration[] regCfgs) { - List res = new ArrayList<>(); - - if (regCfgs != null) { - for (DataRegionConfiguration plc: regCfgs) - res.add(new VisorDataRegionConfiguration(plc)); - } - - return res; - } - - /** - * @return Unique name of DataRegion. - */ - public String getName() { - return name; - } - - /** - * @return Maximum memory region size defined by this memory policy. - */ - public long getMaxSize() { - return maxSize; - } - - /** - * @return Initial memory region size defined by this memory policy. - */ - public long getInitialSize() { - return initSize; - } - - /** - * @return Path for memory mapped file. - */ - public String getSwapPath() { - return swapPath; - } - - /** - * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default. - */ - public DataPageEvictionMode getPageEvictionMode() { - return pageEvictionMode; - } - - /** - * @return Memory pages eviction threshold. - */ - public double getEvictionThreshold() { - return evictionThreshold; - } - - /** - * @return Minimum number of empty pages in reuse list. - */ - public int getEmptyPagesPoolSize() { - return emptyPagesPoolSize; - } - - /** - * @return Metrics enabled flag. - */ - public boolean isMetricsEnabled() { - return metricsEnabled; - } - - /** - * @return Number of sub intervals. - */ - public int getMetricsSubIntervalCount() { - return metricsSubIntervalCount; - } - - /** - * @return Time interval over which allocation rate is calculated. - */ - public long getMetricsRateTimeInterval() { - return metricsRateTimeInterval; - } - - /** - * @return Persistence enabled flag. - */ - public boolean isPersistenceEnabled() { - return persistenceEnabled; - } - - /** - * @return Amount of memory allocated for a checkpoint temporary buffer in bytes. - */ - public long getCheckpointPageBufferSize() { - return checkpointPageBufSize; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeLong(initSize); - out.writeLong(maxSize); - U.writeString(out, swapPath); - U.writeEnum(out, pageEvictionMode); - out.writeDouble(evictionThreshold); - out.writeInt(emptyPagesPoolSize); - out.writeBoolean(metricsEnabled); - out.writeInt(metricsSubIntervalCount); - out.writeLong(metricsRateTimeInterval); - out.writeBoolean(persistenceEnabled); - out.writeLong(checkpointPageBufSize); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - initSize = in.readLong(); - maxSize = in.readLong(); - swapPath = U.readString(in); - pageEvictionMode = DataPageEvictionMode.fromOrdinal(in.readByte()); - evictionThreshold = in.readDouble(); - emptyPagesPoolSize = in.readInt(); - metricsEnabled = in.readBoolean(); - metricsSubIntervalCount = in.readInt(); - metricsRateTimeInterval = in.readLong(); - persistenceEnabled = in.readBoolean(); - checkpointPageBufSize = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorDataRegionConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java deleted file mode 100644 index dbb941a763af1..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java +++ /dev/null @@ -1,478 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import org.apache.ignite.configuration.CheckpointWriteOrder; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.WALMode; -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 static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for data store configuration. - */ -public class VisorDataStorageConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Size of a memory chunk reserved for system cache initially. */ - private long sysRegionInitSize; - - /** Size of memory for system cache. */ - private long sysRegionMaxSize; - - /** Page size. */ - private int pageSize; - - /** Concurrency level. */ - private int concLvl; - - /** Configuration of default data region. */ - private VisorDataRegionConfiguration dfltDataRegCfg; - - /** Memory policies. */ - private List dataRegCfgs; - - /** */ - private String storagePath; - - /** Checkpointing frequency. */ - private long checkpointFreq; - - /** Lock wait time. */ - private long lockWaitTime; - - /** */ - private int checkpointThreads; - - /** Checkpoint write order. */ - private CheckpointWriteOrder checkpointWriteOrder; - - /** */ - private int walHistSize; - - /** Number of work WAL segments. */ - private int walSegments; - - /** Number of WAL segments to keep. */ - private int walSegmentSize; - - /** WAL persistence path. */ - private String walPath; - - /** WAL archive path. */ - private String walArchivePath; - - /** Wal mode. */ - private WALMode walMode; - - /** WAl thread local buffer size. */ - private int walTlbSize; - - /** Wal flush frequency. */ - private long walFlushFreq; - - /** Wal fsync delay in nanoseconds. */ - private long walFsyncDelay; - - /** Wal record iterator buffer size. */ - private int walRecordIterBuffSize; - - /** Always write full pages. */ - private boolean alwaysWriteFullPages; - - /** Factory to provide I/O interface for files */ - private String fileIOFactory; - - /** Number of sub-intervals. */ - private int metricsSubIntervalCount; - - /** Time interval (in milliseconds) for rate-based metrics. */ - private long metricsRateTimeInterval; - - /** Time interval of inactivity (in milliseconds) for running auto archiving for incompletely WAL segment. */ - private long walAutoArchiveAfterInactivity; - - /** Time interval (in milliseconds) for running auto archiving for incompletely WAL segment. */ - private long walForceArchiveTimeout; - - /** If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled. */ - private boolean writeThrottlingEnabled; - - /** Size of WAL buffer. */ - private int walBufSize; - - /** If true, system filters and compresses WAL archive in background. */ - private boolean walCompactionEnabled; - - /** - * Default constructor. - */ - public VisorDataStorageConfiguration() { - // No-op. - } - - /** - * Constructor. - * - * @param cfg Data storage configuration. - */ - public VisorDataStorageConfiguration(DataStorageConfiguration cfg) { - assert cfg != null; - - sysRegionInitSize = cfg.getSystemDataRegionConfiguration().getInitialSize(); - sysRegionMaxSize = cfg.getSystemDataRegionConfiguration().getMaxSize(); - pageSize = cfg.getPageSize(); - concLvl = cfg.getConcurrencyLevel(); - - DataRegionConfiguration dfltRegion = cfg.getDefaultDataRegionConfiguration(); - - if (dfltRegion != null) - dfltDataRegCfg = new VisorDataRegionConfiguration(dfltRegion); - - dataRegCfgs = VisorDataRegionConfiguration.from(cfg.getDataRegionConfigurations()); - - storagePath = cfg.getStoragePath(); - checkpointFreq = cfg.getCheckpointFrequency(); - lockWaitTime = cfg.getLockWaitTime(); - checkpointThreads = cfg.getCheckpointThreads(); - checkpointWriteOrder = cfg.getCheckpointWriteOrder(); - walHistSize = cfg.getWalHistorySize(); - walSegments = cfg.getWalSegments(); - walSegmentSize = cfg.getWalSegmentSize(); - walPath = cfg.getWalPath(); - walArchivePath = cfg.getWalArchivePath(); - walMode = cfg.getWalMode(); - walTlbSize = cfg.getWalThreadLocalBufferSize(); - walBufSize = cfg.getWalBufferSize(); - walFlushFreq = cfg.getWalFlushFrequency(); - walFsyncDelay = cfg.getWalFsyncDelayNanos(); - walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize(); - alwaysWriteFullPages = cfg.isAlwaysWriteFullPages(); - fileIOFactory = compactClass(cfg.getFileIOFactory()); - metricsSubIntervalCount = cfg.getMetricsSubIntervalCount(); - metricsRateTimeInterval = cfg.getMetricsRateTimeInterval(); - walAutoArchiveAfterInactivity = cfg.getWalAutoArchiveAfterInactivity(); - walForceArchiveTimeout = cfg.getWalForceArchiveTimeout(); - writeThrottlingEnabled = cfg.isWriteThrottlingEnabled(); - walCompactionEnabled = cfg.isWalCompactionEnabled(); - } - - /** - * @return Initial size in bytes. - */ - public long getSystemRegionInitialSize() { - return sysRegionInitSize; - } - - /** - * @return Maximum in bytes. - */ - public long getSystemRegionMaxSize() { - return sysRegionMaxSize; - } - - /** - * @return Page size in bytes. - */ - public int getPageSize() { - return pageSize; - } - - /** - * @return Mapping table concurrency level. - */ - public int getConcurrencyLevel() { - return concLvl; - } - - /** - * @return Configuration of default data region. - */ - public VisorDataRegionConfiguration getDefaultDataRegionConfiguration() { - return dfltDataRegCfg; - } - - /** - * @return Array of configured data regions. - */ - public List getDataRegionConfigurations() { - return dataRegCfgs; - } - - /** - * @return Path the root directory where the Persistent Store will persist data and indexes. - */ - public String getStoragePath() { - return storagePath; - } - - /** - * @return Checkpointing frequency in milliseconds. - */ - public long getCheckpointFrequency() { - return checkpointFreq; - } - - /** - * @return Number of checkpointing threads. - */ - public int getCheckpointThreads() { - return checkpointThreads; - } - - /** - * @return Checkpoint write order. - */ - public CheckpointWriteOrder getCheckpointWriteOrder() { - return checkpointWriteOrder; - } - - /** - * @return Time for wait. - */ - public long getLockWaitTime() { - return lockWaitTime; - } - - /** - * @return Number of WAL segments to keep after a checkpoint is finished. - */ - public int getWalHistorySize() { - return walHistSize; - } - - /** - * @return Number of work WAL segments. - */ - public int getWalSegments() { - return walSegments; - } - - /** - * @return WAL segment size. - */ - public int getWalSegmentSize() { - return walSegmentSize; - } - - /** - * @return WAL persistence path, absolute or relative to Ignite work directory. - */ - public String getWalPath() { - return walPath; - } - - /** - * @return WAL archive directory. - */ - public String getWalArchivePath() { - return walArchivePath; - } - - /** - * @return Time interval in milliseconds. - */ - public long getMetricsRateTimeInterval() { - return metricsRateTimeInterval; - } - - /** - * @return The number of sub-intervals for history tracking. - */ - public int getMetricsSubIntervalCount() { - return metricsSubIntervalCount; - } - - /** - * @return WAL mode. - */ - public WALMode getWalMode() { - return walMode; - } - - /** - * @return Thread local buffer size. - */ - public int getWalThreadLocalBufferSize() { - return walTlbSize; - } - - /** - * @return Flush frequency. - */ - public long getWalFlushFrequency() { - return walFlushFreq; - } - - /** - * @return Gets the fsync delay, in nanoseconds. - */ - public long getWalFsyncDelayNanos() { - return walFsyncDelay; - } - - /** - * @return Record iterator buffer size. - */ - public int getWalRecordIteratorBufferSize() { - return walRecordIterBuffSize; - } - - /** - * @return Flag indicating whether full pages should be always written. - */ - public boolean isAlwaysWriteFullPages() { - return alwaysWriteFullPages; - } - - /** - * @return File I/O factory class name. - */ - public String getFileIOFactory() { - return fileIOFactory; - } - - /** - * @return Time in millis. - */ - public long getWalAutoArchiveAfterInactivity() { - return walAutoArchiveAfterInactivity; - } - - /** - * @return Time in millis. - */ - public long getWalForceArchiveTimeout() { - return walForceArchiveTimeout; - } - - /** - * @return Flag indicating whether write throttling is enabled. - */ - public boolean isWriteThrottlingEnabled() { - return writeThrottlingEnabled; - } - - /** - * @return Size of WAL buffer. - */ - public int getWalBufferSize() { - return walBufSize; - } - - /** - * @return If true, system filters and compresses WAL archive in background - */ - public boolean isWalCompactionEnabled() { - return walCompactionEnabled; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V2; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(sysRegionInitSize); - out.writeLong(sysRegionMaxSize); - out.writeInt(pageSize); - out.writeInt(concLvl); - out.writeObject(dfltDataRegCfg); - U.writeCollection(out, dataRegCfgs); - U.writeString(out, storagePath); - out.writeLong(checkpointFreq); - out.writeLong(lockWaitTime); - out.writeLong(0); // Write stub for removed checkpointPageBufSize. - out.writeInt(checkpointThreads); - U.writeEnum(out, checkpointWriteOrder); - out.writeInt(walHistSize); - out.writeInt(walSegments); - out.writeInt(walSegmentSize); - U.writeString(out, walPath); - U.writeString(out, walArchivePath); - U.writeEnum(out, walMode); - out.writeInt(walTlbSize); - out.writeLong(walFlushFreq); - out.writeLong(walFsyncDelay); - out.writeInt(walRecordIterBuffSize); - out.writeBoolean(alwaysWriteFullPages); - U.writeString(out, fileIOFactory); - out.writeInt(metricsSubIntervalCount); - out.writeLong(metricsRateTimeInterval); - out.writeLong(walAutoArchiveAfterInactivity); - out.writeBoolean(writeThrottlingEnabled); - out.writeInt(walBufSize); - out.writeBoolean(walCompactionEnabled); - out.writeLong(walForceArchiveTimeout); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - sysRegionInitSize = in.readLong(); - sysRegionMaxSize = in.readLong(); - pageSize = in.readInt(); - concLvl = in.readInt(); - dfltDataRegCfg = (VisorDataRegionConfiguration)in.readObject(); - dataRegCfgs = U.readList(in); - storagePath = U.readString(in); - checkpointFreq = in.readLong(); - lockWaitTime = in.readLong(); - in.readLong(); // Read stub for removed checkpointPageBufSize. - checkpointThreads = in.readInt(); - checkpointWriteOrder = CheckpointWriteOrder.fromOrdinal(in.readByte()); - walHistSize = in.readInt(); - walSegments = in.readInt(); - walSegmentSize = in.readInt(); - walPath = U.readString(in); - walArchivePath = U.readString(in); - walMode = WALMode.fromOrdinal(in.readByte()); - walTlbSize = in.readInt(); - walFlushFreq = in.readLong(); - walFsyncDelay = in.readLong(); - walRecordIterBuffSize = in.readInt(); - alwaysWriteFullPages = in.readBoolean(); - fileIOFactory = U.readString(in); - metricsSubIntervalCount = in.readInt(); - metricsRateTimeInterval = in.readLong(); - walAutoArchiveAfterInactivity = in.readLong(); - writeThrottlingEnabled = in.readBoolean(); - - if (protoVer > V1) { - walBufSize = in.readInt(); - walCompactionEnabled = in.readBoolean(); - } - - if (protoVer >= V5) - walForceArchiveTimeout = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorDataStorageConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorConfiguration.java deleted file mode 100644 index 82eaf0b937ebb..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorConfiguration.java +++ /dev/null @@ -1,108 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.List; -import org.apache.ignite.configuration.ExecutorConfiguration; -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.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for configuration of executor data structures. - */ -public class VisorExecutorConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Thread pool name. */ - private String name; - - /** Thread pool size. */ - private int size; - - /** - * Construct data transfer object for Executor configurations properties. - * - * @param cfgs Executor configurations. - * @return Executor configurations properties. - */ - public static List list(ExecutorConfiguration[] cfgs) { - List res = new ArrayList<>(); - - if (!F.isEmpty(cfgs)) { - for (ExecutorConfiguration cfg : cfgs) - res.add(new VisorExecutorConfiguration(cfg)); - } - - return res; - } - - /** - * Default constructor. - */ - public VisorExecutorConfiguration() { - // No-op. - } - - /** - * Create data transfer object for executor configuration. - * - * @param src Executor configuration. - */ - public VisorExecutorConfiguration(ExecutorConfiguration src) { - name = src.getName(); - size = src.getSize(); - } - - /** - * @return Executor name. - */ - public String getName() { - return name; - } - - /** - * @return Thread pool size. - */ - public int getSize() { - return size; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeInt(size); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - size = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorExecutorConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java deleted file mode 100644 index 8fa023f6ba7a1..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java +++ /dev/null @@ -1,269 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import org.apache.ignite.configuration.ClientConnectorConfiguration; -import org.apache.ignite.configuration.ConnectorConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -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; - -/** - * Data transfer object for node executors configuration properties. - */ -public class VisorExecutorServiceConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Public pool size. */ - private int pubPoolSize; - - /** System pool size. */ - private int sysPoolSz; - - /** Management pool size. */ - private int mgmtPoolSize; - - /** IGFS pool size. */ - private int igfsPoolSize; - - /** Peer-to-peer pool size. */ - private int p2pPoolSz; - - /** Rebalance thread pool size. */ - private int rebalanceThreadPoolSize; - - /** REST requests pool size. */ - private int restPoolSz; - - /** Async Callback pool size. */ - private int cbPoolSize; - - /** Data stream pool size. */ - private int dataStreamerPoolSize; - - /** Query pool size. */ - private int qryPoolSize; - - /** Use striped pool for internal requests processing when possible */ - private int stripedPoolSize; - - /** Service pool size. */ - private int svcPoolSize; - - /** Utility cache pool size. */ - private int utilityCachePoolSize; - - /** Client connector configuration pool size. */ - private int cliConnCfgPoolSize; - - /** List of executor configurations. */ - private List executors; - - /** - * Default constructor. - */ - public VisorExecutorServiceConfiguration() { - // No-op. - } - - /** - * Create data transfer object for node executors configuration properties. - * - * @param c Grid configuration. - */ - public VisorExecutorServiceConfiguration(IgniteConfiguration c) { - pubPoolSize = c.getPublicThreadPoolSize(); - sysPoolSz = c.getSystemThreadPoolSize(); - mgmtPoolSize = c.getManagementThreadPoolSize(); - p2pPoolSz = c.getPeerClassLoadingThreadPoolSize(); - rebalanceThreadPoolSize = c.getRebalanceThreadPoolSize(); - - ConnectorConfiguration cc = c.getConnectorConfiguration(); - - if (cc != null) - restPoolSz = cc.getThreadPoolSize(); - - cbPoolSize = c.getAsyncCallbackPoolSize(); - dataStreamerPoolSize = c.getDataStreamerThreadPoolSize(); - qryPoolSize = c.getQueryThreadPoolSize(); - stripedPoolSize = c.getStripedPoolSize(); - svcPoolSize = c.getServiceThreadPoolSize(); - utilityCachePoolSize = c.getUtilityCacheThreadPoolSize(); - - ClientConnectorConfiguration scc = c.getClientConnectorConfiguration(); - - if (scc != null) - cliConnCfgPoolSize = scc.getThreadPoolSize(); - - executors = VisorExecutorConfiguration.list(c.getExecutorConfiguration()); - } - - /** - * @return Public pool size. - */ - public int getPublicThreadPoolSize() { - return pubPoolSize; - } - - /** - * @return System pool size. - */ - public int getSystemThreadPoolSize() { - return sysPoolSz; - } - - /** - * @return Management pool size. - */ - public int getManagementThreadPoolSize() { - return mgmtPoolSize; - } - - /** - * @return IGFS pool size. - */ - public int getIgfsThreadPoolSize() { - return igfsPoolSize; - } - - /** - * @return Peer-to-peer pool size. - */ - public int getPeerClassLoadingThreadPoolSize() { - return p2pPoolSz; - } - - /** - * @return Rebalance thread pool size. - */ - public int getRebalanceThreadPoolSize() { - return rebalanceThreadPoolSize; - } - - /** - * @return REST requests pool size. - */ - public int getRestThreadPoolSize() { - return restPoolSz; - } - - /** - * @return Thread pool size to be used for processing of asynchronous callbacks. - */ - public int getCallbackPoolSize() { - return cbPoolSize; - } - - /** - * @return Thread pool size to be used for data stream messages. - */ - public int getDataStreamerPoolSize() { - return dataStreamerPoolSize; - } - - /** - * @return Thread pool size to be used in grid for query messages. - */ - public int getQueryThreadPoolSize() { - return qryPoolSize; - } - - /** - * @return The number of threads (stripes) to be used for requests processing. - */ - public int getStripedPoolSize() { - return stripedPoolSize; - } - - /** - * @return Thread pool size to be used in grid to process service proxy invocations. - */ - public int getServiceThreadPoolSize() { - return svcPoolSize; - } - - /** - * @return Thread pool size to be used in grid for utility cache messages. - */ - public int getUtilityCacheThreadPoolSize() { - return utilityCachePoolSize; - } - - /** - * @return Thread pool that is in charge of processing ODBC tasks. - */ - public int getClientConnectorConfigurationThreadPoolSize() { - return cliConnCfgPoolSize; - } - - /** - * @return List of executor configurations. - */ - public List getExecutors() { - return executors; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeInt(pubPoolSize); - out.writeInt(sysPoolSz); - out.writeInt(mgmtPoolSize); - out.writeInt(igfsPoolSize); - out.writeInt(p2pPoolSz); - out.writeInt(rebalanceThreadPoolSize); - out.writeInt(restPoolSz); - out.writeInt(cbPoolSize); - out.writeInt(dataStreamerPoolSize); - out.writeInt(qryPoolSize); - out.writeInt(stripedPoolSize); - out.writeInt(svcPoolSize); - out.writeInt(utilityCachePoolSize); - out.writeInt(cliConnCfgPoolSize); - U.writeCollection(out, executors); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - pubPoolSize = in.readInt(); - sysPoolSz = in.readInt(); - mgmtPoolSize = in.readInt(); - igfsPoolSize = in.readInt(); - p2pPoolSz = in.readInt(); - rebalanceThreadPoolSize = in.readInt(); - restPoolSz = in.readInt(); - cbPoolSize = in.readInt(); - dataStreamerPoolSize = in.readInt(); - qryPoolSize = in.readInt(); - stripedPoolSize = in.readInt(); - svcPoolSize = in.readInt(); - utilityCachePoolSize = in.readInt(); - cliConnCfgPoolSize = in.readInt(); - executors = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorExecutorServiceConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java deleted file mode 100644 index 17997aa57345d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java +++ /dev/null @@ -1,470 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.configuration.BinaryConfiguration; -import org.apache.ignite.configuration.ClientConnectorConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -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 static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for node configuration data. - */ -public class VisorGridConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Basic. */ - private VisorBasicConfiguration basic; - - /** Metrics. */ - private VisorMetricsConfiguration metrics; - - /** SPIs. */ - private VisorSpisConfiguration spis; - - /** P2P. */ - private VisorPeerToPeerConfiguration p2p; - - /** Lifecycle. */ - private VisorLifecycleConfiguration lifecycle; - - /** Executors service configuration. */ - private VisorExecutorServiceConfiguration execSvc; - - /** Segmentation. */ - private VisorSegmentationConfiguration seg; - - /** Include properties. */ - private String inclProps; - - /** Include events types. */ - private int[] inclEvtTypes; - - /** REST configuration. */ - private VisorRestConfiguration rest; - - /** User attributes. */ - private Map userAttrs; - - /** IGFSs. */ - private List igfss; - - /** Environment. */ - private Map env; - - /** System properties. */ - private Properties sysProps; - - /** Configuration of atomic data structures. */ - private VisorAtomicConfiguration atomic; - - /** Transactions configuration. */ - private VisorTransactionConfiguration txCfg; - - /** Memory configuration. */ - private VisorMemoryConfiguration memCfg; - - /** Persistence configuration. */ - private VisorPersistentStoreConfiguration psCfg; - - /** Cache store session listeners. */ - private String storeSesLsnrs; - - /** Warmup closure. Will be invoked before actual grid start. */ - private String warmupClos; - - /** Binary configuration. */ - private VisorBinaryConfiguration binaryCfg; - - /** List of cache key configurations. */ - private List cacheKeyCfgs; - - /** Hadoop configuration. */ - private VisorHadoopConfiguration hadoopCfg; - - /** SQL connector configuration. */ - private VisorSqlConnectorConfiguration sqlConnCfg; - - /** List of service configurations. */ - private List srvcCfgs; - - /** Configuration of data storage. */ - private VisorDataStorageConfiguration dataStorage; - - /** Client connector configuration */ - private VisorClientConnectorConfiguration clnConnCfg; - - /** MVCC configuration. */ - private VisorMvccConfiguration mvccCfg; - - /** - * Default constructor. - */ - public VisorGridConfiguration() { - // No-op. - } - - /** - * Create data transfer object with node configuration data. - * - * @param ignite Grid. - */ - public VisorGridConfiguration(IgniteEx ignite) { - assert ignite != null; - - IgniteConfiguration c = ignite.configuration(); - - basic = new VisorBasicConfiguration(ignite, c); - metrics = new VisorMetricsConfiguration(c); - spis = new VisorSpisConfiguration(c); - p2p = new VisorPeerToPeerConfiguration(c); - lifecycle = new VisorLifecycleConfiguration(c); - execSvc = new VisorExecutorServiceConfiguration(c); - seg = new VisorSegmentationConfiguration(c); - inclProps = compactArray(c.getIncludeProperties()); - inclEvtTypes = c.getIncludeEventTypes(); - rest = new VisorRestConfiguration(c); - userAttrs = c.getUserAttributes(); - env = new HashMap<>(System.getenv()); - sysProps = IgniteSystemProperties.snapshot(); - atomic = new VisorAtomicConfiguration(c.getAtomicConfiguration()); - txCfg = new VisorTransactionConfiguration(c.getTransactionConfiguration()); - - if (c.getDataStorageConfiguration() != null) - memCfg = null; - - if (c.getDataStorageConfiguration() != null) - psCfg = null; - - storeSesLsnrs = compactArray(c.getCacheStoreSessionListenerFactories()); - warmupClos = compactClass(c.getWarmupClosure()); - - BinaryConfiguration bc = c.getBinaryConfiguration(); - - if (bc != null) - binaryCfg = new VisorBinaryConfiguration(bc); - - cacheKeyCfgs = VisorCacheKeyConfiguration.list(c.getCacheKeyConfiguration()); - - ClientConnectorConfiguration ccc = c.getClientConnectorConfiguration(); - - if (ccc != null) - clnConnCfg = new VisorClientConnectorConfiguration(ccc); - - srvcCfgs = VisorServiceConfiguration.list(c.getServiceConfiguration()); - - DataStorageConfiguration dsCfg = c.getDataStorageConfiguration(); - - if (dsCfg != null) - dataStorage = new VisorDataStorageConfiguration(dsCfg); - - mvccCfg = new VisorMvccConfiguration(c); - } - - /** - * @return Basic. - */ - public VisorBasicConfiguration getBasic() { - return basic; - } - - /** - * @return Metrics. - */ - public VisorMetricsConfiguration getMetrics() { - return metrics; - } - - /** - * @return SPIs. - */ - public VisorSpisConfiguration getSpis() { - return spis; - } - - /** - * @return P2P. - */ - public VisorPeerToPeerConfiguration getP2p() { - return p2p; - } - - /** - * @return Lifecycle. - */ - public VisorLifecycleConfiguration getLifecycle() { - return lifecycle; - } - - /** - * @return Executors service configuration. - */ - public VisorExecutorServiceConfiguration getExecutorService() { - return execSvc; - } - - /** - * @return Segmentation. - */ - public VisorSegmentationConfiguration getSegmentation() { - return seg; - } - - /** - * @return Include properties. - */ - public String getIncludeProperties() { - return inclProps; - } - - /** - * @return Include events types. - */ - public int[] getIncludeEventTypes() { - return inclEvtTypes; - } - - /** - * @return Rest. - */ - public VisorRestConfiguration getRest() { - return rest; - } - - /** - * @return User attributes. - */ - public Map getUserAttributes() { - return userAttrs; - } - - /** - * @return Igfss. - */ - public List getIgfss() { - return igfss; - } - - /** - * @return Environment. - */ - public Map getEnv() { - return env; - } - - /** - * @return System properties. - */ - public Properties getSystemProperties() { - return sysProps; - } - - /** - * @return Configuration of atomic data structures. - */ - public VisorAtomicConfiguration getAtomic() { - return atomic; - } - - /** - * @return Transactions configuration. - */ - public VisorTransactionConfiguration getTransaction() { - return txCfg; - } - - /** - * @return Memory configuration. - */ - public VisorMemoryConfiguration getMemoryConfiguration() { - return memCfg; - } - - /** - * @return Persistent store configuration. - */ - public VisorPersistentStoreConfiguration getPersistentStoreConfiguration() { - return psCfg; - } - - /** - * @return Cache store session listener factories. - */ - public String getCacheStoreSessionListenerFactories() { - return storeSesLsnrs; - } - - /** - * @return Warmup closure to execute. - */ - public String getWarmupClosure() { - return warmupClos; - } - - /** - * @return Binary configuration. - */ - public VisorBinaryConfiguration getBinaryConfiguration() { - return binaryCfg; - } - - /** - * @return List of cache key configurations. - */ - public List getCacheKeyConfigurations() { - return cacheKeyCfgs; - } - - /** - * @return Hadoop configuration. - */ - public VisorHadoopConfiguration getHadoopConfiguration() { - return hadoopCfg; - } - - /** - * @return SQL connector configuration. - */ - public VisorSqlConnectorConfiguration getSqlConnectorConfiguration() { - return sqlConnCfg; - } - - /** - * @return Client connector configuration. - */ - public VisorClientConnectorConfiguration getClientConnectorConfiguration() { - return clnConnCfg; - } - - /** - * @return List of service configurations - */ - public List getServiceConfigurations() { - return srvcCfgs; - } - - /** - * @return Configuration of data storage. - */ - public VisorDataStorageConfiguration getDataStorageConfiguration() { - return dataStorage; - } - - /** - * @return MVCC configuration. - */ - public VisorMvccConfiguration getMvccConfiguration() { - return mvccCfg; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V5; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeObject(basic); - out.writeObject(metrics); - out.writeObject(spis); - out.writeObject(p2p); - out.writeObject(lifecycle); - out.writeObject(execSvc); - out.writeObject(seg); - U.writeString(out, inclProps); - out.writeObject(inclEvtTypes); - out.writeObject(rest); - U.writeMap(out, userAttrs); - U.writeCollection(out, null); - U.writeMap(out, env); - out.writeObject(sysProps); - out.writeObject(atomic); - out.writeObject(txCfg); - out.writeObject(memCfg); - out.writeObject(psCfg); - U.writeString(out, storeSesLsnrs); - U.writeString(out, warmupClos); - out.writeObject(binaryCfg); - U.writeCollection(out, cacheKeyCfgs); - out.writeObject(null); - out.writeObject(sqlConnCfg); - U.writeCollection(out, srvcCfgs); - out.writeObject(dataStorage); - out.writeObject(clnConnCfg); - out.writeObject(mvccCfg); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - basic = (VisorBasicConfiguration)in.readObject(); - metrics = (VisorMetricsConfiguration)in.readObject(); - spis = (VisorSpisConfiguration)in.readObject(); - p2p = (VisorPeerToPeerConfiguration)in.readObject(); - lifecycle = (VisorLifecycleConfiguration)in.readObject(); - execSvc = (VisorExecutorServiceConfiguration)in.readObject(); - seg = (VisorSegmentationConfiguration)in.readObject(); - inclProps = U.readString(in); - inclEvtTypes = (int[])in.readObject(); - rest = (VisorRestConfiguration)in.readObject(); - userAttrs = U.readMap(in); - igfss = U.readList(in); - env = U.readMap(in); - sysProps = (Properties)in.readObject(); - atomic = (VisorAtomicConfiguration)in.readObject(); - txCfg = (VisorTransactionConfiguration)in.readObject(); - memCfg = (VisorMemoryConfiguration)in.readObject(); - psCfg = (VisorPersistentStoreConfiguration)in.readObject(); - storeSesLsnrs = U.readString(in); - warmupClos = U.readString(in); - binaryCfg = (VisorBinaryConfiguration)in.readObject(); - cacheKeyCfgs = U.readList(in); - hadoopCfg = (VisorHadoopConfiguration)in.readObject(); - sqlConnCfg = (VisorSqlConnectorConfiguration)in.readObject(); - srvcCfgs = U.readList(in); - - if (protoVer > V1) - dataStorage = (VisorDataStorageConfiguration)in.readObject(); - - if (protoVer > V2) - clnConnCfg = (VisorClientConnectorConfiguration)in.readObject(); - - if (protoVer > V3) - mvccCfg = (VisorMvccConfiguration)in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorGridConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorHadoopConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorHadoopConfiguration.java deleted file mode 100644 index 4d4a97863a413..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorHadoopConfiguration.java +++ /dev/null @@ -1,127 +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.node; - -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; -import org.jetbrains.annotations.Nullable; - -/** - * Data transfer object for configuration of hadoop data structures. - */ -public class VisorHadoopConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Map reduce planner. */ - private String planner; - - /** */ - private boolean extExecution; - - /** Finished job info TTL. */ - private long finishedJobInfoTtl; - - /** */ - private int maxParallelTasks; - - /** */ - private int maxTaskQueueSize; - - /** Library names. */ - private List libNames; - - /** - * Default constructor. - */ - public VisorHadoopConfiguration() { - // No-op. - } - - /** - * @return Max number of local tasks that may be executed in parallel. - */ - public int getMaxParallelTasks() { - return maxParallelTasks; - } - - /** - * @return Max task queue size. - */ - public int getMaxTaskQueueSize() { - return maxTaskQueueSize; - } - - /** - * @return Finished job info time-to-live. - */ - public long getFinishedJobInfoTtl() { - return finishedJobInfoTtl; - } - - /** - * @return {@code True} if external execution. - */ - public boolean isExternalExecution() { - return extExecution; - } - - /** - * @return Map-reduce planner. - */ - public String getMapReducePlanner() { - return planner; - } - - /** - * @return Native library names. - */ - @Nullable public List getNativeLibraryNames() { - return libNames; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, planner); - out.writeBoolean(extExecution); - out.writeLong(finishedJobInfoTtl); - out.writeInt(maxParallelTasks); - out.writeInt(maxTaskQueueSize); - U.writeCollection(out, libNames); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - planner = U.readString(in); - extExecution = in.readBoolean(); - finishedJobInfoTtl = in.readLong(); - maxParallelTasks = in.readInt(); - maxTaskQueueSize = in.readInt(); - libNames = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorHadoopConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java deleted file mode 100644 index 7da280b14f8e6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java +++ /dev/null @@ -1,320 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Map; -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.internal.visor.igfs.VisorIgfsMode; -import org.jetbrains.annotations.Nullable; - -/** - * Data transfer object for IGFS configuration properties. - */ -public class VisorIgfsConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** IGFS instance name. */ - private String name; - - /** Cache name to store IGFS meta information. */ - private String metaCacheName; - - /** Cache name to store IGFS data. */ - private String dataCacheName; - - /** File's data block size. */ - private int blockSize; - - /** Number of pre-fetched blocks if specific file's chunk is requested. */ - private int prefetchBlocks; - - /** Read/write buffer size for IGFS stream operations in bytes. */ - private int streamBufSize; - - /** Number of file blocks buffered on local node before sending batch to remote node. */ - private int perNodeBatchSize; - - /** Number of batches that can be concurrently sent to remote node. */ - private int perNodeParallelBatchCnt; - - /** IGFS instance mode. */ - private VisorIgfsMode dfltMode; - - /** Map of paths to IGFS modes. */ - private Map pathModes; - - /** Maximum range length. */ - private long maxTaskRangeLen; - - /** Fragmentizer concurrent files. */ - private int fragmentizerConcurrentFiles; - - /** Fragmentizer enabled flag. */ - private boolean fragmentizerEnabled; - - /** Fragmentizer throttling block length. */ - private long fragmentizerThrottlingBlockLen; - - /** Fragmentizer throttling delay. */ - private long fragmentizerThrottlingDelay; - - /** IPC endpoint config (in JSON format) to publish IGFS over. */ - private String ipcEndpointCfg; - - /** IPC endpoint enabled flag. */ - private boolean ipcEndpointEnabled; - - /** Management port. */ - private int mgmtPort; - - /** Amount of sequential block reads before prefetch is triggered. */ - private int seqReadsBeforePrefetch; - - /** Metadata co-location flag. */ - private boolean colocateMeta; - - /** Relaxed consistency flag. */ - private boolean relaxedConsistency; - - /** Update file length on flush flag. */ - private boolean updateFileLenOnFlush; - - /** - * Default constructor. - */ - public VisorIgfsConfiguration() { - // No-op. - } - - /** - * @return IGFS instance name. - */ - @Nullable public String getName() { - return name; - } - - /** - * @return Cache name to store IGFS meta information. - */ - @Nullable public String getMetaCacheName() { - return metaCacheName; - } - - /** - * @return Cache name to store IGFS data. - */ - @Nullable public String getDataCacheName() { - return dataCacheName; - } - - /** - * @return File's data block size. - */ - public int getBlockSize() { - return blockSize; - } - - /** - * @return Number of pre-fetched blocks if specific file's chunk is requested. - */ - public int getPrefetchBlocks() { - return prefetchBlocks; - } - - /** - * @return Read/write buffer size for IGFS stream operations in bytes. - */ - public int getStreamBufferSize() { - return streamBufSize; - } - - /** - * @return Number of file blocks buffered on local node before sending batch to remote node. - */ - public int getPerNodeBatchSize() { - return perNodeBatchSize; - } - - /** - * @return Number of batches that can be concurrently sent to remote node. - */ - public int getPerNodeParallelBatchCount() { - return perNodeParallelBatchCnt; - } - - /** - * @return IGFS instance mode. - */ - public VisorIgfsMode getDefaultMode() { - return dfltMode; - } - - /** - * @return Map of paths to IGFS modes. - */ - @Nullable public Map getPathModes() { - return pathModes; - } - - /** - * @return Maximum range length. - */ - public long getMaxTaskRangeLength() { - return maxTaskRangeLen; - } - - /** - * @return Fragmentizer concurrent files. - */ - public int getFragmentizerConcurrentFiles() { - return fragmentizerConcurrentFiles; - } - - /** - * @return Fragmentizer enabled flag. - */ - public boolean isFragmentizerEnabled() { - return fragmentizerEnabled; - } - - /** - * @return Fragmentizer throttling block length. - */ - public long getFragmentizerThrottlingBlockLength() { - return fragmentizerThrottlingBlockLen; - } - - /** - * @return Fragmentizer throttling delay. - */ - public long getFragmentizerThrottlingDelay() { - return fragmentizerThrottlingDelay; - } - - /** - * @return IPC endpoint config to publish IGFS over. - */ - @Nullable public String getIpcEndpointConfiguration() { - return ipcEndpointCfg; - } - - /** - * @return IPC endpoint enabled flag. - */ - public boolean isIpcEndpointEnabled() { - return ipcEndpointEnabled; - } - - /** - * @return Management port. - */ - public int getManagementPort() { - return mgmtPort; - } - - /** - * @return Amount of sequential block reads before prefetch is triggered. - */ - public int getSequenceReadsBeforePrefetch() { - return seqReadsBeforePrefetch; - } - - /** - * @return {@code True} if metadata co-location is enabled. - */ - public boolean isColocateMetadata() { - return colocateMeta; - } - - /** - * @return {@code True} if relaxed consistency is enabled. - */ - public boolean isRelaxedConsistency() { - return relaxedConsistency; - } - - /** - * @return Whether to update file length on flush. - */ - public boolean isUpdateFileLengthOnFlush() { - return updateFileLenOnFlush; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - U.writeString(out, metaCacheName); - U.writeString(out, dataCacheName); - out.writeInt(blockSize); - out.writeInt(prefetchBlocks); - out.writeInt(streamBufSize); - out.writeInt(perNodeBatchSize); - out.writeInt(perNodeParallelBatchCnt); - U.writeEnum(out, dfltMode); - U.writeMap(out, pathModes); - out.writeLong(maxTaskRangeLen); - out.writeInt(fragmentizerConcurrentFiles); - out.writeBoolean(fragmentizerEnabled); - out.writeLong(fragmentizerThrottlingBlockLen); - out.writeLong(fragmentizerThrottlingDelay); - U.writeString(out, ipcEndpointCfg); - out.writeBoolean(ipcEndpointEnabled); - out.writeInt(mgmtPort); - out.writeInt(seqReadsBeforePrefetch); - out.writeBoolean(colocateMeta); - out.writeBoolean(relaxedConsistency); - out.writeBoolean(updateFileLenOnFlush); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - metaCacheName = U.readString(in); - dataCacheName = U.readString(in); - blockSize = in.readInt(); - prefetchBlocks = in.readInt(); - streamBufSize = in.readInt(); - perNodeBatchSize = in.readInt(); - perNodeParallelBatchCnt = in.readInt(); - dfltMode = VisorIgfsMode.fromOrdinal(in.readByte()); - pathModes = U.readMap(in); - maxTaskRangeLen = in.readLong(); - fragmentizerConcurrentFiles = in.readInt(); - fragmentizerEnabled = in.readBoolean(); - fragmentizerThrottlingBlockLen = in.readLong(); - fragmentizerThrottlingDelay = in.readLong(); - ipcEndpointCfg = U.readString(in); - ipcEndpointEnabled = in.readBoolean(); - mgmtPort = in.readInt(); - seqReadsBeforePrefetch = in.readInt(); - colocateMeta = in.readBoolean(); - relaxedConsistency = in.readBoolean(); - updateFileLenOnFlush = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIgfsConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java deleted file mode 100644 index 6aa3c6947c2c6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java +++ /dev/null @@ -1,78 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.IgniteConfiguration; -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.visor.util.VisorTaskUtils.compactArray; - -/** - * Data transfer object for node lifecycle configuration properties. - */ -public class VisorLifecycleConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Lifecycle beans. */ - private String beans; - - /** - * Default constructor. - */ - public VisorLifecycleConfiguration() { - // No-op. - } - - /** - * Create data transfer object for node lifecycle configuration properties. - * - * @param c Grid configuration. - */ - public VisorLifecycleConfiguration(IgniteConfiguration c) { - beans = compactArray(c.getLifecycleBeans()); - } - - /** - * @return Lifecycle beans. - */ - @Nullable public String getBeans() { - return beans; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, beans); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - beans = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorLifecycleConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java deleted file mode 100644 index 18835a24e28b2..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java +++ /dev/null @@ -1,167 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.List; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -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.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for memory configuration. - */ -public class VisorMemoryConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Size of a memory chunk reserved for system cache initially. */ - private long sysCacheInitSize; - - /** Size of memory for system cache. */ - private long sysCacheMaxSize; - - /** Page size. */ - private int pageSize; - - /** Concurrency level. */ - private int concLvl; - - /** Name of DataRegion to be used as default. */ - private String dfltMemPlcName; - - /** Size of memory (in bytes) to use for default DataRegion. */ - private long dfltMemPlcSize; - - /** Memory policies. */ - private List memPlcs; - - /** - * Default constructor. - */ - public VisorMemoryConfiguration() { - // No-op. - } - - /** - * Create data transfer object. - * - * @param memCfg Memory configuration. - */ - public VisorMemoryConfiguration(DataStorageConfiguration memCfg) { - assert memCfg != null; - - sysCacheInitSize = memCfg.getSystemDataRegionConfiguration().getInitialSize(); - sysCacheMaxSize = memCfg.getSystemDataRegionConfiguration().getMaxSize(); - pageSize = memCfg.getPageSize(); - concLvl = memCfg.getConcurrencyLevel(); -// dfltMemPlcName = memCfg.getDefaultDataRegionName(); - //dfltMemPlcSize = memCfg.getDefaultDataRegionSize(); - - DataRegionConfiguration[] plcs = memCfg.getDataRegionConfigurations(); - - if (!F.isEmpty(plcs)) { - memPlcs = new ArrayList<>(plcs.length); - - for (DataRegionConfiguration plc : plcs) - memPlcs.add(new VisorMemoryPolicyConfiguration(plc)); - } - } - - /** - * @return Concurrency level. - */ - public int getConcurrencyLevel() { - return concLvl; - } - - /** - * @return Initial size of a memory region reserved for system cache. - */ - public long getSystemCacheInitialSize() { - return sysCacheInitSize; - } - - /** - * @return Maximum memory region size reserved for system cache. - */ - public long getSystemCacheMaxSize() { - return sysCacheMaxSize; - } - - /** - * @return Page size. - */ - public int getPageSize() { - return pageSize; - } - - /** - * @return Name of DataRegion to be used as default. - */ - public String getDefaultMemoryPolicyName() { - return dfltMemPlcName; - } - - /** - * @return Default memory policy size. - */ - public long getDefaultMemoryPolicySize() { - return dfltMemPlcSize; - } - - /** - * @return Collection of DataRegionConfiguration objects. - */ - public List getMemoryPolicies() { - return memPlcs; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(sysCacheInitSize); - out.writeLong(sysCacheMaxSize); - out.writeInt(pageSize); - out.writeInt(concLvl); - U.writeString(out, dfltMemPlcName); - out.writeLong(dfltMemPlcSize); - U.writeCollection(out, memPlcs); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - sysCacheInitSize = in.readLong(); - sysCacheMaxSize = in.readLong(); - pageSize = in.readInt(); - concLvl = in.readInt(); - dfltMemPlcName = U.readString(in); - dfltMemPlcSize = in.readLong(); - memPlcs = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorMemoryConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java deleted file mode 100644 index 92159a811db69..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java +++ /dev/null @@ -1,159 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.DataPageEvictionMode; -import org.apache.ignite.configuration.DataRegionConfiguration; -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; - -/** - * Data transfer object for memory configuration. - */ -public class VisorMemoryPolicyConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Unique name of DataRegion. */ - private String name; - - /** Maximum memory region size defined by this memory policy. */ - private long maxSize; - - /** Initial memory region size defined by this memory policy. */ - private long initSize; - - /** Path for memory mapped file. */ - private String swapFilePath; - - /** An algorithm for memory pages eviction. */ - private DataPageEvictionMode pageEvictionMode; - - /** - * A threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page - * memory will start the eviction only after 90% memory region (defined by this policy) is occupied. - */ - private double evictionThreshold; - - /** Minimum number of empty pages in reuse lists. */ - private int emptyPagesPoolSize; - - /** - * Default constructor. - */ - public VisorMemoryPolicyConfiguration() { - // No-op. - } - - /** - * Constructor. - * - * @param plc Memory policy configuration. - */ - public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) { - assert plc != null; - - name = plc.getName(); - maxSize = plc.getMaxSize(); - initSize = plc.getInitialSize(); - swapFilePath = plc.getSwapPath(); - pageEvictionMode = plc.getPageEvictionMode(); - evictionThreshold = plc.getEvictionThreshold(); - emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); - } - - /** - * Unique name of DataRegion. - */ - public String getName() { - return name; - } - - /** - * Maximum memory region size defined by this memory policy. - */ - public long getMaxSize() { - return maxSize; - } - - /** - * Initial memory region size defined by this memory policy. - */ - public long getInitialSize() { - return initSize; - } - - /** - * @return Path for memory mapped file. - */ - public String getSwapFilePath() { - return swapFilePath; - } - - /** - * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default. - */ - public DataPageEvictionMode getPageEvictionMode() { - return pageEvictionMode; - } - - /** - * @return Memory pages eviction threshold. - */ - public double getEvictionThreshold() { - return evictionThreshold; - } - - /** - * @return Minimum number of empty pages in reuse list. - */ - public int getEmptyPagesPoolSize() { - return emptyPagesPoolSize; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - out.writeLong(initSize); - out.writeLong(maxSize); - U.writeString(out, swapFilePath); - U.writeEnum(out, pageEvictionMode); - out.writeDouble(evictionThreshold); - out.writeInt(emptyPagesPoolSize); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - initSize = in.readLong(); - maxSize = in.readLong(); - swapFilePath = U.readString(in); - pageEvictionMode = DataPageEvictionMode.fromOrdinal(in.readByte()); - evictionThreshold = in.readDouble(); - emptyPagesPoolSize = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorMemoryPolicyConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java deleted file mode 100644 index 4ce7b6ce61e0b..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java +++ /dev/null @@ -1,100 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for node metrics configuration properties. - */ -public class VisorMetricsConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Metrics expired time. */ - private long expTime; - - /** Number of node metrics stored in memory. */ - private int histSize; - - /** Frequency of metrics log printout. */ - private long logFreq; - - /** - * Default constructor. - */ - public VisorMetricsConfiguration() { - // No-op. - } - - /** - * Create transfer object for node metrics configuration properties. - * - * @param c Grid configuration. - */ - public VisorMetricsConfiguration(IgniteConfiguration c) { - expTime = c.getMetricsExpireTime(); - histSize = c.getMetricsHistorySize(); - logFreq = c.getMetricsLogFrequency(); - } - - /** - * @return Metrics expired time. - */ - public long getExpireTime() { - return expTime; - } - - /** - * @return Number of node metrics stored in memory. - */ - public int getHistorySize() { - return histSize; - } - - /** - * @return Frequency of metrics log printout. - */ - public long getLoggerFrequency() { - return logFreq; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(expTime); - out.writeInt(histSize); - out.writeLong(logFreq); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - expTime = in.readLong(); - histSize = in.readInt(); - logFreq = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorMetricsConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java deleted file mode 100644 index 1bcaa21507818..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMvccConfiguration.java +++ /dev/null @@ -1,94 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for data store configuration. - */ -public class VisorMvccConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Number of MVCC vacuum cleanup threads. */ - private int mvccVacuumThreadCnt; - - /** Time interval between vacuum runs */ - private long mvccVacuumFreq; - - /** - * Default constructor. - */ - public VisorMvccConfiguration() { - // No-op. - } - - /** - * Constructor. - * - * @param cfg Ignite configuration. - */ - public VisorMvccConfiguration(IgniteConfiguration cfg) { - assert cfg != null; - - mvccVacuumThreadCnt = cfg.getMvccVacuumThreadCount(); - mvccVacuumFreq = cfg.getMvccVacuumFrequency(); - } - - /** - * @return Number of MVCC vacuum threads. - */ - public int getMvccVacuumThreadCount() { - return mvccVacuumThreadCnt; - } - - /** - * @return Time interval between MVCC vacuum runs in milliseconds. - */ - public long getMvccVacuumFrequency() { - return mvccVacuumFreq; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V1; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeInt(mvccVacuumThreadCnt); - out.writeLong(mvccVacuumFreq); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - mvccVacuumThreadCnt = in.readInt(); - mvccVacuumFreq = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorMvccConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java deleted file mode 100644 index a273ca9364a12..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.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.node; - -import org.jetbrains.annotations.Nullable; - -/** - * Node baseline status. - */ -public enum VisorNodeBaselineStatus { - /** */ - NODE_IN_BASELINE, - - /** */ - NODE_NOT_IN_BASELINE, - - /** */ - BASELINE_NOT_AVAILABLE; - - /** Enumerated values. */ - private static final VisorNodeBaselineStatus[] 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 VisorNodeBaselineStatus fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java deleted file mode 100644 index 35b7ad3aaa62c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.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.node; - -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; - -/** - * Grid configuration data collect job. - */ -public class VisorNodeConfigurationCollectorJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Formal job argument. - * @param debug Debug flag. - */ - public VisorNodeConfigurationCollectorJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorGridConfiguration run(Void arg) { - return new VisorGridConfiguration(ignite); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeConfigurationCollectorJob.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorTask.java deleted file mode 100644 index 10e77f4caaffc..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorTask.java +++ /dev/null @@ -1,35 +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.node; - -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Grid configuration data collect task. - */ -@GridInternal -public class VisorNodeConfigurationCollectorTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodeConfigurationCollectorJob job(Void arg) { - return new VisorNodeConfigurationCollectorJob(arg, debug); - } -} 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 deleted file mode 100644 index 86ae5de2f7b6f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java +++ /dev/null @@ -1,289 +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.node; - -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentMap; -import org.apache.ignite.DataRegionMetrics; -import org.apache.ignite.cache.CacheMetrics; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.CacheGroupContext; -import org.apache.ignite.internal.processors.cache.GridCacheAdapter; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; -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.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.cache.VisorCache; -import org.apache.ignite.internal.visor.cache.VisorMemoryMetrics; -import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -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.MINIMAL_REBALANCE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.NOTHING_TO_REBALANCE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_COMPLETE; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_NOT_AVAILABLE; -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; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isProxyCache; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isRestartingCache; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log; - -/** - * Job that collects data from node. - */ -public class VisorNodeDataCollectorJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - public VisorNodeDataCollectorJob(VisorNodeDataCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** - * Collect events. - * - * @param res Job result. - * @param evtOrderKey Unique key to take last order key from node local map. - * @param evtThrottleCntrKey Unique key to take throttle count from node local map. - * @param all If {@code true} then collect all events otherwise collect only non task events. - */ - protected void events0(VisorNodeDataCollectorJobResult res, String evtOrderKey, String evtThrottleCntrKey, - final boolean all) { - res.getEvents().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all, EVT_MAPPER)); - } - - /** - * Collect events. - * - * @param res Job result. - * @param arg Task argument. - */ - protected void events(VisorNodeDataCollectorJobResult res, VisorNodeDataCollectorTaskArg arg) { - try { - // Visor events explicitly enabled in configuration. - if (checkExplicitTaskMonitoring(ignite)) - res.setTaskMonitoringEnabled(true); - else { - // Get current task monitoring state. - res.setTaskMonitoringEnabled(arg.isTaskMonitoringEnabled()); - - if (arg.isTaskMonitoringEnabled()) { - ConcurrentMap storage = ignite.cluster().nodeLocalMap(); - - VisorComputeMonitoringHolder holder = storage.get(COMPUTE_MONITORING_HOLDER_KEY); - - if (holder == null) { - VisorComputeMonitoringHolder holderNew = new VisorComputeMonitoringHolder(); - - VisorComputeMonitoringHolder holderOld = storage.putIfAbsent(COMPUTE_MONITORING_HOLDER_KEY, holderNew); - - holder = holderOld == null ? holderNew : holderOld; - } - - // Enable task monitoring for new node in grid. - holder.startCollect(ignite, arg.getEventsOrderKey()); - - // Update current state after change (it may not changed in some cases). - res.setTaskMonitoringEnabled(ignite.allEventsUserRecordable(VISOR_TASK_EVTS)); - } - } - - events0(res, arg.getEventsOrderKey(), arg.getEventsThrottleCounterKey(), arg.isTaskMonitoringEnabled()); - } - catch (Exception e) { - res.setEventsEx(new VisorExceptionWrapper(e)); - } - } - - /** - * Collect memory metrics. - * - * @param res Job result. - */ - protected void memoryMetrics(VisorNodeDataCollectorJobResult res) { - try { - List memoryMetrics = res.getMemoryMetrics(); - - // TODO: Should be really fixed in IGNITE-7111. - if (ignite.cluster().active()) { - for (DataRegionMetrics m : ignite.dataRegionMetrics()) - memoryMetrics.add(new VisorMemoryMetrics(m)); - } - } - catch (Exception e) { - res.setMemoryMetricsEx(new VisorExceptionWrapper(e)); - } - } - - /** - * Collect caches. - * - * @param res Job result. - * @param arg Task argument. - */ - protected void caches(VisorNodeDataCollectorJobResult res, VisorNodeDataCollectorTaskArg arg) { - try { - IgniteConfiguration cfg = ignite.configuration(); - - GridCacheProcessor cacheProc = ignite.context().cache(); - - Set cacheGrps = arg.getCacheGroups(); - - boolean all = F.isEmpty(cacheGrps); - - int partitions = 0; - double total = 0; - double ready = 0; - - List resCaches = res.getCaches(); - - boolean rebalanceInProgress = false; - - for (CacheGroupContext grp : cacheProc.cacheGroups()) { - boolean first = true; - - for (GridCacheContext cache : grp.caches()) { - long start0 = U.currentTimeMillis(); - - String cacheName = cache.name(); - - try { - if (isProxyCache(ignite, cacheName) || isRestartingCache(ignite, cacheName)) - continue; - - GridCacheAdapter ca = cacheProc.internalCache(cacheName); - - if (ca == null || !ca.context().started()) - continue; - - if (first) { - CacheMetrics cm = ca.localMetrics(); - - partitions += cm.getTotalPartitionsCount(); - - long keysTotal = cm.getEstimatedRebalancingKeys(); - long keysReady = cm.getRebalancedKeys(); - - if (keysReady >= keysTotal) - keysReady = Math.max(keysTotal - 1, 0); - - total += keysTotal; - ready += keysReady; - - if (!rebalanceInProgress && cm.getRebalancingPartitionsCount() > 0) - rebalanceInProgress = true; - - first = false; - } - - boolean addToRes = arg.getSystemCaches() || !(isSystemCache(cacheName)); - - if (addToRes && (all || cacheGrps.contains(ca.configuration().getGroupName()))) - resCaches.add(new VisorCache(ignite, ca, arg.isCollectCacheMetrics())); - } - catch (IllegalStateException | IllegalArgumentException e) { - if (debug && ignite.log() != null) - ignite.log().error("Ignored cache: " + cacheName, e); - } - finally { - if (debug) - log(ignite.log(), "Collected cache: " + cacheName, getClass(), start0); - } - } - } - - if (partitions == 0) - res.setRebalance(NOTHING_TO_REBALANCE); - else if (total == 0 && rebalanceInProgress) - res.setRebalance(MINIMAL_REBALANCE); - else - res.setRebalance(total > 0 && rebalanceInProgress - ? Math.max(ready / total, MINIMAL_REBALANCE) - : REBALANCE_COMPLETE); - } - catch (Exception e) { - res.setRebalance(REBALANCE_NOT_AVAILABLE); - res.setCachesEx(new VisorExceptionWrapper(e)); - } - } - - /** {@inheritDoc} */ - @Override protected VisorNodeDataCollectorJobResult run(VisorNodeDataCollectorTaskArg arg) { - return run(new VisorNodeDataCollectorJobResult(), arg); - } - - /** - * Execution logic of concrete job. - * - * @param res Result response. - * @param arg Job argument. - * @return Job result. - */ - protected VisorNodeDataCollectorJobResult run(VisorNodeDataCollectorJobResult res, - VisorNodeDataCollectorTaskArg arg) { - res.setGridName(ignite.name()); - - GridCachePartitionExchangeManager exchange = ignite.context().cache().context().exchange(); - - res.setReadyAffinityVersion(new VisorAffinityTopologyVersion(exchange.readyAffinityVersion())); - res.setHasPendingExchange(exchange.hasPendingExchange()); - - res.setTopologyVersion(ignite.cluster().topologyVersion()); - - long start0 = U.currentTimeMillis(); - - events(res, arg); - - if (debug) - start0 = log(ignite.log(), "Collected events", getClass(), start0); - - memoryMetrics(res); - - if (debug) - start0 = log(ignite.log(), "Collected memory metrics", getClass(), start0); - - if (ignite.cluster().active()) - caches(res, arg); - - if (debug) - log(ignite.log(), "Collected caches", getClass(), start0); - - res.setErrorCount(ignite.context().exceptionRegistry().errorCount()); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeDataCollectorJob.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java deleted file mode 100644 index c6c01c2a9de64..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java +++ /dev/null @@ -1,335 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -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; -import org.apache.ignite.internal.visor.cache.VisorCache; -import org.apache.ignite.internal.visor.cache.VisorMemoryMetrics; -import org.apache.ignite.internal.visor.event.VisorGridEvent; -import org.apache.ignite.internal.visor.igfs.VisorIgfs; -import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -/** - * Data collector job result. - */ -public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Grid name. */ - private String gridName; - - /** Node topology version. */ - private long topVer; - - /** Task monitoring state collected from node. */ - private boolean taskMonitoringEnabled; - - /** Node events. */ - private List evts = new ArrayList<>(); - - /** Exception while collecting node events. */ - private VisorExceptionWrapper evtsEx; - - /** Node data region metrics. */ - private List memoryMetrics = new ArrayList<>(); - - /** Exception while collecting memory metrics. */ - private VisorExceptionWrapper memoryMetricsEx; - - /** Node caches. */ - private List caches = new ArrayList<>(); - - /** Exception while collecting node caches. */ - private VisorExceptionWrapper cachesEx; - - /** Node IGFSs. */ - private List igfss = new ArrayList<>(); - - /** All IGFS endpoints collected from nodes. */ - private List igfsEndpoints = new ArrayList<>(); - - /** Exception while collecting node IGFSs. */ - private VisorExceptionWrapper igfssEx; - - /** Errors count. */ - private long errCnt; - - /** Topology version of latest completed partition exchange. */ - private VisorAffinityTopologyVersion readyTopVer; - - /** Whether pending exchange future exists. */ - private boolean hasPendingExchange; - - /** Rebalance percent. */ - private double rebalance; - - /** - * Default constructor. - */ - public VisorNodeDataCollectorJobResult() { - // No-op. - } - - /** - * @return Grid name. - */ - public String getGridName() { - return gridName; - } - - /** - * @param gridName New grid name value. - */ - public void setGridName(String gridName) { - this.gridName = gridName; - } - - /** - * @return Current topology version. - */ - public long getTopologyVersion() { - return topVer; - } - - /** - * @param topVer New topology version value. - */ - public void setTopologyVersion(long topVer) { - this.topVer = topVer; - } - - /** - * @return Current task monitoring state. - */ - public boolean isTaskMonitoringEnabled() { - return taskMonitoringEnabled; - } - - /** - * @param taskMonitoringEnabled New value of task monitoring state. - */ - public void setTaskMonitoringEnabled(boolean taskMonitoringEnabled) { - this.taskMonitoringEnabled = taskMonitoringEnabled; - } - - /** - * @return Collection of collected events. - */ - public List getEvents() { - return evts; - } - - /** - * @return Exception caught during collecting events. - */ - public VisorExceptionWrapper getEventsEx() { - return evtsEx; - } - - /** - * @param evtsEx Exception caught during collecting events. - */ - public void setEventsEx(VisorExceptionWrapper evtsEx) { - this.evtsEx = evtsEx; - } - - /** - * @return Collected data region metrics. - */ - public List getMemoryMetrics() { - return memoryMetrics; - } - - /** - * @return Exception caught during collecting memory metrics. - */ - public VisorExceptionWrapper getMemoryMetricsEx() { - return memoryMetricsEx; - } - - /** - * @param memoryMetricsEx Exception caught during collecting memory metrics. - */ - public void setMemoryMetricsEx(VisorExceptionWrapper memoryMetricsEx) { - this.memoryMetricsEx = memoryMetricsEx; - } - - /** - * @return Collected cache metrics. - */ - public List getCaches() { - return caches; - } - - /** - * @return Exception caught during collecting caches metrics. - */ - public VisorExceptionWrapper getCachesEx() { - return cachesEx; - } - - /** - * @param cachesEx Exception caught during collecting caches metrics. - */ - public void setCachesEx(VisorExceptionWrapper cachesEx) { - this.cachesEx = cachesEx; - } - - /** - * @return Collected IGFSs metrics. - */ - public List getIgfss() { - return igfss; - } - - /** - * @return Collected IGFSs endpoints. - */ - public List getIgfsEndpoints() { - return igfsEndpoints; - } - - /** - * @return Exception caught during collecting IGFSs metrics. - */ - public VisorExceptionWrapper getIgfssEx() { - return igfssEx; - } - - /** - * @param igfssEx Exception caught during collecting IGFSs metrics. - */ - public void setIgfssEx(VisorExceptionWrapper igfssEx) { - this.igfssEx = igfssEx; - } - - /** - * @return Errors count. - */ - public long getErrorCount() { - return errCnt; - } - - /** - * @param errCnt Errors count. - */ - public void setErrorCount(long errCnt) { - this.errCnt = errCnt; - } - - /** - * @return Topology version of latest completed partition exchange. - */ - public VisorAffinityTopologyVersion getReadyAffinityVersion() { - return readyTopVer; - } - - /** - * @param readyTopVer Topology version of latest completed partition exchange. - */ - public void setReadyAffinityVersion(VisorAffinityTopologyVersion readyTopVer) { - this.readyTopVer = readyTopVer; - } - - /** - * @return Whether pending exchange future exists. - */ - public boolean isHasPendingExchange() { - return hasPendingExchange; - } - - /** - * @param hasPendingExchange Whether pending exchange future exists. - */ - public void setHasPendingExchange(boolean hasPendingExchange) { - this.hasPendingExchange = hasPendingExchange; - } - - /** - * @return Rebalance progress. - */ - public double getRebalance() { - return rebalance; - } - - /** - * @param rebalance Rebalance progress. - */ - public void setRebalance(double rebalance) { - this.rebalance = rebalance; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V2; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, gridName); - out.writeLong(topVer); - out.writeBoolean(taskMonitoringEnabled); - U.writeCollection(out, evts); - out.writeObject(evtsEx); - U.writeCollection(out, memoryMetrics); - out.writeObject(memoryMetricsEx); - U.writeCollection(out, caches); - out.writeObject(cachesEx); - U.writeCollection(out, igfss); - U.writeCollection(out, igfsEndpoints); - out.writeObject(igfssEx); - out.writeLong(errCnt); - out.writeObject(readyTopVer); - out.writeBoolean(hasPendingExchange); - out.writeDouble(rebalance); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - gridName = U.readString(in); - topVer = in.readLong(); - taskMonitoringEnabled = in.readBoolean(); - evts = U.readList(in); - evtsEx = (VisorExceptionWrapper)in.readObject(); - memoryMetrics = U.readList(in); - memoryMetricsEx = (VisorExceptionWrapper)in.readObject(); - caches = U.readList(in); - cachesEx = (VisorExceptionWrapper)in.readObject(); - igfss = U.readList(in); - igfsEndpoints = U.readList(in); - igfssEx = (VisorExceptionWrapper)in.readObject(); - errCnt = in.readLong(); - readyTopVer = (VisorAffinityTopologyVersion)in.readObject(); - hasPendingExchange = in.readBoolean(); - rebalance = (protoVer > V1) ? in.readDouble() : -1; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeDataCollectorJobResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java deleted file mode 100644 index 06d538434f3df..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java +++ /dev/null @@ -1,130 +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.node; - -import java.util.List; -import java.util.UUID; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cluster.ClusterGroupEmptyException; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; -import org.jetbrains.annotations.Nullable; - -/** - * Collects current Grid state mostly topology and metrics. - */ -@GridInternal -public class VisorNodeDataCollectorTask extends VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodeDataCollectorJob job(VisorNodeDataCollectorTaskArg arg) { - return new VisorNodeDataCollectorJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected VisorNodeDataCollectorTaskResult reduce0(List results) { - return reduce(new VisorNodeDataCollectorTaskResult(), results); - } - - /** - * @param taskRes Task result. - * @param results Results. - * @return Data collector task result. - */ - protected VisorNodeDataCollectorTaskResult reduce(VisorNodeDataCollectorTaskResult taskRes, - List results) { - for (ComputeJobResult res : results) { - VisorNodeDataCollectorJobResult jobRes = res.getData(); - - if (jobRes != null) { - UUID nid = res.getNode().id(); - - IgniteException unhandledEx = res.getException(); - - if (unhandledEx == null) - reduceJobResult(taskRes, jobRes, nid); - else { - // Ignore nodes that left topology. - if (!(unhandledEx instanceof ClusterGroupEmptyException)) - taskRes.getUnhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx)); - } - } - } - - taskRes.setActive(ignite.cluster().active()); - - return taskRes; - } - - /** - * Reduce job result. - * - * @param taskRes Task result. - * @param jobRes Job result. - * @param nid Node ID. - */ - protected void reduceJobResult(VisorNodeDataCollectorTaskResult taskRes, - VisorNodeDataCollectorJobResult jobRes, UUID nid) { - taskRes.getGridNames().put(nid, jobRes.getGridName()); - - taskRes.getTopologyVersions().put(nid, jobRes.getTopologyVersion()); - - taskRes.getTaskMonitoringEnabled().put(nid, jobRes.isTaskMonitoringEnabled()); - - taskRes.getErrorCounts().put(nid, jobRes.getErrorCount()); - - if (!F.isEmpty(jobRes.getEvents())) - taskRes.getEvents().addAll(jobRes.getEvents()); - - if (jobRes.getEventsEx() != null) - taskRes.getEventsEx().put(nid, jobRes.getEventsEx()); - - if (!F.isEmpty(jobRes.getMemoryMetrics())) - taskRes.getMemoryMetrics().put(nid, jobRes.getMemoryMetrics()); - - if (jobRes.getMemoryMetricsEx() != null) - taskRes.getMemoryMetricsEx().put(nid, jobRes.getMemoryMetricsEx()); - - if (!F.isEmpty(jobRes.getCaches())) - taskRes.getCaches().put(nid, jobRes.getCaches()); - - if (jobRes.getCachesEx() != null) - taskRes.getCachesEx().put(nid, jobRes.getCachesEx()); - - if (!F.isEmpty(jobRes.getIgfss())) - taskRes.getIgfss().put(nid, jobRes.getIgfss()); - - if (!F.isEmpty(jobRes.getIgfsEndpoints())) - taskRes.getIgfsEndpoints().put(nid, jobRes.getIgfsEndpoints()); - - if (jobRes.getIgfssEx() != null) - taskRes.getIgfssEx().put(nid, jobRes.getIgfssEx()); - - taskRes.getReadyAffinityVersions().put(nid, jobRes.getReadyAffinityVersion()); - - taskRes.getPendingExchanges().put(nid, jobRes.isHasPendingExchange()); - - taskRes.getRebalance().put(nid, jobRes.getRebalance()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java deleted file mode 100644 index 328527e4d135c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java +++ /dev/null @@ -1,238 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Set; - -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; - -/** - * Data collector task arguments. - */ -public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Whether task monitoring should be enabled. */ - private boolean taskMonitoringEnabled; - - /** Visor unique key to get last event order from node local storage. */ - private String evtOrderKey; - - /** Visor unique key to get lost events throttle counter from node local storage. */ - private String evtThrottleCntrKey; - - /** If {@code true} then collect information about system caches. */ - private boolean sysCaches; - - /** If {@code false} then cache metrics will not be collected. */ - private boolean collectCacheMetrics; - - /** Optional Set of cache groups, if provided, then caches only from that groups will be collected. */ - private Set cacheGrps; - - /** - * Default constructor. - */ - public VisorNodeDataCollectorTaskArg() { - // No-op. - } - - /** - * Create task arguments with given parameters. - * - * @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks. - * @param evtOrderKey Event order key, unique for Visor instance. - * @param evtThrottleCntrKey Event throttle counter key, unique for Visor instance. - * @param sysCaches If {@code true} then collect information about system caches. - * @param collectCacheMetrics If {@code false} then cache metrics will not be collected. - * @param cacheGrps Optional Set of cache groups, if provided, then caches only from that groups will be collected. - */ - public VisorNodeDataCollectorTaskArg( - boolean taskMonitoringEnabled, - String evtOrderKey, - String evtThrottleCntrKey, - boolean sysCaches, - boolean collectCacheMetrics, - Set cacheGrps - ) { - this.taskMonitoringEnabled = taskMonitoringEnabled; - this.evtOrderKey = evtOrderKey; - this.evtThrottleCntrKey = evtThrottleCntrKey; - this.sysCaches = sysCaches; - this.collectCacheMetrics = collectCacheMetrics; - this.cacheGrps = cacheGrps; - } - - /** - * Create task arguments with given parameters. - * - * @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks. - * @param evtOrderKey Event order key, unique for Visor instance. - * @param evtThrottleCntrKey Event throttle counter key, unique for Visor instance. - * @param sysCaches If {@code true} then collect information about system caches. - * @param collectCacheMetrics If {@code false} then cache metrics will not be collected. - */ - public VisorNodeDataCollectorTaskArg( - boolean taskMonitoringEnabled, - String evtOrderKey, - String evtThrottleCntrKey, - boolean sysCaches, - boolean collectCacheMetrics - ) { - this(taskMonitoringEnabled, evtOrderKey, evtThrottleCntrKey, sysCaches, collectCacheMetrics, null); - } - - /** - * Create task arguments with given parameters. - * - * @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks. - * @param evtOrderKey Event order key, unique for Visor instance. - * @param evtThrottleCntrKey Event throttle counter key, unique for Visor instance. - * @param sysCaches If {@code true} then collect information about system caches. - */ - public VisorNodeDataCollectorTaskArg( - boolean taskMonitoringEnabled, - String evtOrderKey, - String evtThrottleCntrKey, - boolean sysCaches - ) { - this(taskMonitoringEnabled, evtOrderKey, evtThrottleCntrKey, sysCaches, true, null); - } - - /** - * @return {@code true} if Visor should collect information about tasks. - */ - public boolean isTaskMonitoringEnabled() { - return taskMonitoringEnabled; - } - - /** - * @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks. - */ - public void setTaskMonitoringEnabled(boolean taskMonitoringEnabled) { - this.taskMonitoringEnabled = taskMonitoringEnabled; - } - - /** - * @return Key for store and read last event order number. - */ - public String getEventsOrderKey() { - return evtOrderKey; - } - - /** - * @param evtOrderKey Key for store and read last event order number. - */ - public void setEventsOrderKey(String evtOrderKey) { - this.evtOrderKey = evtOrderKey; - } - - /** - * @return Key for store and read events throttle counter. - */ - public String getEventsThrottleCounterKey() { - return evtThrottleCntrKey; - } - - /** - * @param evtThrottleCntrKey Key for store and read events throttle counter. - */ - public void setEventsThrottleCounterKey(String evtThrottleCntrKey) { - this.evtThrottleCntrKey = evtThrottleCntrKey; - } - - /** - * @return {@code true} if Visor should collect metrics for system caches. - */ - public boolean getSystemCaches() { - return sysCaches; - } - - /** - * @param sysCaches {@code true} if Visor should collect metrics for system caches. - */ - public void setSystemCaches(boolean sysCaches) { - this.sysCaches = sysCaches; - } - - /** - * @return If {@code false} then cache metrics will not be collected. - */ - public boolean isCollectCacheMetrics() { - return collectCacheMetrics; - } - - /** - * @param collectCacheMetrics If {@code false} then cache metrics will not be collected. - */ - public void setCollectCacheMetrics(boolean collectCacheMetrics) { - this.collectCacheMetrics = collectCacheMetrics; - } - - /** - * @return Optional cache group, if provided, then caches only from that group will be collected. - */ - public Set getCacheGroups() { - return cacheGrps; - } - - /** - * @param cacheGrps Optional Set of cache groups, if provided, then caches only from that groups will be collected. - */ - public void setCacheGroups(Set cacheGrps) { - this.cacheGrps = cacheGrps; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V3; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(taskMonitoringEnabled); - U.writeString(out, evtOrderKey); - U.writeString(out, evtThrottleCntrKey); - out.writeBoolean(sysCaches); - out.writeBoolean(collectCacheMetrics); - U.writeCollection(out, cacheGrps); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - taskMonitoringEnabled = in.readBoolean(); - evtOrderKey = U.readString(in); - evtThrottleCntrKey = U.readString(in); - sysCaches = in.readBoolean(); - - collectCacheMetrics = protoVer < V2 || in.readBoolean(); - - cacheGrps = protoVer < V3 ? null : U.readSet(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeDataCollectorTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java deleted file mode 100644 index 9b0c0a13ea113..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java +++ /dev/null @@ -1,346 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -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.internal.visor.cache.VisorCache; -import org.apache.ignite.internal.visor.cache.VisorMemoryMetrics; -import org.apache.ignite.internal.visor.event.VisorGridEvent; -import org.apache.ignite.internal.visor.igfs.VisorIgfs; -import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -/** - * Data collector task result. - */ -public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Grid active flag. */ - private boolean active; - - /** Unhandled exceptions from nodes. */ - private Map unhandledEx = new HashMap<>(); - - /** Nodes grid names. */ - private Map gridNames = new HashMap<>(); - - /** Nodes topology versions. */ - private Map topVersions = new HashMap<>(); - - /** All task monitoring state collected from nodes. */ - private Map taskMonitoringEnabled = new HashMap<>(); - - /** Nodes error counts. */ - private Map errCnts = new HashMap<>(); - - /** All events collected from nodes. */ - private List evts = new ArrayList<>(); - - /** Exceptions caught during collecting events from nodes. */ - private Map evtsEx = new HashMap<>(); - - /** All data region metrics collected from nodes. */ - private Map> memoryMetrics = new HashMap<>(); - - /** Exceptions caught during collecting memory metrics from nodes. */ - private Map memoryMetricsEx = new HashMap<>(); - - /** All caches collected from nodes. */ - private Map> caches = new HashMap<>(); - - /** Exceptions caught during collecting caches from nodes. */ - private Map cachesEx = new HashMap<>(); - - /** All IGFS collected from nodes. */ - private Map> igfss = new HashMap<>(); - - /** All IGFS endpoints collected from nodes. */ - private Map> igfsEndpoints = new HashMap<>(); - - /** Exceptions caught during collecting IGFS from nodes. */ - private Map igfssEx = new HashMap<>(); - - /** Topology version of latest completed partition exchange from nodes. */ - private Map readyTopVers = new HashMap<>(); - - /** Whether pending exchange future exists from nodes. */ - private Map pendingExchanges = new HashMap<>(); - - /** Rebalance state on nodes. */ - private Map rebalance = new HashMap<>(); - - /** - * Default constructor. - */ - public VisorNodeDataCollectorTaskResult() { - // No-op. - } - - /** - * @return {@code true} If no data was collected. - */ - public boolean isEmpty() { - return - gridNames.isEmpty() && - topVersions.isEmpty() && - unhandledEx.isEmpty() && - taskMonitoringEnabled.isEmpty() && - evts.isEmpty() && - evtsEx.isEmpty() && - memoryMetrics.isEmpty() && - memoryMetricsEx.isEmpty() && - caches.isEmpty() && - cachesEx.isEmpty() && - igfss.isEmpty() && - igfsEndpoints.isEmpty() && - igfssEx.isEmpty() && - readyTopVers.isEmpty() && - pendingExchanges.isEmpty() && - rebalance.isEmpty(); - } - - /** - * @return {@code True} if grid is active. - */ - public boolean isActive() { - return active; - } - - /** - * @param active active New value of grid active flag. - */ - public void setActive(boolean active) { - this.active = active; - } - - /** - * @return Unhandled exceptions from nodes. - */ - public Map getUnhandledEx() { - return unhandledEx; - } - - /** - * @return Nodes grid names. - */ - public Map getGridNames() { - return gridNames; - } - - /** - * @return Nodes topology versions. - */ - public Map getTopologyVersions() { - return topVersions; - } - - /** - * @return All task monitoring state collected from nodes. - */ - public Map getTaskMonitoringEnabled() { - return taskMonitoringEnabled; - } - - /** - * @return All events collected from nodes. - */ - public List getEvents() { - return evts; - } - - /** - * @return Exceptions caught during collecting events from nodes. - */ - public Map getEventsEx() { - return evtsEx; - } - - /** - * @return All data region metrics collected from nodes. - */ - public Map> getMemoryMetrics() { - return memoryMetrics; - } - - /** - * @return Exceptions caught during collecting memory metrics from nodes. - */ - public Map getMemoryMetricsEx() { - return memoryMetricsEx; - } - - /** - * @return All caches collected from nodes. - */ - public Map> getCaches() { - return caches; - } - - /** - * @return Exceptions caught during collecting caches from nodes. - */ - public Map getCachesEx() { - return cachesEx; - } - - /** - * @return All IGFS collected from nodes. - */ - public Map> getIgfss() { - return igfss; - } - - /** - * @return All IGFS endpoints collected from nodes. - */ - public Map> getIgfsEndpoints() { - return igfsEndpoints; - } - - /** - * @return Exceptions caught during collecting IGFS from nodes. - */ - public Map getIgfssEx() { - return igfssEx; - } - - /** - * @return Nodes error counts. - */ - public Map getErrorCounts() { - return errCnts; - } - - /** - * @return Topology version of latest completed partition exchange from nodes. - */ - public Map getReadyAffinityVersions() { - return readyTopVers; - } - - /** - * @return Whether pending exchange future exists from nodes. - */ - public Map getPendingExchanges() { - return pendingExchanges; - } - - /** - * @return Rebalance on nodes. - */ - public Map getRebalance() { - return rebalance; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V2; - } - - /** - * Add specified results. - * - * @param res Results to add. - */ - public void add(VisorNodeDataCollectorTaskResult res) { - assert res != null; - - active = active || res.isActive(); - unhandledEx.putAll(res.getUnhandledEx()); - gridNames.putAll(res.getGridNames()); - topVersions.putAll(res.getTopologyVersions()); - taskMonitoringEnabled.putAll(res.getTaskMonitoringEnabled()); - errCnts.putAll(res.getErrorCounts()); - evts.addAll(res.getEvents()); - evtsEx.putAll(res.getEventsEx()); - memoryMetrics.putAll(res.getMemoryMetrics()); - memoryMetricsEx.putAll(res.getMemoryMetricsEx()); - caches.putAll(res.getCaches()); - cachesEx.putAll(res.getCachesEx()); - igfss.putAll(res.getIgfss()); - igfsEndpoints.putAll(res.getIgfsEndpoints()); - igfssEx.putAll(res.getIgfssEx()); - readyTopVers.putAll(res.getReadyAffinityVersions()); - pendingExchanges.putAll(res.getPendingExchanges()); - rebalance.putAll(res.getRebalance()); - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(active); - U.writeMap(out, unhandledEx); - U.writeMap(out, gridNames); - U.writeMap(out, topVersions); - U.writeMap(out, taskMonitoringEnabled); - U.writeMap(out, errCnts); - U.writeCollection(out, evts); - U.writeMap(out, evtsEx); - U.writeMap(out, memoryMetrics); - U.writeMap(out, memoryMetricsEx); - U.writeMap(out, caches); - U.writeMap(out, cachesEx); - U.writeMap(out, igfss); - U.writeMap(out, igfsEndpoints); - U.writeMap(out, igfssEx); - U.writeMap(out, readyTopVers); - U.writeMap(out, pendingExchanges); - U.writeMap(out, rebalance); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - active = in.readBoolean(); - unhandledEx = U.readMap(in); - gridNames = U.readMap(in); - topVersions = U.readMap(in); - taskMonitoringEnabled = U.readMap(in); - errCnts = U.readMap(in); - evts = U.readList(in); - evtsEx = U.readMap(in); - memoryMetrics = U.readMap(in); - memoryMetricsEx = U.readMap(in); - caches = U.readMap(in); - cachesEx = U.readMap(in); - igfss = U.readMap(in); - igfsEndpoints = U.readMap(in); - igfssEx = U.readMap(in); - readyTopVers = U.readMap(in); - pendingExchanges = U.readMap(in); - - if (protoVer > V1) - rebalance = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeDataCollectorTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java deleted file mode 100644 index bb6c83ea37285..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java +++ /dev/null @@ -1,220 +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.node; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ConcurrentMap; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.events.DeploymentEvent; -import org.apache.ignite.events.Event; -import org.apache.ignite.events.JobEvent; -import org.apache.ignite.events.TaskEvent; -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.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.event.VisorGridEvent; -import org.apache.ignite.internal.visor.util.VisorEventMapper; -import org.apache.ignite.lang.IgniteClosure; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.lang.IgniteUuid; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.EVT_MAPPER; - -/** - * Task that runs on specified node and returns events data. - */ -@GridInternal -public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask, Collection> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodeEventsCollectorJob job(VisorNodeEventsCollectorTaskArg arg) { - return new VisorNodeEventsCollectorJob(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Iterable reduce0(List results) { - Collection allEvts = new ArrayList<>(); - - for (ComputeJobResult r : results) { - if (r.getException() == null) - allEvts.addAll((Collection)r.getData()); - } - - return allEvts.isEmpty() ? Collections.emptyList() : allEvts; - } - - /** - * Job for task returns events data. - */ - protected static class VisorNodeEventsCollectorJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - protected VisorNodeEventsCollectorJob(VisorNodeEventsCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** - * Tests whether or not this task has specified substring in its name. - * - * @param taskName Task name to check. - * @param taskClsName Task class name to check. - * @param s Substring to check. - */ - private boolean containsInTaskName(String taskName, String taskClsName, String s) { - assert taskName != null; - assert taskClsName != null; - - if (taskName.equals(taskClsName)) { - int idx = taskName.lastIndexOf('.'); - - return ((idx >= 0) ? taskName.substring(idx + 1) : taskName).toLowerCase().contains(s); - } - - return taskName.toLowerCase().contains(s); - } - - /** - * Filter events containing visor in it's name. - * - * @param e Event - * @param taskName Task name to filter of events. - * @return {@code true} if not contains {@code visor} in task name. - */ - private boolean filterByTaskName(Event e, String taskName) { - String compareTaskName = taskName.toLowerCase(); - - if (e.getClass().equals(TaskEvent.class)) { - TaskEvent te = (TaskEvent)e; - - return containsInTaskName(te.taskName(), te.taskClassName(), compareTaskName); - } - - if (e.getClass().equals(JobEvent.class)) { - JobEvent je = (JobEvent)e; - - return containsInTaskName(je.taskName(), je.taskName(), compareTaskName); - } - - if (e.getClass().equals(DeploymentEvent.class)) { - DeploymentEvent de = (DeploymentEvent)e; - - return de.alias().toLowerCase().contains(compareTaskName); - } - - return true; - } - - /** - * Filter events containing visor in it's name. - * - * @param e Event - * @return {@code true} if not contains {@code visor} in task name. - */ - private boolean filterByTaskSessionId(Event e, IgniteUuid taskSesId) { - if (e.getClass().equals(TaskEvent.class)) { - TaskEvent te = (TaskEvent)e; - - return te.taskSessionId().equals(taskSesId); - } - - if (e.getClass().equals(JobEvent.class)) { - JobEvent je = (JobEvent)e; - - return je.taskSessionId().equals(taskSesId); - } - - return true; - } - - /** - * @return Events mapper. - */ - protected VisorEventMapper eventMapper() { - return EVT_MAPPER; - } - - /** {@inheritDoc} */ - @Override protected Collection run(final VisorNodeEventsCollectorTaskArg arg) { - final long startEvtTime = arg.getTimeArgument() == null ? 0L : System.currentTimeMillis() - arg.getTimeArgument(); - - final ConcurrentMap nl = ignite.cluster().nodeLocalMap(); - - final Long startEvtOrder = arg.getKeyOrder() != null && nl.containsKey(arg.getKeyOrder()) ? - nl.get(arg.getKeyOrder()) : -1L; - - Collection evts = ignite.events().localQuery(new IgnitePredicate() { - /** */ - private static final long serialVersionUID = 0L; - - @Override public boolean apply(Event evt) { - return evt.localOrder() > startEvtOrder && - (arg.getTypeArgument() == null || F.contains(arg.getTypeArgument(), evt.type())) && - (evt.timestamp() >= startEvtTime) && - (arg.getTaskName() == null || filterByTaskName(evt, arg.getTaskName())) && - (arg.getTaskSessionId() == null || filterByTaskSessionId(evt, arg.getTaskSessionId())); - } - }); - - Collection res = new ArrayList<>(evts.size()); - - Long maxOrder = startEvtOrder; - - IgniteClosure mapper = eventMapper(); - - for (Event e : evts) { - maxOrder = Math.max(maxOrder, e.localOrder()); - - VisorGridEvent visorEvt = mapper.apply(e); - - if (visorEvt != null) - res.add(visorEvt); - else - res.add(new VisorGridEvent( - e.type(), e.id(), e.name(), e.node().id(), e.timestamp(), e.message(), e.shortDisplay() - )); - } - - // Update latest order in node local, if not empty. - if (arg.getKeyOrder() != null && !res.isEmpty()) - nl.put(arg.getKeyOrder(), maxOrder); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeEventsCollectorJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java deleted file mode 100644 index 06cb34059f25c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java +++ /dev/null @@ -1,163 +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.node; - -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.apache.ignite.lang.IgniteUuid; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.events.EventType.EVTS_JOB_EXECUTION; -import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.concat; - -/** - * Argument for task returns events data. - */ -public class VisorNodeEventsCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Node local storage key. */ - private String keyOrder; - - /** Arguments for type filter. */ - private int[] typeArg; - - /** Arguments for time filter. */ - private Long timeArg; - - /** Task or job events with task name contains. */ - private String taskName; - - /** Task or job events with session. */ - private IgniteUuid taskSesId; - - /** - * Default constructor. - */ - public VisorNodeEventsCollectorTaskArg() { - // No-op. - } - - /** - * @param keyOrder Arguments for node local storage key. - * @param typeArg Arguments for type filter. - * @param timeArg Arguments for time filter. - * @param taskName Arguments for task name filter. - * @param taskSesId Arguments for task session filter. - */ - public VisorNodeEventsCollectorTaskArg(@Nullable String keyOrder, @Nullable int[] typeArg, - @Nullable Long timeArg, - @Nullable String taskName, @Nullable IgniteUuid taskSesId) { - this.keyOrder = keyOrder; - this.typeArg = typeArg; - this.timeArg = timeArg; - this.taskName = taskName; - this.taskSesId = taskSesId; - } - - /** - * @param typeArg Arguments for type filter. - * @param timeArg Arguments for time filter. - */ - public static VisorNodeEventsCollectorTaskArg createEventsArg(@Nullable int[] typeArg, @Nullable Long timeArg) { - return new VisorNodeEventsCollectorTaskArg(null, typeArg, timeArg, null, null); - } - - /** - * @param timeArg Arguments for time filter. - * @param taskName Arguments for task name filter. - * @param taskSesId Arguments for task session filter. - */ - public static VisorNodeEventsCollectorTaskArg createTasksArg(@Nullable Long timeArg, @Nullable String taskName, - @Nullable IgniteUuid taskSesId) { - return new VisorNodeEventsCollectorTaskArg(null, concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION), - timeArg, taskName, taskSesId); - } - - /** - * @param keyOrder Arguments for node local storage key. - * @param typeArg Arguments for type filter. - */ - public static VisorNodeEventsCollectorTaskArg createLogArg(@Nullable String keyOrder, @Nullable int[] typeArg) { - return new VisorNodeEventsCollectorTaskArg(keyOrder, typeArg, null, null, null); - } - - /** - * @return Node local storage key. - */ - @Nullable public String getKeyOrder() { - return keyOrder; - } - - /** - * @return Arguments for type filter. - */ - public int[] getTypeArgument() { - return typeArg; - } - - /** - * @return Arguments for time filter. - */ - public Long getTimeArgument() { - return timeArg; - } - - /** - * @return Task or job events with task name contains. - */ - public String getTaskName() { - return taskName; - } - - /** - * @return Task or job events with session. - */ - public IgniteUuid getTaskSessionId() { - return taskSesId; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, keyOrder); - out.writeObject(typeArg); - out.writeObject(timeArg); - U.writeString(out, taskName); - U.writeIgniteUuid(out, taskSesId); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - keyOrder = U.readString(in); - typeArg = (int[])in.readObject(); - timeArg = (Long)in.readObject(); - taskName = U.readString(in); - taskSesId = U.readIgniteUuid(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeEventsCollectorTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java deleted file mode 100644 index 1e0ca4717d4f7..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java +++ /dev/null @@ -1,102 +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.node; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.cluster.ClusterMetrics; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -/** - * Task to run gc on nodes. - */ -@GridInternal -@GridVisorManagementTask -public class VisorNodeGcTask extends VisorMultiNodeTask, VisorNodeGcTaskResult> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodeGcJob job(Void arg) { - return new VisorNodeGcJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Map reduce0(List results) { - Map total = new HashMap<>(); - - for (ComputeJobResult res : results) { - VisorNodeGcTaskResult jobRes = res.getData(); - - total.put(res.getNode().id(), jobRes); - } - - return total; - } - - /** Job that perform GC on node. */ - private static class VisorNodeGcJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Formal task argument. - * @param debug Debug flag. - */ - private VisorNodeGcJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorNodeGcTaskResult run(Void arg) { - ClusterNode locNode = ignite.localNode(); - - long before = freeHeap(locNode); - - System.gc(); - - return new VisorNodeGcTaskResult(before, freeHeap(locNode)); - } - - /** - * @param node Node. - * @return Current free heap. - */ - private long freeHeap(ClusterNode node) { - final ClusterMetrics m = node.metrics(); - - return m.getHeapMemoryMaximum() - m.getHeapMemoryUsed(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeGcJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java deleted file mode 100644 index eb12ef75b2346..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java +++ /dev/null @@ -1,85 +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.node; - -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.visor.VisorDataTransferObject; - -/** - * Argument for task returns GC execution results. - */ -public class VisorNodeGcTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Size before GC execution. */ - private long sizeBefore; - - /** Size after GC execution. */ - private long sizeAfter; - - /** - * Default constructor. - */ - public VisorNodeGcTaskResult() { - // No-op. - } - - /** - * @param sizeBefore Size before GC execution. - * @param sizeAfter Size after GC execution. - */ - public VisorNodeGcTaskResult(long sizeBefore, long sizeAfter) { - this.sizeBefore = sizeBefore; - this.sizeAfter = sizeAfter; - } - - /** - * @return Size before GC execution. - */ - public Long getSizeBefore() { - return sizeBefore; - } - - /** - * @return Size after GC execution. - */ - public Long getSizeAfter() { - return sizeAfter; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(sizeBefore); - out.writeLong(sizeAfter); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - sizeBefore = in.readLong(); - sizeAfter = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeGcTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java deleted file mode 100644 index 656d12aee3d52..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java +++ /dev/null @@ -1,81 +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.node; - -import java.util.List; -import org.apache.ignite.cluster.ClusterTopologyException; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -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.jetbrains.annotations.Nullable; - -/** - * Ping other node. - */ -@GridInternal -@GridVisorManagementTask -public class VisorNodePingTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodePingJob job(VisorNodePingTaskArg arg) { - return new VisorNodePingJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected VisorNodePingTaskResult reduce0(List results) { - try { - return super.reduce0(results); - } - catch (ClusterTopologyException ignored) { - return new VisorNodePingTaskResult(false, -1L, -1L); - } - } - - /** - * Job that ping node. - */ - private static class VisorNodePingJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Node ID to ping. - * @param debug Debug flag. - */ - protected VisorNodePingJob(VisorNodePingTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorNodePingTaskResult run(VisorNodePingTaskArg arg) { - long start = System.currentTimeMillis(); - - return new VisorNodePingTaskResult(ignite.cluster().pingNode(arg.getNodeId()), start, System.currentTimeMillis()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodePingJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskArg.java deleted file mode 100644 index bd5a8262512d4..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskArg.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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.UUID; -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; - -/** - * Argument for {@link VisorNodePingTask}. - */ -public class VisorNodePingTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Node ID to ping. */ - private UUID nodeId; - - /** - * Default constructor. - */ - public VisorNodePingTaskArg() { - // No-op. - } - - /** - * @param nodeId Node ID to ping. - */ - public VisorNodePingTaskArg(UUID nodeId) { - this.nodeId = nodeId; - } - - /** - * @return Node ID to ping. - */ - public UUID getNodeId() { - return nodeId; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeUuid(out, nodeId); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - nodeId = U.readUuid(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodePingTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java deleted file mode 100644 index 5328f658dce42..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java +++ /dev/null @@ -1,99 +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.node; - -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.visor.VisorDataTransferObject; - -/** - * Result for {@link VisorNodePingTask}. - */ -public class VisorNodePingTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Node alive. */ - private boolean alive; - - /** Ping start time. */ - private long startTime; - - /** Ping finish time. */ - private long finishTime; - - /** - * Default constructor. - */ - public VisorNodePingTaskResult() { - // No-op. - } - - /** - * @param alive Node alive. - * @param startTime Ping start time. - * @param finishTime Ping finish time. - */ - public VisorNodePingTaskResult(boolean alive, long startTime, long finishTime) { - this.alive = alive; - this.startTime = startTime; - this.finishTime = finishTime; - } - - /** - * @return Node alive. - */ - public boolean isAlive() { - return alive; - } - - /** - * @return Ping start time. - */ - public long getStartTime() { - return startTime; - } - - /** - * @return Ping finish time. - */ - public long getFinishTime() { - return finishTime; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(alive); - out.writeLong(startTime); - out.writeLong(finishTime); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - alive = in.readBoolean(); - startTime = in.readLong(); - finishTime = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodePingTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeRestartTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeRestartTask.java deleted file mode 100644 index 7c5d4b073826c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeRestartTask.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.node; - -import java.util.List; -import org.apache.ignite.Ignition; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -/** - * Restarts nodes. - */ -@GridInternal -@GridVisorManagementTask -public class VisorNodeRestartTask extends VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Nullable @Override protected Void reduce0(List results) { - return null; - } - - /** - * Job that restart node. - */ - private static class VisorNodesRestartJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Formal job argument. - * @param debug Debug flag. - */ - private VisorNodesRestartJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(Void arg) { - new Thread(new Runnable() { - @Override public void run() { - Ignition.restart(true); - } - }, "grid-restarter").start(); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodesRestartJob.class, this); - } - } - - /** {@inheritDoc} */ - @Override protected VisorNodesRestartJob job(Void arg) { - return new VisorNodesRestartJob(arg, debug); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeStopTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeStopTask.java deleted file mode 100644 index 702e5826348f7..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeStopTask.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.node; - -import java.util.List; -import org.apache.ignite.Ignition; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -/** - * Stops nodes. - */ -@GridInternal -@GridVisorManagementTask -public class VisorNodeStopTask extends VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodesStopJob job(Void arg) { - return new VisorNodesStopJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Void reduce0(List results) { - return null; - } - - /** - * Job that stop node. - */ - private static class VisorNodesStopJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Formal job argument. - * @param debug Debug flag. - */ - private VisorNodesStopJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(Void arg) { - new Thread(new Runnable() { - @Override public void run() { - Ignition.kill(true); - } - }, "grid-stopper").start(); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodesStopJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java deleted file mode 100644 index fa599ec70f4de..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java +++ /dev/null @@ -1,89 +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.node; - -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; - -/** - * Create data transfer object for node's suppressed errors. - */ -public class VisorNodeSuppressedErrors extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Order number of last suppressed error. */ - private long order; - - /** List of suppressed errors. */ - private List errors; - - /** - * Default constructor. - */ - public VisorNodeSuppressedErrors() { - // No-op. - } - - /** - * Create data transfer object for node's suppressed errors. - * - * @param order Order number of last suppressed error. - * @param errors List of suppressed errors. - */ - public VisorNodeSuppressedErrors(long order, List errors) { - this.order = order; - this.errors = errors; - } - - /** - * @return Order number of last suppressed error. - */ - public long getOrder() { - return order; - } - - /** - * @return List of suppressed errors. - */ - public List getErrors() { - return errors; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(order); - U.writeCollection(out, errors); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - order = in.readLong(); - errors = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeSuppressedErrors.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java deleted file mode 100644 index 263d3e73ddfe9..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.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.visor.node; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.IgniteExceptionRegistry; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; -import org.jetbrains.annotations.Nullable; - -/** - * Task to collect last errors on nodes. - */ -@GridInternal -public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask, VisorNodeSuppressedErrors> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorNodeSuppressedErrorsJob job(VisorNodeSuppressedErrorsTaskArg arg) { - return new VisorNodeSuppressedErrorsJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Map - reduce0(List results) { - Map taskRes = - new HashMap<>(results.size()); - - for (ComputeJobResult res : results) { - VisorNodeSuppressedErrors jobRes = res.getData(); - - taskRes.put(res.getNode().id(), jobRes); - } - - return taskRes; - } - - /** - * Job to collect last errors on nodes. - */ - private static class VisorNodeSuppressedErrorsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with given argument. - * - * @param arg Map with last error counter. - * @param debug Debug flag. - */ - private VisorNodeSuppressedErrorsJob(VisorNodeSuppressedErrorsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorNodeSuppressedErrors run(VisorNodeSuppressedErrorsTaskArg arg) { - Long lastOrder = arg.getOrders().get(ignite.localNode().id()); - - long order = lastOrder != null ? lastOrder : 0; - - List errors = ignite.context().exceptionRegistry().getErrors(order); - - List wrapped = new ArrayList<>(errors.size()); - - for (IgniteExceptionRegistry.ExceptionInfo error : errors) { - if (error.order() > order) - order = error.order(); - - wrapped.add(new VisorSuppressedError(error.order(), - new VisorExceptionWrapper(error.error()), - error.message(), - error.threadId(), - error.threadName(), - error.time())); - } - - return new VisorNodeSuppressedErrors(order, wrapped); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeSuppressedErrorsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTaskArg.java deleted file mode 100644 index 17f7a9c921121..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTaskArg.java +++ /dev/null @@ -1,74 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Map; -import java.util.UUID; -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; - -/** - * Arguments for task {@link VisorNodeSuppressedErrorsTask} - */ -public class VisorNodeSuppressedErrorsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Last laded error orders. */ - private Map orders; - - /** - * Default constructor. - */ - public VisorNodeSuppressedErrorsTaskArg() { - // No-op. - } - - /** - * @param orders Last laded error orders. - */ - public VisorNodeSuppressedErrorsTaskArg(Map orders) { - this.orders = orders; - } - - /** - * @return Last laded error orders. - */ - public Map getOrders() { - return orders; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, orders); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - orders = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorNodeSuppressedErrorsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java deleted file mode 100644 index ab9e140f23afc..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java +++ /dev/null @@ -1,104 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Arrays; -import java.util.List; -import org.apache.ignite.configuration.IgniteConfiguration; -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; - -/** - * Data transfer object for node P2P configuration properties. - */ -public class VisorPeerToPeerConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Whether peer-to-peer class loading is enabled. */ - private boolean p2pEnabled; - - /** Missed resource cache size. */ - private int p2pMissedResCacheSize; - - /** List of packages from the system classpath that need to be loaded from task originating node. */ - private List p2pLocClsPathExcl; - - /** - * Default constructor. - */ - public VisorPeerToPeerConfiguration() { - // No-op. - } - - /** - * Create data transfer object for node P2P configuration properties. - * - * @param c Grid configuration. - */ - public VisorPeerToPeerConfiguration(IgniteConfiguration c) { - p2pEnabled = c.isPeerClassLoadingEnabled(); - p2pMissedResCacheSize = c.getPeerClassLoadingMissedResourcesCacheSize(); - p2pLocClsPathExcl = Arrays.asList(c.getPeerClassLoadingLocalClassPathExclude()); - } - - /** - * @return Whether peer-to-peer class loading is enabled. - */ - public boolean isPeerClassLoadingEnabled() { - return p2pEnabled; - } - - /** - * @return Missed resource cache size. - */ - public int getPeerClassLoadingMissedResourcesCacheSize() { - return p2pMissedResCacheSize; - } - - /** - * @return List of packages from the system classpath that need to be loaded from task originating node. - */ - @Nullable public List getPeerClassLoadingLocalClassPathExclude() { - return p2pLocClsPathExcl; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(p2pEnabled); - out.writeInt(p2pMissedResCacheSize); - U.writeCollection(out, p2pLocClsPathExcl); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - p2pEnabled = in.readBoolean(); - p2pMissedResCacheSize = in.readInt(); - p2pLocClsPathExcl = U.readList(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorPeerToPeerConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java deleted file mode 100644 index dad02deefd58a..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java +++ /dev/null @@ -1,293 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.WALMode; -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; - -/** - * DTO object for {@link DataStorageConfiguration}. - */ -public class VisorPersistentStoreConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String persistenceStorePath; - - /** Checkpointing frequency. */ - private long checkpointingFreq; - - /** Lock wait time. */ - private long lockWaitTime; - - /** */ - private long checkpointingPageBufSize; - - /** */ - private int checkpointingThreads; - - /** */ - private int walHistSize; - - /** Number of work WAL segments. */ - private int walSegments; - - /** Number of WAL segments to keep. */ - private int walSegmentSize; - - /** WAL persistence path. */ - private String walStorePath; - - /** WAL archive path. */ - private String walArchivePath; - - /** Wal mode. */ - private WALMode walMode; - - /** WAl thread local buffer size. */ - private int tlbSize; - - /** Wal flush frequency. */ - private long walFlushFreq; - - /** Wal fsync delay in nanoseconds. */ - private long walFsyncDelay; - - /** Wal record iterator buffer size. */ - private int walRecordIterBuffSize; - - /** Always write full pages. */ - private boolean alwaysWriteFullPages; - - /** Number of sub-intervals. */ - private int subIntervals; - - /** Time interval (in milliseconds) for rate-based metrics. */ - private long rateTimeInterval; - - /** - * Default constructor. - */ - public VisorPersistentStoreConfiguration() { - // No-op. - } - - /** - * @param cfg Persistent store configuration. - */ - public VisorPersistentStoreConfiguration(DataStorageConfiguration cfg) { - persistenceStorePath = cfg.getStoragePath(); - checkpointingFreq = cfg.getCheckpointFrequency(); - lockWaitTime = cfg.getLockWaitTime(); - checkpointingThreads = cfg.getCheckpointThreads(); - walHistSize = cfg.getWalHistorySize(); - walSegments = cfg.getWalSegments(); - walSegmentSize = cfg.getWalSegmentSize(); - walStorePath = cfg.getWalPath(); - walArchivePath = cfg.getWalArchivePath(); - walMode = cfg.getWalMode(); - tlbSize = cfg.getWalBufferSize(); - walFlushFreq = cfg.getWalFlushFrequency(); - walFsyncDelay = cfg.getWalFsyncDelayNanos(); - walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize(); - alwaysWriteFullPages = cfg.isAlwaysWriteFullPages(); - subIntervals = cfg.getMetricsSubIntervalCount(); - rateTimeInterval = cfg.getMetricsRateTimeInterval(); - } - - /** - * @return Path the root directory where the Persistent Store will persist data and indexes. - */ - public String getPersistentStorePath() { - return persistenceStorePath; - } - - /** - * @return Checkpointing frequency in milliseconds. - */ - public long getCheckpointingFrequency() { - return checkpointingFreq; - } - - /** - * @return Checkpointing page buffer size in bytes. - */ - public long getCheckpointingPageBufferSize() { - return checkpointingPageBufSize; - } - - /** - * @return Number of checkpointing threads. - */ - public int getCheckpointingThreads() { - return checkpointingThreads; - } - - /** - * @return Time for wait. - */ - public long getLockWaitTime() { - return lockWaitTime; - } - - /** - * @return Number of WAL segments to keep after a checkpoint is finished. - */ - public int getWalHistorySize() { - return walHistSize; - } - - /** - * @return Number of work WAL segments. - */ - public int getWalSegments() { - return walSegments; - } - - /** - * @return WAL segment size. - */ - public int getWalSegmentSize() { - return walSegmentSize; - } - - /** - * @return WAL persistence path, absolute or relative to Ignite work directory. - */ - public String getWalStorePath() { - return walStorePath; - } - - /** - * @return WAL archive directory. - */ - public String getWalArchivePath() { - return walArchivePath; - } - - /** - * @return Time interval in milliseconds. - */ - public long getRateTimeInterval() { - return rateTimeInterval; - } - - /** - * @return The number of sub-intervals for history tracking. - */ - public int getSubIntervals() { - return subIntervals; - } - - /** - * @return WAL mode. - */ - public WALMode getWalMode() { - return walMode; - } - - /** - * @return Thread local buffer size. - */ - public int getTlbSize() { - return tlbSize; - } - - /** - * @return Flush frequency. - */ - public long getWalFlushFrequency() { - return walFlushFreq; - } - - /** - * Gets the fsync delay, in nanoseconds. - */ - public long getWalFsyncDelayNanos() { - return walFsyncDelay; - } - - /** - * @return Record iterator buffer size. - */ - public int getWalRecordIteratorBufferSize() { - return walRecordIterBuffSize; - } - - /** - * - */ - public boolean isAlwaysWriteFullPages() { - return alwaysWriteFullPages; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, persistenceStorePath); - out.writeLong(checkpointingFreq); - out.writeLong(lockWaitTime); - out.writeLong(checkpointingPageBufSize); - out.writeInt(checkpointingThreads); - out.writeInt(walHistSize); - out.writeInt(walSegments); - out.writeInt(walSegmentSize); - U.writeString(out, walStorePath); - U.writeString(out, walArchivePath); - U.writeEnum(out, walMode); - out.writeInt(tlbSize); - out.writeLong(walFlushFreq); - out.writeLong(walFsyncDelay); - out.writeInt(walRecordIterBuffSize); - out.writeBoolean(alwaysWriteFullPages); - out.writeInt(subIntervals); - out.writeLong(rateTimeInterval); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - persistenceStorePath = U.readString(in); - checkpointingFreq = in.readLong(); - lockWaitTime = in.readLong(); - checkpointingPageBufSize = in.readLong(); - checkpointingThreads = in.readInt(); - walHistSize = in.readInt(); - walSegments = in.readInt(); - walSegmentSize = in.readInt(); - walStorePath = U.readString(in); - walArchivePath = U.readString(in); - walMode = WALMode.fromOrdinal(in.readByte()); - tlbSize = in.readInt(); - walFlushFreq = in.readLong(); - walFsyncDelay = in.readLong(); - walRecordIterBuffSize = in.readInt(); - alwaysWriteFullPages = in.readBoolean(); - subIntervals = in.readInt(); - rateTimeInterval = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorPersistentStoreConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java deleted file mode 100644 index baf0ea6a3eb32..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java +++ /dev/null @@ -1,366 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.ConnectorConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -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 java.lang.System.getProperty; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_HOST; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.intValue; - -/** - * Create data transfer object for node REST configuration properties. - */ -public class VisorRestConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Whether REST enabled or not. */ - private boolean restEnabled; - - /** Whether or not SSL is enabled for TCP binary protocol. */ - private boolean tcpSslEnabled; - - /** Jetty config path. */ - private String jettyPath; - - /** Jetty host. */ - private String jettyHost; - - /** Jetty port. */ - private Integer jettyPort; - - /** REST TCP binary host. */ - private String tcpHost; - - /** REST TCP binary port. */ - private int tcpPort; - - /** Context factory for SSL. */ - private String tcpSslCtxFactory; - - /** REST secret key. */ - private String secretKey; - - /** TCP no delay flag. */ - private boolean noDelay; - - /** REST TCP direct buffer flag. */ - private boolean directBuf; - - /** REST TCP send buffer size. */ - private int sndBufSize; - - /** REST TCP receive buffer size. */ - private int rcvBufSize; - - /** REST idle timeout for query cursor. */ - private long idleQryCurTimeout; - - /** REST idle check frequency for query cursor. */ - private long idleQryCurCheckFreq; - - /** REST TCP send queue limit. */ - private int sndQueueLimit; - - /** REST TCP selector count. */ - private int selectorCnt; - - /** Idle timeout. */ - private long idleTimeout; - - /** SSL need client auth flag. */ - private boolean sslClientAuth; - - /** SSL context factory for rest binary server. */ - private String sslFactory; - - /** Port range */ - private int portRange; - - /** Client message interceptor. */ - private String msgInterceptor; - - /** - * Default constructor. - */ - public VisorRestConfiguration() { - // No-op. - } - - /** - * Create data transfer object for node REST configuration properties. - * - * @param c Grid configuration. - */ - public VisorRestConfiguration(IgniteConfiguration c) { - assert c != null; - - ConnectorConfiguration conCfg = c.getConnectorConfiguration(); - - restEnabled = conCfg != null; - - if (restEnabled) { - tcpSslEnabled = conCfg.isSslEnabled(); - jettyPath = conCfg.getJettyPath(); - jettyHost = getProperty(IGNITE_JETTY_HOST); - jettyPort = intValue(IGNITE_JETTY_PORT, null); - tcpHost = conCfg.getHost(); - tcpPort = conCfg.getPort(); - tcpSslCtxFactory = compactClass(conCfg.getSslContextFactory()); - secretKey = conCfg.getSecretKey(); - noDelay = conCfg.isNoDelay(); - directBuf = conCfg.isDirectBuffer(); - sndBufSize = conCfg.getSendBufferSize(); - rcvBufSize = conCfg.getReceiveBufferSize(); - idleQryCurTimeout = conCfg.getIdleQueryCursorTimeout(); - idleQryCurCheckFreq = conCfg.getIdleQueryCursorCheckFrequency(); - sndQueueLimit = conCfg.getSendQueueLimit(); - selectorCnt = conCfg.getSelectorCount(); - idleTimeout = conCfg.getIdleTimeout(); - sslClientAuth = conCfg.isSslClientAuth(); - sslFactory = compactClass(conCfg.getSslFactory()); - portRange = conCfg.getPortRange(); - msgInterceptor = compactClass(conCfg.getMessageInterceptor()); - } - } - - /** - * @return Whether REST enabled or not. - */ - public boolean isRestEnabled() { - return restEnabled; - } - - /** - * @return Whether or not SSL is enabled for TCP binary protocol. - */ - public boolean isTcpSslEnabled() { - return tcpSslEnabled; - } - - /** - * @return Jetty config path. - */ - @Nullable public String getJettyPath() { - return jettyPath; - } - - /** - * @return Jetty host. - */ - @Nullable public String getJettyHost() { - return jettyHost; - } - - /** - * @return Jetty port. - */ - @Nullable public Integer getJettyPort() { - return jettyPort; - } - - /** - * @return REST TCP binary host. - */ - @Nullable public String getTcpHost() { - return tcpHost; - } - - /** - * @return REST TCP binary port. - */ - public int getTcpPort() { - return tcpPort; - } - - /** - * @return Context factory for SSL. - */ - @Nullable public String getTcpSslContextFactory() { - return tcpSslCtxFactory; - } - - /** - * @return Secret key. - */ - @Nullable public String getSecretKey() { - return secretKey; - } - - /** - * @return Whether {@code TCP_NODELAY} option should be enabled. - */ - public boolean isNoDelay() { - return noDelay; - } - - /** - * @return Whether direct buffer should be used. - */ - public boolean isDirectBuffer() { - return directBuf; - } - - /** - * @return REST TCP server send buffer size (0 for default). - */ - public int getSendBufferSize() { - return sndBufSize; - } - - /** - * @return REST TCP server receive buffer size (0 for default). - */ - public int getReceiveBufferSize() { - return rcvBufSize; - } - - /** - * @return Idle query cursors timeout in milliseconds - */ - public long getIdleQueryCursorTimeout() { - return idleQryCurTimeout; - } - - /** - * @return Idle query cursor check frequency in milliseconds. - */ - public long getIdleQueryCursorCheckFrequency() { - return idleQryCurCheckFreq; - } - - /** - * @return REST TCP server send queue limit (0 for unlimited). - */ - public int getSendQueueLimit() { - return sndQueueLimit; - } - - /** - * @return Number of selector threads for REST TCP server. - */ - public int getSelectorCount() { - return selectorCnt; - } - - /** - * @return Idle timeout in milliseconds. - */ - public long getIdleTimeout() { - return idleTimeout; - } - - /** - * Gets a flag indicating whether or not remote clients will be required to have a valid SSL certificate which - * validity will be verified with trust manager. - * - * @return Whether or not client authentication is required. - */ - public boolean isSslClientAuth() { - return sslClientAuth; - } - - /** - * @return SslContextFactory instance. - */ - public String getSslFactory() { - return sslFactory; - } - - /** - * @return Number of ports to try. - */ - public int getPortRange() { - return portRange; - } - - /** - * @return Interceptor. - */ - @Nullable public String getMessageInterceptor() { - return msgInterceptor; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeBoolean(restEnabled); - out.writeBoolean(tcpSslEnabled); - U.writeString(out, jettyPath); - U.writeString(out, jettyHost); - out.writeObject(jettyPort); - U.writeString(out, tcpHost); - out.writeInt(tcpPort); - U.writeString(out, tcpSslCtxFactory); - U.writeString(out, secretKey); - out.writeBoolean(noDelay); - out.writeBoolean(directBuf); - out.writeInt(sndBufSize); - out.writeInt(rcvBufSize); - out.writeLong(idleQryCurTimeout); - out.writeLong(idleQryCurCheckFreq); - out.writeInt(sndQueueLimit); - out.writeInt(selectorCnt); - out.writeLong(idleTimeout); - out.writeBoolean(sslClientAuth); - U.writeString(out, sslFactory); - out.writeInt(portRange); - U.writeString(out, msgInterceptor); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - restEnabled = in.readBoolean(); - tcpSslEnabled = in.readBoolean(); - jettyPath = U.readString(in); - jettyHost = U.readString(in); - jettyPort = (Integer)in.readObject(); - tcpHost = U.readString(in); - tcpPort = in.readInt(); - tcpSslCtxFactory = U.readString(in); - secretKey = U.readString(in); - noDelay = in.readBoolean(); - directBuf = in.readBoolean(); - sndBufSize = in.readInt(); - rcvBufSize = in.readInt(); - idleQryCurTimeout = in.readLong(); - idleQryCurCheckFreq = in.readLong(); - sndQueueLimit = in.readInt(); - selectorCnt = in.readInt(); - idleTimeout = in.readLong(); - sslClientAuth = in.readBoolean(); - sslFactory = U.readString(in); - portRange = in.readInt(); - msgInterceptor = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorRestConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java deleted file mode 100644 index 5e4dd4089f6f7..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java +++ /dev/null @@ -1,144 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.IgniteConfiguration; -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.plugin.segmentation.SegmentationPolicy; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray; - -/** - * Data transfer object for node segmentation configuration properties. - */ -public class VisorSegmentationConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Segmentation policy. */ - private SegmentationPolicy plc; - - /** Segmentation resolvers. */ - private String resolvers; - - /** Frequency of network segment check by discovery manager. */ - private long checkFreq; - - /** Whether or not node should wait for correct segment on start. */ - private boolean waitOnStart; - - /** Whether or not all resolvers should succeed for node to be in correct segment. */ - private boolean allResolversPassReq; - - /** Segmentation resolve attempts count. */ - private int segResolveAttempts; - - /** - * Default constructor. - */ - public VisorSegmentationConfiguration() { - // No-op. - } - - /** - * Create data transfer object for node segmentation configuration properties. - * - * @param c Grid configuration. - */ - public VisorSegmentationConfiguration(IgniteConfiguration c) { - plc = c.getSegmentationPolicy(); - resolvers = compactArray(c.getSegmentationResolvers()); - checkFreq = c.getSegmentCheckFrequency(); - waitOnStart = c.isWaitForSegmentOnStart(); - allResolversPassReq = c.isAllSegmentationResolversPassRequired(); - segResolveAttempts = c.getSegmentationResolveAttempts(); - } - - /** - * @return Segmentation policy. - */ - public SegmentationPolicy getPolicy() { - return plc; - } - - /** - * @return Segmentation resolvers. - */ - @Nullable public String getResolvers() { - return resolvers; - } - - /** - * @return Frequency of network segment check by discovery manager. - */ - public long getCheckFrequency() { - return checkFreq; - } - - /** - * @return Whether or not node should wait for correct segment on start. - */ - public boolean isWaitOnStart() { - return waitOnStart; - } - - /** - * @return Whether or not all resolvers should succeed for node to be in correct segment. - */ - public boolean isAllSegmentationResolversPassRequired() { - return allResolversPassReq; - } - - /** - * @return Segmentation resolve attempts. - */ - public int getSegmentationResolveAttempts() { - return segResolveAttempts; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeEnum(out, plc); - U.writeString(out, resolvers); - out.writeLong(checkFreq); - out.writeBoolean(waitOnStart); - out.writeBoolean(allResolversPassReq); - out.writeInt(segResolveAttempts); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - plc = SegmentationPolicy.fromOrdinal(in.readByte()); - resolvers = U.readString(in); - checkFreq = in.readLong(); - waitOnStart = in.readBoolean(); - allResolversPassReq = in.readBoolean(); - segResolveAttempts = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorSegmentationConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorServiceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorServiceConfiguration.java deleted file mode 100644 index 9092cc2dce0fd..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorServiceConfiguration.java +++ /dev/null @@ -1,175 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.List; -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.internal.visor.VisorDataTransferObject; -import org.apache.ignite.services.ServiceConfiguration; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for configuration of service data structures. - */ -public class VisorServiceConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Service name. */ - private String name; - - /** Service instance. */ - private String svc; - - /** Total count. */ - private int totalCnt; - - /** Max per-node count. */ - private int maxPerNodeCnt; - - /** Cache name. */ - private String cacheName; - - /** Affinity key. */ - private String affKey; - - /** Node filter. */ - private String nodeFilter; - - /** - * Construct data transfer object for service configurations properties. - * - * @param cfgs Service configurations. - * @return Service configurations properties. - */ - public static List list(ServiceConfiguration[] cfgs) { - List res = new ArrayList<>(); - - if (!F.isEmpty(cfgs)) { - for (ServiceConfiguration cfg : cfgs) - res.add(new VisorServiceConfiguration(cfg)); - } - - return res; - } - - /** - * Default constructor. - */ - public VisorServiceConfiguration() { - // No-op. - } - - /** - * Create data transfer object for service configuration. - * - * @param src Service configuration. - */ - public VisorServiceConfiguration(ServiceConfiguration src) { - name = src.getName(); - svc = compactClass(src.getService()); - totalCnt = src.getTotalCount(); - maxPerNodeCnt = src.getMaxPerNodeCount(); - cacheName = src.getCacheName(); - affKey = compactClass(src.getAffinityKey()); - nodeFilter = compactClass(src.getNodeFilter()); - } - - /** - * @return Service name. - */ - public String getName() { - return name; - } - - /** - * @return Service instance. - */ - public String getService() { - return svc; - } - - /** - * @return Total number of deployed service instances in the cluster, {@code 0} for unlimited. - */ - public int getTotalCount() { - return totalCnt; - } - - /** - * @return Maximum number of deployed service instances on each node, {@code 0} for unlimited. - */ - public int getMaxPerNodeCount() { - return maxPerNodeCnt; - } - - /** - * @return Cache name, possibly {@code null}. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return Affinity key, possibly {@code null}. - */ - public String getAffinityKey() { - return affKey; - } - - /** - * @return Node filter used to filter nodes on which the service will be deployed, possibly {@code null}. - */ - public String getNodeFilter() { - return nodeFilter; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - U.writeString(out, svc); - out.writeInt(totalCnt); - out.writeInt(maxPerNodeCnt); - U.writeString(out, cacheName); - U.writeString(out, affKey); - U.writeString(out, nodeFilter); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - svc = U.readString(in); - totalCnt = in.readInt(); - maxPerNodeCnt = in.readInt(); - cacheName = U.readString(in); - affKey = U.readString(in); - nodeFilter = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorServiceConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java deleted file mode 100644 index 2d1eb48f591aa..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java +++ /dev/null @@ -1,89 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Map; -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; - -/** - * Transfer object for single spi description. - */ -public class VisorSpiDescription extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** SPI class name. */ - private String clsName; - - /** SPI fields description. */ - private Map fldDesc; - - /** - * Default constructor. - */ - public VisorSpiDescription() { - // No-op. - } - - /** - * Construct Visor spi description object. - * - * @param clsName SPI class name. - * @param fldDesc SPI fields description. - */ - public VisorSpiDescription(String clsName, Map fldDesc) { - this.clsName = clsName; - this.fldDesc = fldDesc; - } - - /** - * @return SPI class name. - */ - public String getClassName() { - return clsName; - } - - /** - * @return SPI fields description. - */ - public Map getFieldDescriptions() { - return fldDesc; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, clsName); - U.writeMap(out, fldDesc); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - clsName = U.readString(in); - fldDesc = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorSpiDescription.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java deleted file mode 100644 index 83cc7c1eaf0d0..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java +++ /dev/null @@ -1,256 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; -import org.apache.ignite.spi.IgniteSpi; -import org.apache.ignite.spi.IgniteSpiConfiguration; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject; - -/** - * Data transfer object for node SPIs configuration properties. - */ -public class VisorSpisConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Discovery SPI. */ - private VisorSpiDescription discoSpi; - - /** Communication SPI. */ - private VisorSpiDescription commSpi; - - /** Event storage SPI. */ - private VisorSpiDescription evtSpi; - - /** Collision SPI. */ - private VisorSpiDescription colSpi; - - /** Deployment SPI. */ - private VisorSpiDescription deploySpi; - - /** Checkpoint SPIs. */ - private VisorSpiDescription[] cpSpis; - - /** Failover SPIs. */ - private VisorSpiDescription[] failSpis; - - /** Load balancing SPIs. */ - private VisorSpiDescription[] loadBalancingSpis; - - /** Indexing SPIs. */ - private VisorSpiDescription[] indexingSpis; - - /** - * Default constructor. - */ - public VisorSpisConfiguration() { - // No-op. - } - - /** - * Collects SPI information based on GridSpiConfiguration-annotated methods. - * Methods with {@code Deprecated} annotation are skipped. - * - * @param spi SPI to collect information on. - * @return Tuple where first component is SPI name and map with properties as second. - */ - private static VisorSpiDescription collectSpiInfo(IgniteSpi spi) { - Class spiCls = spi.getClass(); - - HashMap res = new HashMap<>(); - - res.put("Class Name", compactClass(spi)); - - for (Method mtd : spiCls.getDeclaredMethods()) { - if (mtd.isAnnotationPresent(IgniteSpiConfiguration.class) && !mtd.isAnnotationPresent(Deprecated.class)) { - String mtdName = mtd.getName(); - - if (mtdName.startsWith("set")) { - String propName = Character.toLowerCase(mtdName.charAt(3)) + mtdName.substring(4); - - try { - String[] getterNames = new String[] { - "get" + mtdName.substring(3), - "is" + mtdName.substring(3), - "get" + mtdName.substring(3) + "Formatted" - }; - - for (String getterName : getterNames) { - try { - Method getter = spiCls.getDeclaredMethod(getterName); - - Object getRes = getter.invoke(spi); - - res.put(propName, compactObject(getRes)); - - break; - } - catch (NoSuchMethodException ignored) { - // No-op. - } - } - } - catch (IllegalAccessException ignored) { - res.put(propName, "Error: Method Cannot Be Accessed"); - } - catch (InvocationTargetException ite) { - res.put(propName, ("Error: Method Threw An Exception: " + ite)); - } - } - } - } - - return new VisorSpiDescription(spi.getName(), res); - } - - /** - * @param spis Array of spi to process. - * @return Tuple where first component is SPI name and map with properties as second. - */ - private static VisorSpiDescription[] collectSpiInfo(IgniteSpi[] spis) { - VisorSpiDescription[] res = new VisorSpiDescription[spis.length]; - - for (int i = 0; i < spis.length; i++) - res[i] = collectSpiInfo(spis[i]); - - return res; - } - - /** - * Create data transfer object for node SPIs configuration properties. - * - * @param c Grid configuration. - */ - public VisorSpisConfiguration(IgniteConfiguration c) { - discoSpi = collectSpiInfo(c.getDiscoverySpi()); - commSpi = collectSpiInfo(c.getCommunicationSpi()); - evtSpi = collectSpiInfo(c.getEventStorageSpi()); - colSpi = collectSpiInfo(c.getCollisionSpi()); - deploySpi = collectSpiInfo(c.getDeploymentSpi()); - cpSpis = collectSpiInfo(c.getCheckpointSpi()); - failSpis = collectSpiInfo(c.getFailoverSpi()); - loadBalancingSpis = collectSpiInfo(c.getLoadBalancingSpi()); - indexingSpis = F.asArray(collectSpiInfo(c.getIndexingSpi())); - } - - /** - * @return Discovery SPI. - */ - public VisorSpiDescription getDiscoverySpi() { - return discoSpi; - } - - /** - * @return Communication SPI. - */ - public VisorSpiDescription getCommunicationSpi() { - return commSpi; - } - - /** - * @return Event storage SPI. - */ - public VisorSpiDescription getEventStorageSpi() { - return evtSpi; - } - - /** - * @return Collision SPI. - */ - public VisorSpiDescription getCollisionSpi() { - return colSpi; - } - - /** - * @return Deployment SPI. - */ - public VisorSpiDescription getDeploymentSpi() { - return deploySpi; - } - - /** - * @return Checkpoint SPIs. - */ - public VisorSpiDescription[] getCheckpointSpis() { - return cpSpis; - } - - /** - * @return Failover SPIs. - */ - public VisorSpiDescription[] getFailoverSpis() { - return failSpis; - } - - /** - * @return Load balancing SPIs. - */ - public VisorSpiDescription[] getLoadBalancingSpis() { - return loadBalancingSpis; - } - - /** - * @return Indexing SPIs. - */ - public VisorSpiDescription[] getIndexingSpis() { - return indexingSpis; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeObject(discoSpi); - out.writeObject(commSpi); - out.writeObject(evtSpi); - out.writeObject(colSpi); - out.writeObject(deploySpi); - out.writeObject(cpSpis); - out.writeObject(failSpis); - out.writeObject(loadBalancingSpis); - out.writeObject(indexingSpis); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - discoSpi = (VisorSpiDescription)in.readObject(); - commSpi = (VisorSpiDescription)in.readObject(); - evtSpi = (VisorSpiDescription)in.readObject(); - colSpi = (VisorSpiDescription)in.readObject(); - deploySpi = (VisorSpiDescription)in.readObject(); - cpSpis = (VisorSpiDescription[])in.readObject(); - failSpis = (VisorSpiDescription[])in.readObject(); - loadBalancingSpis = (VisorSpiDescription[])in.readObject(); - indexingSpis = (VisorSpiDescription[])in.readObject(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorSpisConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java deleted file mode 100644 index 2e5466360b95c..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java +++ /dev/null @@ -1,170 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.SqlConnectorConfiguration; -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; - -/** - * Data transfer object for SQL connector configuration. - * - * Deprecated as of Apache Ignite 2.3 - */ -@Deprecated -public class VisorSqlConnectorConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Host. */ - private String host; - - /** Port. */ - private int port; - - /** Port range. */ - private int portRange; - - /** Max number of opened cursors per connection. */ - private int maxOpenCursorsPerConn; - - /** Socket send buffer size. */ - private int sockSndBufSize; - - /** Socket receive buffer size. */ - private int sockRcvBufSize; - - /** TCP no delay. */ - private boolean tcpNoDelay; - - /** Thread pool size. */ - private int threadPoolSize; - - /** - * Default constructor. - */ - public VisorSqlConnectorConfiguration() { - // No-op. - } - - /** - * Create data transfer object for Sql connector configuration. - * - * @param cfg Sql connector configuration. - */ - public VisorSqlConnectorConfiguration(SqlConnectorConfiguration cfg) { - host = cfg.getHost(); - port = cfg.getPort(); - portRange = cfg.getPortRange(); - maxOpenCursorsPerConn = cfg.getMaxOpenCursorsPerConnection(); - sockSndBufSize = cfg.getSocketSendBufferSize(); - sockRcvBufSize = cfg.getSocketReceiveBufferSize(); - tcpNoDelay = cfg.isTcpNoDelay(); - threadPoolSize = cfg.getThreadPoolSize(); - } - - /** - * @return Host. - */ - @Nullable public String getHost() { - return host; - } - - /** - * @return Port. - */ - public int getPort() { - return port; - } - - /** - * @return Port range. - */ - public int getPortRange() { - return portRange; - } - - /** - * @return Maximum number of opened cursors. - */ - public int getMaxOpenCursorsPerConnection() { - return maxOpenCursorsPerConn; - } - - /** - * @return Socket send buffer size in bytes. - */ - public int getSocketSendBufferSize() { - return sockSndBufSize; - } - - /** - * @return Socket receive buffer size in bytes. - */ - public int getSocketReceiveBufferSize() { - return sockRcvBufSize; - } - - /** - * @return TCP NO_DELAY flag. - */ - public boolean isTcpNoDelay() { - return tcpNoDelay; - } - - /** - * @return Thread pool that is in charge of processing SQL requests. - */ - public int getThreadPoolSize() { - return threadPoolSize; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, host); - out.writeInt(port); - out.writeInt(portRange); - out.writeInt(maxOpenCursorsPerConn); - out.writeInt(sockSndBufSize); - out.writeInt(sockRcvBufSize ); - out.writeBoolean(tcpNoDelay); - out.writeInt(threadPoolSize); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - host = U.readString(in); - port = in.readInt(); - portRange = in.readInt(); - maxOpenCursorsPerConn = in.readInt(); - sockSndBufSize = in.readInt(); - sockRcvBufSize = in.readInt(); - tcpNoDelay = in.readBoolean(); - threadPoolSize = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorSqlConnectorConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java deleted file mode 100644 index 7c65f98e3e63e..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java +++ /dev/null @@ -1,147 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.util.tostring.GridToStringExclude; -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.internal.visor.util.VisorExceptionWrapper; - -/** - * Data transfer object for suppressed errors. - */ -public class VisorSuppressedError extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private long order; - - /** */ - @GridToStringExclude - private VisorExceptionWrapper error; - - /** */ - private long threadId; - - /** */ - private String threadName; - - /** */ - private long time; - - /** */ - private String msg; - - /** - * Default constructor. - */ - public VisorSuppressedError() { - // No-op. - } - - /** - * Constructor. - * - * @param order Locally unique ID that is atomically incremented for each new error. - * @param error Suppressed error. - * @param msg Message that describe reason why error was suppressed. - * @param threadId Thread ID. - * @param threadName Thread name. - * @param time Occurrence time. - */ - public VisorSuppressedError(long order, VisorExceptionWrapper error, String msg, long threadId, String threadName, long time) { - this.order = order; - this.error = error; - this.threadId = threadId; - this.threadName = threadName; - this.time = time; - this.msg = msg; - } - - /** - * @return Locally unique ID that is atomically incremented for each new error. - */ - public long getOrder() { - return order; - } - - /** - * @return Gets message that describe reason why error was suppressed. - */ - public String getMessage() { - return msg; - } - - /** - * @return Suppressed error. - */ - public VisorExceptionWrapper getError() { - return error; - } - - /** - * @return Gets thread ID. - */ - public long getThreadId() { - return threadId; - } - - /** - * @return Gets thread name. - */ - public String getThreadName() { - return threadName; - } - - /** - * @return Gets time. - */ - public long getTime() { - return time; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(order); - out.writeObject(error); - out.writeLong(threadId); - U.writeString(out, threadName); - out.writeLong(time); - U.writeString(out, msg); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - order = in.readLong(); - error = (VisorExceptionWrapper)in.readObject(); - threadId = in.readLong(); - threadName = U.readString(in); - time = in.readLong(); - msg = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorSuppressedError.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java deleted file mode 100644 index 1ac827a89e610..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java +++ /dev/null @@ -1,159 +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.node; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.configuration.TransactionConfiguration; -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.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass; - -/** - * Data transfer object for transaction configuration. - */ -public class VisorTransactionConfiguration extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Default cache concurrency. */ - private TransactionConcurrency dfltConcurrency; - - /** Default transaction isolation. */ - private TransactionIsolation dfltIsolation; - - /** Default transaction timeout. */ - private long dfltTimeout; - - /** Pessimistic tx log linger. */ - private int pessimisticTxLogLinger; - - /** Pessimistic tx log size. */ - private int pessimisticTxLogSize; - - /** Transaction manager factory. */ - private String txMgrFactory; - - /** - * Default constructor. - */ - public VisorTransactionConfiguration() { - // No-op. - } - - /** - * Whether to use JTA {@code javax.transaction.Synchronization} - * instead of {@code javax.transaction.xa.XAResource}. - */ - private boolean useJtaSync; - - /** - * Create data transfer object for transaction configuration. - * - * @param cfg Transaction configuration. - */ - public VisorTransactionConfiguration(TransactionConfiguration cfg) { - dfltConcurrency = cfg.getDefaultTxConcurrency(); - dfltIsolation = cfg.getDefaultTxIsolation(); - dfltTimeout = cfg.getDefaultTxTimeout(); - pessimisticTxLogLinger = cfg.getPessimisticTxLogLinger(); - pessimisticTxLogSize = cfg.getPessimisticTxLogSize(); - txMgrFactory = compactClass(cfg.getTxManagerFactory()); - useJtaSync = cfg.isUseJtaSynchronization(); - } - - /** - * @return Default cache transaction concurrency. - */ - public TransactionConcurrency getDefaultTxConcurrency() { - return dfltConcurrency; - } - - /** - * @return Default cache transaction isolation. - */ - public TransactionIsolation getDefaultTxIsolation() { - return dfltIsolation; - } - - /** - * @return Default transaction timeout. - */ - public long getDefaultTxTimeout() { - return dfltTimeout; - } - - /** - * @return Pessimistic log cleanup delay in milliseconds. - */ - public int getPessimisticTxLogLinger() { - return pessimisticTxLogLinger; - } - - /** - * @return Pessimistic transaction log size. - */ - public int getPessimisticTxLogSize() { - return pessimisticTxLogSize; - } - - /** - * @return Transaction manager factory. - */ - public String getTxManagerFactory() { - return txMgrFactory; - } - - /** - * @return Whether to use JTA {@code javax.transaction.Synchronization} - * instead of {@code javax.transaction.xa.XAResource}. - */ - public boolean isUseJtaSync() { - return useJtaSync; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeEnum(out, dfltConcurrency); - U.writeEnum(out, dfltIsolation); - out.writeLong(dfltTimeout); - out.writeInt(pessimisticTxLogLinger); - out.writeInt(pessimisticTxLogSize); - U.writeString(out, txMgrFactory); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - dfltConcurrency = TransactionConcurrency.fromOrdinal(in.readByte()); - dfltIsolation = TransactionIsolation.fromOrdinal(in.readByte()); - dfltTimeout = in.readLong(); - pessimisticTxLogLinger = in.readInt(); - pessimisticTxLogSize = in.readInt(); - txMgrFactory = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorTransactionConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java deleted file mode 100644 index 8bb764695a0b8..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java +++ /dev/null @@ -1,74 +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; - -import java.util.Collections; -import java.util.List; -import org.apache.ignite.IgniteException; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.jetbrains.annotations.Nullable; - -/** - * Task to cancel queries. - */ -@GridInternal -@GridVisorManagementTask -public class VisorQueryCancelTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCancelQueriesJob job(VisorQueryCancelTaskArg arg) { - return new VisorCancelQueriesJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Void reduce0(List results) throws IgniteException { - return null; - } - - /** - * Job to cancel queries on node. - */ - private static class VisorCancelQueriesJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Flag indicating whether debug information should be printed into node log. - */ - protected VisorCancelQueriesJob(@Nullable VisorQueryCancelTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(@Nullable VisorQueryCancelTaskArg arg) throws IgniteException { - ignite.context().query().cancelLocalQueries(Collections.singleton(arg.getQueryId())); - - return null; - } - } - -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTaskArg.java deleted file mode 100644 index 887a11e8dfe26..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTaskArg.java +++ /dev/null @@ -1,71 +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; - -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.visor.VisorDataTransferObject; - -/** - * Arguments for task {@link VisorQueryCancelTask} - */ -public class VisorQueryCancelTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Query ID to cancel. */ - private long qryId; - - /** - * Default constructor. - */ - public VisorQueryCancelTaskArg() { - // No-op. - } - - /** - * @param qryId Query ID to cancel. - */ - public VisorQueryCancelTaskArg(long qryId) { - this.qryId = qryId; - } - - /** - * @return Query ID to cancel. - */ - public long getQueryId() { - return qryId; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(qryId); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - qryId = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryCancelTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java deleted file mode 100644 index e62393a5349bd..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java +++ /dev/null @@ -1,134 +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; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeJob; -import org.apache.ignite.internal.processors.task.GridInternal; -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.VisorMultiNodeTask; -import org.apache.ignite.internal.visor.VisorTaskArgument; -import org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.removeQueryHolder; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.logMapped; - -/** - * Task for cleanup not needed SCAN or SQL queries result futures from node local. - */ -@GridInternal -public class VisorQueryCleanupTask extends VisorMultiNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorJob job(VisorQueryCleanupTaskArg arg) { - return null; - } - - /** {@inheritDoc} */ - @Override protected Map map0(List subgrid, - @Nullable VisorTaskArgument arg) { - Set nodeIds = taskArg.getQueryIds().keySet(); - - if (nodeIds.isEmpty()) - throw new VisorClusterGroupEmptyException("Nothing to clear. List with node IDs is empty!"); - - Map map = U.newHashMap(nodeIds.size()); - - try { - for (ClusterNode node : subgrid) - if (nodeIds.contains(node.id())) - map.put(new VisorQueryCleanupJob(taskArg.getQueryIds().get(node.id()), debug), node); - - if (map.isEmpty()) { - StringBuilder notFoundNodes = new StringBuilder(); - - for (UUID nid : nodeIds) - notFoundNodes.append((notFoundNodes.length() == 0) ? "" : ",").append(U.id8(nid)); - - throw new VisorClusterGroupEmptyException("Failed to clear query results. Nodes are not available: [" + - notFoundNodes + "]"); - } - - return map; - } - finally { - if (debug) - logMapped(ignite.log(), getClass(), map.values()); - } - } - - /** {@inheritDoc} */ - @Nullable @Override protected Void reduce0(List list) { - return null; - } - - /** - * Job for cleanup not needed SCAN or SQL queries result futures from node local. - */ - private static class VisorQueryCleanupJob extends VisorJob, Void> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - protected VisorQueryCleanupJob(Collection arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(Collection qryIds) { - long start = U.currentTimeMillis(); - - if (debug) { - start = log( - ignite.log(), - "Queries cancellation started: [" + String.join(", ", qryIds) + "]", - getClass(), - start); - } - - for (String qryId : qryIds) - removeQueryHolder(ignite, qryId); - - if (debug) - log(ignite.log(), "Queries cancellation finished", getClass(), start); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryCleanupJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTaskArg.java deleted file mode 100644 index 878a6122ea70d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTaskArg.java +++ /dev/null @@ -1,75 +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; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collection; -import java.util.Map; -import java.util.UUID; -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; - -/** - * Arguments for task {@link VisorQueryCleanupTask} - */ -public class VisorQueryCleanupTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Query IDs to cancel. */ - private Map> qryIds; - - /** - * Default constructor. - */ - public VisorQueryCleanupTaskArg() { - // No-op. - } - - /** - * @param qryIds Query IDs to cancel. - */ - public VisorQueryCleanupTaskArg(Map> qryIds) { - this.qryIds = qryIds; - } - - /** - * @return Query IDs to cancel. - */ - public Map> getQueryIds() { - return qryIds; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, qryIds); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - qryIds = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryCleanupTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java deleted file mode 100644 index b74784514a5d6..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java +++ /dev/null @@ -1,205 +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; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.cache.query.QueryDetailMetrics; -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; - -/** - * Data transfer object for cache query detail metrics. - */ -public class VisorQueryDetailMetrics extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Query type. */ - private String qryType; - - /** Textual query representation. */ - private String qry; - - /** Cache name. */ - private String cache; - - /** Number of executions. */ - private int execs; - - /** Number of completions executions. */ - private int completions; - - /** Number of failures. */ - private int failures; - - /** Minimum time of execution. */ - private long minTime; - - /** Maximum time of execution. */ - private long maxTime; - - /** Average time of execution. */ - private double avgTime; - - /** Sum of execution time of completions time. */ - private long totalTime; - - /** Sum of execution time of completions time. */ - private long lastStartTime; - - /** - * Default constructor - */ - public VisorQueryDetailMetrics() { - // No-op. - } - - /** - * @param m Cache query metrics. - */ - public VisorQueryDetailMetrics(QueryDetailMetrics m) { - qryType = m.queryType(); - qry = m.query(); - cache = m.cache(); - - execs = m.executions(); - completions = m.completions(); - failures = m.failures(); - - minTime = m.minimumTime(); - maxTime = m.maximumTime(); - avgTime = m.averageTime(); - totalTime = m.totalTime(); - lastStartTime = m.lastStartTime(); - } - - /** - * @return Query type - */ - public String getQueryType() { - return qryType; - } - - /** - * @return Query type - */ - public String getQuery() { - return qry; - } - - /** - * @return Cache name where query was executed. - */ - public String getCache() { - return cache; - } - - /** - * @return Number of executions. - */ - public int getExecutions() { - return execs; - } - - /** - * @return Number of completed executions. - */ - public int getCompletions() { - return completions; - } - - /** - * @return Total number of times a query execution failed. - */ - public int getFailures() { - return failures; - } - - /** - * @return Minimum execution time of query. - */ - public long getMinimumTime() { - return minTime; - } - - /** - * @return Maximum execution time of query. - */ - public long getMaximumTime() { - return maxTime; - } - - /** - * @return Average execution time of query. - */ - public double getAverageTime() { - return avgTime; - } - - /** - * @return Total time of all query executions. - */ - public long getTotalTime() { - return totalTime; - } - - /** - * @return Latest time query was stared. - */ - public long getLastStartTime() { - return lastStartTime; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, qryType); - U.writeString(out, qry); - U.writeString(out, cache); - out.writeInt(execs); - out.writeInt(completions); - out.writeInt(failures); - out.writeLong(minTime); - out.writeLong(maxTime); - out.writeDouble(avgTime); - out.writeLong(totalTime); - out.writeLong(lastStartTime); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - qryType = U.readString(in); - qry = U.readString(in); - cache = U.readString(in); - execs = in.readInt(); - completions = in.readInt(); - failures = in.readInt(); - minTime = in.readLong(); - maxTime = in.readLong(); - avgTime = in.readDouble(); - totalTime = in.readLong(); - lastStartTime = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryDetailMetrics.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java deleted file mode 100644 index d45ddfa5f6cec..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java +++ /dev/null @@ -1,145 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.query.QueryDetailMetrics; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; -import org.apache.ignite.internal.processors.cache.IgniteInternalCache; -import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter; -import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey; -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.VisorMultiNodeTask; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache; - -/** - * Task to collect cache query metrics. - */ -@GridInternal -public class VisorQueryDetailMetricsCollectorTask extends VisorMultiNodeTask, Collection> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheQueryDetailMetricsCollectorJob job(VisorQueryDetailMetricsCollectorTaskArg arg) { - return new VisorCacheQueryDetailMetricsCollectorJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Collection reduce0(List results) - throws IgniteException { - Map taskRes = new HashMap<>(); - - for (ComputeJobResult res : results) { - if (res.getException() != null) - throw res.getException(); - - Collection metrics = res.getData(); - - VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics); - } - - Collection aggMetrics = taskRes.values(); - - Collection res = new ArrayList<>(aggMetrics.size()); - - for (GridCacheQueryDetailMetricsAdapter m: aggMetrics) - res.add(new VisorQueryDetailMetrics(m)); - - return res; - } - - /** - * Job that will actually collect query metrics. - */ - private static class VisorCacheQueryDetailMetricsCollectorJob - extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Last time when metrics were collected. - * @param debug Debug flag. - */ - protected VisorCacheQueryDetailMetricsCollectorJob(@Nullable VisorQueryDetailMetricsCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** - * @param since Time when metrics were collected last time. - * @param res Response. - * @param metrics Metrics. - */ - private static void aggregateMetrics(long since, Map res, Collection metrics) { - for (GridCacheQueryDetailMetricsAdapter m : metrics) { - if (m.lastStartTime() > since) { - GridCacheQueryDetailMetricsKey key = m.key(); - - GridCacheQueryDetailMetricsAdapter aggMetrics = res.get(key); - - res.put(key, aggMetrics == null ? m : aggMetrics.aggregate(m)); - } - } - } - - /** {@inheritDoc} */ - @Override protected Collection run( - @Nullable VisorQueryDetailMetricsCollectorTaskArg arg - ) throws IgniteException { - assert arg != null; - - GridCacheProcessor cacheProc = ignite.context().cache(); - - Collection cacheNames = cacheProc.cacheNames(); - - Map aggMetrics = new HashMap<>(); - - for (String cacheName : cacheNames) { - if (!isSystemCache(cacheName)) { - IgniteInternalCache cache = cacheProc.cache(cacheName); - - if (cache == null || !cache.context().started()) - continue; - - aggregateMetrics(arg.getSince(), aggMetrics, cache.context().queries().detailMetrics()); - } - } - - return new ArrayList<>(aggMetrics.values()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheQueryDetailMetricsCollectorJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTaskArg.java deleted file mode 100644 index 5c769510010eb..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTaskArg.java +++ /dev/null @@ -1,71 +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; - -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.visor.VisorDataTransferObject; - -/** - * Arguments for task {@link VisorQueryDetailMetricsCollectorTask} - */ -public class VisorQueryDetailMetricsCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Time when metrics were collected last time. */ - private long since; - - /** - * Default constructor. - */ - public VisorQueryDetailMetricsCollectorTaskArg() { - // No-op. - } - - /** - * @param since Time when metrics were collected last time. - */ - public VisorQueryDetailMetricsCollectorTaskArg(long since) { - this.since = since; - } - - /** - * @return Time when metrics were collected last time. - */ - public long getSince() { - return since; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(since); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - since = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryDetailMetricsCollectorTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryFetchFirstPageTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryFetchFirstPageTask.java deleted file mode 100644 index 98d4801c79e58..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryFetchFirstPageTask.java +++ /dev/null @@ -1,107 +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; - -import java.util.Iterator; -import java.util.List; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorEither; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchQueryRows; -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.getQueryHolder; -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.removeQueryHolder; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log; - -/** - * Task for check a query execution and receiving first page of query result. - */ -@GridInternal -public class VisorQueryFetchFirstPageTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorQueryFetchFirstPageJob job(VisorQueryNextPageTaskArg arg) { - return new VisorQueryFetchFirstPageJob(arg, debug); - } - - /** - * Job for collecting first page previously executed SQL or SCAN query. - */ - private static class VisorQueryFetchFirstPageJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorQueryFetchFirstPageJob(VisorQueryNextPageTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorEither run(VisorQueryNextPageTaskArg arg) { - String qryId = arg.getQueryId(); - - long start = U.currentTimeMillis(); - - if (debug) - start = log(ignite.log(), "Fetch query first page started: " + qryId, getClass(), start); - - VisorQueryHolder holder = getQueryHolder(ignite, qryId); - - if (holder.getErr() != null) - return new VisorEither<>(new VisorExceptionWrapper(holder.getErr())); - - List rows = null; - List cols = holder.getColumns(); - - boolean hasMore = cols == null; - - if (cols != null) { - Iterator itr = holder.getIterator(); - rows = fetchQueryRows(itr, qryId, arg.getPageSize()); - hasMore = itr.hasNext(); - } - - if (hasMore) - holder.setAccessed(true); - else - removeQueryHolder(ignite, qryId); - - if (debug) - log(ignite.log(), "Fetch query first page finished: " + qryId, getClass(), start); - - return new VisorEither<>( - new VisorQueryResult(ignite.localNode().id(), qryId, cols, rows, hasMore, holder.duration())); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryFetchFirstPageJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java deleted file mode 100644 index ad84dda2bf2be..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java +++ /dev/null @@ -1,132 +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; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -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.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for query field type description. - */ -public class VisorQueryField extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Schema name. */ - private String schemaName; - - /** Type name. */ - private String typeName; - - /** Field name. */ - private String fieldName; - - /** Field type name. */ - private String fieldTypeName; - - /** - * Default constructor. - */ - public VisorQueryField() { - // No-op. - } - - /** - * Create data transfer object with given parameters. - * - * @param schemaName Schema name. - * @param typeName Type name. - * @param fieldName Name. - * @param fieldTypeName Type. - */ - public VisorQueryField(String schemaName, String typeName, String fieldName, String fieldTypeName) { - this.schemaName = schemaName; - this.typeName = typeName; - this.fieldName = fieldName; - this.fieldTypeName = fieldTypeName; - } - - /** - * @return Schema name. - */ - public String getSchemaName() { - return schemaName; - } - - /** - * @return Type name. - */ - public String getTypeName() { - return typeName; - } - - /** - * @return Field name. - */ - public String getFieldName() { - return fieldName; - } - - /** - * @return Field type name. - */ - public String getFieldTypeName() { - return fieldTypeName; - } - - /** - * @param schema If {@code true} then add schema name to full name. - * @return Fully qualified field name with type name and schema name. - */ - public String getFullName(boolean schema) { - if (!F.isEmpty(typeName)) { - if (schema && !F.isEmpty(schemaName)) - return schemaName + "." + typeName + "." + fieldName; - - return typeName + "." + fieldName; - } - - return fieldName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, schemaName); - U.writeString(out, typeName); - U.writeString(out, fieldName); - U.writeString(out, fieldTypeName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - schemaName = U.readString(in); - typeName = U.readString(in); - fieldName = U.readString(in); - fieldTypeName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryField.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryHolder.java deleted file mode 100644 index af54f27df5c05..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryHolder.java +++ /dev/null @@ -1,171 +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; - -import java.util.Iterator; -import java.util.List; -import java.util.UUID; -import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.internal.processors.query.GridQueryCancel; - -/** - * Holds identify information of executing query and its result. - */ -public class VisorQueryHolder implements AutoCloseable { - /** Prefix for node local key for SQL queries. */ - private static final String SQL_QRY_PREFIX = "VISOR_SQL_QUERY"; - - /** Prefix for node local key for SCAN queries. */ - private static final String SCAN_QRY_PREFIX = "VISOR_SCAN_QUERY"; - - /** Query ID for extraction query data result. */ - private final String qryId; - - /** Cancel query object. */ - private final GridQueryCancel cancel; - - /** Query column descriptors. */ - private volatile List cols; - - /** Error in process of query result receiving. */ - private volatile Throwable err; - - /** Query duration in ms. */ - private volatile long duration; - - /** Flag indicating that this cursor was read from last check. */ - private volatile boolean accessed; - - /** Query cursor. */ - private volatile QueryCursor cur; - - /** Result set iterator. */ - private volatile Iterator itr; - - /** - * @param qryId Query ID. - * @return {@code true} if holder contains SQL query. - */ - public static boolean isSqlQuery(String qryId) { - return qryId.startsWith(SQL_QRY_PREFIX); - } - - /** - * Constructor. - * - * @param sqlQry Flag indicating that holder contains SQL or SCAN query. - * @param cur Query cursor. - * @param cancel Cancel object. - */ - VisorQueryHolder(boolean sqlQry, QueryCursor cur, GridQueryCancel cancel) { - this.cur = cur; - this.cancel = cancel; - - // Generate query ID to store query cursor in node local storage. - qryId = (sqlQry ? SQL_QRY_PREFIX : SCAN_QRY_PREFIX) + "-" + UUID.randomUUID(); - } - - /** - * @return Query ID for extraction query data result. - */ - public String getQueryID() { - return qryId; - } - - /** - * @return Result set iterator. - */ - public synchronized Iterator getIterator() { - assert cur != null; - - if (itr == null) - itr = cur.iterator(); - - return itr; - } - - /** - * @return Query column descriptors. - */ - public List getColumns() { - return cols; - } - - /** - * Complete query execution. - * - * @param cur Query cursor. - * @param duration Duration of query execution. - * @param cols Query column descriptors. - */ - public void complete(QueryCursor cur, long duration, List cols) { - this.cur = cur; - this.duration = duration; - this.cols = cols; - this.accessed = false; - } - - /** {@inheritDoc} */ - @Override public void close() { - if (cur != null) - cur.close(); - - if (cancel != null) - cancel.cancel(); - } - - /** - * @return Error in process of query result receiving. - */ - public Throwable getErr() { - return err; - } - - /** - * Set error caught during query execution. - * - * @param err Error caught during query execution. - */ - public void setError(Throwable err) { - this.err = err; - - if (cur != null) - cur.close(); - } - - /** - * @return Flag indicating that this future was read from last check.. - */ - public boolean isAccessed() { - return accessed; - } - - /** - * @param accessed New accessed. - */ - public void setAccessed(boolean accessed) { - this.accessed = accessed; - } - - /** - * @return Duration of query execution. - */ - public long duration() { - return duration; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java deleted file mode 100644 index f878ab63e7e47..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java +++ /dev/null @@ -1,125 +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; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.cache.query.QueryMetrics; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Data transfer object for cache query metrics. - */ -public class VisorQueryMetrics extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Minimum execution time of query. */ - private long minTime; - - /** Maximum execution time of query. */ - private long maxTime; - - /** Average execution time of query. */ - private double avgTime; - - /** Number of executions. */ - private int execs; - - /** Total number of times a query execution failed. */ - private int fails; - - /** - * Default constructor. - */ - public VisorQueryMetrics() { - // No-op. - } - - /** - * Create data transfer object for given cache metrics. - * @param m Cache query metrics. - */ - public VisorQueryMetrics(QueryMetrics m) { - minTime = m.minimumTime(); - maxTime = m.maximumTime(); - avgTime = m.averageTime(); - execs = m.executions(); - fails = m.fails(); - } - - /** - * @return Minimum execution time of query. - */ - public long getMinimumTime() { - return minTime; - } - - /** - * @return Maximum execution time of query. - */ - public long getMaximumTime() { - return maxTime; - } - - /** - * @return Average execution time of query. - */ - public double getAverageTime() { - return avgTime; - } - - /** - * @return Number of executions. - */ - public int getExecutions() { - return execs; - } - - /** - * @return Total number of times a query execution failed. - */ - public int getFailures() { - return fails; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(minTime); - out.writeLong(maxTime); - out.writeDouble(avgTime); - out.writeInt(execs); - out.writeInt(fails); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - minTime = in.readLong(); - maxTime = in.readLong(); - avgTime = in.readDouble(); - execs = in.readInt(); - fails = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryMetrics.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java deleted file mode 100644 index dc7b09fc53b66..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java +++ /dev/null @@ -1,91 +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; - -import java.util.Iterator; -import java.util.List; -import org.apache.ignite.internal.processors.task.GridInternal; -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.VisorOneNodeTask; - -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.getQueryHolder; -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.removeQueryHolder; - -/** - * Task for collecting next page previously executed SQL or SCAN query. - */ -@GridInternal -public class VisorQueryNextPageTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorQueryNextPageJob job(VisorQueryNextPageTaskArg arg) { - return new VisorQueryNextPageJob(arg, debug); - } - - /** - * Job for collecting next page previously executed SQL or SCAN query. - */ - private static class VisorQueryNextPageJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorQueryNextPageJob(VisorQueryNextPageTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorQueryResult run(VisorQueryNextPageTaskArg arg) { - long start = U.currentTimeMillis(); - - String qryId = arg.getQueryId(); - - VisorQueryHolder holder = getQueryHolder(ignite, qryId); - - Iterator itr = holder.getIterator(); - - List nextRows = VisorQueryHolder.isSqlQuery(qryId) - ? VisorQueryUtils.fetchSqlQueryRows(itr, arg.getPageSize()) - : VisorQueryUtils.fetchScanQueryRows(itr, arg.getPageSize()); - - boolean hasMore = itr.hasNext(); - - if (hasMore) - holder.setAccessed(true); - else - removeQueryHolder(ignite, qryId); - - return new VisorQueryResult(ignite.localNode().id(), qryId, null, nextRows, hasMore, - U.currentTimeMillis() - start); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryNextPageJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java deleted file mode 100644 index d0f62b9363a48..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java +++ /dev/null @@ -1,86 +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; - -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; - -/** - * Arguments for {@link VisorQueryNextPageTask}. - */ -public class VisorQueryNextPageTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** ID of query execution. */ - private String qryId; - - /** Number of rows to load. */ - private int pageSize; - - /** - * Default constructor. - */ - public VisorQueryNextPageTaskArg() { - // No-op. - } - - /** - * @param qryId ID of query execution. - * @param pageSize Number of rows to load. - */ - public VisorQueryNextPageTaskArg(String qryId, int pageSize) { - this.qryId = qryId; - this.pageSize = pageSize; - } - - /** - * @return ID of query execution. - */ - public String getQueryId() { - return qryId; - } - - /** - * @return Number of rows to load. - */ - public int getPageSize() { - return pageSize; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, qryId); - out.writeInt(pageSize); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - qryId = U.readString(in); - pageSize = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryNextPageTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTask.java deleted file mode 100644 index b7d42006b6c1a..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTask.java +++ /dev/null @@ -1,88 +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; - -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorEither; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.getQueryHolder; -import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log; - -/** - * Task for inform a node about awaiting of query result from Web console. - */ -@GridInternal -public class VisorQueryPingTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorQueryFetchFirstPageJob job(VisorQueryNextPageTaskArg arg) { - return new VisorQueryFetchFirstPageJob(arg, debug); - } - - /** - * Job for inform a node about awaiting of query result from Web console. - */ - private static class VisorQueryFetchFirstPageJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorQueryFetchFirstPageJob(VisorQueryNextPageTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorEither run(VisorQueryNextPageTaskArg arg) { - String qryId = arg.getQueryId(); - - long start = U.currentTimeMillis(); - - if (debug) - start = log(ignite.log(), "Ping of query started: " + qryId, getClass(), start); - - VisorQueryHolder holder = getQueryHolder(ignite, qryId); - - if (holder.getErr() != null) - return new VisorEither<>(new VisorExceptionWrapper(holder.getErr())); - - holder.setAccessed(true); - - if (debug) - log(ignite.log(), "Ping of query finished: " + qryId, getClass(), start); - - return new VisorEither<>(new VisorQueryPingTaskResult()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryFetchFirstPageJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTaskResult.java deleted file mode 100644 index 540dd14f1286e..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryPingTaskResult.java +++ /dev/null @@ -1,50 +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; - -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.visor.VisorDataTransferObject; - -/** - * Result for cache query ping tasks. - */ -public class VisorQueryPingTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Default constructor. - */ - public VisorQueryPingTaskResult() { - // No-op. - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException {} - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {} - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryPingTaskResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java deleted file mode 100644 index a0da7972c44b4..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.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.query; - -import org.apache.ignite.IgniteCache; -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; - -/** - * Reset query detail metrics. - */ -@GridInternal -public class VisorQueryResetDetailMetricsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheResetQueryDetailMetricsJob job(Void arg) { - return new VisorCacheResetQueryDetailMetricsJob(arg, debug); - } - - /** - * Job that reset query detail metrics. - */ - private static class VisorCacheResetQueryDetailMetricsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Task argument. - * @param debug Debug flag. - */ - private VisorCacheResetQueryDetailMetricsJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(Void arg) { - for (String cacheName : ignite.cacheNames()) { - IgniteCache cache = ignite.cache(cacheName); - - if (cache == null) - throw new IllegalStateException("Failed to find cache for name: " + cacheName); - - cache.resetQueryDetailMetrics(); - } - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheResetQueryDetailMetricsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java deleted file mode 100644 index a339f8d790474..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java +++ /dev/null @@ -1,75 +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; - -import org.apache.ignite.IgniteCache; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; - -/** - * Reset compute grid query metrics. - */ -@GridInternal -@GridVisorManagementTask -public class VisorQueryResetMetricsTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorQueryResetMetricsJob job(VisorQueryResetMetricsTaskArg arg) { - return new VisorQueryResetMetricsJob(arg, debug); - } - - /** - * Job that reset cache query metrics. - */ - private static class VisorQueryResetMetricsJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param arg Cache name to reset query metrics for. - * @param debug Debug flag. - */ - private VisorQueryResetMetricsJob(VisorQueryResetMetricsTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(VisorQueryResetMetricsTaskArg arg) { - String cacheName = arg.getCacheName(); - - IgniteCache cache = ignite.cache(cacheName); - - if (cache == null) - throw new IllegalStateException("Failed to find cache for name: " + cacheName); - - cache.resetQueryMetrics(); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryResetMetricsJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTaskArg.java deleted file mode 100644 index 8faa43bbd25d2..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTaskArg.java +++ /dev/null @@ -1,72 +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; - -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; - -/** - * Argument for {@link VisorQueryResetMetricsTask}. - */ -public class VisorQueryResetMetricsTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** - * Default constructor. - */ - public VisorQueryResetMetricsTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name. - */ - public VisorQueryResetMetricsTaskArg(String cacheName) { - this.cacheName = cacheName; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryResetMetricsTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java deleted file mode 100644 index f7beae2cfefbe..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java +++ /dev/null @@ -1,152 +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; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collection; -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; -import org.apache.ignite.internal.visor.VisorDataTransferObject; - -/** - * Result for cache query tasks. - */ -public class VisorQueryResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Node where query executed. */ - private UUID resNodeId; - - /** Query ID to store in node local. */ - private String qryId; - - /** Query columns descriptors. */ - private List cols; - - /** Rows fetched from query. */ - private List rows; - - /** Whether query has more rows to fetch. */ - private boolean hasMore; - - /** Query duration */ - private long duration; - - /** - * Default constructor. - */ - public VisorQueryResult() { - // No-op. - } - - /** - * @param resNodeId Node where query executed. - * @param qryId Query ID for future extraction in nextPage() access. - * @param cols Columns descriptors. - * @param rows Rows fetched from query. - * @param hasMore Whether query has more rows to fetch. - * @param duration Query duration. - */ - public VisorQueryResult( - UUID resNodeId, - String qryId, - List cols, - List rows, - boolean hasMore, - long duration - ) { - this.resNodeId = resNodeId; - this.qryId = qryId; - this.cols = cols; - this.rows = rows; - this.hasMore = hasMore; - this.duration = duration; - } - - /** - * @return Response node id. - */ - public UUID getResponseNodeId() { - return resNodeId; - } - - /** - * @return Query id. - */ - public String getQueryId() { - return qryId; - } - - /** - * @return Columns. - */ - public Collection getColumns() { - return cols; - } - - /** - * @return Rows fetched from query. - */ - public List getRows() { - return rows; - } - - /** - * @return Whether query has more rows to fetch. - */ - public boolean isHasMore() { - return hasMore; - } - - /** - * @return Duration of next page fetching. - */ - public long getDuration() { - return duration; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeUuid(out, resNodeId); - U.writeString(out, qryId); - U.writeCollection(out, cols); - U.writeCollection(out, rows); - out.writeBoolean(hasMore); - out.writeLong(duration); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - resNodeId = U.readUuid(in); - qryId = U.readString(in); - cols = U.readList(in); - rows = U.readList(in); - hasMore = in.readBoolean(); - duration = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryResult.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java deleted file mode 100644 index 3c200b2faf581..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java +++ /dev/null @@ -1,60 +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; - -import java.util.regex.Pattern; -import org.apache.ignite.binary.BinaryObject; -import org.apache.ignite.lang.IgniteBiPredicate; - -/** - * Filter scan results by specified substring in string presentation of key or value. - */ -public class VisorQueryScanRegexFilter implements IgniteBiPredicate { - /** */ - private static final long serialVersionUID = 0L; - - /** Regex pattern to search data. */ - private final Pattern ptrn; - - /** - * Create filter instance. - * - * @param caseSensitive Case sensitive flag. - * @param regex Regex search flag. - * @param ptrn String to search in string presentation of key or value. - */ - public VisorQueryScanRegexFilter(boolean caseSensitive, boolean regex, String ptrn) { - int flags = caseSensitive ? 0 : Pattern.CASE_INSENSITIVE; - - this.ptrn = Pattern.compile(regex ? ptrn : ".*?" + Pattern.quote(ptrn) + ".*?", flags); - } - - /** - * Check that key or value contains specified string. - * - * @param key Key object. - * @param val Value object. - * @return {@code true} when string presentation of key or value contain specified string. - */ - @Override public boolean apply(Object key, Object val) { - String k = key instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)key) : key.toString(); - String v = val instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)val) : val.toString(); - - return ptrn.matcher(k).find() || ptrn.matcher(v).find(); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java deleted file mode 100644 index 88a1c8d1e3cee..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java +++ /dev/null @@ -1,91 +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; - -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.internal.processors.query.GridQueryCancel; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.processors.task.GridVisorManagementTask; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorEither; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.scheduleQueryStart; - -/** - * Task for execute SQL fields query and get first page of results. - */ -@GridInternal -@GridVisorManagementTask -public class VisorQueryTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorQueryJob job(VisorQueryTaskArg arg) { - return new VisorQueryJob(arg, debug); - } - - /** - * Job for execute SCAN or SQL query and get first page of results. - */ - private static class VisorQueryJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorQueryJob(VisorQueryTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorEither run(final VisorQueryTaskArg arg) { - try { - UUID nid = ignite.localNode().id(); - - GridQueryCancel cancel = new GridQueryCancel(); - - Map storage = ignite.cluster().nodeLocalMap(); - - VisorQueryHolder holder = new VisorQueryHolder(true, null, cancel); - - storage.put(holder.getQueryID(), holder); - - scheduleQueryStart(ignite, holder, arg, cancel); - - return new VisorEither<>(new VisorQueryResult(nid, holder.getQueryID(), null, null, false, 0)); - } - catch (Throwable e) { - return new VisorEither<>(new VisorExceptionWrapper(e)); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskArg.java deleted file mode 100644 index 5220b02632bb1..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskArg.java +++ /dev/null @@ -1,249 +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; - -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; - -/** - * Arguments for {@link VisorQueryTask}. - */ -public class VisorQueryTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name for query. */ - private String cacheName; - - /** Query text. */ - private String qryTxt; - - /** Distributed joins enabled flag. */ - private boolean distributedJoins; - - /** Enforce join order flag. */ - private boolean enforceJoinOrder; - - /** Query contains only replicated tables flag.*/ - private boolean replicatedOnly; - - /** Flag whether to execute query locally. */ - private boolean loc; - - /** Result batch size. */ - private int pageSize; - - /** Lazy query execution flag */ - private boolean lazy; - - /** Collocation flag. */ - private boolean collocated; - - /** - * Default constructor. - */ - public VisorQueryTaskArg() { - // No-op. - } - - /** - * @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 replicatedOnly {@code true} then query contains only replicated tables. - * @param loc Flag whether to execute query locally. - * @param pageSize Result batch size. - */ - public VisorQueryTaskArg( - String cacheName, - String qryTxt, - boolean distributedJoins, - boolean enforceJoinOrder, - boolean replicatedOnly, - boolean loc, - int pageSize - ) { - this(cacheName, qryTxt, distributedJoins, enforceJoinOrder, replicatedOnly, loc, pageSize, false, false); - } - - /** - * @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 replicatedOnly {@code true} then query contains only replicated tables. - * @param loc Flag whether to execute query locally. - * @param pageSize Result batch size. - * @param lazy Lazy query execution flag. - */ - public VisorQueryTaskArg( - String cacheName, - String qryTxt, - boolean distributedJoins, - boolean enforceJoinOrder, - boolean replicatedOnly, - boolean loc, - int pageSize, - boolean lazy - ) { - this(cacheName, qryTxt, distributedJoins, enforceJoinOrder, replicatedOnly, loc, pageSize, lazy, false); - } - - /** - * @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 replicatedOnly {@code true} then query contains only replicated tables. - * @param loc Flag whether to execute query locally. - * @param pageSize Result batch size. - * @param lazy Lazy query execution flag. - * @param collocated Collocation flag. - */ - public VisorQueryTaskArg( - String cacheName, - String qryTxt, - boolean distributedJoins, - boolean enforceJoinOrder, - boolean replicatedOnly, - boolean loc, - int pageSize, - boolean lazy, - boolean collocated - ) { - this.cacheName = cacheName; - this.qryTxt = qryTxt; - this.distributedJoins = distributedJoins; - this.enforceJoinOrder = enforceJoinOrder; - this.replicatedOnly = replicatedOnly; - this.loc = loc; - this.pageSize = pageSize; - this.lazy = lazy; - this.collocated = collocated; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return Query txt. - */ - public String getQueryText() { - return qryTxt; - } - - /** - * @return Distributed joins enabled flag. - */ - public boolean isDistributedJoins() { - return distributedJoins; - } - - /** - * @return Enforce join order flag. - */ - public boolean isEnforceJoinOrder() { - return enforceJoinOrder; - } - - /** - * @return {@code true} If the query contains only replicated tables. - */ - public boolean isReplicatedOnly() { - return replicatedOnly; - } - - /** - * @return {@code true} If query should be executed locally. - */ - public boolean isLocal() { - return loc; - } - - /** - * @return Page size. - */ - public int getPageSize() { - return pageSize; - } - - /** - * Lazy query execution flag. - * - * @return Lazy flag. - */ - public boolean getLazy() { - return lazy; - } - - /** - * Flag indicating if this query is collocated. - * - * @return {@code true} If the query is collocated. - */ - public boolean isCollocated() { - return collocated; - } - - /** {@inheritDoc} */ - @Override public byte getProtocolVersion() { - return V3; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - U.writeString(out, qryTxt); - out.writeBoolean(distributedJoins); - out.writeBoolean(enforceJoinOrder); - out.writeBoolean(loc); - out.writeInt(pageSize); - out.writeBoolean(lazy); - out.writeBoolean(collocated); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - qryTxt = U.readString(in); - distributedJoins = in.readBoolean(); - enforceJoinOrder = in.readBoolean(); - loc = in.readBoolean(); - pageSize = in.readInt(); - - if (protoVer > V1) - lazy = in.readBoolean(); - - if (protoVer > V2) - collocated = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorQueryTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java deleted file mode 100644 index 39f2251b9864a..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java +++ /dev/null @@ -1,519 +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; - -import java.math.BigDecimal; -import java.net.URL; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.ConcurrentMap; -import javax.cache.Cache; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteException; -import org.apache.ignite.binary.BinaryObject; -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.binary.BinaryType; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.cache.query.ScanQuery; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.binary.BinaryObjectEx; -import org.apache.ignite.internal.processors.cache.query.QueryCursorEx; -import org.apache.ignite.internal.processors.query.GridQueryCancel; -import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata; -import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter; -import org.apache.ignite.internal.util.IgniteUtils; -import org.apache.ignite.internal.util.lang.GridPlainRunnable; -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.SB; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiPredicate; - -import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MANAGEMENT_POOL; - -/** - * Contains utility methods for Visor query tasks and jobs. - */ -public class VisorQueryUtils { - /** How long to store future with query in node local map: 5 minutes. */ - public static final Integer RMV_DELAY = 5 * 60 * 1000; - - /** Message for query result expired error. */ - private static final String SQL_QRY_RESULTS_EXPIRED_ERR = "SQL query results are expired."; - - /** Message for scan result expired error. */ - private static final String SCAN_QRY_RESULTS_EXPIRED_ERR = "Scan query results are expired."; - - /** Columns for SCAN queries. */ - public static final List SCAN_COL_NAMES = Arrays.asList( - new VisorQueryField(null, null, "Key Class", ""), new VisorQueryField(null, null, "Key", ""), - new VisorQueryField(null, null, "Value Class", ""), new VisorQueryField(null, null, "Value", "") - ); - - /** - * @param o Source object. - * @return String representation of object class. - */ - private static String typeOf(Object o) { - if (o != null) { - Class clazz = o.getClass(); - - return clazz.isArray() ? IgniteUtils.compact(clazz.getComponentType().getName()) + "[]" - : IgniteUtils.compact(o.getClass().getName()); - } - else - return "n/a"; - } - - /** - * @param o Object. - * @return String representation of value. - */ - private static String valueOf(Object o) { - if (o == null) - return "null"; - - if (o instanceof byte[]) - return "size=" + ((byte[])o).length; - - if (o instanceof Byte[]) - return "size=" + ((Byte[])o).length; - - if (o instanceof Object[]) { - return "size=" + ((Object[])o).length + - ", values=[" + S.joinToString(Arrays.asList((Object[])o), ", ", "...", 120, 0) + "]"; - } - - if (o instanceof BinaryObject) - return binaryToString((BinaryObject)o); - - return o.toString(); - } - - /** - * Fetch rows from SCAN query future. - * - * @param itr Result set iterator. - * @param pageSize Number of rows to fetch. - * @return Fetched rows. - */ - public static List fetchScanQueryRows(Iterator itr, int pageSize) { - List rows = new ArrayList<>(); - - int cnt = 0; - - Iterator> scanItr = (Iterator>)itr; - - while (scanItr.hasNext() && cnt < pageSize) { - Cache.Entry next = scanItr.next(); - - Object k = next.getKey(); - Object v = next.getValue(); - - rows.add(new Object[] {typeOf(k), valueOf(k), typeOf(v), valueOf(v)}); - - cnt++; - } - - return rows; - } - - /** - * Checks is given object is one of known types. - * - * @param obj Object instance to check. - * @return {@code true} if it is one of known types. - */ - private static boolean isKnownType(Object obj) { - return obj instanceof String || - obj instanceof Boolean || - obj instanceof Byte || - obj instanceof Integer || - obj instanceof Long || - obj instanceof Short || - obj instanceof Date || - obj instanceof Double || - obj instanceof Float || - obj instanceof BigDecimal || - obj instanceof URL; - } - - /** - * Convert Binary object to string. - * - * @param obj Binary object. - * @return String representation of Binary object. - */ - public static String binaryToString(BinaryObject obj) { - int hash = obj.hashCode(); - - if (obj instanceof BinaryObjectEx) { - BinaryObjectEx objEx = (BinaryObjectEx)obj; - - BinaryType meta; - - try { - meta = ((BinaryObjectEx)obj).rawType(); - } - catch (BinaryObjectException ignore) { - meta = null; - } - - if (meta != null) { - if (meta.isEnum()) { - try { - return obj.deserialize().toString(); - } - catch (BinaryObjectException ignore) { - // NO-op. - } - } - - SB buf = new SB(meta.typeName()); - - if (meta.fieldNames() != null) { - buf.a(" [hash=").a(hash); - - for (String name : meta.fieldNames()) { - Object val = objEx.field(name); - - buf.a(", ").a(name).a('=').a(val); - } - - buf.a(']'); - - return buf.toString(); - } - } - } - - return S.toString(obj.getClass().getSimpleName(), - "hash", hash, false, - "typeId", obj.type().typeId(), true); - } - - /** - * Convert object that can be passed to client. - * - * @param original Source object. - * @return Converted value. - */ - public static Object convertValue(Object original) { - if (original == null) - return null; - else if (isKnownType(original)) - return original; - else if (original instanceof BinaryObject) - return binaryToString((BinaryObject)original); - else - return original.getClass().isArray() ? "binary" : original.toString(); - } - - /** - * Collects rows from sql query future, first time creates meta and column names arrays. - * - * @param itr Result set iterator. - * @param pageSize Number of rows to fetch. - * @return Fetched rows. - */ - public static List fetchSqlQueryRows(Iterator itr, int pageSize) { - List rows = new ArrayList<>(); - - int cnt = 0; - - Iterator> sqlItr = (Iterator>)itr; - - while (sqlItr.hasNext() && cnt < pageSize) { - List next = sqlItr.next(); - - int sz = next.size(); - - Object[] row = new Object[sz]; - - for (int i = 0; i < sz; i++) - row[i] = convertValue(next.get(i)); - - rows.add(row); - - cnt++; - } - - return rows; - } - - /** - * Get holder for query or throw exception if not found. - * - * @param ignite IgniteEx instance. - * @param qryId Query ID to get holder. - * @return Query holder for specified query ID. - * @throws IgniteException When holder is not found. - */ - public static VisorQueryHolder getQueryHolder(final IgniteEx ignite, final String qryId) throws IgniteException { - ConcurrentMap storage = ignite.cluster().nodeLocalMap(); - - VisorQueryHolder holder = storage.get(qryId); - - if (holder == null) - throw new IgniteException(VisorQueryHolder.isSqlQuery(qryId) - ? SQL_QRY_RESULTS_EXPIRED_ERR - : SCAN_QRY_RESULTS_EXPIRED_ERR); - - return holder; - } - - /** - * Remove query holder from local storage for query with specified ID and cancel query if it is in progress. - * - * @param ignite IgniteEx instance. - * @param qryId Query ID to get holder. - */ - public static void removeQueryHolder(final IgniteEx ignite, final String qryId) { - ConcurrentMap storage = ignite.cluster().nodeLocalMap(); - VisorQueryHolder holder = storage.remove(qryId); - - if (holder != null) - holder.close(); - } - - /** - * Fetch rows from query cursor. - * - * @param itr Result set iterator. - * @param qryId Query ID. - * @param pageSize Page size. - */ - public static List fetchQueryRows(Iterator itr, String qryId, int pageSize) { - return itr.hasNext() - ? (VisorQueryHolder.isSqlQuery(qryId) - ? fetchSqlQueryRows(itr, pageSize) - : fetchScanQueryRows(itr, pageSize)) - : Collections.emptyList(); - } - - /** - * Schedule start of SQL query execution. - * - * @param ignite IgniteEx instance. - * @param holder Query holder object. - * @param arg Query task argument with query properties. - * @param cancel Object to cancel query. - */ - public static void scheduleQueryStart( - final IgniteEx ignite, - final VisorQueryHolder holder, - final VisorQueryTaskArg arg, - final GridQueryCancel cancel - ) { - ignite.context().closure().runLocalSafe((GridPlainRunnable)() -> { - try { - SqlFieldsQuery qry = new SqlFieldsQuery(arg.getQueryText()); - - qry.setPageSize(arg.getPageSize()); - qry.setLocal(arg.isLocal()); - qry.setDistributedJoins(arg.isDistributedJoins()); - qry.setCollocated(arg.isCollocated()); - qry.setEnforceJoinOrder(arg.isEnforceJoinOrder()); - qry.setReplicatedOnly(arg.isReplicatedOnly()); - qry.setLazy(arg.getLazy()); - - String cacheName = arg.getCacheName(); - - if (!F.isEmpty(cacheName)) - qry.setSchema(cacheName); - - long start = U.currentTimeMillis(); - - List>> qryCursors = ignite - .context() - .query() - .querySqlFields(null, qry, null, true, false, cancel); - - // In case of multiple statements leave opened only last cursor. - for (int i = 0; i < qryCursors.size() - 1; i++) - U.closeQuiet(qryCursors.get(i)); - - // In case of multiple statements return last cursor as result. - FieldsQueryCursor> cur = F.last(qryCursors); - - try { - // Ensure holder was not removed from node local storage from separate thread if user cancel query. - VisorQueryHolder actualHolder = getQueryHolder(ignite, holder.getQueryID()); - - List meta = ((QueryCursorEx)cur).fieldsMeta(); - - if (meta == null) - actualHolder.setError(new SQLException("Fail to execute query. No metadata available.")); - else { - List cols = new ArrayList<>(meta.size()); - - for (GridQueryFieldMetadata col : meta) { - cols.add(new VisorQueryField( - col.schemaName(), - col.typeName(), - col.fieldName(), - col.fieldTypeName()) - ); - } - - actualHolder.complete(cur, U.currentTimeMillis() - start, cols); - - scheduleQueryHolderRemoval(ignite, actualHolder.getQueryID()); - } - } - catch (Throwable e) { - U.closeQuiet(cur); - - throw e; - } - } - catch (Throwable e) { - holder.setError(e); - } - }, MANAGEMENT_POOL); - } - - /** - * Schedule start of SCAN query execution. - * - * @param ignite IgniteEx instance. - * @param holder Query holder object. - * @param arg Query task argument with query properties. - */ - public static void scheduleScanStart( - final IgniteEx ignite, - final VisorQueryHolder holder, - final VisorScanQueryTaskArg arg - ) { - ignite.context().closure().runLocalSafe((GridPlainRunnable)() -> { - try { - IgniteCache c = ignite.cache(arg.getCacheName()); - String filterText = arg.getFilter(); - IgniteBiPredicate filter = null; - - if (!F.isEmpty(filterText)) - filter = new VisorQueryScanRegexFilter(arg.isCaseSensitive(), arg.isRegEx(), filterText); - - QueryCursor> cur; - - long start = U.currentTimeMillis(); - - if (arg.isNear()) - cur = new VisorNearCacheCursor<>(c.localEntries(CachePeekMode.NEAR).iterator()); - else { - ScanQuery qry = new ScanQuery<>(filter); - qry.setPageSize(arg.getPageSize()); - qry.setLocal(arg.isLocal()); - - cur = c.withKeepBinary().query(qry); - } - - try { - // Ensure holder was not removed from node local storage from separate thread if user cancel query. - VisorQueryHolder actualHolder = getQueryHolder(ignite, holder.getQueryID()); - - actualHolder.complete(cur, U.currentTimeMillis() - start, SCAN_COL_NAMES); - - scheduleQueryHolderRemoval(ignite, actualHolder.getQueryID()); - } - catch (Throwable e) { - U.closeQuiet(cur); - - throw e; - } - } - catch (Throwable e) { - holder.setError(e); - } - }, MANAGEMENT_POOL); - } - - /** - * Wrapper for cache iterator to behave like {@link QueryCursor}. - */ - private static class VisorNearCacheCursor implements QueryCursor { - /** Wrapped iterator. */ - private final Iterator it; - - /** - * Wrapping constructor. - * - * @param it Near cache iterator to wrap. - */ - private VisorNearCacheCursor(Iterator it) { - this.it = it; - } - - /** {@inheritDoc} */ - @Override public List getAll() { - List all = new ArrayList<>(); - - while (it.hasNext()) - all.add(it.next()); - - return all; - } - - /** {@inheritDoc} */ - @Override public void close() { - // Nothing to close. - } - - /** {@inheritDoc} */ - @Override public Iterator iterator() { - return it; - } - } - - /** - * Schedule clearing of query context by timeout. - * - * @param qryId Unique query result id. - * @param ignite IgniteEx instance. - */ - public static void scheduleQueryHolderRemoval(final IgniteEx ignite, final String qryId) { - ignite.context().timeout().addTimeoutObject(new GridTimeoutObjectAdapter(RMV_DELAY) { - @Override public void onTimeout() { - ConcurrentMap storage = ignite.cluster().nodeLocalMap(); - - VisorQueryHolder holder = storage.get(qryId); - - if (holder != null) { - if (holder.isAccessed()) { - holder.setAccessed(false); - - // Holder was accessed, we need to keep it for one more period. - scheduleQueryHolderRemoval(ignite, qryId); - } - else { - // Remove stored cursor otherwise. - removeQueryHolder(ignite, qryId); - } - } - } - }); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java deleted file mode 100644 index 535799fb94a54..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java +++ /dev/null @@ -1,101 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.IgniteException; -import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.processors.query.GridRunningQueryInfo; -import org.apache.ignite.internal.processors.task.GridInternal; -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.jetbrains.annotations.Nullable; - -/** - * Task to collect currently running queries. - */ -@GridInternal -public class VisorRunningQueriesCollectorTask extends - VisorMultiNodeTask>, Collection> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCollectRunningQueriesJob job(VisorRunningQueriesCollectorTaskArg arg) { - return new VisorCollectRunningQueriesJob(arg, debug); - } - - /** {@inheritDoc} */ - @Nullable @Override protected Map> reduce0(List results) throws IgniteException { - Map> map = new HashMap<>(); - - for (ComputeJobResult res : results) - if (res.getException() == null) { - Collection queries = res.getData(); - - map.put(res.getNode().id(), queries); - } - - return map; - } - - /** - * Job to collect currently running queries from node. - */ - private static class VisorCollectRunningQueriesJob - extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Flag indicating whether debug information should be printed into node log. - */ - protected VisorCollectRunningQueriesJob(@Nullable VisorRunningQueriesCollectorTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Collection run(@Nullable VisorRunningQueriesCollectorTaskArg arg) - throws IgniteException { - assert arg != null; - - Collection queries = ignite.context().query() - .runningQueries(arg.getDuration()); - - Collection res = new ArrayList<>(queries.size()); - - long curTime = U.currentTimeMillis(); - - for (GridRunningQueryInfo qry : queries) - res.add(new VisorRunningQuery(qry.id(), qry.query(), qry.queryType(), qry.schemaName(), - qry.startTime(), curTime - qry.startTime(), - qry.cancelable(), qry.local())); - - return res; - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTaskArg.java deleted file mode 100644 index 2de61c5cc008e..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTaskArg.java +++ /dev/null @@ -1,71 +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; - -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.visor.VisorDataTransferObject; - -/** - * Arguments for task {@link VisorRunningQueriesCollectorTask} - */ -public class VisorRunningQueriesCollectorTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Duration to check. */ - private long duration; - - /** - * Default constructor. - */ - public VisorRunningQueriesCollectorTaskArg() { - // No-op. - } - - /** - * @param duration Duration to check. - */ - public VisorRunningQueriesCollectorTaskArg(long duration) { - this.duration = duration; - } - - /** - * @return Duration to check. - */ - public long getDuration() { - return duration; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(duration); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - duration = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorRunningQueriesCollectorTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java deleted file mode 100644 index 47f4436fbefaf..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java +++ /dev/null @@ -1,175 +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; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType; -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; - -/** - * Descriptor of running query. - */ -public class VisorRunningQuery extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private long id; - - /** Query text. */ - private String qry; - - /** Query type. */ - private GridCacheQueryType qryType; - - /** Schema name. */ - private String schemaName; - - /** */ - private long startTime; - - /** */ - private long duration; - - /** */ - private boolean cancellable; - - /** */ - private boolean loc; - - /** - * Default constructor. - */ - public VisorRunningQuery() { - // No-op. - } - - /** - * Construct data transfer object for running query information. - * - * @param id Query ID. - * @param qry Query text. - * @param qryType Query type. - * @param schemaName Query schema name. - * @param startTime Query start time. - * @param duration Query current duration. - * @param cancellable {@code true} if query can be canceled. - * @param loc {@code true} if query is local. - */ - public VisorRunningQuery(long id, String qry, GridCacheQueryType qryType, String schemaName, - long startTime, long duration, - boolean cancellable, boolean loc) { - this.id = id; - this.qry = qry; - this.qryType = qryType; - this.schemaName = schemaName; - this.startTime = startTime; - this.duration = duration; - this.cancellable = cancellable; - this.loc = loc; - } - - /** - * @return Query ID. - */ - public long getId() { - return id; - } - - /** - * @return Query txt. - */ - public String getQuery() { - return qry; - } - - /** - * @return Query type. - */ - public GridCacheQueryType getQueryType() { - return qryType; - } - - /** - * @return Schema name. - */ - public String getSchemaName() { - return schemaName; - } - - /** - * @return Query start time. - */ - public long getStartTime() { - return startTime; - } - - /** - * @return Query duration. - */ - public long getDuration() { - return duration; - } - - /** - * @return {@code true} if query can be cancelled. - */ - public boolean isCancelable() { - return cancellable; - } - - /** - * @return {@code true} if query is local. - */ - public boolean isLocal() { - return loc; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeLong(id); - U.writeString(out, qry); - U.writeEnum(out, qryType); - U.writeString(out, schemaName); - out.writeLong(startTime); - out.writeLong(duration); - out.writeBoolean(cancellable); - out.writeBoolean(loc); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - id = in.readLong(); - qry = U.readString(in); - qryType = GridCacheQueryType.fromOrdinal(in.readByte()); - schemaName = U.readString(in); - startTime = in.readLong(); - duration = in.readLong(); - cancellable = in.readBoolean(); - loc = in.readBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorRunningQuery.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java deleted file mode 100644 index 7c0fac9710f86..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java +++ /dev/null @@ -1,83 +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; - -import java.util.UUID; -import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.visor.VisorEither; -import org.apache.ignite.internal.visor.VisorJob; -import org.apache.ignite.internal.visor.VisorOneNodeTask; -import org.apache.ignite.internal.visor.util.VisorExceptionWrapper; - -import static org.apache.ignite.internal.visor.query.VisorQueryUtils.scheduleScanStart; - -/** - * Task for execute SCAN query and get first page of results. - */ -@GridInternal -public class VisorScanQueryTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorScanQueryJob job(VisorScanQueryTaskArg arg) { - return new VisorScanQueryJob(arg, debug); - } - - /** - * Job for execute SCAN query and get first page of results. - */ - private static class VisorScanQueryJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - private VisorScanQueryJob(VisorScanQueryTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorEither run(final VisorScanQueryTaskArg arg) { - try { - UUID nid = ignite.localNode().id(); - - VisorQueryHolder holder = new VisorQueryHolder(false, null, null); - - ignite.cluster().nodeLocalMap().put(holder.getQueryID(), holder); - - scheduleScanStart(ignite, holder, arg); - - return new VisorEither<>(new VisorQueryResult(nid, holder.getQueryID(), null, null, false, 0)); - } - catch (Throwable e) { - return new VisorEither<>(new VisorExceptionWrapper(e)); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorScanQueryJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTaskArg.java deleted file mode 100644 index 314a7c4681ab3..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTaskArg.java +++ /dev/null @@ -1,157 +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; - -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; - -/** - * Arguments for {@link VisorScanQueryTask}. - */ -public class VisorScanQueryTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name for query. */ - private String cacheName; - - /** Filter text. */ - private String filter; - - /** Filter is regular expression */ - private boolean regEx; - - /** Case sensitive filtration */ - private boolean caseSensitive; - - /** Scan of near cache */ - private boolean near; - - /** Flag whether to execute query locally. */ - private boolean loc; - - /** Result batch size. */ - private int pageSize; - - /** - * Default constructor. - */ - public VisorScanQueryTaskArg() { - // No-op. - } - - /** - * @param cacheName Cache name for query. - * @param filter Filter text. - * @param regEx Filter is regular expression. - * @param caseSensitive Case sensitive filtration. - * @param near Scan near cache. - * @param loc Flag whether to execute query locally. - * @param pageSize Result batch size. - */ - public VisorScanQueryTaskArg(String cacheName, String filter, boolean regEx, boolean caseSensitive, boolean near, - boolean loc, int pageSize) { - this.cacheName = cacheName; - this.filter = filter; - this.regEx = regEx; - this.caseSensitive = caseSensitive; - this.near = near; - this.loc = loc; - this.pageSize = pageSize; - } - - /** - * @return Cache name. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return Filter is regular expression. - */ - public boolean isRegEx() { - return regEx; - } - - /** - * @return Filter. - */ - public String getFilter() { - return filter; - } - - /** - * @return Case sensitive filtration. - */ - public boolean isCaseSensitive() { - return caseSensitive; - } - - /** - * @return Scan of near cache. - */ - public boolean isNear() { - return near; - } - - /** - * @return {@code true} if query should be executed locally. - */ - public boolean isLocal() { - return loc; - } - - /** - * @return Page size. - */ - public int getPageSize() { - return pageSize; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, cacheName); - U.writeString(out, filter); - out.writeBoolean(regEx); - out.writeBoolean(caseSensitive); - out.writeBoolean(near); - out.writeBoolean(loc); - out.writeInt(pageSize); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - cacheName = U.readString(in); - filter = U.readString(in); - regEx = in.readBoolean(); - caseSensitive = in.readBoolean(); - near = in.readBoolean(); - loc = in.readBoolean(); - pageSize = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorScanQueryTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java deleted file mode 100644 index 4cfd1503fcb7d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java +++ /dev/null @@ -1,166 +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.service; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Map; -import java.util.UUID; -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.internal.visor.util.VisorTaskUtils; -import org.apache.ignite.services.ServiceDescriptor; - -/** - * Data transfer object for {@link ServiceDescriptor} object. - */ -public class VisorServiceDescriptor extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Service name. */ - private String name; - - /** Service class. */ - private String srvcCls; - - /** Maximum allowed total number of deployed services in the grid, {@code 0} for unlimited. */ - private int totalCnt; - - /** Maximum allowed number of deployed services on each node. */ - private int maxPerNodeCnt; - - /** Cache name used for key-to-node affinity calculation. */ - private String cacheName; - - /** ID of grid node that initiated the service deployment. */ - private UUID originNodeId; - - /** - * Service deployment topology snapshot. - * Number of service instances deployed on a node mapped to node ID. - */ - private Map topSnapshot; - - /** - * Default constructor. - */ - public VisorServiceDescriptor() { - // No-op. - } - - /** - * Create task result with given parameters - * - * @param srvc Service descriptor to transfer. - */ - public VisorServiceDescriptor(ServiceDescriptor srvc) { - name = srvc.name(); - - try { - srvcCls = VisorTaskUtils.compactClass(srvc.serviceClass()); - } - catch (Throwable e) { - srvcCls = e.getClass().getName() + ": " + e.getMessage(); - } - - totalCnt = srvc.totalCount(); - maxPerNodeCnt = srvc.maxPerNodeCount(); - cacheName = srvc.cacheName(); - originNodeId = srvc.originNodeId(); - topSnapshot = srvc.topologySnapshot(); - } - - /** - * @return Service name. - */ - public String getName() { - return name; - } - - /** - * @return Service class. - */ - public String getServiceClass() { - return srvcCls; - } - - /** - * @return Maximum allowed total number of deployed services in the grid, 0 for unlimited. - */ - public int getTotalCnt() { - return totalCnt; - } - - /** - * @return Maximum allowed number of deployed services on each node. - */ - public int getMaxPerNodeCnt() { - return maxPerNodeCnt; - } - - /** - * @return Cache name used for key-to-node affinity calculation. - */ - public String getCacheName() { - return cacheName; - } - - /** - * @return ID of grid node that initiated the service deployment. - */ - public UUID getOriginNodeId() { - return originNodeId; - } - - /** - * @return Service deployment topology snapshot. Number of service instances deployed on a node mapped to node ID. - */ - public Map getTopologySnapshot() { - return topSnapshot; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeString(out, name); - U.writeString(out, srvcCls); - out.writeInt(totalCnt); - out.writeInt(maxPerNodeCnt); - U.writeString(out, cacheName); - U.writeUuid(out, originNodeId); - U.writeMap(out, topSnapshot); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - name = U.readString(in); - srvcCls = U.readString(in); - totalCnt = in.readInt(); - maxPerNodeCnt = in.readInt(); - cacheName = U.readString(in); - originNodeId = U.readUuid(in); - topSnapshot = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorServiceDescriptor.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java deleted file mode 100644 index e2a1fb7024720..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java +++ /dev/null @@ -1,77 +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.service; - -import java.util.ArrayList; -import java.util.Collection; -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.services.ServiceDescriptor; - -/** - * Task for collect topology service configuration. - */ -@GridInternal -public class VisorServiceTask extends VisorOneNodeTask> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorServiceJob job(Void arg) { - return new VisorServiceJob(arg, debug); - } - - /** - * Job for collect topology service configuration. - */ - private static class VisorServiceJob extends VisorJob> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job with specified argument. - * - * @param arg Job argument. - * @param debug Debug flag. - */ - protected VisorServiceJob(Void arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Collection run(final Void arg) { - Collection res = new ArrayList<>(); - - if (ignite.cluster().active()) { - Collection services = ignite.services().serviceDescriptors(); - - for (ServiceDescriptor srvc : services) - res.add(new VisorServiceDescriptor(srvc)); - } - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorServiceJob.class, this); - } - } -} 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 deleted file mode 100644 index ca319dbec525f..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEventMapper.java +++ /dev/null @@ -1,147 +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.util; - -import java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.events.DeploymentEvent; -import org.apache.ignite.events.DiscoveryEvent; -import org.apache.ignite.events.Event; -import org.apache.ignite.events.JobEvent; -import org.apache.ignite.events.TaskEvent; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent; -import org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent; -import org.apache.ignite.internal.visor.event.VisorGridEvent; -import org.apache.ignite.internal.visor.event.VisorGridJobEvent; -import org.apache.ignite.internal.visor.event.VisorGridTaskEvent; -import org.apache.ignite.lang.IgniteClosure; -import org.apache.ignite.lang.IgniteUuid; - -/** - * Mapper from grid event to Visor data transfer object. - */ -public class VisorEventMapper implements IgniteClosure { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Map grid event to Visor data transfer object. - * - * @param evt Grid event. - * @param type Event's 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. - * @return Visor data transfer object for event. - */ - protected VisorGridEvent map(Event evt, int type, IgniteUuid id, String name, UUID nid, long ts, String msg, - String shortDisplay) { - if (evt instanceof TaskEvent) - return taskEvent((TaskEvent)evt, type, id, name, nid, ts, msg, shortDisplay); - - if (evt instanceof JobEvent) - return jobEvent((JobEvent)evt, type, id, name, nid, ts, msg, shortDisplay); - - if (evt instanceof DeploymentEvent) - return deploymentEvent((DeploymentEvent)evt, type, id, name, nid, ts, msg, shortDisplay); - - if (evt instanceof DiscoveryEvent) - return discoveryEvent((DiscoveryEvent)evt, type, id, name, nid, ts, msg, shortDisplay); - - return null; - } - - /** - * @param te Task event. - * @param type Event's 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. - * @return Visor data transfer object for event. - */ - protected VisorGridEvent taskEvent(TaskEvent te, int type, IgniteUuid id, String name, UUID nid, long ts, - String msg, String shortDisplay) { - return new VisorGridTaskEvent(type, id, name, nid, ts, msg, shortDisplay, - te.taskName(), te.taskClassName(), te.taskSessionId(), te.internal()); - } - - /** - * @param je Job event. - * @param type Event's 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. - * @return Visor data transfer object for event. - */ - protected VisorGridEvent jobEvent(JobEvent je, int type, IgniteUuid id, String name, UUID nid, long ts, - String msg, String shortDisplay) { - return new VisorGridJobEvent(type, id, name, nid, ts, msg, shortDisplay, je.taskName(), je.taskClassName(), - je.taskSessionId(), je.jobId()); - } - - /** - * @param de Deployment event. - * @param type Event's 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. - * @return Visor data transfer object for event. - */ - protected VisorGridEvent deploymentEvent(DeploymentEvent de, int type, IgniteUuid id, String name, UUID nid, - long ts, String msg, String shortDisplay) { - return new VisorGridDeploymentEvent(type, id, name, nid, ts, msg, shortDisplay, de.alias()); - } - - /** - * @param de Discovery event. - * @param type Event's 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. - * @return Visor data transfer object for event. - */ - 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 VisorGridDiscoveryEvent(type, id, name, nid, ts, msg, shortDisplay, node.id(), - F.first(node.addresses()), node.isDaemon(), de.topologyVersion()); - } - - /** {@inheritDoc} */ - @Override public VisorGridEvent apply(Event evt) { - return map(evt, evt.type(), evt.id(), evt.name(), evt.node().id(), evt.timestamp(), evt.message(), - evt.shortDisplay()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java deleted file mode 100644 index 449395deae7b5..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java +++ /dev/null @@ -1,1019 +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.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Map; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.jetbrains.annotations.Nullable; - -/** - * Helper class to get MIME type. - */ -public class VisorMimeTypes { - /** Bytes to read from file for mimetype detection. */ - private static final int PREVIEW_SIZE = 11; - - /** Common MIME types. */ - private static final Map mimeTypes = U.newHashMap(810); - - static { - mimeTypes.put("mseed", "application/vnd.fdsn.mseed"); - mimeTypes.put("vsf", "application/vnd.vsf"); - mimeTypes.put("cmdf", "chemical/x-cmdf"); - mimeTypes.put("mxs", "application/vnd.triscape.mxs"); - mimeTypes.put("m4v", "video/x-m4v"); - mimeTypes.put("oga", "audio/ogg"); - mimeTypes.put("ogg", "audio/ogg"); - mimeTypes.put("spx", "audio/ogg"); - mimeTypes.put("shf", "application/shf+xml"); - mimeTypes.put("jisp", "application/vnd.jisp"); - mimeTypes.put("sgl", "application/vnd.stardivision.writer-global"); - mimeTypes.put("gxt", "application/vnd.geonext"); - mimeTypes.put("mp4s", "application/mp4"); - mimeTypes.put("smi", "application/smil+xml"); - mimeTypes.put("smil", "application/smil+xml"); - mimeTypes.put("xop", "application/xop+xml"); - mimeTypes.put("spl", "application/x-futuresplash"); - mimeTypes.put("spq", "application/scvp-vp-request"); - mimeTypes.put("bh2", "application/vnd.fujitsu.oasysprs"); - mimeTypes.put("xpm", "image/x-xpixmap"); - mimeTypes.put("gdl", "model/vnd.gdl"); - mimeTypes.put("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"); - mimeTypes.put("ser", "application/java-serialized-object"); - mimeTypes.put("ghf", "application/vnd.groove-help"); - mimeTypes.put("mc1", "application/vnd.medcalcdata"); - mimeTypes.put("cdy", "application/vnd.cinderella"); - mimeTypes.put("nns", "application/vnd.noblenet-sealer"); - mimeTypes.put("msty", "application/vnd.muvee.style"); - mimeTypes.put("aas", "application/x-authorware-seg"); - mimeTypes.put("p", "text/x-pascal"); - mimeTypes.put("pas", "text/x-pascal"); - mimeTypes.put("rdz", "application/vnd.data-vision.rdz"); - mimeTypes.put("js", "text/javascript"); - mimeTypes.put("fzs", "application/vnd.fuzzysheet"); - mimeTypes.put("csml", "chemical/x-csml"); - mimeTypes.put("psf", "application/x-font-linux-psf"); - mimeTypes.put("afp", "application/vnd.ibm.modcap"); - mimeTypes.put("listafp", "application/vnd.ibm.modcap"); - mimeTypes.put("list3820", "application/vnd.ibm.modcap"); - mimeTypes.put("qt", "video/quicktime"); - mimeTypes.put("mov", "video/quicktime"); - mimeTypes.put("fly", "text/vnd.fly"); - mimeTypes.put("rlc", "image/vnd.fujixerox.edmics-rlc"); - mimeTypes.put("sxi", "application/vnd.sun.xml.impress"); - mimeTypes.put("vor", "application/vnd.stardivision.writer"); - mimeTypes.put("gac", "application/vnd.groove-account"); - mimeTypes.put("sldm", "application/vnd.ms-powerpoint.slide.macroenabled.12"); - mimeTypes.put("pgn", "application/x-chess-pgn"); - mimeTypes.put("zaz", "application/vnd.zzazz.deck+xml"); - mimeTypes.put("ccxml", "application/ccxml+xml"); - mimeTypes.put("csh", "application/x-csh"); - mimeTypes.put("fvt", "video/vnd.fvt"); - mimeTypes.put("grv", "application/vnd.groove-injector"); - mimeTypes.put("scurl", "text/vnd.curl.scurl"); - mimeTypes.put("oa3", "application/vnd.fujitsu.oasys3"); - mimeTypes.put("oa2", "application/vnd.fujitsu.oasys2"); - mimeTypes.put("rgb", "image/x-rgb"); - mimeTypes.put("pfr", "application/font-tdpfr"); - mimeTypes.put("pbd", "application/vnd.powerbuilder6"); - mimeTypes.put("psd", "image/vnd.adobe.photoshop"); - mimeTypes.put("fh", "image/x-freehand"); - mimeTypes.put("fhc", "image/x-freehand"); - mimeTypes.put("fh4", "image/x-freehand"); - mimeTypes.put("fh5", "image/x-freehand"); - mimeTypes.put("fh7", "image/x-freehand"); - mimeTypes.put("doc", "application/msword"); - mimeTypes.put("dot", "application/msword"); - mimeTypes.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); - mimeTypes.put("plc", "application/vnd.mobius.plc"); - mimeTypes.put("rnc", "application/relax-ng-compact-syntax"); - mimeTypes.put("rpss", "application/vnd.nokia.radio-presets"); - mimeTypes.put("nlu", "application/vnd.neurolanguage.nlu"); - mimeTypes.put("pcl", "application/vnd.hp-pcl"); - mimeTypes.put("uu", "text/x-uuencode"); - mimeTypes.put("ami", "application/vnd.amiga.ami"); - mimeTypes.put("viv", "video/vnd.vivo"); - mimeTypes.put("mp4a", "audio/mp4"); - mimeTypes.put("vis", "application/vnd.visionary"); - mimeTypes.put("asc", "application/pgp-signature"); - mimeTypes.put("sig", "application/pgp-signature"); - mimeTypes.put("karbon", "application/vnd.kde.karbon"); - mimeTypes.put("htke", "application/vnd.kenameaapp"); - mimeTypes.put("nnd", "application/vnd.noblenet-directory"); - mimeTypes.put("xlsm", "application/vnd.ms-excel.sheet.macroenabled.12"); - mimeTypes.put("ez2", "application/vnd.ezpix-album"); - mimeTypes.put("otm", "application/vnd.oasis.opendocument.text-master"); - mimeTypes.put("f", "text/x-fortran"); - mimeTypes.put("for", "text/x-fortran"); - mimeTypes.put("f77", "text/x-fortran"); - mimeTypes.put("f90", "text/x-fortran"); - mimeTypes.put("apr", "application/vnd.lotus-approach"); - mimeTypes.put("mid", "audio/midi"); - mimeTypes.put("midi", "audio/midi"); - mimeTypes.put("kar", "audio/midi"); - mimeTypes.put("rmi", "audio/midi"); - mimeTypes.put("tmo", "application/vnd.tmobile-livetv"); - mimeTypes.put("pya", "audio/vnd.ms-playready.media.pya"); - mimeTypes.put("cgm", "image/cgm"); - mimeTypes.put("uri", "text/uri-list"); - mimeTypes.put("uris", "text/uri-list"); - mimeTypes.put("urls", "text/uri-list"); - mimeTypes.put("ipk", "application/vnd.shana.informed.package"); - mimeTypes.put("clkk", "application/vnd.crick.clicker.keyboard"); - mimeTypes.put("mbox", "application/mbox"); - mimeTypes.put("unityweb", "application/vnd.unity"); - mimeTypes.put("joda", "application/vnd.joost.joda-archive"); - mimeTypes.put("kwd", "application/vnd.kde.kword"); - mimeTypes.put("kwt", "application/vnd.kde.kword"); - mimeTypes.put("mpy", "application/vnd.ibm.minipay"); - mimeTypes.put("mpeg", "video/mpeg"); - mimeTypes.put("mpg", "video/mpeg"); - mimeTypes.put("mpe", "video/mpeg"); - mimeTypes.put("m1v", "video/mpeg"); - mimeTypes.put("m2v", "video/mpeg"); - mimeTypes.put("asf", "video/x-ms-asf"); - mimeTypes.put("asx", "video/x-ms-asf"); - mimeTypes.put("jad", "text/vnd.sun.j2me.app-descriptor"); - mimeTypes.put("rm", "application/vnd.rn-realmedia"); - mimeTypes.put("xer", "application/patch-ops-error+xml"); - mimeTypes.put("xml", "application/xml"); - mimeTypes.put("xsl", "application/xml"); - mimeTypes.put("icc", "application/vnd.iccprofile"); - mimeTypes.put("icm", "application/vnd.iccprofile"); - mimeTypes.put("mmr", "image/vnd.fujixerox.edmics-mmr"); - mimeTypes.put("hvd", "application/vnd.yamaha.hv-dic"); - mimeTypes.put("mbk", "application/vnd.mobius.mbk"); - mimeTypes.put("123", "application/vnd.lotus-1-2-3"); - mimeTypes.put("fe_launch", "application/vnd.denovo.fcselayout-link"); - mimeTypes.put("setpay", "application/set-payment-initiation"); - mimeTypes.put("sdc", "application/vnd.stardivision.calc"); - mimeTypes.put("swi", "application/vnd.aristanetworks.swi"); - mimeTypes.put("g3", "image/g3fax"); - mimeTypes.put("cil", "application/vnd.ms-artgalry"); - mimeTypes.put("vcg", "application/vnd.groove-vcard"); - mimeTypes.put("chm", "application/vnd.ms-htmlhelp"); - mimeTypes.put("grxml", "application/srgs+xml"); - mimeTypes.put("ext", "application/vnd.novadigm.ext"); - mimeTypes.put("opf", "application/oebps-package+xml"); - mimeTypes.put("gtm", "application/vnd.groove-tool-message"); - mimeTypes.put("au", "audio/basic"); - mimeTypes.put("snd", "audio/basic"); - mimeTypes.put("ppsm", "application/vnd.ms-powerpoint.slideshow.macroenabled.12"); - mimeTypes.put("wbxml", "application/vnd.wap.wbxml"); - mimeTypes.put("oxt", "application/vnd.openofficeorg.extension"); - mimeTypes.put("davmount", "application/davmount+xml"); - mimeTypes.put("ivu", "application/vnd.immervision-ivu"); - mimeTypes.put("wrl", "model/vrml"); - mimeTypes.put("vrml", "model/vrml"); - mimeTypes.put("p7m", "application/pkcs7-mime"); - mimeTypes.put("p7c", "application/pkcs7-mime"); - mimeTypes.put("ppt", "application/vnd.ms-powerpoint"); - mimeTypes.put("pps", "application/vnd.ms-powerpoint"); - mimeTypes.put("pot", "application/vnd.ms-powerpoint"); - mimeTypes.put("ivp", "application/vnd.immervision-ivp"); - mimeTypes.put("movie", "video/x-sgi-movie"); - mimeTypes.put("ecelp4800", "audio/vnd.nuera.ecelp4800"); - mimeTypes.put("tpl", "application/vnd.groove-tool-template"); - mimeTypes.put("fnc", "application/vnd.frogans.fnc"); - mimeTypes.put("wax", "audio/x-ms-wax"); - mimeTypes.put("3gp", "video/3gpp"); - mimeTypes.put("ppd", "application/vnd.cups-ppd"); - mimeTypes.put("mmf", "application/vnd.smaf"); - mimeTypes.put("exe", "application/x-msdownload"); - mimeTypes.put("dll", "application/x-msdownload"); - mimeTypes.put("com", "application/x-msdownload"); - mimeTypes.put("bat", "application/x-msdownload"); - mimeTypes.put("msi", "application/x-msdownload"); - mimeTypes.put("skp", "application/vnd.koan"); - mimeTypes.put("skd", "application/vnd.koan"); - mimeTypes.put("skt", "application/vnd.koan"); - mimeTypes.put("skm", "application/vnd.koan"); - mimeTypes.put("ice", "x-conference/x-cooltalk"); - mimeTypes.put("emma", "application/emma+xml"); - mimeTypes.put("odc", "application/vnd.oasis.opendocument.chart"); - mimeTypes.put("atomcat", "application/atomcat+xml"); - mimeTypes.put("onetoc", "application/onenote"); - mimeTypes.put("onetoc2", "application/onenote"); - mimeTypes.put("onetmp", "application/onenote"); - mimeTypes.put("onepkg", "application/onenote"); - mimeTypes.put("otp", "application/vnd.oasis.opendocument.presentation-template"); - mimeTypes.put("irm", "application/vnd.ibm.rights-management"); - mimeTypes.put("texinfo", "application/x-texinfo"); - mimeTypes.put("texi", "application/x-texinfo"); - mimeTypes.put("spp", "application/scvp-vp-response"); - mimeTypes.put("xif", "image/vnd.xiff"); - mimeTypes.put("sitx", "application/x-stuffitx"); - mimeTypes.put("eol", "audio/vnd.digital-winds"); - mimeTypes.put("c4g", "application/vnd.clonk.c4group"); - mimeTypes.put("c4d", "application/vnd.clonk.c4group"); - mimeTypes.put("c4f", "application/vnd.clonk.c4group"); - mimeTypes.put("c4p", "application/vnd.clonk.c4group"); - mimeTypes.put("c4u", "application/vnd.clonk.c4group"); - mimeTypes.put("flo", "application/vnd.micrografx.flo"); - mimeTypes.put("svg", "image/svg+xml"); - mimeTypes.put("svgz", "image/svg+xml"); - mimeTypes.put("xsm", "application/vnd.syncml+xml"); - mimeTypes.put("hdf", "application/x-hdf"); - mimeTypes.put("cml", "chemical/x-cml"); - mimeTypes.put("atx", "application/vnd.antix.game-component"); - mimeTypes.put("flv", "video/x-flv"); - mimeTypes.put("m3u8", "application/vnd.apple.mpegurl"); - mimeTypes.put("wbs", "application/vnd.criticaltools.wbs+xml"); - mimeTypes.put("bz2", "application/x-bzip2"); - mimeTypes.put("boz", "application/x-bzip2"); - mimeTypes.put("plf", "application/vnd.pocketlearn"); - mimeTypes.put("lbe", "application/vnd.llamagraphics.life-balance.exchange+xml"); - mimeTypes.put("vcd", "application/x-cdlink"); - mimeTypes.put("sxg", "application/vnd.sun.xml.writer.global"); - mimeTypes.put("fli", "video/x-fli"); - mimeTypes.put("wsdl", "application/wsdl+xml"); - mimeTypes.put("slt", "application/vnd.epson.salt"); - mimeTypes.put("lwp", "application/vnd.lotus-wordpro"); - mimeTypes.put("ddd", "application/vnd.fujixerox.ddd"); - mimeTypes.put("xfdf", "application/vnd.adobe.xfdf"); - mimeTypes.put("portpkg", "application/vnd.macports.portpkg"); - mimeTypes.put("pfa", "application/x-font-type1"); - mimeTypes.put("pfb", "application/x-font-type1"); - mimeTypes.put("pfm", "application/x-font-type1"); - mimeTypes.put("afm", "application/x-font-type1"); - mimeTypes.put("nc", "application/x-netcdf"); - mimeTypes.put("cdf", "application/x-netcdf"); - mimeTypes.put("mpm", "application/vnd.blueice.multipass"); - mimeTypes.put("sis", "application/vnd.symbian.install"); - mimeTypes.put("sisx", "application/vnd.symbian.install"); - mimeTypes.put("ustar", "application/x-ustar"); - mimeTypes.put("rpst", "application/vnd.nokia.radio-preset"); - mimeTypes.put("eml", "message/rfc822"); - mimeTypes.put("mime", "message/rfc822"); - mimeTypes.put("g2w", "application/vnd.geoplan"); - mimeTypes.put("ma", "application/mathematica"); - mimeTypes.put("nb", "application/mathematica"); - mimeTypes.put("mb", "application/mathematica"); - mimeTypes.put("csv", "text/csv"); - mimeTypes.put("css", "text/css"); - mimeTypes.put("wvx", "video/x-ms-wvx"); - mimeTypes.put("jlt", "application/vnd.hp-jlyt"); - mimeTypes.put("vcx", "application/vnd.vcx"); - mimeTypes.put("html", "text/html"); - mimeTypes.put("htm", "text/html"); - mimeTypes.put("docm", "application/vnd.ms-word.document.macroenabled.12"); - mimeTypes.put("xdssc", "application/dssc+xml"); - mimeTypes.put("pbm", "image/x-binary-bitmap"); - mimeTypes.put("fdf", "application/vnd.fdf"); - mimeTypes.put("ggt", "application/vnd.geogebra.tool"); - mimeTypes.put("cii", "application/vnd.anser-web-certificate-issue-initiation"); - mimeTypes.put("atomsvc", "application/atomsvc+xml"); - mimeTypes.put("stw", "application/vnd.sun.xml.writer.template"); - mimeTypes.put("vtu", "model/vnd.vtu"); - mimeTypes.put("latex", "application/x-latex"); - mimeTypes.put("cat", "application/vnd.ms-pki.seccat"); - mimeTypes.put("odf", "application/vnd.oasis.opendocument.formula"); - mimeTypes.put("trm", "application/x-msterminal"); - mimeTypes.put("pptm", "application/vnd.ms-powerpoint.presentation.macroenabled.12"); - mimeTypes.put("stl", "application/vnd.ms-pki.stl"); - mimeTypes.put("ltf", "application/vnd.frogans.ltf"); - mimeTypes.put("obd", "application/x-msbinder"); - mimeTypes.put("sda", "application/vnd.stardivision.draw"); - mimeTypes.put("org", "application/vnd.lotus-organizer"); - mimeTypes.put("ftc", "application/vnd.fluxtime.clip"); - mimeTypes.put("rcprofile", "application/vnd.ipunplugged.rcprofile"); - mimeTypes.put("cmx", "image/x-cmx"); - mimeTypes.put("cif", "chemical/x-cif"); - mimeTypes.put("rp9", "application/vnd.cloanto.rp9"); - mimeTypes.put("pvb", "application/vnd.3gpp.pic-bw-var"); - mimeTypes.put("aw", "application/applixware"); - mimeTypes.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"); - mimeTypes.put("rld", "application/resource-lists-diff+xml"); - mimeTypes.put("xar", "application/vnd.xara"); - mimeTypes.put("ecelp7470", "audio/vnd.nuera.ecelp7470"); - mimeTypes.put("xls", "application/vnd.ms-excel"); - mimeTypes.put("xlm", "application/vnd.ms-excel"); - mimeTypes.put("xla", "application/vnd.ms-excel"); - mimeTypes.put("xlc", "application/vnd.ms-excel"); - mimeTypes.put("xlt", "application/vnd.ms-excel"); - mimeTypes.put("xlw", "application/vnd.ms-excel"); - mimeTypes.put("txf", "application/vnd.mobius.txf"); - mimeTypes.put("prc", "application/x-mobipocket-ebook"); - mimeTypes.put("mobi", "application/x-mobipocket-ebook"); - mimeTypes.put("swf", "application/x-shockwave-flash"); - mimeTypes.put("sfs", "application/vnd.spotfire.sfs"); - mimeTypes.put("dp", "application/vnd.osgi.dp"); - mimeTypes.put("potx", "application/vnd.openxmlformats-officedocument.presentationml.template"); - mimeTypes.put("efif", "application/vnd.picsel"); - mimeTypes.put("pdf", "application/pdf"); - mimeTypes.put("dsc", "text/prs.lines.tag"); - mimeTypes.put("mathml", "application/mathml+xml"); - mimeTypes.put("bed", "application/vnd.realvnc.bed"); - mimeTypes.put("bcpio", "application/x-bcpio"); - mimeTypes.put("shar", "application/x-shar"); - mimeTypes.put("xdm", "application/vnd.syncml.dm+xml"); - mimeTypes.put("teacher", "application/vnd.smart.teacher"); - mimeTypes.put("sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide"); - mimeTypes.put("stf", "application/vnd.wt.stf"); - mimeTypes.put("odb", "application/vnd.oasis.opendocument.database"); - mimeTypes.put("bdf", "application/x-font-bdf"); - mimeTypes.put("tcap", "application/vnd.3gpp2.tcap"); - mimeTypes.put("fm", "application/vnd.framemaker"); - mimeTypes.put("frame", "application/vnd.framemaker"); - mimeTypes.put("maker", "application/vnd.framemaker"); - mimeTypes.put("book", "application/vnd.framemaker"); - mimeTypes.put("src", "application/x-wais-source"); - mimeTypes.put("rep", "application/vnd.businessobjects"); - mimeTypes.put("dna", "application/vnd.dna"); - mimeTypes.put("jpgv", "video/jpeg"); - mimeTypes.put("ez", "application/andrew-inset"); - mimeTypes.put("vxml", "application/voicexml+xml"); - mimeTypes.put("x3d", "application/vnd.hzn-3d-crossword"); - mimeTypes.put("dxp", "application/vnd.spotfire.dxp"); - mimeTypes.put("dvi", "application/x-dvi"); - mimeTypes.put("f4v", "video/x-f4v"); - mimeTypes.put("fg5", "application/vnd.fujitsu.oasysgp"); - mimeTypes.put("clp", "application/x-msclip"); - mimeTypes.put("acu", "application/vnd.acucobol"); - mimeTypes.put("ksp", "application/vnd.kde.kspread"); - mimeTypes.put("rms", "application/vnd.jcp.javame.midlet-rms"); - mimeTypes.put("lvp", "audio/vnd.lucent.voice"); - mimeTypes.put("jpm", "video/jpm"); - mimeTypes.put("jpgm", "video/jpm"); - mimeTypes.put("pcx", "image/x-pcx"); - mimeTypes.put("sxm", "application/vnd.sun.xml.math"); - mimeTypes.put("g3w", "application/vnd.geospace"); - mimeTypes.put("ngdat", "application/vnd.nokia.n-gage.data"); - mimeTypes.put("clkp", "application/vnd.crick.clicker.palette"); - mimeTypes.put("osfpvg", "application/vnd.yamaha.openscoreformat.osfpvg+xml"); - mimeTypes.put("aep", "application/vnd.audiograph"); - mimeTypes.put("wqd", "application/vnd.wqd"); - mimeTypes.put("mdi", "image/vnd.ms-modi"); - mimeTypes.put("ecelp9600", "audio/vnd.nuera.ecelp9600"); - mimeTypes.put("fig", "application/x-xfig"); - mimeTypes.put("p7r", "application/x-pkcs7-certreqresp"); - mimeTypes.put("jar", "application/java-archive"); - mimeTypes.put("ief", "image/ief"); - mimeTypes.put("hvs", "application/vnd.yamaha.hv-script"); - mimeTypes.put("cdx", "chemical/x-cdx"); - mimeTypes.put("abw", "application/x-abiword"); - mimeTypes.put("deb", "application/x-debian-package"); - mimeTypes.put("udeb", "application/x-debian-package"); - mimeTypes.put("djvu", "image/vnd.djvu"); - mimeTypes.put("djv", "image/vnd.djvu"); - mimeTypes.put("wml", "text/vnd.wap.wml"); - mimeTypes.put("xhtml", "application/xhtml+xml"); - mimeTypes.put("xht", "application/xhtml+xml"); - mimeTypes.put("tpt", "application/vnd.trid.tpt"); - mimeTypes.put("wmz", "application/x-ms-wmz"); - mimeTypes.put("rtx", "text/richtext"); - mimeTypes.put("wspolicy", "application/wspolicy+xml"); - mimeTypes.put("odg", "application/vnd.oasis.opendocument.graphics"); - mimeTypes.put("res", "application/x-dtbresource+xml"); - mimeTypes.put("xbm", "image/x-xbitmap"); - mimeTypes.put("zir", "application/vnd.zul"); - mimeTypes.put("zirz", "application/vnd.zul"); - mimeTypes.put("cdkey", "application/vnd.mediastation.cdkey"); - mimeTypes.put("wmd", "application/x-ms-wmd"); - mimeTypes.put("ogv", "video/ogg"); - mimeTypes.put("scq", "application/scvp-cv-request"); - mimeTypes.put("sfd-hdstx", "application/vnd.hydrostatix.sof-data"); - mimeTypes.put("igx", "application/vnd.micrografx.igx"); - mimeTypes.put("xps", "application/vnd.ms-xpsdocument"); - mimeTypes.put("xdw", "application/vnd.fujixerox.docuworks"); - mimeTypes.put("kfo", "application/vnd.kde.kformula"); - mimeTypes.put("chrt", "application/vnd.kde.kchart"); - mimeTypes.put("sdp", "application/sdp"); - mimeTypes.put("oth", "application/vnd.oasis.opendocument.text-web"); - mimeTypes.put("3g2", "video/3gpp2"); - mimeTypes.put("utz", "application/vnd.uiq.theme"); - mimeTypes.put("mus", "application/vnd.musician"); - mimeTypes.put("wpd", "application/vnd.wordperfect"); - mimeTypes.put("oas", "application/vnd.fujitsu.oasys"); - mimeTypes.put("pic", "image/x-pict"); - mimeTypes.put("pct", "image/x-pict"); - mimeTypes.put("wmx", "video/x-ms-wmx"); - mimeTypes.put("p10", "application/pkcs10"); - mimeTypes.put("wmv", "video/x-ms-wmv"); - mimeTypes.put("xfdl", "application/vnd.xfdl"); - mimeTypes.put("pgp", "application/pgp-encrypted"); - mimeTypes.put("rs", "application/rls-services+xml"); - mimeTypes.put("cpt", "application/mac-compactpro"); - mimeTypes.put("gmx", "application/vnd.gmx"); - mimeTypes.put("potm", "application/vnd.ms-powerpoint.template.macroenabled.12"); - mimeTypes.put("iif", "application/vnd.shana.informed.interchange"); - mimeTypes.put("ace", "application/x-ace-compressed"); - mimeTypes.put("pcurl", "application/vnd.curl.pcurl"); - mimeTypes.put("ods", "application/vnd.oasis.opendocument.spreadsheet"); - mimeTypes.put("vsd", "application/vnd.visio"); - mimeTypes.put("vst", "application/vnd.visio"); - mimeTypes.put("vss", "application/vnd.visio"); - mimeTypes.put("vsw", "application/vnd.visio"); - mimeTypes.put("ifm", "application/vnd.shana.informed.formdata"); - mimeTypes.put("fbs", "image/vnd.fastbidsheet"); - mimeTypes.put("qxd", "application/vnd.quark.quarkxpress"); - mimeTypes.put("qxt", "application/vnd.quark.quarkxpress"); - mimeTypes.put("qwd", "application/vnd.quark.quarkxpress"); - mimeTypes.put("qwt", "application/vnd.quark.quarkxpress"); - mimeTypes.put("qxl", "application/vnd.quark.quarkxpress"); - mimeTypes.put("qxb", "application/vnd.quark.quarkxpress"); - mimeTypes.put("epub", "application/epub+zip"); - mimeTypes.put("crl", "application/pkix-crl"); - mimeTypes.put("nnw", "application/vnd.noblenet-web"); - mimeTypes.put("nbp", "application/vnd.wolfram.player"); - mimeTypes.put("plb", "application/vnd.3gpp.pic-bw-large"); - mimeTypes.put("itp", "application/vnd.shana.informed.formtemplate"); - mimeTypes.put("snf", "application/x-font-snf"); - mimeTypes.put("str", "application/vnd.pg.format"); - mimeTypes.put("wtb", "application/vnd.webturbo"); - mimeTypes.put("osf", "application/vnd.yamaha.openscoreformat"); - mimeTypes.put("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"); - mimeTypes.put("pre", "application/vnd.lotus-freelance"); - mimeTypes.put("clkt", "application/vnd.crick.clicker.template"); - mimeTypes.put("hbci", "application/vnd.hbci"); - mimeTypes.put("dwf", "model/vnd.dwf"); - mimeTypes.put("igs", "model/iges"); - mimeTypes.put("iges", "model/iges"); - mimeTypes.put("ktz", "application/vnd.kahootz"); - mimeTypes.put("ktr", "application/vnd.kahootz"); - mimeTypes.put("n-gage", "application/vnd.nokia.n-gage.symbian.install"); - mimeTypes.put("otg", "application/vnd.oasis.opendocument.graphics-template"); - mimeTypes.put("rsd", "application/rsd+xml"); - mimeTypes.put("hlp", "application/winhlp"); - mimeTypes.put("azw", "application/vnd.amazon.ebook"); - mimeTypes.put("msf", "application/vnd.epson.msf"); - mimeTypes.put("mp4", "video/mp4"); - mimeTypes.put("mp4v", "video/mp4"); - mimeTypes.put("mpg4", "video/mp4"); - mimeTypes.put("cod", "application/vnd.rim.cod"); - mimeTypes.put("st", "application/vnd.sailingtracker.track"); - mimeTypes.put("odi", "application/vnd.oasis.opendocument.image"); - mimeTypes.put("tra", "application/vnd.trueapp"); - mimeTypes.put("wm", "video/x-ms-wm"); - mimeTypes.put("bin", "application/octet-stream"); - mimeTypes.put("dms", "application/octet-stream"); - mimeTypes.put("lha", "application/octet-stream"); - mimeTypes.put("lrf", "application/octet-stream"); - mimeTypes.put("lzh", "application/octet-stream"); - mimeTypes.put("so", "application/octet-stream"); - mimeTypes.put("iso", "application/octet-stream"); - mimeTypes.put("dmg", "application/octet-stream"); - mimeTypes.put("dist", "application/octet-stream"); - mimeTypes.put("distz", "application/octet-stream"); - mimeTypes.put("pkg", "application/octet-stream"); - mimeTypes.put("bpk", "application/octet-stream"); - mimeTypes.put("dump", "application/octet-stream"); - mimeTypes.put("elc", "application/octet-stream"); - mimeTypes.put("deploy", "application/octet-stream"); - mimeTypes.put("tsv", "text/tab-separated-values"); - mimeTypes.put("esf", "application/vnd.epson.esf"); - mimeTypes.put("p7s", "application/pkcs7-signature"); - mimeTypes.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - mimeTypes.put("geo", "application/vnd.dynageo"); - mimeTypes.put("mmd", "application/vnd.chipnuts.karaoke-mmd"); - mimeTypes.put("mxml", "application/xv+xml"); - mimeTypes.put("xhvml", "application/xv+xml"); - mimeTypes.put("xvml", "application/xv+xml"); - mimeTypes.put("xvm", "application/xv+xml"); - mimeTypes.put("nsf", "application/vnd.lotus-notes"); - mimeTypes.put("crd", "application/x-mscardfile"); - mimeTypes.put("p12", "application/x-pkcs12"); - mimeTypes.put("pfx", "application/x-pkcs12"); - mimeTypes.put("c", "text/x-c"); - mimeTypes.put("cc", "text/x-c"); - mimeTypes.put("cxx", "text/x-c"); - mimeTypes.put("cpp", "text/x-c"); - mimeTypes.put("h", "text/x-c"); - mimeTypes.put("hh", "text/x-c"); - mimeTypes.put("dic", "text/x-c"); - mimeTypes.put("cla", "application/vnd.claymore"); - mimeTypes.put("avi", "video/x-msvideo"); - mimeTypes.put("edx", "application/vnd.novadigm.edx"); - mimeTypes.put("gph", "application/vnd.flographit"); - mimeTypes.put("rq", "application/sparql-query"); - mimeTypes.put("xdp", "application/vnd.adobe.xdp+xml"); - mimeTypes.put("umj", "application/vnd.umajin"); - mimeTypes.put("pclxl", "application/vnd.hp-pclxl"); - mimeTypes.put("edm", "application/vnd.novadigm.edm"); - mimeTypes.put("gif", "image/gif"); - mimeTypes.put("jpeg", "image/jpeg"); - mimeTypes.put("jpg", "image/jpeg"); - mimeTypes.put("jpe", "image/jpeg"); - mimeTypes.put("adp", "audio/adpcm"); - mimeTypes.put("txt", "text/plain"); - mimeTypes.put("text", "text/plain"); - mimeTypes.put("conf", "text/plain"); - mimeTypes.put("def", "text/plain"); - mimeTypes.put("list", "text/plain"); - mimeTypes.put("log", "text/plain"); - mimeTypes.put("in", "text/plain"); - mimeTypes.put("gsf", "application/x-font-ghostscript"); - mimeTypes.put("aab", "application/x-authorware-bin"); - mimeTypes.put("x32", "application/x-authorware-bin"); - mimeTypes.put("u32", "application/x-authorware-bin"); - mimeTypes.put("vox", "application/x-authorware-bin"); - mimeTypes.put("ott", "application/vnd.oasis.opendocument.text-template"); - mimeTypes.put("kmz", "application/vnd.google-earth.kmz"); - mimeTypes.put("etx", "text/x-setext"); - mimeTypes.put("sv4crc", "application/x-sv4crc"); - mimeTypes.put("xlam", "application/vnd.ms-excel.addin.macroenabled.12"); - mimeTypes.put("pcf", "application/x-font-pcf"); - mimeTypes.put("torrent", "application/x-bittorrent"); - mimeTypes.put("twd", "application/vnd.simtech-mindmapper"); - mimeTypes.put("twds", "application/vnd.simtech-mindmapper"); - mimeTypes.put("qam", "application/vnd.epson.quickanime"); - mimeTypes.put("bdm", "application/vnd.syncml.dm+wbxml"); - mimeTypes.put("3dml", "text/vnd.in3d.3dml"); - mimeTypes.put("saf", "application/vnd.yamaha.smaf-audio"); - mimeTypes.put("ncx", "application/x-dtbncx+xml"); - mimeTypes.put("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow"); - mimeTypes.put("sc", "application/vnd.ibm.secure-container"); - mimeTypes.put("gnumeric", "application/x-gnumeric"); - mimeTypes.put("paw", "application/vnd.pawaafile"); - mimeTypes.put("bmp", "image/bmp"); - mimeTypes.put("bmi", "application/vnd.bmi"); - mimeTypes.put("sxc", "application/vnd.sun.xml.calc"); - mimeTypes.put("gim", "application/vnd.groove-identity-message"); - mimeTypes.put("qps", "application/vnd.publishare-delta-tree"); - mimeTypes.put("scd", "application/x-msschedule"); - mimeTypes.put("mgz", "application/vnd.proteus.magazine"); - mimeTypes.put("vcf", "text/x-vcard"); - mimeTypes.put("flw", "application/vnd.kde.kivio"); - mimeTypes.put("xslt", "application/xslt+xml"); - mimeTypes.put("stc", "application/vnd.sun.xml.calc.template"); - mimeTypes.put("dir", "application/x-director"); - mimeTypes.put("dcr", "application/x-director"); - mimeTypes.put("dxr", "application/x-director"); - mimeTypes.put("cst", "application/x-director"); - mimeTypes.put("cct", "application/x-director"); - mimeTypes.put("cxt", "application/x-director"); - mimeTypes.put("w3d", "application/x-director"); - mimeTypes.put("fgd", "application/x-director"); - mimeTypes.put("swa", "application/x-director"); - mimeTypes.put("rif", "application/reginfo+xml"); - mimeTypes.put("atc", "application/vnd.acucorp"); - mimeTypes.put("acutc", "application/vnd.acucorp"); - mimeTypes.put("fti", "application/vnd.anser-web-funds-transfer-initiation"); - mimeTypes.put("dis", "application/vnd.mobius.dis"); - mimeTypes.put("zmm", "application/vnd.handheld-entertainment+xml"); - mimeTypes.put("mag", "application/vnd.ecowin.chart"); - mimeTypes.put("mlp", "application/vnd.dolby.mlp"); - mimeTypes.put("psb", "application/vnd.3gpp.pic-bw-small"); - mimeTypes.put("mdb", "application/x-msaccess"); - mimeTypes.put("aso", "application/vnd.accpac.simply.aso"); - mimeTypes.put("pwn", "application/vnd.3m.post-it-notes"); - mimeTypes.put("ots", "application/vnd.oasis.opendocument.spreadsheet-template"); - mimeTypes.put("mj2", "video/mj2"); - mimeTypes.put("mjp2", "video/mj2"); - mimeTypes.put("link66", "application/vnd.route66.link66+xml"); - mimeTypes.put("les", "application/vnd.hhe.lesson-player"); - mimeTypes.put("sti", "application/vnd.sun.xml.impress.template"); - mimeTypes.put("cdbcmsg", "application/vnd.contact.cmsg"); - mimeTypes.put("cdxml", "application/vnd.chemdraw+xml"); - mimeTypes.put("aac", "audio/x-aac"); - mimeTypes.put("ipfix", "application/ipfix"); - mimeTypes.put("mxu", "video/vnd.mpegurl"); - mimeTypes.put("m4u", "video/vnd.mpegurl"); - mimeTypes.put("cer", "application/pkix-cert"); - mimeTypes.put("mny", "application/x-msmoney"); - mimeTypes.put("tex", "application/x-tex"); - mimeTypes.put("ics", "text/calendar"); - mimeTypes.put("ifb", "text/calendar"); - mimeTypes.put("ei6", "application/vnd.pg.osasli"); - mimeTypes.put("spf", "application/vnd.yamaha.smaf-phrase"); - mimeTypes.put("lostxml", "application/lost+xml"); - mimeTypes.put("apk", "application/vnd.android.package-archive"); - mimeTypes.put("pub", "application/x-mspublisher"); - mimeTypes.put("gtw", "model/vnd.gtw"); - mimeTypes.put("ufd", "application/vnd.ufdl"); - mimeTypes.put("ufdl", "application/vnd.ufdl"); - mimeTypes.put("jnlp", "application/x-java-jnlp-file"); - mimeTypes.put("air", "application/vnd.adobe.air-application-installer-package+zip"); - mimeTypes.put("dcurl", "text/vnd.curl.dcurl"); - mimeTypes.put("mxl", "application/vnd.recordare.musicxml"); - mimeTypes.put("cpio", "application/x-cpio"); - mimeTypes.put("mpp", "application/vnd.ms-project"); - mimeTypes.put("mpt", "application/vnd.ms-project"); - mimeTypes.put("pdb", "application/vnd.palm"); - mimeTypes.put("pqa", "application/vnd.palm"); - mimeTypes.put("oprc", "application/vnd.palm"); - mimeTypes.put("mrc", "application/marc"); - mimeTypes.put("hqx", "application/mac-binhex40"); - mimeTypes.put("json", "application/json"); - mimeTypes.put("mvb", "application/x-msmediaview"); - mimeTypes.put("m13", "application/x-msmediaview"); - mimeTypes.put("m14", "application/x-msmediaview"); - mimeTypes.put("mpga", "audio/mpeg"); - mimeTypes.put("mp2", "audio/mpeg"); - mimeTypes.put("mp2a", "audio/mpeg"); - mimeTypes.put("mp3", "audio/mpeg"); - mimeTypes.put("m2a", "audio/mpeg"); - mimeTypes.put("m3a", "audio/mpeg"); - mimeTypes.put("cmc", "application/vnd.cosmocaller"); - mimeTypes.put("wmf", "application/x-msmetafile"); - mimeTypes.put("odft", "application/vnd.oasis.opendocument.formula-template"); - mimeTypes.put("dtb", "application/x-dtbook+xml"); - mimeTypes.put("xbap", "application/x-ms-xbap"); - mimeTypes.put("csp", "application/vnd.commonspace"); - mimeTypes.put("stk", "application/hyperstudio"); - mimeTypes.put("mpn", "application/vnd.mophun.application"); - mimeTypes.put("gqf", "application/vnd.grafeq"); - mimeTypes.put("gqs", "application/vnd.grafeq"); - mimeTypes.put("rl", "application/resource-lists+xml"); - mimeTypes.put("gtar", "application/x-gtar"); - mimeTypes.put("pls", "application/pls+xml"); - mimeTypes.put("tcl", "application/x-tcl"); - mimeTypes.put("der", "application/x-x509-ca-cert"); - mimeTypes.put("crt", "application/x-x509-ca-cert"); - mimeTypes.put("xo", "application/vnd.olpc-sugar"); - mimeTypes.put("xltm", "application/vnd.ms-excel.template.macroenabled.12"); - mimeTypes.put("cu", "application/cu-seeme"); - mimeTypes.put("kml", "application/vnd.google-earth.kml+xml"); - mimeTypes.put("sh", "application/x-sh"); - mimeTypes.put("xpw", "application/vnd.intercon.formnet"); - mimeTypes.put("xpx", "application/vnd.intercon.formnet"); - mimeTypes.put("wg", "application/vnd.pmi.widget"); - mimeTypes.put("seed", "application/vnd.fdsn.seed"); - mimeTypes.put("dataless", "application/vnd.fdsn.seed"); - mimeTypes.put("sdd", "application/vnd.stardivision.impress"); - mimeTypes.put("ttf", "application/x-font-ttf"); - mimeTypes.put("ttc", "application/x-font-ttf"); - mimeTypes.put("npx", "image/vnd.net-fpx"); - mimeTypes.put("aif", "audio/x-aiff"); - mimeTypes.put("aiff", "audio/x-aiff"); - mimeTypes.put("aifc", "audio/x-aiff"); - mimeTypes.put("xlsb", "application/vnd.ms-excel.sheet.binary.macroenabled.12"); - mimeTypes.put("wbmp", "image/vnd.wap.wbmp"); - mimeTypes.put("rtf", "application/rtf"); - mimeTypes.put("sus", "application/vnd.sus-calendar"); - mimeTypes.put("susp", "application/vnd.sus-calendar"); - mimeTypes.put("prf", "application/pics-rules"); - mimeTypes.put("tar", "application/x-tar"); - mimeTypes.put("pml", "application/vnd.ctc-posml"); - mimeTypes.put("ims", "application/vnd.ms-ims"); - mimeTypes.put("imp", "application/vnd.accpac.simply.imp"); - mimeTypes.put("xul", "application/vnd.mozilla.xul+xml"); - mimeTypes.put("acc", "application/vnd.americandynamics.acc"); - mimeTypes.put("mfm", "application/vnd.mfmp"); - mimeTypes.put("dotm", "application/vnd.ms-word.template.macroenabled.12"); - mimeTypes.put("ptid", "application/vnd.pvi.ptid1"); - mimeTypes.put("pyv", "video/vnd.ms-playready.media.pyv"); - mimeTypes.put("ssf", "application/vnd.epson.ssf"); - mimeTypes.put("sxd", "application/vnd.sun.xml.draw"); - mimeTypes.put("xap", "application/x-silverlight-app"); - mimeTypes.put("fst", "image/vnd.fst"); - mimeTypes.put("rdf", "application/rdf+xml"); - mimeTypes.put("gv", "text/vnd.graphviz"); - mimeTypes.put("lrm", "application/vnd.ms-lrm"); - mimeTypes.put("box", "application/vnd.previewsystems.box"); - mimeTypes.put("mseq", "application/vnd.mseq"); - mimeTypes.put("xwd", "image/x-xwindowdump"); - mimeTypes.put("mscml", "application/mediaservercontrol+xml"); - mimeTypes.put("cmp", "application/vnd.yellowriver-custom-menu"); - mimeTypes.put("wad", "application/x-doom"); - mimeTypes.put("svd", "application/vnd.svd"); - mimeTypes.put("pki", "application/pkixcmp"); - mimeTypes.put("ai", "application/postscript"); - mimeTypes.put("eps", "application/postscript"); - mimeTypes.put("ps", "application/postscript"); - mimeTypes.put("msl", "application/vnd.mobius.msl"); - mimeTypes.put("sv4cpio", "application/x-sv4cpio"); - mimeTypes.put("java", "text/x-java-source"); - mimeTypes.put("mpc", "application/vnd.mophun.certificate"); - mimeTypes.put("daf", "application/vnd.mobius.daf"); - mimeTypes.put("qfx", "application/vnd.intu.qfx"); - mimeTypes.put("mxf", "application/mxf"); - mimeTypes.put("mif", "application/vnd.mif"); - mimeTypes.put("txd", "application/vnd.genomatix.tuxedo"); - mimeTypes.put("pkipath", "application/pkix-pkipath"); - mimeTypes.put("sse", "application/vnd.kodak-descriptor"); - mimeTypes.put("kon", "application/vnd.kde.kontour"); - mimeTypes.put("dfac", "application/vnd.dreamfactory"); - mimeTypes.put("gram", "application/srgs"); - mimeTypes.put("hps", "application/vnd.hp-hps"); - mimeTypes.put("cab", "application/vnd.ms-cab-compressed"); - mimeTypes.put("m3u", "audio/x-mpegurl"); - mimeTypes.put("odp", "application/vnd.oasis.opendocument.presentation"); - mimeTypes.put("ggb", "application/vnd.geogebra.file"); - mimeTypes.put("xyz", "chemical/x-xyz"); - mimeTypes.put("clkw", "application/vnd.crick.clicker.wordbank"); - mimeTypes.put("mqy", "application/vnd.mobius.mqy"); - mimeTypes.put("ico", "image/x-icon"); - mimeTypes.put("png", "image/png"); - mimeTypes.put("wmlc", "application/vnd.wap.wmlc"); - mimeTypes.put("kne", "application/vnd.kinar"); - mimeTypes.put("knp", "application/vnd.kinar"); - mimeTypes.put("kpr", "application/vnd.kde.kpresenter"); - mimeTypes.put("kpt", "application/vnd.kde.kpresenter"); - mimeTypes.put("sbml", "application/sbml+xml"); - mimeTypes.put("fpx", "image/vnd.fpx"); - mimeTypes.put("bz", "application/x-bzip"); - mimeTypes.put("flx", "text/vnd.fmi.flexstor"); - mimeTypes.put("application", "application/x-ms-application"); - mimeTypes.put("wmlsc", "application/vnd.wap.wmlscriptc"); - mimeTypes.put("lbd", "application/vnd.llamagraphics.life-balance.desktop"); - mimeTypes.put("sxw", "application/vnd.sun.xml.writer"); - mimeTypes.put("jam", "application/vnd.jam"); - mimeTypes.put("musicxml", "application/vnd.recordare.musicxml+xml"); - mimeTypes.put("see", "application/vnd.seemail"); - mimeTypes.put("irp", "application/vnd.irepository.package+xml"); - mimeTypes.put("tiff", "image/tiff"); - mimeTypes.put("tif", "image/tiff"); - mimeTypes.put("aam", "application/x-authorware-map"); - mimeTypes.put("chat", "application/x-chat"); - mimeTypes.put("mpkg", "application/vnd.apple.installer+xml"); - mimeTypes.put("otc", "application/vnd.oasis.opendocument.chart-template"); - mimeTypes.put("msh", "model/mesh"); - mimeTypes.put("mesh", "model/mesh"); - mimeTypes.put("silo", "model/mesh"); - mimeTypes.put("t", "text/troff"); - mimeTypes.put("tr", "text/troff"); - mimeTypes.put("roff", "text/troff"); - mimeTypes.put("man", "text/troff"); - mimeTypes.put("me", "text/troff"); - mimeTypes.put("ms", "text/troff"); - mimeTypes.put("dpg", "application/vnd.dpgraph"); - mimeTypes.put("wri", "application/x-mswrite"); - mimeTypes.put("dts", "audio/vnd.dts"); - mimeTypes.put("xpi", "application/x-xpinstall"); - mimeTypes.put("ram", "audio/x-pn-realaudio"); - mimeTypes.put("ra", "audio/x-pn-realaudio"); - mimeTypes.put("sdkm", "application/vnd.solent.sdkm+xml"); - mimeTypes.put("sdkd", "application/vnd.solent.sdkm+xml"); - mimeTypes.put("dtshd", "audio/vnd.dts.hd"); - mimeTypes.put("btif", "image/prs.btif"); - mimeTypes.put("scs", "application/scvp-cv-response"); - mimeTypes.put("car", "application/vnd.curl.car"); - mimeTypes.put("otf", "application/x-font-otf"); - mimeTypes.put("clkx", "application/vnd.crick.clicker"); - mimeTypes.put("xbd", "application/vnd.fujixerox.docuworks.binder"); - mimeTypes.put("ppm", "image/x-binary-pixmap"); - mimeTypes.put("wav", "audio/x-wav"); - mimeTypes.put("ssml", "application/ssml+xml"); - mimeTypes.put("p7b", "application/x-pkcs7-certificates"); - mimeTypes.put("spc", "application/x-pkcs7-certificates"); - mimeTypes.put("kia", "application/vnd.kidspiration"); - mimeTypes.put("rss", "application/rss+xml"); - mimeTypes.put("setreg", "application/set-registration-initiation"); - mimeTypes.put("qbo", "application/vnd.intu.qbo"); - mimeTypes.put("ras", "image/x-cmu-raster"); - mimeTypes.put("rar", "application/x-rar-compressed"); - mimeTypes.put("ogx", "application/ogg"); - mimeTypes.put("class", "application/java-vm"); - mimeTypes.put("smf", "application/vnd.stardivision.math"); - mimeTypes.put("atom", "application/atom+xml"); - mimeTypes.put("sit", "application/x-stuffit"); - mimeTypes.put("ez3", "application/vnd.ezpix-package"); - mimeTypes.put("mcurl", "text/vnd.curl.mcurl"); - mimeTypes.put("wmls", "text/vnd.wap.wmlscript"); - mimeTypes.put("srx", "application/sparql-results+xml"); - mimeTypes.put("wps", "application/vnd.ms-works"); - mimeTypes.put("wks", "application/vnd.ms-works"); - mimeTypes.put("wcm", "application/vnd.ms-works"); - mimeTypes.put("wdb", "application/vnd.ms-works"); - mimeTypes.put("vcs", "text/x-vcalendar"); - mimeTypes.put("ecma", "application/ecmascript"); - mimeTypes.put("curl", "text/vnd.curl"); - mimeTypes.put("std", "application/vnd.sun.xml.draw.template"); - mimeTypes.put("eot", "application/vnd.ms-fontobject"); - mimeTypes.put("fsc", "application/vnd.fsc.weblaunch"); - mimeTypes.put("tfm", "application/x-tex-tfm"); - mimeTypes.put("dra", "audio/vnd.dra"); - mimeTypes.put("mwf", "application/vnd.mfer"); - mimeTypes.put("hpid", "application/vnd.hp-hpid"); - mimeTypes.put("nml", "application/vnd.enliven"); - mimeTypes.put("hvp", "application/vnd.yamaha.hv-voice"); - mimeTypes.put("s", "text/x-asm"); - mimeTypes.put("asm", "text/x-asm"); - mimeTypes.put("mcd", "application/vnd.mcd"); - mimeTypes.put("mts", "model/vnd.mts"); - mimeTypes.put("igl", "application/vnd.igloader"); - mimeTypes.put("tao", "application/vnd.tao.intent-module-archive"); - mimeTypes.put("sgml", "text/sgml"); - mimeTypes.put("sgm", "text/sgml"); - mimeTypes.put("rmp", "audio/x-pn-realaudio-plugin"); - mimeTypes.put("xenc", "application/xenc+xml"); - mimeTypes.put("wpl", "application/vnd.ms-wpl"); - mimeTypes.put("dxf", "image/vnd.dxf"); - mimeTypes.put("pgm", "image/x-binary-graymap"); - mimeTypes.put("spot", "text/vnd.in3d.spot"); - mimeTypes.put("odt", "application/vnd.oasis.opendocument.text"); - mimeTypes.put("azs", "application/vnd.airzip.filesecure.azs"); - mimeTypes.put("es3", "application/vnd.eszigno3+xml"); - mimeTypes.put("et3", "application/vnd.eszigno3+xml"); - mimeTypes.put("dd2", "application/vnd.oma.dd2+xml"); - mimeTypes.put("semf", "application/vnd.semf"); - mimeTypes.put("semd", "application/vnd.semd"); - mimeTypes.put("pnm", "image/x-binary-anymap"); - mimeTypes.put("sema", "application/vnd.sema"); - mimeTypes.put("wma", "audio/x-ms-wma"); - mimeTypes.put("cww", "application/prs.cww"); - mimeTypes.put("scm", "application/vnd.lotus-screencam"); - mimeTypes.put("azf", "application/vnd.airzip.filesecure.azf"); - mimeTypes.put("oda", "application/oda"); - mimeTypes.put("dwg", "image/vnd.dwg"); - mimeTypes.put("h264", "video/h264"); - mimeTypes.put("hpgl", "application/vnd.hp-hpgl"); - mimeTypes.put("xpr", "application/vnd.is-xpr"); - mimeTypes.put("h263", "video/h263"); - mimeTypes.put("zip", "application/zip"); - mimeTypes.put("h261", "video/h261"); - mimeTypes.put("oti", "application/vnd.oasis.opendocument.image-template"); - mimeTypes.put("uoml", "application/vnd.uoml+xml"); - mimeTypes.put("xspf", "application/xspf+xml"); - mimeTypes.put("ppam", "application/vnd.ms-powerpoint.addin.macroenabled.12"); - mimeTypes.put("dtd", "application/xml-dtd"); - mimeTypes.put("gex", "application/vnd.geometry-explorer"); - mimeTypes.put("gre", "application/vnd.geometry-explorer"); - mimeTypes.put("dssc", "application/dssc+der"); - } - - /** - * @param f File to detect content type. - * @return Content type. - */ - @Nullable public static String getContentType(File f) { - try (FileInputStream is = new FileInputStream(f)) { - byte[] data = new byte[Math.min((int)f.length(), PREVIEW_SIZE)]; - - is.read(data); - - return getContentType(data, f.getName()); - } - catch (IOException ignored) { - return null; - } - } - - /** - * @param data Bytes to detect content type. - * @param name File name to detect content type by file name. - * @return Content type. - */ - @Nullable public static String getContentType(byte[] data, String name) { - if (data == null) - return null; - - byte[] hdr = new byte[PREVIEW_SIZE]; - - System.arraycopy(data, 0, hdr, 0, Math.min(data.length, hdr.length)); - - int c1 = hdr[0] & 0xff; - int c2 = hdr[1] & 0xff; - int c3 = hdr[2] & 0xff; - int c4 = hdr[3] & 0xff; - int c5 = hdr[4] & 0xff; - int c6 = hdr[5] & 0xff; - int c7 = hdr[6] & 0xff; - int c8 = hdr[7] & 0xff; - int c9 = hdr[8] & 0xff; - int c10 = hdr[9] & 0xff; - int c11 = hdr[10] & 0xff; - - if (c1 == 0xCA && c2 == 0xFE && c3 == 0xBA && c4 == 0xBE) - return "application/java-vm"; - - if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 && c5 == 0xA1 && c6 == 0xB1 && c7 == 0x1A && c8 == 0xE1) { - // if the name is set then check if it can be validated by name, because it could be a xls or powerpoint - String contentType = guessContentTypeFromName(name); - - if (contentType != null) - return contentType; - - return "application/msword"; - } - if (c1 == 0x25 && c2 == 0x50 && c3 == 0x44 && c4 == 0x46 && c5 == 0x2d && c6 == 0x31 && c7 == 0x2e) - return "application/pdf"; - - if (c1 == 0x38 && c2 == 0x42 && c3 == 0x50 && c4 == 0x53 && c5 == 0x00 && c6 == 0x01) - return "image/photoshop"; - - if (c1 == 0x25 && c2 == 0x21 && c3 == 0x50 && c4 == 0x53) - return "application/postscript"; - - if (c1 == 0xff && c2 == 0xfb && c3 == 0x30) - return "audio/mp3"; - - if (c1 == 0x49 && c2 == 0x44 && c3 == 0x33) - return "audio/mp3"; - - if (c1 == 0xAC && c2 == 0xED) { - // next two bytes are version number, currently 0x00 0x05 - return "application/x-java-serialized-object"; - } - - if (c1 == '<') { - if (c2 == '!' || - ((c2 == 'h' && (c3 == 't' && c4 == 'm' && c5 == 'l' || c3 == 'e' && c4 == 'a' && c5 == 'd') || - (c2 == 'b' && c3 == 'o' && c4 == 'd' && c5 == 'y'))) || - ((c2 == 'H' && (c3 == 'T' && c4 == 'M' && c5 == 'L' || c3 == 'E' && c4 == 'A' && c5 == 'D') || - (c2 == 'B' && c3 == 'O' && c4 == 'D' && c5 == 'Y')))) - return "text/html"; - - if (c2 == '?' && c3 == 'x' && c4 == 'm' && c5 == 'l' && c6 == ' ') - return "application/xml"; - } - - // big and little endian UTF-16 encodings, with byte order mark - if (c1 == 0xfe && c2 == 0xff) { - if (c3 == 0 && c4 == '<' && c5 == 0 && c6 == '?' && c7 == 0 && c8 == 'x') - return "application/xml"; - } - - if (c1 == 0xff && c2 == 0xfe) { - if (c3 == '<' && c4 == 0 && c5 == '?' && c6 == 0 && c7 == 'x' && c8 == 0) - return "application/xml"; - } - - if (c1 == 'B' && c2 == 'M') - return "image/bmp"; - - if (c1 == 0x49 && c2 == 0x49 && c3 == 0x2a && c4 == 0x00) - return "image/tiff"; - - if (c1 == 0x4D && c2 == 0x4D && c3 == 0x00 && c4 == 0x2a) - return "image/tiff"; - - if (c1 == 'G' && c2 == 'I' && c3 == 'F' && c4 == '8') - return "image/gif"; - - if (c1 == '#' && c2 == 'd' && c3 == 'e' && c4 == 'f') - return "image/x-bitmap"; - - if (c1 == '!' && c2 == ' ' && c3 == 'X' && c4 == 'P' && c5 == 'M' && c6 == '2') - return "image/x-pixmap"; - - if (c1 == 137 && c2 == 80 && c3 == 78 && c4 == 71 && c5 == 13 && c6 == 10 && c7 == 26 && c8 == 10) - return "image/png"; - - if (c1 == 0xFF && c2 == 0xD8 && c3 == 0xFF) { - if (c4 == 0xE0) - return "image/jpeg"; - - // File format used by digital cameras to store images. - // Exif Format can be read by any application supporting JPEG. Exif Spec can be found at: - // http://www.pima.net/standards/it10/PIMA15740/Exif_2-1.PDF - if ((c4 == 0xE1) && (c7 == 'E' && c8 == 'x' && c9 == 'i' && c10 == 'f' && c11 == 0)) - return "image/jpeg"; - - if (c4 == 0xEE) - return "image/jpg"; - } - - // According to http://www.opendesign.com/files/guestdownloads/OpenDesign_Specification_for_.dwg_files.pdf - // first 6 bytes are of type "AC1018" (for example) and the next 5 bytes are 0x00. - if ((c1 == 0x41 && c2 == 0x43) && (c7 == 0x00 && c8 == 0x00 && c9 == 0x00 && c10 == 0x00 && c11 == 0x00)) - return "application/acad"; - - if (c1 == 0x2E && c2 == 0x73 && c3 == 0x6E && c4 == 0x64) - return "audio/basic"; // .au format, big endian - - if (c1 == 0x64 && c2 == 0x6E && c3 == 0x73 && c4 == 0x2E) - return "audio/basic"; // .au format, little endian - - // I don't know if this is official but evidence suggests that .wav files start with "RIFF" - brown - if (c1 == 'R' && c2 == 'I' && c3 == 'F' && c4 == 'F') - return "audio/x-wav"; - - if (c1 == 'P' && c2 == 'K') { - // its application/zip but this could be a open office thing if name is given - String contentType = guessContentTypeFromName(name); - if (contentType != null) - return contentType; - return "application/zip"; - } - return guessContentTypeFromName(name); - } - - /** - * @param name File name to detect content type by file name. - * @return Content type. - */ - @Nullable public static String guessContentTypeFromName(String name) { - if (name == null) - return null; - - int lastIdx = name.lastIndexOf('.'); - - if (lastIdx != -1) { - String extension = name.substring(lastIdx + 1).toLowerCase(); - - return mimeTypes.get(extension); - } - - return null; - } -} 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 521d2128340d0..aaeb55387d5c4 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 @@ -17,46 +17,18 @@ package org.apache.ignite.internal.visor.util; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileFilter; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; import java.math.BigDecimal; import java.net.InetAddress; import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.file.Files; -import java.nio.file.LinkOption; -import java.nio.file.Path; -import java.nio.file.Paths; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; import javax.cache.configuration.Factory; -import org.apache.ignite.Ignite; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.eviction.AbstractEvictionPolicyFactory; import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.events.Event; import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager; import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; import org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl; import org.apache.ignite.internal.util.IgniteUtils; @@ -64,214 +36,13 @@ 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.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.spi.eventstorage.NoopEventStorageSpi; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static java.lang.System.getProperty; -import static org.apache.ignite.events.EventType.EVTS_DISCOVERY; -import static org.apache.ignite.events.EventType.EVT_CLASS_DEPLOY_FAILED; -import static org.apache.ignite.events.EventType.EVT_JOB_CANCELLED; -import static org.apache.ignite.events.EventType.EVT_JOB_FAILED; -import static org.apache.ignite.events.EventType.EVT_JOB_FAILED_OVER; -import static org.apache.ignite.events.EventType.EVT_JOB_FINISHED; -import static org.apache.ignite.events.EventType.EVT_JOB_REJECTED; -import static org.apache.ignite.events.EventType.EVT_JOB_STARTED; -import static org.apache.ignite.events.EventType.EVT_JOB_TIMEDOUT; -import static org.apache.ignite.events.EventType.EVT_TASK_DEPLOY_FAILED; -import static org.apache.ignite.events.EventType.EVT_TASK_FAILED; -import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED; -import static org.apache.ignite.events.EventType.EVT_TASK_STARTED; -import static org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT; - /** * Contains utility methods for Visor tasks and jobs. */ public class VisorTaskUtils { - /** Default substitute for {@code null} names. */ - private static final String DFLT_EMPTY_NAME = ""; - - /** Throttle count for lost events. */ - private static final int EVENTS_LOST_THROTTLE = 10; - - /** Period to grab events. */ - private static final int EVENTS_COLLECT_TIME_WINDOW = 10 * 60 * 1000; - - /** Empty buffer for file block. */ - private static final byte[] EMPTY_FILE_BUF = new byte[0]; - - /** Log files count limit */ - public static final int LOG_FILES_COUNT_LIMIT = 5000; - - /** */ - public static final int NOTHING_TO_REBALANCE = -1; - - /** */ - public static final int REBALANCE_NOT_AVAILABLE = -2; - - /** */ - public static final double MINIMAL_REBALANCE = 0.01; - - /** */ - public static final int REBALANCE_COMPLETE = 1; - - /** */ - private static final int DFLT_BUFFER_SIZE = 4096; - - /** Only task event types that Visor should collect. */ - public static final int[] VISOR_TASK_EVTS = { - EVT_JOB_STARTED, - EVT_JOB_FINISHED, - EVT_JOB_TIMEDOUT, - EVT_JOB_FAILED, - EVT_JOB_FAILED_OVER, - EVT_JOB_REJECTED, - EVT_JOB_CANCELLED, - - EVT_TASK_STARTED, - EVT_TASK_FINISHED, - EVT_TASK_FAILED, - EVT_TASK_TIMEDOUT - }; - - /** Only non task event types that Visor should collect. */ - public static final int[] VISOR_NON_TASK_EVTS = { - EVT_CLASS_DEPLOY_FAILED, - EVT_TASK_DEPLOY_FAILED - }; - - /** Only non task event types that Visor should collect. */ - public static final int[] VISOR_ALL_EVTS = concat(VISOR_TASK_EVTS, VISOR_NON_TASK_EVTS); - - /** Maximum folder depth. I.e. if depth is 4 we look in starting folder and 3 levels of sub-folders. */ - public static final int MAX_FOLDER_DEPTH = 4; - - /** Comparator for log files by last modified date. */ - private static final Comparator LAST_MODIFIED = new Comparator() { - @Override public int compare(VisorLogFile f1, VisorLogFile f2) { - return Long.compare(f2.getLastModified(), f1.getLastModified()); - } - }; - - /** - * @param name Grid-style nullable name. - * @return Name with {@code null} replaced to <default>. - */ - public static String escapeName(@Nullable Object name) { - return name == null ? DFLT_EMPTY_NAME : name.toString(); - } - - /** - * @param name Escaped name. - * @return Name or {@code null} for default name. - */ - public static String unescapeName(String name) { - assert name != null; - - return DFLT_EMPTY_NAME.equals(name) ? null : name; - } - - /** - * Concat arrays in one. - * - * @param arrays Arrays. - * @return Summary array. - */ - public static int[] concat(int[]... arrays) { - assert arrays != null; - assert arrays.length > 1; - - int len = 0; - - for (int[] a : arrays) - len += a.length; - - int[] r = Arrays.copyOf(arrays[0], len); - - for (int i = 1, shift = 0; i < arrays.length; i++) { - shift += arrays[i - 1].length; - System.arraycopy(arrays[i], 0, r, shift, arrays[i].length); - } - - return r; - } - - /** - * Returns compact class host. - * - * @param obj Object to compact. - * @return String. - */ - @Nullable public static Object compactObject(Object obj) { - if (obj == null) - return null; - - if (obj instanceof Enum) - return obj.toString(); - - if (obj instanceof String || obj instanceof Boolean || obj instanceof Number) - return obj; - - if (obj instanceof Collection) { - Collection col = (Collection)obj; - - Object[] res = new Object[col.size()]; - - int i = 0; - - for (Object elm : col) - res[i++] = compactObject(elm); - - return res; - } - - if (obj.getClass().isArray()) { - Class arrType = obj.getClass().getComponentType(); - - if (arrType.isPrimitive()) { - if (obj instanceof boolean[]) - return Arrays.toString((boolean[])obj); - if (obj instanceof byte[]) - return Arrays.toString((byte[])obj); - if (obj instanceof short[]) - return Arrays.toString((short[])obj); - if (obj instanceof int[]) - return Arrays.toString((int[])obj); - if (obj instanceof long[]) - return Arrays.toString((long[])obj); - if (obj instanceof float[]) - return Arrays.toString((float[])obj); - if (obj instanceof double[]) - return Arrays.toString((double[])obj); - } - - Object[] arr = (Object[])obj; - - int iMax = arr.length - 1; - - StringBuilder sb = new StringBuilder("["); - - for (int i = 0; i <= iMax; i++) { - sb.append(compactObject(arr[i])); - - if (i != iMax) - sb.append(", "); - } - - sb.append(']'); - - return sb.toString(); - } - - return U.compact(obj.getClass().getName()); - } - /** * Compact class names. * @@ -318,29 +89,6 @@ public static int[] concat(int[]... arrays) { return res; } - /** - * Joins array elements to string. - * - * @param arr Array. - * @return String. - */ - @Nullable public static String compactArray(Object[] arr) { - if (arr == null || arr.length == 0) - return null; - - String sep = ", "; - - StringBuilder sb = new StringBuilder(); - - for (Object s : arr) - sb.append(s).append(sep); - - if (sb.length() > 0) - sb.setLength(sb.length() - sep.length()); - - return U.compact(sb.toString()); - } - /** * Joins iterable collection elements to string. * @@ -364,376 +112,6 @@ public static int[] concat(int[]... arrays) { return U.compact(sb.toString()); } - /** - * Returns boolean value from system property or provided function. - * - * @param propName System property name. - * @param dflt Function that returns {@code Integer}. - * @return {@code Integer} value - */ - public static Integer intValue(String propName, Integer dflt) { - String sysProp = getProperty(propName); - - return (sysProp != null && !sysProp.isEmpty()) ? Integer.getInteger(sysProp) : dflt; - } - - /** - * Returns boolean value from system property or provided function. - * - * @param propName System property host. - * @param dflt Function that returns {@code Boolean}. - * @return {@code Boolean} value - */ - public static boolean boolValue(String propName, boolean dflt) { - String sysProp = getProperty(propName); - - return (sysProp != null && !sysProp.isEmpty()) ? Boolean.getBoolean(sysProp) : dflt; - } - - /** - * Helper function to get value from map. - * - * @param map Map to take value from. - * @param key Key to search in map. - * @param ifNull Default value if {@code null} was returned by map. - * @param Key type. - * @param Value type. - * @return Value from map or default value if map return {@code null}. - */ - public static V getOrElse(Map map, K key, V ifNull) { - assert map != null; - - V res = map.get(key); - - return res != null ? res : ifNull; - } - - /** - * Checks for explicit events configuration. - * - * @param ignite Grid instance. - * @return {@code true} if all task events explicitly specified in configuration. - */ - public static boolean checkExplicitTaskMonitoring(Ignite ignite) { - int[] evts = ignite.configuration().getIncludeEventTypes(); - - if (F.isEmpty(evts)) - return false; - - for (int evt : VISOR_TASK_EVTS) { - if (!F.contains(evts, evt)) - return false; - } - - return true; - } - - /** Events comparator by event local order. */ - private static final Comparator EVTS_ORDER_COMPARATOR = new Comparator() { - @Override public int compare(Event o1, Event o2) { - return Long.compare(o1.localOrder(), o2.localOrder()); - } - }; - - /** Mapper from grid event to Visor data transfer object. */ - public static final VisorEventMapper EVT_MAPPER = new VisorEventMapper(); - - /** - * Grabs local events and detects if events was lost since last poll. - * - * @param ignite Target grid. - * @param evtOrderKey Unique key to take last order key from node local map. - * @param evtThrottleCntrKey Unique key to take throttle count from node local map. - * @param all If {@code true} then collect all events otherwise collect only non task events. - * @param evtMapper Closure to map grid events to Visor data transfer objects. - * @return Collections of node events - */ - public static Collection collectEvents(Ignite ignite, String evtOrderKey, String evtThrottleCntrKey, - boolean all, IgniteClosure evtMapper) { - int[] evtTypes = all ? VISOR_ALL_EVTS : VISOR_NON_TASK_EVTS; - - // Collect discovery events for Web Console. - if (evtOrderKey.startsWith("CONSOLE_")) - evtTypes = concat(evtTypes, EVTS_DISCOVERY); - - return collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, evtTypes, evtMapper); - } - - /** - * Grabs local events and detects if events was lost since last poll. - * - * @param ignite Target grid. - * @param evtOrderKey Unique key to take last order key from node local map. - * @param evtThrottleCntrKey Unique key to take throttle count from node local map. - * @param evtTypes Event types to collect. - * @param evtMapper Closure to map grid events to Visor data transfer objects. - * @return Collections of node events - */ - public static List collectEvents(Ignite ignite, String evtOrderKey, String evtThrottleCntrKey, - int[] evtTypes, IgniteClosure evtMapper) { - assert ignite != null; - assert evtTypes != null && evtTypes.length > 0; - - ConcurrentMap nl = ignite.cluster().nodeLocalMap(); - - final long lastOrder = getOrElse(nl, evtOrderKey, -1L); - final long throttle = getOrElse(nl, evtThrottleCntrKey, 0L); - - // When we first time arrive onto a node to get its local events, - // we'll grab only last those events that not older than given period to make sure we are - // not grabbing GBs of data accidentally. - final long notOlderThan = System.currentTimeMillis() - EVENTS_COLLECT_TIME_WINDOW; - - // Flag for detecting gaps between events. - final AtomicBoolean lastFound = new AtomicBoolean(lastOrder < 0); - - IgnitePredicate p = new IgnitePredicate() { - /** */ - private static final long serialVersionUID = 0L; - - @Override public boolean apply(Event e) { - // Detects that events were lost. - if (!lastFound.get() && (lastOrder == e.localOrder())) - lastFound.set(true); - - // Retains events by lastOrder, period and type. - return e.localOrder() > lastOrder && e.timestamp() > notOlderThan; - } - }; - - Collection evts = ignite.configuration().getEventStorageSpi() instanceof NoopEventStorageSpi - ? Collections.emptyList() - : ignite.events().localQuery(p, evtTypes); - - // Update latest order in node local, if not empty. - if (!evts.isEmpty()) { - Event maxEvt = Collections.max(evts, EVTS_ORDER_COMPARATOR); - - nl.put(evtOrderKey, maxEvt.localOrder()); - } - - // Update throttle counter. - if (!lastFound.get()) - nl.put(evtThrottleCntrKey, throttle == 0 ? EVENTS_LOST_THROTTLE : throttle - 1); - - boolean lost = !lastFound.get() && throttle == 0; - - List res = new ArrayList<>(evts.size() + (lost ? 1 : 0)); - - if (lost) - res.add(new VisorGridEventsLost(ignite.cluster().localNode().id())); - - for (Event e : evts) { - VisorGridEvent visorEvt = evtMapper.apply(e); - - if (visorEvt != null) - res.add(visorEvt); - } - - return res; - } - - /** - * @param path Path to resolve only relative to IGNITE_HOME. - * @return Resolved path as file, or {@code null} if path cannot be resolved. - * @throws IOException If failed to resolve path. - */ - public static File resolveIgnitePath(String path) throws IOException { - File folder = U.resolveIgnitePath(path); - - if (folder == null) - return null; - - if (!folder.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS).startsWith(Paths.get(U.getIgniteHome()))) - return null; - - return folder; - } - - /** - * @param file File to resolve. - * @return Resolved file if it is a symbolic link or original file. - * @throws IOException If failed to resolve symlink. - */ - public static File resolveSymbolicLink(File file) throws IOException { - Path path = file.toPath(); - - return Files.isSymbolicLink(path) ? Files.readSymbolicLink(path).toFile() : file; - } - - /** - * Finds all files in folder and in it's sub-tree of specified depth. - * - * @param file Starting folder - * @param maxDepth Depth of the tree. If 1 - just look in the folder, no sub-folders. - * @param filter file filter. - * @return List of found files. - * @throws IOException If failed to list files. - */ - public static List fileTree(File file, int maxDepth, @Nullable FileFilter filter) throws IOException { - file = resolveSymbolicLink(file); - - if (file.isDirectory()) { - File[] files = (filter == null) ? file.listFiles() : file.listFiles(filter); - - if (files == null) - return Collections.emptyList(); - - List res = new ArrayList<>(files.length); - - for (File f : files) { - if (f.isFile() && f.length() > 0) - res.add(new VisorLogFile(f)); - else if (maxDepth > 1) - res.addAll(fileTree(f, maxDepth - 1, filter)); - } - - return res; - } - - // Return ArrayList, because it could be sorted in matchedFiles() method. - return new ArrayList<>(F.asList(new VisorLogFile(file))); - } - - /** - * @param file Folder with files to match. - * @param ptrn Pattern to match against file name. - * @return Collection of matched files. - * @throws IOException If failed to filter files. - */ - public static List matchedFiles(File file, final String ptrn) throws IOException { - List files = fileTree(file, MAX_FOLDER_DEPTH, - new FileFilter() { - @Override public boolean accept(File f) { - return !f.isHidden() && (f.isDirectory() || f.isFile() && f.getName().matches(ptrn)); - } - } - ); - - Collections.sort(files, LAST_MODIFIED); - - return files; - } - - /** Text files mime types. */ - private static final String[] TEXT_MIME_TYPE = new String[] {"text/plain", "application/xml", "text/html", "x-sh"}; - - /** - * Check is text file. - * - * @param f file reference. - * @param emptyOk default value if empty file. - * @return Is text file. - */ - public static boolean textFile(File f, boolean emptyOk) { - if (f.length() == 0) - return emptyOk; - - String detected = VisorMimeTypes.getContentType(f); - - for (String mime : TEXT_MIME_TYPE) - if (mime.equals(detected)) - return true; - - return false; - } - - /** - * Decode file charset. - * - * @param f File to process. - * @return File charset. - * @throws IOException in case of error. - */ - public static Charset decode(File f) throws IOException { - SortedMap charsets = Charset.availableCharsets(); - - String[] firstCharsets = {Charset.defaultCharset().name(), "US-ASCII", "UTF-8", "UTF-16BE", "UTF-16LE"}; - - Collection orderedCharsets = U.newLinkedHashSet(charsets.size()); - - for (String c : firstCharsets) - if (charsets.containsKey(c)) - orderedCharsets.add(charsets.get(c)); - - orderedCharsets.addAll(charsets.values()); - - try (RandomAccessFile raf = new RandomAccessFile(f, "r")) { - FileChannel ch = raf.getChannel(); - - ByteBuffer buf = ByteBuffer.allocate(DFLT_BUFFER_SIZE); - - ch.read(buf); - - buf.flip(); - - for (Charset charset : orderedCharsets) { - CharsetDecoder decoder = charset.newDecoder(); - - decoder.reset(); - - try { - decoder.decode(buf); - - return charset; - } - catch (CharacterCodingException ignored) { - } - } - } - - return Charset.defaultCharset(); - } - - /** - * Read block from file. - * - * @param file - File to read. - * @param off - Marker position in file to start read from if {@code -1} read last blockSz bytes. - * @param blockSz - Maximum number of chars to read. - * @param lastModified - File last modification time. - * @return Read file block. - * @throws IOException In case of error. - */ - public static VisorFileBlock readBlock(File file, long off, int blockSz, long lastModified) throws IOException { - RandomAccessFile raf = null; - - try { - long fSz = file.length(); - long fLastModified = file.lastModified(); - - long pos = off >= 0 ? off : Math.max(fSz - blockSz, 0); - - // Try read more that file length. - if (fLastModified == lastModified && fSz != 0 && pos >= fSz) - throw new IOException("Trying to read file block with wrong offset: " + pos + " while file size: " + fSz); - - if (fSz == 0) - return new VisorFileBlock(file.getPath(), pos, fLastModified, 0, false, EMPTY_FILE_BUF); - else { - int toRead = Math.min(blockSz, (int)(fSz - pos)); - - raf = new RandomAccessFile(file, "r"); - raf.seek(pos); - - byte[] buf = new byte[toRead]; - - int cntRead = raf.read(buf, 0, toRead); - - if (cntRead != toRead) - throw new IOException("Count of requested and actually read bytes does not match [cntRead=" + - cntRead + ", toRead=" + toRead + ']'); - - boolean zipped = buf.length > 512; - - return new VisorFileBlock(file.getPath(), pos, fSz, fLastModified, zipped, zipped ? zipBytes(buf) : buf); - } - } - finally { - U.close(raf, null); - } - } - /** * Extract max size from eviction policy if available. * @@ -860,246 +238,6 @@ public static long log(@Nullable IgniteLogger log, String msg, Class clazz, l return end; } - /** - * Log message. - * - * @param log Logger. - * @param msg Message. - */ - public static void log(@Nullable IgniteLogger log, String msg) { - log0(log, System.currentTimeMillis(), " " + msg); - } - - /** - * Checks if address can be reached using one argument InetAddress.isReachable() version or ping command if failed. - * - * @param addr Address to check. - * @param reachTimeout Timeout for the check. - * @return {@code True} if address is reachable. - */ - public static boolean reachableByPing(InetAddress addr, int reachTimeout) { - try { - if (addr.isReachable(reachTimeout)) - return true; - - String cmd = String.format("ping -%s 1 %s", U.isWindows() ? "n" : "c", addr.getHostAddress()); - - Process myProc = Runtime.getRuntime().exec(cmd); - - myProc.waitFor(); - - return myProc.exitValue() == 0; - } - catch (IOException ignore) { - return false; - } - catch (InterruptedException ignored) { - Thread.currentThread().interrupt(); - - return false; - } - } - - /** - * Start local node in terminal. - * - * @param log Logger. - * @param cfgPath Path to node configuration to start with. - * @param nodesToStart Number of nodes to start. - * @param quite If {@code true} then start node in quiet mode. - * @param envVars Optional map with environment variables. - * @return List of started processes. - * @throws IOException If failed to start. - */ - public static List startLocalNode(@Nullable IgniteLogger log, String cfgPath, int nodesToStart, - boolean quite, Map envVars) throws IOException { - String quitePar = quite ? "" : "-v"; - - String cmdFile = new File("bin", U.isWindows() ? "ignite.bat" : "ignite.sh").getPath(); - - File cmdFilePath = U.resolveIgnitePath(cmdFile); - - if (cmdFilePath == null || !cmdFilePath.exists()) - throw new FileNotFoundException(String.format("File not found: %s", cmdFile)); - - File nodesCfgPath = U.resolveIgnitePath(cfgPath); - - if (nodesCfgPath == null || !nodesCfgPath.exists()) - throw new FileNotFoundException(String.format("File not found: %s", cfgPath)); - - String nodeCfg = nodesCfgPath.getCanonicalPath(); - - log(log, String.format("Starting %s local %s with '%s' config", nodesToStart, nodesToStart > 1 ? "nodes" : "node", nodeCfg)); - - List run = new ArrayList<>(); - - try { - String igniteCmd = cmdFilePath.getCanonicalPath(); - - for (int i = 0; i < nodesToStart; i++) { - if (U.isMacOs()) { - Map macEnv = new HashMap<>(System.getenv()); - - if (envVars != null) { - for (Map.Entry ent : envVars.entrySet()) - if (macEnv.containsKey(ent.getKey())) { - String old = macEnv.get(ent.getKey()); - - if (old == null || old.isEmpty()) - macEnv.put(ent.getKey(), ent.getValue()); - else - macEnv.put(ent.getKey(), old + ':' + ent.getValue()); - } - else - macEnv.put(ent.getKey(), ent.getValue()); - } - - StringBuilder envs = new StringBuilder(); - - for (Map.Entry entry : macEnv.entrySet()) { - String val = entry.getValue(); - - if (val.indexOf(';') < 0 && val.indexOf('\'') < 0) - envs.append(String.format("export %s='%s'; ", - entry.getKey(), val.replace('\n', ' ').replace("'", "\'"))); - } - - run.add(openInConsole(envs.toString(), igniteCmd, quitePar, nodeCfg)); - } - else - run.add(openInConsole(null, envVars, igniteCmd, quitePar, nodeCfg)); - } - - return run; - } - catch (Exception e) { - for (Process proc: run) - proc.destroy(); - - throw e; - } - } - - /** - * Run command in separated console. - * - * @param args A string array containing the program and its arguments. - * @return Started process. - * @throws IOException in case of error. - */ - public static Process openInConsole(String... args) throws IOException { - return openInConsole(null, args); - } - - /** - * Run command in separated console. - * - * @param workFolder Work folder for command. - * @param args A string array containing the program and its arguments. - * @return Started process. - * @throws IOException in case of error. - */ - public static Process openInConsole(@Nullable File workFolder, String... args) throws IOException { - return openInConsole(workFolder, null, args); - } - - /** - * Run command in separated console. - * - * @param workFolder Work folder for command. - * @param envVars Optional map with environment variables. - * @param args A string array containing the program and its arguments. - * @return Started process. - * @throws IOException If failed to start process. - */ - public static Process openInConsole(@Nullable File workFolder, Map envVars, String... args) - throws IOException { - String[] commands = args; - - String cmd = F.concat(Arrays.asList(args), " "); - - if (U.isWindows()) - commands = F.asArray("cmd", "/c", String.format("start %s", cmd)); - - if (U.isMacOs()) - commands = F.asArray("osascript", "-e", - String.format("tell application \"Terminal\" to do script \"%s\"", cmd)); - - if (U.isUnix()) - commands = F.asArray("xterm", "-sl", "1024", "-geometry", "200x50", "-e", cmd); - - ProcessBuilder pb = new ProcessBuilder(commands); - - if (workFolder != null) - pb.directory(workFolder); - - if (envVars != null) { - String sep = U.isWindows() ? ";" : ":"; - - Map goalVars = pb.environment(); - - for (Map.Entry var: envVars.entrySet()) { - String envVar = goalVars.get(var.getKey()); - - if (envVar == null || envVar.isEmpty()) - envVar = var.getValue(); - else - envVar += sep + var.getValue(); - - goalVars.put(var.getKey(), envVar); - } - } - - return pb.start(); - } - - /** - * Zips byte array. - * - * @param input Input bytes. - * @return Zipped byte array. - * @throws IOException If failed. - */ - public static byte[] zipBytes(byte[] input) throws IOException { - return zipBytes(input, DFLT_BUFFER_SIZE); - } - - /** - * Zips byte array. - * - * @param input Input bytes. - * @param initBufSize Initial buffer size. - * @return Zipped byte array. - * @throws IOException If failed. - */ - public static byte[] zipBytes(byte[] input, int initBufSize) throws IOException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(initBufSize); - - try (ZipOutputStream zos = new ZipOutputStream(bos)) { - try { - ZipEntry entry = new ZipEntry(""); - - entry.setSize(input.length); - - zos.putNextEntry(entry); - zos.write(input); - } - finally { - zos.closeEntry(); - } - } - - return bos.toByteArray(); - } - - /** - * @param msg Exception message. - * @return {@code true} if node failed to join grid. - */ - public static boolean joinTimedOut(String msg) { - return msg != null && msg.startsWith("Join process timed out."); - } - /** * Special wrapper over address that can be sorted in following order: * IPv4, private IPv4, IPv4 local host, IPv6. @@ -1191,64 +329,6 @@ public String address() { } } - /** - * Sort addresses: IPv4 & real addresses first. - * - * @param addrs Addresses to sort. - * @return Sorted list. - */ - public static Collection sortAddresses(Collection addrs) { - if (F.isEmpty(addrs)) - return Collections.emptyList(); - - int sz = addrs.size(); - - List sorted = new ArrayList<>(sz); - - for (String addr : addrs) - sorted.add(new SortableAddress(addr)); - - Collections.sort(sorted); - - Collection res = new ArrayList<>(sz); - - for (SortableAddress sa : sorted) - res.add(sa.address()); - - return res; - } - - /** - * Split addresses. - * - * @param s String with comma separted addresses. - * @return Collection of addresses. - */ - public static Collection splitAddresses(String s) { - if (F.isEmpty(s)) - return Collections.emptyList(); - - String[] addrs = s.split(","); - - for (int i = 0; i < addrs.length; i++) - addrs[i] = addrs[i].trim(); - - return Arrays.asList(addrs); - } - - /** - * @param ignite Ignite. - * @param cacheName Cache name to check. - * @return {@code true} if cache on local node is not a data cache or near cache disabled. - */ - public static boolean isProxyCache(IgniteEx ignite, String cacheName) { - GridDiscoveryManager discovery = ignite.context().discovery(); - - ClusterNode locNode = ignite.localNode(); - - return !(discovery.cacheAffinityNode(locNode, cacheName) || discovery.cacheNearNode(locNode, cacheName)); - } - /** * Check whether cache restarting in progress. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java deleted file mode 100644 index 2d86a428d38bd..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.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.verify; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import org.apache.ignite.IgniteException; -import org.apache.ignite.compute.ComputeJobContext; -import org.apache.ignite.compute.ComputeTaskFuture; -import org.apache.ignite.internal.processors.cache.verify.CollectConflictPartitionKeysTask; -import org.apache.ignite.internal.processors.cache.verify.PartitionEntryHashRecord; -import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord; -import org.apache.ignite.internal.processors.cache.verify.RetrieveConflictPartitionValuesTask; -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.IgniteFuture; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.resources.JobContextResource; - -/** - * Task to find diverged keys of conflict partition. - */ -@GridInternal -public class VisorIdleAnalyzeTask extends VisorOneNodeTask { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorJob job(VisorIdleAnalyzeTaskArg arg) { - return new VisorIdleVerifyJob(arg, debug); - } - - /** - * - */ - private static class VisorIdleVerifyJob extends VisorJob { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private ComputeTaskFuture>> conflictKeysFut; - - /** */ - private ComputeTaskFuture>> conflictValsFut; - - /** Auto-inject job context. */ - @JobContextResource - protected transient ComputeJobContext jobCtx; - - /** - * @param arg Argument. - * @param debug Debug. - */ - private VisorIdleVerifyJob(VisorIdleAnalyzeTaskArg arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected VisorIdleAnalyzeTaskResult run(VisorIdleAnalyzeTaskArg arg) throws IgniteException { - if (conflictKeysFut == null) { - conflictKeysFut = ignite.compute() - .executeAsync(CollectConflictPartitionKeysTask.class, arg.getPartitionKey()); - - if (!conflictKeysFut.isDone()) { - jobCtx.holdcc(); - - conflictKeysFut.listen(new IgniteInClosure>>>() { - @Override public void apply(IgniteFuture>> f) { - jobCtx.callcc(); - } - }); - - return null; - } - } - - Map> conflictKeys = conflictKeysFut.get(); - - if (conflictKeys.isEmpty()) - return new VisorIdleAnalyzeTaskResult(Collections.emptyMap()); - - if (conflictValsFut == null) { - conflictValsFut = ignite.compute().executeAsync(RetrieveConflictPartitionValuesTask.class, conflictKeys); - - if (!conflictValsFut.isDone()) { - jobCtx.holdcc(); - - conflictKeysFut.listen(new IgniteInClosure>>>() { - @Override public void apply(IgniteFuture>> f) { - jobCtx.callcc(); - } - }); - - return null; - } - } - - return new VisorIdleAnalyzeTaskResult(conflictValsFut.get()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIdleVerifyJob.class, this); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java deleted file mode 100644 index 884f9610c42a7..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java +++ /dev/null @@ -1,88 +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.verify; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.processors.cache.verify.PartitionKey; -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; - -/** - * Arguments for task {@link VisorIdleAnalyzeTask} - */ -public class VisorIdleAnalyzeTaskArg extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Partition key. */ - private PartitionKey partKey; - - /** - * Default constructor. - */ - public VisorIdleAnalyzeTaskArg() { - // No-op. - } - - /** - * @param partKey Partition key. - */ - public VisorIdleAnalyzeTaskArg(PartitionKey partKey) { - this.partKey = partKey; - } - - /** - * @param grpId Group id. - * @param partId Partition id. - * @param grpName Group name. - */ - public VisorIdleAnalyzeTaskArg(int grpId, int partId, String grpName) { - this(new PartitionKey(grpId, partId, grpName)); - } - - /** - * @return Partition key. - */ - public PartitionKey getPartitionKey() { - return partKey; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - out.writeInt(partKey.groupId()); - out.writeInt(partKey.partitionId()); - U.writeString(out, partKey.groupName()); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException { - int grpId = in.readInt(); - int partId = in.readInt(); - String grpName = U.readString(in); - - partKey = new PartitionKey(grpId, partId, grpName); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIdleAnalyzeTaskArg.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java deleted file mode 100644 index e8c129033ef8d..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java +++ /dev/null @@ -1,76 +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.verify; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.List; -import java.util.Map; -import org.apache.ignite.internal.processors.cache.verify.PartitionEntryHashRecord; -import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord; -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 task {@link VisorIdleAnalyzeTask} - */ -public class VisorIdleAnalyzeTaskResult extends VisorDataTransferObject { - /** */ - private static final long serialVersionUID = 0L; - - /** Results. */ - private Map> divergedEntries; - - /** - * Default constructor. - */ - public VisorIdleAnalyzeTaskResult() { - // No-op. - } - - /** - * @param divergedEntries Result. - */ - public VisorIdleAnalyzeTaskResult(Map> divergedEntries) { - this.divergedEntries = divergedEntries; - } - - /** - * @return Results. - */ - public Map> getDivergedEntries() { - return divergedEntries; - } - - /** {@inheritDoc} */ - @Override protected void writeExternalData(ObjectOutput out) throws IOException { - U.writeMap(out, divergedEntries); - } - - /** {@inheritDoc} */ - @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { - divergedEntries = U.readMap(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorIdleAnalyzeTaskResult.class, this); - } -} diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties index e315041ed67a0..b61eefc713dc2 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -25,6 +25,7 @@ org.apache.ignite.IgniteIllegalStateException org.apache.ignite.IgniteInterruptedException org.apache.ignite.IgniteJdbcThinDataSource org.apache.ignite.IgniteState +org.apache.ignite.ShutdownPolicy org.apache.ignite.binary.BinaryInvalidTypeException org.apache.ignite.binary.BinaryObject org.apache.ignite.binary.BinaryObjectException @@ -32,6 +33,7 @@ org.apache.ignite.binary.BinaryTypeConfiguration org.apache.ignite.cache.CacheAtomicityMode org.apache.ignite.cache.CacheEntryEventSerializableFilter org.apache.ignite.cache.CacheEntryProcessor +org.apache.ignite.cache.CacheEntryVersion org.apache.ignite.cache.CacheExistsException org.apache.ignite.cache.CacheInterceptor org.apache.ignite.cache.CacheInterceptorAdapter @@ -46,11 +48,13 @@ org.apache.ignite.cache.PartitionLossPolicy org.apache.ignite.cache.QueryEntity org.apache.ignite.cache.QueryIndex org.apache.ignite.cache.QueryIndexType +org.apache.ignite.cache.ReadRepairStrategy org.apache.ignite.cache.affinity.AffinityFunction org.apache.ignite.cache.affinity.AffinityKey org.apache.ignite.cache.affinity.AffinityKeyMapper org.apache.ignite.cache.affinity.AffinityUuid org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeAffinityBackupFilter +org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction$HashComparator org.apache.ignite.cache.eviction.AbstractEvictionPolicy @@ -69,6 +73,8 @@ org.apache.ignite.cache.query.AbstractContinuousQuery org.apache.ignite.cache.query.CacheQueryEntryEvent org.apache.ignite.cache.query.ContinuousQuery org.apache.ignite.cache.query.ContinuousQueryWithTransformer +org.apache.ignite.cache.query.IndexQuery +org.apache.ignite.cache.query.IndexQueryCriterion org.apache.ignite.cache.query.Query org.apache.ignite.cache.query.QueryCancelledException org.apache.ignite.cache.query.QueryRetryException @@ -112,11 +118,20 @@ org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect$1 org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect$2 org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect$3 +org.apache.ignite.cdc.CdcEvent +org.apache.ignite.cdc.TypeMapping org.apache.ignite.client.ClientAuthenticationException org.apache.ignite.client.ClientAuthorizationException org.apache.ignite.client.ClientCacheConfiguration org.apache.ignite.client.ClientConnectionException org.apache.ignite.client.ClientException +org.apache.ignite.client.ClientFeatureNotSupportedByServerException +org.apache.ignite.client.ClientOperationType +org.apache.ignite.client.ClientReconnectedException +org.apache.ignite.client.ClientRetryAllPolicy +org.apache.ignite.client.ClientRetryNonePolicy +org.apache.ignite.client.ClientRetryPolicy +org.apache.ignite.client.ClientRetryReadPolicy org.apache.ignite.client.SslMode org.apache.ignite.client.SslProtocol org.apache.ignite.cluster.ClusterGroupEmptyException @@ -148,20 +163,31 @@ org.apache.ignite.configuration.CacheConfiguration org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate org.apache.ignite.configuration.CheckpointWriteOrder org.apache.ignite.configuration.ClientConfiguration +org.apache.ignite.configuration.ClientTransactionConfiguration org.apache.ignite.configuration.CollectionConfiguration org.apache.ignite.configuration.DataPageEvictionMode org.apache.ignite.configuration.DataRegionConfiguration org.apache.ignite.configuration.DataStorageConfiguration org.apache.ignite.configuration.DeploymentMode org.apache.ignite.configuration.DiskPageCompression +org.apache.ignite.configuration.EncryptionConfiguration org.apache.ignite.configuration.IgniteReflectionFactory +org.apache.ignite.configuration.LoadAllWarmUpConfiguration org.apache.ignite.configuration.MemoryConfiguration org.apache.ignite.configuration.MemoryPolicyConfiguration org.apache.ignite.configuration.NearCacheConfiguration +org.apache.ignite.configuration.NoOpWarmUpConfiguration +org.apache.ignite.configuration.PageReplacementMode org.apache.ignite.configuration.PersistentStoreConfiguration +org.apache.ignite.configuration.PlatformCacheConfiguration +org.apache.ignite.configuration.SystemDataRegionConfiguration org.apache.ignite.configuration.TopologyValidator org.apache.ignite.configuration.TransactionConfiguration org.apache.ignite.configuration.WALMode +org.apache.ignite.configuration.WarmUpConfiguration +org.apache.ignite.events.BaselineChangedEvent +org.apache.ignite.events.BaselineConfigurationChangedEvent +org.apache.ignite.events.CacheConsistencyViolationEvent org.apache.ignite.events.CacheEvent org.apache.ignite.events.CacheQueryExecutedEvent org.apache.ignite.events.CacheQueryReadEvent @@ -169,18 +195,25 @@ org.apache.ignite.events.CacheRebalancingEvent org.apache.ignite.events.CheckpointEvent org.apache.ignite.events.ClusterActivationEvent org.apache.ignite.events.ClusterStateChangeEvent +org.apache.ignite.events.ClusterStateChangeStartedEvent +org.apache.ignite.events.ClusterTagUpdatedEvent org.apache.ignite.events.DeploymentEvent org.apache.ignite.events.DiscoveryEvent org.apache.ignite.events.Event org.apache.ignite.events.EventAdapter org.apache.ignite.events.JobEvent +org.apache.ignite.events.NodeValidationFailedEvent +org.apache.ignite.events.PageReplacementStartedEvent +org.apache.ignite.events.SnapshotEvent +org.apache.ignite.events.SqlQueryExecutionEvent org.apache.ignite.events.TaskEvent org.apache.ignite.events.TransactionStateChangedEvent org.apache.ignite.events.WalSegmentArchivedEvent org.apache.ignite.events.WalSegmentCompactedEvent org.apache.ignite.failure.FailureType -org.apache.ignite.hadoop.HadoopInputSplit -org.apache.ignite.hadoop.HadoopMapReducePlan +org.apache.ignite.internal.CheckCpHistTask +org.apache.ignite.internal.CheckCpHistTask$CheckCpHistClosureJob +org.apache.ignite.internal.ComputeMXBeanImpl$ComputeCancelSession org.apache.ignite.internal.DuplicateTypeIdException org.apache.ignite.internal.ExecutorAwareMessage org.apache.ignite.internal.GridClosureCallMode @@ -233,24 +266,24 @@ org.apache.ignite.internal.IgniteFutureTimeoutCheckedException org.apache.ignite.internal.IgniteInterruptedCheckedException org.apache.ignite.internal.IgniteKernal org.apache.ignite.internal.IgniteKernal$1 -org.apache.ignite.internal.IgniteKernal$5 +org.apache.ignite.internal.IgniteKernal$3 org.apache.ignite.internal.IgniteMessagingImpl org.apache.ignite.internal.IgniteNeedReconnectException org.apache.ignite.internal.IgniteSchedulerImpl org.apache.ignite.internal.IgniteServicesImpl +org.apache.ignite.internal.IgniteTooManyOpenFilesException org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$2 org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$3 -org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$4 -org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$5 org.apache.ignite.internal.NodeStoppingException -org.apache.ignite.internal.SecurityCredentialsAttrFilterPredicate +org.apache.ignite.internal.QueryMXBeanImpl$CancelContinuousOnInitiator +org.apache.ignite.internal.QueryMXBeanImpl$CancelScan org.apache.ignite.internal.SecurityAwareBiPredicate org.apache.ignite.internal.SecurityAwarePredicate -org.apache.ignite.internal.TransactionMetricsMxBeanImpl +org.apache.ignite.internal.SecurityCredentialsAttrFilterPredicate org.apache.ignite.internal.UnregisteredBinaryTypeException org.apache.ignite.internal.UnregisteredClassException -org.apache.ignite.internal.CheckCpHistTask -org.apache.ignite.internal.CheckCpHistTask.CheckCpHistClosureJob +org.apache.ignite.internal.binary.BinaryArray +org.apache.ignite.internal.binary.BinaryEnumArray org.apache.ignite.internal.binary.BinaryEnumObjectImpl org.apache.ignite.internal.binary.BinaryFieldMetadata org.apache.ignite.internal.binary.BinaryMetadata @@ -264,31 +297,19 @@ org.apache.ignite.internal.binary.BinarySchema$Confirmation org.apache.ignite.internal.binary.BinaryTreeMap org.apache.ignite.internal.binary.BinaryWriteMode org.apache.ignite.internal.binary.builder.BinaryLazyMap$1$1$1 -org.apache.ignite.internal.commandline.cache.check_indexes_inline_size.CheckIndexInlineSizesResult -org.apache.ignite.internal.commandline.cache.check_indexes_inline_size.CheckIndexInlineSizesTask -org.apache.ignite.internal.commandline.cache.check_indexes_inline_size.CheckIndexInlineSizesTask.CheckIndexInlineSizesJob -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionGroup -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionNode -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionPartition -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTask -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTask$CacheDistributionJob -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTaskArg -org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTaskResult -org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTask -org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTask$CacheResetLostPartitionsJob -org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTaskArg -org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTaskResult -org.apache.ignite.internal.commandline.meta.tasks.MetadataListResult -org.apache.ignite.internal.commandline.meta.tasks.MetadataInfoTask -org.apache.ignite.internal.commandline.meta.tasks.MetadataInfoTask.MetadataListJob -org.apache.ignite.internal.commandline.meta.tasks.MetadataMarshalled -org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask -org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask.MetadataRemoveJob -org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask.DropAllThinSessionsJob -org.apache.ignite.internal.commandline.meta.tasks.MetadataTypeArgs -org.apache.ignite.internal.commandline.meta.tasks.MetadataUpdateTask -org.apache.ignite.internal.commandline.meta.tasks.MetadataUpdateTask.MetadataUpdateJob -org.apache.ignite.internal.commandline.meta.subcommands.VoidDto +org.apache.ignite.internal.cache.query.InIndexQueryCriterion +org.apache.ignite.internal.cache.query.RangeIndexQueryCriterion +org.apache.ignite.internal.cache.query.index.IndexQueryProcessor$1 +org.apache.ignite.internal.cache.query.index.IndexQueryResultMeta +org.apache.ignite.internal.cache.query.index.NullsOrder +org.apache.ignite.internal.cache.query.index.SortOrder +org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask +org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2 +org.apache.ignite.internal.cache.query.index.sorted.IndexKeyDefinition +org.apache.ignite.internal.cache.query.index.sorted.IndexKeyType +org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypeSettings +org.apache.ignite.internal.cdc.CdcEventImpl +org.apache.ignite.internal.cdc.TypeMappingImpl org.apache.ignite.internal.client.GridClientAuthenticationException org.apache.ignite.internal.client.GridClientCacheFlag org.apache.ignite.internal.client.GridClientCacheMode @@ -313,11 +334,15 @@ 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.client.thin.BinaryNameMapperMode +org.apache.ignite.internal.client.thin.ClientCacheEntryListenerHandler$CacheEntryEventImpl org.apache.ignite.internal.client.thin.ClientError +org.apache.ignite.internal.client.thin.ClientNotificationType org.apache.ignite.internal.client.thin.ClientOperation org.apache.ignite.internal.client.thin.ClientProtocolError org.apache.ignite.internal.client.thin.ClientServerError org.apache.ignite.internal.client.thin.ClientUtils$CfgItem +org.apache.ignite.internal.client.thin.ProtocolBitmaskFeature org.apache.ignite.internal.cluster.ClusterGroupAdapter org.apache.ignite.internal.cluster.ClusterGroupAdapter$AgeClusterGroup org.apache.ignite.internal.cluster.ClusterGroupAdapter$AttributeFilter @@ -337,38 +362,39 @@ org.apache.ignite.internal.cluster.IgniteKillTask org.apache.ignite.internal.cluster.IgniteKillTask$IgniteKillJob org.apache.ignite.internal.cluster.NodeOrderComparator org.apache.ignite.internal.cluster.NodeOrderLegacyComparator -org.apache.ignite.internal.commandline.CommandList -org.apache.ignite.internal.commandline.OutputFormat -org.apache.ignite.internal.commandline.TxCommandArg -org.apache.ignite.internal.commandline.baseline.AutoAdjustCommandArg -org.apache.ignite.internal.commandline.baseline.BaselineSubcommands -org.apache.ignite.internal.commandline.cache.CacheCommandList -org.apache.ignite.internal.commandline.cache.CacheSubcommands -org.apache.ignite.internal.commandline.cache.argument.DistributionCommandArg -org.apache.ignite.internal.commandline.cache.argument.FindAndDeleteGarbageArg -org.apache.ignite.internal.commandline.cache.argument.IdleVerifyCommandArg -org.apache.ignite.internal.commandline.cache.argument.ListCommandArg -org.apache.ignite.internal.commandline.cache.argument.PartitionReconciliationCommandArg -org.apache.ignite.internal.commandline.cache.argument.ValidateIndexesCommandArg +org.apache.ignite.internal.commandline.cache.check_indexes_inline_size.CheckIndexInlineSizesResult +org.apache.ignite.internal.commandline.cache.check_indexes_inline_size.CheckIndexInlineSizesTask org.apache.ignite.internal.commandline.cache.check_indexes_inline_size.CheckIndexInlineSizesTask$CheckIndexInlineSizesJob -org.apache.ignite.internal.commandline.diagnostic.DiagnosticSubCommand -org.apache.ignite.internal.commandline.diagnostic.PageLocksCommand$PageLocksCommandArg -org.apache.ignite.internal.commandline.dr.DrSubCommandsList -org.apache.ignite.internal.commandline.dr.subcommands.DrCacheCommand$Action -org.apache.ignite.internal.commandline.dr.subcommands.DrCacheCommand$CacheFilter -org.apache.ignite.internal.commandline.dr.subcommands.DrCacheCommand$SenderGroup -org.apache.ignite.internal.commandline.management.ManagementCommandList -org.apache.ignite.internal.commandline.management.ManagementURLCommandArg -org.apache.ignite.internal.commandline.meta.subcommands.MetadataAbstractSubCommand.VoidDto -org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask$MetadataRemoveJob +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionGroup +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionNode +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionPartition +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTask +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTask$CacheDistributionJob +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTaskArg +org.apache.ignite.internal.commandline.cache.distribution.CacheDistributionTaskResult +org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTask +org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTask$CacheResetLostPartitionsJob +org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTaskArg +org.apache.ignite.internal.commandline.cache.reset_lost_partitions.CacheResetLostPartitionsTaskResult +org.apache.ignite.internal.commandline.meta.subcommands.VoidDto +org.apache.ignite.internal.commandline.meta.tasks.MetadataInfoTask +org.apache.ignite.internal.commandline.meta.tasks.MetadataInfoTask$MetadataListJob +org.apache.ignite.internal.commandline.meta.tasks.MetadataListResult +org.apache.ignite.internal.commandline.meta.tasks.MetadataMarshalled +org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask$DropAllThinSessionsJob +org.apache.ignite.internal.commandline.meta.tasks.MetadataRemoveTask$MetadataRemoveJob +org.apache.ignite.internal.commandline.meta.tasks.MetadataTypeArgs +org.apache.ignite.internal.commandline.meta.tasks.MetadataUpdateTask +org.apache.ignite.internal.commandline.meta.tasks.MetadataUpdateTask$MetadataUpdateJob +org.apache.ignite.internal.commandline.property.PropertyArgs +org.apache.ignite.internal.commandline.property.PropertyArgs$Action org.apache.ignite.internal.commandline.property.tasks.PropertiesListResult org.apache.ignite.internal.commandline.property.tasks.PropertiesListTask +org.apache.ignite.internal.commandline.property.tasks.PropertiesListTask$PropertiesListJob org.apache.ignite.internal.commandline.property.tasks.PropertyOperationResult org.apache.ignite.internal.commandline.property.tasks.PropertyTask -org.apache.ignite.internal.commandline.property.PropertyArgs -org.apache.ignite.internal.commandline.ru.RollingUpgradeCommandArg -org.apache.ignite.internal.commandline.ru.RollingUpgradeSubCommands +org.apache.ignite.internal.commandline.property.tasks.PropertyTask$PropertyJob org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException org.apache.ignite.internal.compute.ComputeTaskTimeoutCheckedException org.apache.ignite.internal.direct.DirectMessageReader$1 @@ -378,8 +404,11 @@ org.apache.ignite.internal.events.DiscoveryCustomEvent org.apache.ignite.internal.executor.GridExecutorService org.apache.ignite.internal.executor.GridExecutorService$1 org.apache.ignite.internal.executor.GridExecutorService$TaskTerminateListener +org.apache.ignite.internal.jdbc.JdbcConnectionValidationTask +org.apache.ignite.internal.jdbc.JdbcConnectionValidationTask$1 org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$1 +org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$2 org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$BooleanProperty org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$ConnectionProperty org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$IntegerProperty @@ -390,6 +419,7 @@ org.apache.ignite.internal.jdbc2.JdbcBatchUpdateTask org.apache.ignite.internal.jdbc2.JdbcCloseCursorTask org.apache.ignite.internal.jdbc2.JdbcConnection$JdbcConnectionValidationTask org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask +org.apache.ignite.internal.jdbc2.JdbcQueryMultipleStatementsNotAllowTask org.apache.ignite.internal.jdbc2.JdbcQueryMultipleStatementsTask org.apache.ignite.internal.jdbc2.JdbcQueryMultipleStatementsTaskV3 org.apache.ignite.internal.jdbc2.JdbcQueryTask @@ -402,12 +432,18 @@ org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointS org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest org.apache.ignite.internal.managers.communication.GridIoManager$ConcurrentHashMap0 org.apache.ignite.internal.managers.communication.GridIoMessage +org.apache.ignite.internal.managers.communication.GridIoSecurityAwareMessage org.apache.ignite.internal.managers.communication.GridIoUserMessage org.apache.ignite.internal.managers.communication.IgniteIoTestMessage +org.apache.ignite.internal.managers.communication.SessionChannelMessage +org.apache.ignite.internal.managers.communication.TransmissionCancelledException +org.apache.ignite.internal.managers.communication.TransmissionMeta +org.apache.ignite.internal.managers.communication.TransmissionPolicy org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean 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.deployment.P2PClassNotFoundException org.apache.ignite.internal.managers.discovery.CustomMessageWrapper org.apache.ignite.internal.managers.discovery.DiscoCache$1 org.apache.ignite.internal.managers.discovery.DiscoCache$2 @@ -417,22 +453,31 @@ org.apache.ignite.internal.managers.discovery.DiscoveryServerOnlyCustomMessage 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$6 +org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$7 org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$8 -org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$9 -org.apache.ignite.internal.managers.discovery.GridLocalMetrics +org.apache.ignite.internal.managers.discovery.IncompleteDeserializationException +org.apache.ignite.internal.managers.discovery.SecurityAwareCustomMessageWrapper +org.apache.ignite.internal.managers.encryption.CacheGroupEncryptionKeys$TrackedWalSegment +org.apache.ignite.internal.managers.encryption.CacheGroupPageScanner$1 +org.apache.ignite.internal.managers.encryption.CacheGroupPageScanner$2 +org.apache.ignite.internal.managers.encryption.ChangeCacheEncryptionRequest org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyRequest org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyResponse +org.apache.ignite.internal.managers.encryption.GridEncryptionManager$EmptyResult +org.apache.ignite.internal.managers.encryption.GridEncryptionManager$MasterKeyChangeRequest org.apache.ignite.internal.managers.encryption.GridEncryptionManager$NodeEncryptionKeys +org.apache.ignite.internal.managers.encryption.GroupKeyEncrypted org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage org.apache.ignite.internal.managers.indexing.GridIndexingManager$1 org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerAdapter org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1 org.apache.ignite.internal.marshaller.optimized.OptimizedFieldType +org.apache.ignite.internal.marshaller.optimized.OptimizedMarshallerInaccessibleClassException org.apache.ignite.internal.mem.IgniteOutOfMemoryException +org.apache.ignite.internal.metric.IndexPageType +org.apache.ignite.internal.metric.IoStatisticsType org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl$Segment org.apache.ignite.internal.pagemem.wal.WALIterator -org.apache.ignite.internal.pagemem.wal.WALPointer org.apache.ignite.internal.pagemem.wal.record.ExchangeRecord$Type org.apache.ignite.internal.pagemem.wal.record.RolloverType org.apache.ignite.internal.pagemem.wal.record.WALRecord$RecordPurpose @@ -447,6 +492,8 @@ org.apache.ignite.internal.processors.affinity.GridAffinityProcessor$AffinityFut org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob org.apache.ignite.internal.processors.authentication.IgniteAccessControlException org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor$InitialUsersData +org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor$SecurityContextImpl +org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor$SecuritySubjectImpl org.apache.ignite.internal.processors.authentication.User org.apache.ignite.internal.processors.authentication.UserAcceptedMessage org.apache.ignite.internal.processors.authentication.UserAuthenticateRequestMessage @@ -458,6 +505,7 @@ org.apache.ignite.internal.processors.authentication.UserManagementOperationFini org.apache.ignite.internal.processors.authentication.UserProposedMessage org.apache.ignite.internal.processors.bulkload.BulkLoadCacheWriter org.apache.ignite.internal.processors.bulkload.BulkLoadStreamerWriter +org.apache.ignite.internal.processors.bulkload.pipeline.CsvLineProcessorBlock$ReaderState org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$1 org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$10 @@ -538,29 +586,30 @@ 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$17 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$18$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1 org.apache.ignite.internal.processors.cache.GridCacheAdapter$2 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$24$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$26 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$27$1 org.apache.ignite.internal.processors.cache.GridCacheAdapter$28 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$29$1 org.apache.ignite.internal.processors.cache.GridCacheAdapter$3 org.apache.ignite.internal.processors.cache.GridCacheAdapter$30 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$32 org.apache.ignite.internal.processors.cache.GridCacheAdapter$4 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$45 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$46 org.apache.ignite.internal.processors.cache.GridCacheAdapter$47 -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$6 org.apache.ignite.internal.processors.cache.GridCacheAdapter$8 +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 org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1 org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$AtomicReadRepairEntryProcessor +org.apache.ignite.internal.processors.cache.GridCacheAdapter$BulkOperation org.apache.ignite.internal.processors.cache.GridCacheAdapter$ClearTask org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllJob org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllNearJob @@ -580,9 +629,13 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeLongTask org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeTask org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateGetAllTimeStatClosure +org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateGetAndRemoveTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateGetTimeStatClosure +org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutAllTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutAndGetTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutTimeStatClosure +org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateRemoveAllTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateRemoveTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAttributes @@ -633,19 +686,17 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$5 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$7 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$9 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeFutureSet +org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker$1 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$MessageHandler org.apache.ignite.internal.processors.cache.GridCacheProcessor$1 -org.apache.ignite.internal.processors.cache.GridCacheProcessor$10 -org.apache.ignite.internal.processors.cache.GridCacheProcessor$11 org.apache.ignite.internal.processors.cache.GridCacheProcessor$2 org.apache.ignite.internal.processors.cache.GridCacheProcessor$3 org.apache.ignite.internal.processors.cache.GridCacheProcessor$4 org.apache.ignite.internal.processors.cache.GridCacheProcessor$5 org.apache.ignite.internal.processors.cache.GridCacheProcessor$6 +org.apache.ignite.internal.processors.cache.GridCacheProcessor$6$1 org.apache.ignite.internal.processors.cache.GridCacheProcessor$7 -org.apache.ignite.internal.processors.cache.GridCacheProcessor$7$1 org.apache.ignite.internal.processors.cache.GridCacheProcessor$8 -org.apache.ignite.internal.processors.cache.GridCacheProcessor$9 org.apache.ignite.internal.processors.cache.GridCacheProxyImpl org.apache.ignite.internal.processors.cache.GridCacheReturn org.apache.ignite.internal.processors.cache.GridCacheTtlManager$1 @@ -683,20 +734,18 @@ org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$1 org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$2 org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$3 org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$4 -org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$5 org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$6 -org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$7 -org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$9 -org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$CacheDataStoreImpl$1 org.apache.ignite.internal.processors.cache.IgniteCacheProxy org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$1 org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$2 org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$3 org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$4 -org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$6 +org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$5 org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$7 org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$8 +org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl$9 +org.apache.ignite.internal.processors.cache.IgnitePeerToPeerClassLoadingException org.apache.ignite.internal.processors.cache.IgniteRebalanceIterator org.apache.ignite.internal.processors.cache.KeyCacheObject org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl @@ -707,13 +756,16 @@ org.apache.ignite.internal.processors.cache.WalStateAbstractMessage org.apache.ignite.internal.processors.cache.WalStateAckMessage org.apache.ignite.internal.processors.cache.WalStateFinishMessage org.apache.ignite.internal.processors.cache.WalStateManager$2 -org.apache.ignite.internal.processors.cache.WalStateManager$3 org.apache.ignite.internal.processors.cache.WalStateProposeMessage org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy org.apache.ignite.internal.processors.cache.binary.BinaryMetadataHolder org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey org.apache.ignite.internal.processors.cache.binary.BinaryMetadataTransport$2 org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$2 +org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$3 +org.apache.ignite.internal.processors.cache.binary.MetadataRemoveAcceptedMessage +org.apache.ignite.internal.processors.cache.binary.MetadataRemoveProposedMessage +org.apache.ignite.internal.processors.cache.binary.MetadataRemoveProposedMessage$ProposalStatus org.apache.ignite.internal.processors.cache.binary.MetadataRequestMessage org.apache.ignite.internal.processors.cache.binary.MetadataResponseMessage org.apache.ignite.internal.processors.cache.binary.MetadataResponseMessage$ClientResponseStatus @@ -744,7 +796,6 @@ org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepare org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest$1 org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest$2 org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareResponse -org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxRemoteAdapter org.apache.ignite.internal.processors.cache.distributed.GridDistributedUnlockRequest org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy org.apache.ignite.internal.processors.cache.distributed.dht.CacheDistributedGetFutureAdapter$1 @@ -757,9 +808,8 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCache org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$2 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$3 -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$4 +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$5 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$6 -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$7 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$MessageHandler org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry$2 @@ -775,7 +825,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$3 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$4 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRequest org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockResponse -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter$OperationType org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$10 @@ -805,11 +854,9 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxAbstractEnl org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishFuture$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$2 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$3 -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$2 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxOnePhaseCommitAckRequest @@ -822,10 +869,12 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResp org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxQueryEnlistRequest org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxQueryEnlistResponse org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxQueryFirstEnlistRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException org.apache.ignite.internal.processors.cache.distributed.dht.GridInvokeValue +org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$1 +org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture$1 +org.apache.ignite.internal.processors.cache.distributed.dht.IgniteClusterReadOnlyException org.apache.ignite.internal.processors.cache.distributed.dht.NearTxQueryEnlistResultHandler org.apache.ignite.internal.processors.cache.distributed.dht.NearTxResultHandler org.apache.ignite.internal.processors.cache.distributed.dht.PartitionUpdateCountersMessage @@ -899,7 +948,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtCol org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$9 org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$1 org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$2 -org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$3 org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$LockTimeoutObject$1 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CacheGroupAffinityMessage org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionFullCountersMap @@ -911,8 +959,11 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPar org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1 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$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$5 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$RebalanceFuture$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$RebalanceFutureState 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 @@ -943,11 +994,14 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtP org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteHistoricalIterator +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteHistoricalIteratorException org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteRebalanceIteratorImpl org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.LatchAckMessage org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException +org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition$2 org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionsReservation$1 +org.apache.ignite.internal.processors.cache.distributed.dht.topology.PartitionsEvictManager$EvictReason org.apache.ignite.internal.processors.cache.distributed.near.CacheVersionedValue org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache$1 @@ -960,7 +1014,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4 org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$LockTimeoutObject$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest @@ -974,7 +1027,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticT org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$3 org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$4 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$5 org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest @@ -984,7 +1036,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearTransaction org.apache.ignite.internal.processors.cache.distributed.near.GridNearTransactionalCache$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxAbstractEnlistFuture$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxEnlistFuture$1 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxEnlistFuture$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxEnlistRequest org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxEnlistResponse org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishFuture$1 @@ -993,7 +1044,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishFut org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishFuture$FinishMiniFuture$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$10 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$11 @@ -1012,14 +1062,13 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$23 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$24 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$25 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$26 +org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$26$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$27 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$27$1 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$28 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$29 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$3 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$30 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$31 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$32 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$4 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$5 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$6 @@ -1031,15 +1080,16 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFu org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryEnlistFuture$1 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryEnlistFuture$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryEnlistRequest org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryEnlistResponse org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryResultsEnlistFuture$1 -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryResultsEnlistFuture$2 org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryResultsEnlistRequest org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryResultsEnlistResponse -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxRemote org.apache.ignite.internal.processors.cache.distributed.near.GridNearUnlockRequest +org.apache.ignite.internal.processors.cache.distributed.near.consistency.IgniteAtomicConsistencyViolationException +org.apache.ignite.internal.processors.cache.distributed.near.consistency.IgniteConsistencyViolationException +org.apache.ignite.internal.processors.cache.distributed.near.consistency.IgniteIrreparableConsistencyViolationException +org.apache.ignite.internal.processors.cache.distributed.near.consistency.IgniteTransactionalConsistencyViolationException org.apache.ignite.internal.processors.cache.dr.GridCacheDrExpirationInfo org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo org.apache.ignite.internal.processors.cache.mvcc.DeadlockProbe @@ -1065,57 +1115,91 @@ org.apache.ignite.internal.processors.cache.mvcc.msg.MvccQuerySnapshotRequest org.apache.ignite.internal.processors.cache.mvcc.msg.MvccRecoveryFinishedMessage org.apache.ignite.internal.processors.cache.mvcc.msg.MvccSnapshotResponse org.apache.ignite.internal.processors.cache.mvcc.msg.MvccTxSnapshotRequest -org.apache.ignite.internal.processors.cache.mvcc.msg.PartitionCountersNeighborcastRequest -org.apache.ignite.internal.processors.cache.mvcc.msg.PartitionCountersNeighborcastResponse org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter$RowData -org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$4 -org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$8 -org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$CheckpointReadLockTimeoutException +org.apache.ignite.internal.processors.cache.persistence.CheckpointState +org.apache.ignite.internal.processors.cache.persistence.CorruptedDataStructureException +org.apache.ignite.internal.processors.cache.persistence.CorruptedPartitionMetaPageException +org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$3 org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager$WALHistoricalIterator org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager$1 org.apache.ignite.internal.processors.cache.persistence.StorageException org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointEntryType +org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointTimeoutLock$CheckpointReadLockTimeoutException +org.apache.ignite.internal.processors.cache.persistence.checkpoint.EarliestCheckpointMapSnapshot +org.apache.ignite.internal.processors.cache.persistence.checkpoint.EarliestCheckpointMapSnapshot$GroupStateSnapshot +org.apache.ignite.internal.processors.cache.persistence.checkpoint.ReservationReason +org.apache.ignite.internal.processors.cache.persistence.defragmentation.IgniteDefragmentation$CancelResult +org.apache.ignite.internal.processors.cache.persistence.defragmentation.IgniteDefragmentation$ScheduleResult org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory org.apache.ignite.internal.processors.cache.persistence.file.EncryptedFileIOFactory org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager$IdxCacheStores org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory org.apache.ignite.internal.processors.cache.persistence.freelist.CorruptedFreeListException +org.apache.ignite.internal.processors.cache.persistence.metastorage.pendingtask.DurableBackgroundTask org.apache.ignite.internal.processors.cache.persistence.migration.UpgradePendingTreeToPerPartitionTask org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl$Segment org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl$ThrottlingPolicy +org.apache.ignite.internal.processors.cache.persistence.snapshot.AbstractSnapshotMessage +org.apache.ignite.internal.processors.cache.persistence.snapshot.AbstractSnapshotVerificationTask +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$3 +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$CancelSnapshotCallable +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$CreateSnapshotCallable +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$DataPageIterator +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$DataPageIterator$1 +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$SnapshotOperationResponse +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager$SnapshotStartDiscoveryMessage +org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotVerifyException org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotFilesFailureMessage +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotFilesRequestMessage +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerRestoreTask +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerRestoreTask$SnapshotHandlerRestoreJob +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerResult +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerType +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerWarningException +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadata +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadataCollectorTask +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadataCollectorTask$1 +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadataCollectorTaskArg org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotOperation +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotOperationRequest +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartitionsVerifyTask +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartitionsVerifyTask$VisorVerifySnapshotPartitionsJob +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartitionsVerifyTaskArg +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartitionsVerifyTaskResult +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess$SnapshotRestoreOperationResponse +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreStatusTask +org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreStatusTask$1 org.apache.ignite.internal.processors.cache.persistence.snapshot.TrackingPageIsCorruptedException org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Bool org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Result +org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTreeRuntimeException org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO$EntryPart org.apache.ignite.internal.processors.cache.persistence.tree.reuse.LongListReuseBag org.apache.ignite.internal.processors.cache.persistence.wal.AbstractWalRecordsIterator org.apache.ignite.internal.processors.cache.persistence.wal.AbstractWalRecordsIterator$StartSeekingFilter -org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer -org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$6 -org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$FileArchiver$1 -org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$FileArchiver$2 +org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$1 org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$FileCompressorWorker$1 org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$RecordsIterator org.apache.ignite.internal.processors.cache.persistence.wal.SegmentEofException org.apache.ignite.internal.processors.cache.persistence.wal.SegmentedRingByteBuffer$BufferMode org.apache.ignite.internal.processors.cache.persistence.wal.SingleSegmentLogicalRecordsIterator org.apache.ignite.internal.processors.cache.persistence.wal.SingleSegmentLogicalRecordsIterator$LogicalRecordsFilter +org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer org.apache.ignite.internal.processors.cache.persistence.wal.WalSegmentTailReachedException org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException +org.apache.ignite.internal.processors.cache.persistence.wal.reader.FilteredWalIterator +org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory$1 org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneWalRecordsIterator org.apache.ignite.internal.processors.cache.persistence.wal.reader.StrictBoundsCheckException org.apache.ignite.internal.processors.cache.query.CacheQueryEntry org.apache.ignite.internal.processors.cache.query.CacheQueryType -org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture$1 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$2 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$4 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$5 -org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$6 org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1 org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$MvccTrackingIterator org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator @@ -1129,6 +1213,7 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$6 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$7 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$QueueIterator @@ -1140,7 +1225,7 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$Metadata 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.GridCacheQueryManager$ScanQueryIterator -org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsAdapter +org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsAdapter$QueryMetricsSnapshot org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsKey org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse @@ -1154,6 +1239,8 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryType org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery +org.apache.ignite.internal.processors.cache.query.IndexQueryDesc +org.apache.ignite.internal.processors.cache.query.ScoredCacheEntry org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryBatchAck org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryDeployableObject @@ -1183,7 +1270,12 @@ org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask$Jd org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask$JdbcDriverJob$1 org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask$1 -org.apache.ignite.spi.monitoring.metric.counter.ratemetrics.HitRateMetricsSandbox +org.apache.ignite.internal.processors.cache.query.reducer.CacheQueryReducer +org.apache.ignite.internal.processors.cache.query.reducer.IndexQueryReducer +org.apache.ignite.internal.processors.cache.query.reducer.IndexQueryReducer$IndexedNodePageComparator +org.apache.ignite.internal.processors.cache.query.reducer.MergeSortCacheQueryReducer +org.apache.ignite.internal.processors.cache.query.reducer.TextQueryReducer +org.apache.ignite.internal.processors.cache.query.reducer.UnsortedCacheQueryReducer org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$1 org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$2 org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3 @@ -1195,7 +1287,6 @@ org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Valu org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx$FinalizationStatus org.apache.ignite.internal.processors.cache.transactions.IgniteTransactionsImpl$1 org.apache.ignite.internal.processors.cache.transactions.IgniteTransactionsImpl$2 -org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter 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 @@ -1206,8 +1297,6 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$14 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$15 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$16 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$17 -org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$18 -org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$19 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$2 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$3 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$4 @@ -1217,7 +1306,6 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$7 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$8 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$9 org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey -org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PLC1 org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PLC2 org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PMC @@ -1228,22 +1316,25 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$Po org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure1$4 org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure2 org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostMissClosure -org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$3 -org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$4 org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$5 +org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$6 +org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$7 +org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$8 org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommitListener org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommittedVersion +org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$KeyCollisionsHolder$1 org.apache.ignite.internal.processors.cache.transactions.IgniteTxMap org.apache.ignite.internal.processors.cache.transactions.IgniteTxMap$1 org.apache.ignite.internal.processors.cache.transactions.IgniteTxMap$1$1 org.apache.ignite.internal.processors.cache.transactions.TransactionEventProxyImpl -org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter$1 org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter$2 org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter$3 +org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter$TransactionMetricsSnapshot org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl$1 org.apache.ignite.internal.processors.cache.transactions.TransactionProxyRollbackOnlyImpl +org.apache.ignite.internal.processors.cache.transactions.TxCollisionsDumpSettingsClosure org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetection$UniqueDeque org.apache.ignite.internal.processors.cache.transactions.TxEntryValueHolder org.apache.ignite.internal.processors.cache.transactions.TxLock @@ -1260,10 +1351,12 @@ org.apache.ignite.internal.processors.cache.verify.GridNotIdleException org.apache.ignite.internal.processors.cache.verify.IdleVerifyDumpResult org.apache.ignite.internal.processors.cache.verify.IdleVerifyException org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2 +org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility$IdleChecker org.apache.ignite.internal.processors.cache.verify.NoMatchingCachesException org.apache.ignite.internal.processors.cache.verify.PartitionEntryHashRecord org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2 +org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2$PartitionState org.apache.ignite.internal.processors.cache.verify.PartitionKey org.apache.ignite.internal.processors.cache.verify.PartitionKeyV2 org.apache.ignite.internal.processors.cache.verify.RetrieveConflictPartitionValuesTask @@ -1309,6 +1402,7 @@ org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage org.apache.ignite.internal.processors.cluster.ClientGetClusterStateComputeRequest org.apache.ignite.internal.processors.cluster.ClientSetClusterStateComputeRequest +org.apache.ignite.internal.processors.cluster.ClusterIdAndTag org.apache.ignite.internal.processors.cluster.ClusterMetricsUpdateMessage org.apache.ignite.internal.processors.cluster.ClusterNodeMetrics org.apache.ignite.internal.processors.cluster.ClusterProcessor$4 @@ -1316,10 +1410,7 @@ org.apache.ignite.internal.processors.cluster.ClusterProcessor$4$1 org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$1$1 org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$2 -org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$3 org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$4 -org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$5 -org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$7 org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$BaselineStateAndHistoryData org.apache.ignite.internal.processors.cluster.baseline.autoadjust.BaselineAutoAdjustStatus$TaskState org.apache.ignite.internal.processors.configuration.distributed.DetachedPropertyException @@ -1417,6 +1508,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$4 org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl$Sync org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreState org.apache.ignite.internal.processors.datastructures.GridCacheSetHeader @@ -1424,29 +1516,14 @@ org.apache.ignite.internal.processors.datastructures.GridCacheSetHeaderKey org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl$5 org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl$SumReducer org.apache.ignite.internal.processors.datastructures.GridCacheSetItemKey -org.apache.ignite.internal.processors.datastructures.GridCacheSetItemKey$HashCodeHolder org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate org.apache.ignite.internal.processors.datastructures.VolatileAtomicDataStructureValue 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.internal.processors.hadoop.HadoopJobId -org.apache.ignite.internal.processors.hadoop.HadoopJobPhase -org.apache.ignite.internal.processors.hadoop.HadoopJobProperty -org.apache.ignite.internal.processors.hadoop.HadoopJobStatus -org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo -org.apache.ignite.internal.processors.hadoop.HadoopTaskType -org.apache.ignite.internal.processors.hadoop.message.HadoopMessage -org.apache.ignite.internal.processors.hadoop.shuffle.HadoopDirectShuffleMessage -org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleAck -org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleFinishRequest -org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleFinishResponse -org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleMessage -org.apache.ignite.internal.processors.job.GridJobProcessor$5 -org.apache.ignite.internal.processors.job.GridJobWorker$3 +org.apache.ignite.internal.processors.job.ComputeJobStatusEnum org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer +org.apache.ignite.internal.processors.localtask.DurableBackgroundTaskState$State org.apache.ignite.internal.processors.marshaller.MappedName org.apache.ignite.internal.processors.marshaller.MappingAcceptedMessage org.apache.ignite.internal.processors.marshaller.MappingExchangeResult$ResultType @@ -1464,10 +1541,13 @@ org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaSto org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageUpdateAckMessage org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageUpdateMessage org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageVersion +org.apache.ignite.internal.processors.odbc.ClientMessage org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler$1 org.apache.ignite.internal.processors.odbc.jdbc.JdbcStatementType +org.apache.ignite.internal.processors.odbc.jdbc.JdbcThinFeature org.apache.ignite.internal.processors.odbc.odbc.OdbcRequestHandler$1 org.apache.ignite.internal.processors.odbc.odbc.escape.OdbcEscapeType +org.apache.ignite.internal.processors.performancestatistics.OperationType org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate org.apache.ignite.internal.processors.platform.PlatformEventFilterListener @@ -1483,13 +1563,13 @@ org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImp org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessorImpl org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException -org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity$1 org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpiryPolicyFactory org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQuery org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryImpl org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryRemoteFilter +org.apache.ignite.internal.processors.platform.client.ClientBitmaskFeature org.apache.ignite.internal.processors.platform.client.IgniteClientException org.apache.ignite.internal.processors.platform.cluster.PlatformClusterNodeFilter org.apache.ignite.internal.processors.platform.cluster.PlatformClusterNodeFilterImpl @@ -1536,6 +1616,7 @@ org.apache.ignite.internal.processors.platform.messaging.PlatformMessageLocalFil 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.PlatformServiceConfiguration org.apache.ignite.internal.processors.platform.services.PlatformServices$2 org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions$1 org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$1 @@ -1543,11 +1624,14 @@ org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$FutureL org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$InternalFutureListenable$1 org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockProcessor org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor +org.apache.ignite.internal.processors.pool.PoolProcessor$2 +org.apache.ignite.internal.processors.pool.PoolProcessor$3 org.apache.ignite.internal.processors.query.EnlistOperation 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$SchemaOperation$1 org.apache.ignite.internal.processors.query.IgniteSQLException @@ -1556,13 +1640,18 @@ org.apache.ignite.internal.processors.query.QueryEntityEx org.apache.ignite.internal.processors.query.QueryField org.apache.ignite.internal.processors.query.QueryIndexKey org.apache.ignite.internal.processors.query.QuerySchema +org.apache.ignite.internal.processors.query.QueryState +org.apache.ignite.internal.processors.query.RunningQueryManager$1 org.apache.ignite.internal.processors.query.UpdateSourceIterator +org.apache.ignite.internal.processors.query.aware.IndexBuildStatusHolder$Status +org.apache.ignite.internal.processors.query.aware.IndexRebuildCacheInfo 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.messages.GridQueryKillRequest org.apache.ignite.internal.processors.query.messages.GridQueryKillResponse +org.apache.ignite.internal.processors.query.schema.SchemaIndexOperationCancellationException org.apache.ignite.internal.processors.query.schema.SchemaOperationException org.apache.ignite.internal.processors.query.schema.SchemaOperationManager$1 org.apache.ignite.internal.processors.query.schema.SchemaOperationWorker$1 @@ -1572,12 +1661,27 @@ org.apache.ignite.internal.processors.query.schema.message.SchemaOperationStatus org.apache.ignite.internal.processors.query.schema.message.SchemaProposeDiscoveryMessage org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractAlterTableOperation org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation +org.apache.ignite.internal.processors.query.schema.operation.SchemaAddQueryEntityOperation org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableDropColumnOperation org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexAbstractOperation org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexDropOperation -org.apache.ignite.internal.processors.query.schema.operation.SchemaAddQueryEntityOperation +org.apache.ignite.internal.processors.query.stat.GatherStatisticCancelException +org.apache.ignite.internal.processors.query.stat.ObjectPartitionStatisticsObsolescence +org.apache.ignite.internal.processors.query.stat.StatisticsKey +org.apache.ignite.internal.processors.query.stat.StatisticsType +org.apache.ignite.internal.processors.query.stat.StatisticsUsageState +org.apache.ignite.internal.processors.query.stat.config.StatisticsColumnConfiguration +org.apache.ignite.internal.processors.query.stat.config.StatisticsColumnOverrides +org.apache.ignite.internal.processors.query.stat.config.StatisticsObjectConfiguration +org.apache.ignite.internal.processors.query.stat.hll.HLLType +org.apache.ignite.internal.processors.query.stat.messages.StatisticsColumnData +org.apache.ignite.internal.processors.query.stat.messages.StatisticsDecimalMessage +org.apache.ignite.internal.processors.query.stat.messages.StatisticsKeyMessage +org.apache.ignite.internal.processors.query.stat.messages.StatisticsObjectData +org.apache.ignite.internal.processors.query.stat.messages.StatisticsRequest +org.apache.ignite.internal.processors.query.stat.messages.StatisticsResponse org.apache.ignite.internal.processors.resource.GridResourceIoc$AnnotationSet org.apache.ignite.internal.processors.resource.GridResourceIoc$ResourceAnnotation org.apache.ignite.internal.processors.rest.GridRestCommand @@ -1590,23 +1694,23 @@ org.apache.ignite.internal.processors.rest.client.message.GridClientCacheBean org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest$GridCacheOperation org.apache.ignite.internal.processors.rest.client.message.GridClientClusterNameRequest +org.apache.ignite.internal.processors.rest.client.message.GridClientClusterStateRequest +org.apache.ignite.internal.processors.rest.client.message.GridClientClusterStateRequestV2 org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeRequest org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeResponse org.apache.ignite.internal.processors.rest.client.message.GridClientMessage org.apache.ignite.internal.processors.rest.client.message.GridClientNodeBean org.apache.ignite.internal.processors.rest.client.message.GridClientNodeMetricsBean +org.apache.ignite.internal.processors.rest.client.message.GridClientNodeStateBeforeStartRequest org.apache.ignite.internal.processors.rest.client.message.GridClientPingPacket -org.apache.ignite.internal.processors.rest.client.message.GridClientClusterStateRequestV2 -org.apache.ignite.internal.processors.rest.client.message.GridClientClusterStateRequest org.apache.ignite.internal.processors.rest.client.message.GridClientResponse org.apache.ignite.internal.processors.rest.client.message.GridClientStateRequest org.apache.ignite.internal.processors.rest.client.message.GridClientTaskRequest org.apache.ignite.internal.processors.rest.client.message.GridClientTaskResultBean org.apache.ignite.internal.processors.rest.client.message.GridClientTopologyRequest +org.apache.ignite.internal.processors.rest.client.message.GridClientWarmUpRequest org.apache.ignite.internal.processors.rest.client.message.GridRouterRequest org.apache.ignite.internal.processors.rest.client.message.GridRouterResponse -org.apache.ignite.internal.processors.rest.client.message.GridClientNodeStateBeforeStartRequest -org.apache.ignite.internal.processors.rest.client.message.GridClientWarmUpRequest org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$2 org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$3 org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$4 @@ -1628,6 +1732,7 @@ org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandle org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetAndReplaceCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataJob +org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataJob$1 org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataTask org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetricsCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$PrependCommand @@ -1665,6 +1770,8 @@ org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisCommand org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisMessage org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisNioListener$1 org.apache.ignite.internal.processors.rest.request.RestQueryRequest$QueryType +org.apache.ignite.internal.processors.security.AbstractSecurityAwareExternalizable +org.apache.ignite.internal.processors.service.CompositeServiceCallInterceptor org.apache.ignite.internal.processors.service.GridServiceMethodNotFoundException org.apache.ignite.internal.processors.service.GridServiceNotFoundException org.apache.ignite.internal.processors.service.GridServiceProxy @@ -1686,11 +1793,12 @@ org.apache.ignite.internal.processors.service.ServiceSingleNodeDeploymentResultB org.apache.ignite.internal.processors.service.ServiceUndeploymentRequest org.apache.ignite.internal.processors.task.GridTaskProcessor$1 org.apache.ignite.internal.processors.task.GridTaskThreadContextKey -org.apache.ignite.internal.processors.task.GridTaskWorker$3 -org.apache.ignite.internal.processors.task.GridTaskWorker$5 +org.apache.ignite.internal.processors.task.GridTaskWorker$2 +org.apache.ignite.internal.processors.task.GridTaskWorker$4 org.apache.ignite.internal.processors.task.GridTaskWorker$State +org.apache.ignite.internal.processors.task.monitor.ComputeTaskStatusEnum org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor$2 -org.apache.ignite.spi.tracing.SpanStatus +org.apache.ignite.internal.processors.tracing.SpanType org.apache.ignite.internal.processors.tracing.messages.SpanContainer org.apache.ignite.internal.sql.SqlLexerTokenType org.apache.ignite.internal.sql.SqlParseException @@ -1698,8 +1806,7 @@ org.apache.ignite.internal.sql.SqlStrictParseException org.apache.ignite.internal.sql.optimizer.affinity.PartitionAffinityFunctionType org.apache.ignite.internal.sql.optimizer.affinity.PartitionCompositeNodeOperator org.apache.ignite.internal.sql.optimizer.affinity.PartitionParameterType -org.apache.ignite.internal.stat.IndexPageType -org.apache.ignite.internal.stat.IoStatisticsType +org.apache.ignite.internal.tracing.TracingSpiType org.apache.ignite.internal.transactions.IgniteTxAlreadyCompletedCheckedException org.apache.ignite.internal.transactions.IgniteTxDuplicateKeyCheckedException org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException @@ -1709,10 +1816,6 @@ org.apache.ignite.internal.transactions.IgniteTxSerializationCheckedException org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException org.apache.ignite.internal.transactions.IgniteTxUnexpectedStateCheckedException org.apache.ignite.internal.transactions.TransactionCheckedException -org.apache.ignite.internal.util.collection.BitSetIntSet -org.apache.ignite.internal.util.collection.IntRWHashMap -org.apache.ignite.internal.util.collection.ImmutableIntSet -org.apache.ignite.internal.util.collection.IntSet org.apache.ignite.internal.util.F0$1 org.apache.ignite.internal.util.F0$2 org.apache.ignite.internal.util.F0$3 @@ -1804,8 +1907,16 @@ org.apache.ignite.internal.util.IgniteUtils$6 org.apache.ignite.internal.util.IgniteUtils$7 org.apache.ignite.internal.util.IgniteUtils$8 org.apache.ignite.internal.util.IgniteUtils$9 +org.apache.ignite.internal.util.ReentrantReadWriteLockWithTracking$1 +org.apache.ignite.internal.util.ReentrantReadWriteLockWithTracking$2 +org.apache.ignite.internal.util.ReentrantReadWriteLockWithTracking$ReadLockWithTracking org.apache.ignite.internal.util.StripedCompositeReadWriteLock$ReadLock org.apache.ignite.internal.util.UUIDCollectionMessage +org.apache.ignite.internal.util.collection.BitSetIntSet +org.apache.ignite.internal.util.distributed.DistributedProcess$DistributedProcessType +org.apache.ignite.internal.util.distributed.FullMessage +org.apache.ignite.internal.util.distributed.InitMessage +org.apache.ignite.internal.util.distributed.SingleNodeMessage org.apache.ignite.internal.util.future.AsyncFutureListener org.apache.ignite.internal.util.future.GridCompoundFuture$1 org.apache.ignite.internal.util.future.GridEmbeddedFuture$1 @@ -1867,8 +1978,11 @@ org.apache.ignite.internal.util.lang.IgniteReducer3 org.apache.ignite.internal.util.lang.IgniteReducer3X org.apache.ignite.internal.util.lang.IgniteReducerX org.apache.ignite.internal.util.lang.IgniteSingletonIterator +org.apache.ignite.internal.util.lang.IgniteThrowableBiPredicate org.apache.ignite.internal.util.lang.IgniteThrowableConsumer org.apache.ignite.internal.util.lang.IgniteThrowableFunction +org.apache.ignite.internal.util.lang.IgniteThrowableSupplier +org.apache.ignite.internal.util.lang.RunnableX org.apache.ignite.internal.util.lang.gridfunc.AlwaysFalsePredicate org.apache.ignite.internal.util.lang.gridfunc.AlwaysTruePredicate org.apache.ignite.internal.util.lang.gridfunc.AlwaysTrueReducer @@ -1971,15 +2085,14 @@ org.apache.ignite.internal.util.typedef.T4 org.apache.ignite.internal.util.typedef.T5 org.apache.ignite.internal.util.typedef.T6 org.apache.ignite.internal.util.typedef.internal.SB -org.apache.ignite.internal.visor.VisorCoordinatorNodeTask org.apache.ignite.internal.visor.VisorDataTransferObject -org.apache.ignite.internal.visor.VisorEither org.apache.ignite.internal.visor.VisorJob org.apache.ignite.internal.visor.VisorMultiNodeTask org.apache.ignite.internal.visor.VisorOneNodeTask org.apache.ignite.internal.visor.VisorTaskArgument org.apache.ignite.internal.visor.baseline.VisorBaselineAutoAdjustSettings org.apache.ignite.internal.visor.baseline.VisorBaselineNode +org.apache.ignite.internal.visor.baseline.VisorBaselineNode$ResolvedAddresses org.apache.ignite.internal.visor.baseline.VisorBaselineOperation org.apache.ignite.internal.visor.baseline.VisorBaselineTask org.apache.ignite.internal.visor.baseline.VisorBaselineTask$VisorBaselineJob @@ -1987,44 +2100,7 @@ org.apache.ignite.internal.visor.baseline.VisorBaselineTaskArg org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult org.apache.ignite.internal.visor.baseline.VisorBaselineViewTask org.apache.ignite.internal.visor.baseline.VisorBaselineViewTask$VisorBaselineViewJob -org.apache.ignite.internal.visor.consistency.VisorConsistencyRepairTaskArg -org.apache.ignite.internal.visor.consistency.VisorConsistencyTaskResult -org.apache.ignite.internal.visor.misc.VisorIdAndTagViewTaskResult -org.apache.ignite.internal.visor.misc.VisorClusterChangeTagTaskResult -org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTask -org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTask$VisorShutdownPolicyJob -org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTaskArg -org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTaskResult -org.apache.ignite.internal.visor.binary.VisorBinaryMetadata -org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTask -org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTask$VisorBinaryCollectMetadataJob -org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTaskArg -org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTaskResult -org.apache.ignite.internal.visor.binary.VisorBinaryMetadataField -org.apache.ignite.internal.visor.cache.index.IndexListInfoContainer -org.apache.ignite.internal.visor.cache.index.IndexListTask -org.apache.ignite.internal.visor.cache.index.IndexListTaskArg -org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTask -org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTaskArg -org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTaskRes -org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildJobRes -org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTask -org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTaskArg -org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTaskRes -org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusTask -org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusTaskArg -org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusInfoContainer -org.apache.ignite.internal.visor.cache.VisorCache org.apache.ignite.internal.visor.cache.VisorCacheAffinityConfiguration -org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTask -org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTask$VisorCacheAffinityNodeJob -org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheAggregatedMetrics -org.apache.ignite.internal.visor.cache.VisorCacheClearTask -org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob -org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob$1 -org.apache.ignite.internal.visor.cache.VisorCacheClearTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheClearTaskResult org.apache.ignite.internal.visor.cache.VisorCacheConfiguration org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorJob org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorTask @@ -2032,259 +2108,177 @@ org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorTaskArg org.apache.ignite.internal.visor.cache.VisorCacheEvictionConfiguration org.apache.ignite.internal.visor.cache.VisorCacheJdbcType org.apache.ignite.internal.visor.cache.VisorCacheJdbcTypeField -org.apache.ignite.internal.visor.cache.VisorCacheLoadTask -org.apache.ignite.internal.visor.cache.VisorCacheLoadTask$VisorCachesLoadJob -org.apache.ignite.internal.visor.cache.VisorCacheLoadTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTask -org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTask$VisorCacheLostPartitionsJob -org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTaskResult -org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask -org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask$VisorCacheMetadataJob -org.apache.ignite.internal.visor.cache.VisorCacheMetadataTaskArg -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.VisorCacheMetricsCollectorTaskArg -org.apache.ignite.internal.visor.cache.metrics.CacheMetricsOperation -org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTask -org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTask$VisorCacheMetricsJob -org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTaskArg -org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTaskResult -org.apache.ignite.internal.visor.cache.VisorCacheModifyTask -org.apache.ignite.internal.visor.cache.VisorCacheModifyTask$VisorCacheModifyJob -org.apache.ignite.internal.visor.cache.VisorCacheModifyTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheModifyTaskResult -org.apache.ignite.internal.visor.cache.VisorCacheNamesCollectorTask -org.apache.ignite.internal.visor.cache.VisorCacheNamesCollectorTask$VisorCacheNamesCollectorJob -org.apache.ignite.internal.visor.cache.VisorCacheNamesCollectorTaskResult org.apache.ignite.internal.visor.cache.VisorCacheNearConfiguration -org.apache.ignite.internal.visor.cache.VisorCacheNodesTask -org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob -org.apache.ignite.internal.visor.cache.VisorCacheNodesTaskArg -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.VisorCachePartitionsTaskArg org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration -org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask -org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob -org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheResetLostPartitionsTask -org.apache.ignite.internal.visor.cache.VisorCacheResetLostPartitionsTask$VisorCacheResetLostPartitionsJob -org.apache.ignite.internal.visor.cache.VisorCacheResetLostPartitionsTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask -org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob -org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTaskArg -org.apache.ignite.internal.visor.cache.VisorCacheSqlIndexMetadata -org.apache.ignite.internal.visor.cache.VisorCacheSqlMetadata -org.apache.ignite.internal.visor.cache.VisorCacheStartTask -org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob -org.apache.ignite.internal.visor.cache.VisorCacheStartTaskArg org.apache.ignite.internal.visor.cache.VisorCacheStopTask org.apache.ignite.internal.visor.cache.VisorCacheStopTask$VisorCacheStopJob org.apache.ignite.internal.visor.cache.VisorCacheStopTaskArg org.apache.ignite.internal.visor.cache.VisorCacheStoreConfiguration -org.apache.ignite.internal.visor.cache.VisorCacheToggleStatisticsTask -org.apache.ignite.internal.visor.cache.VisorCacheToggleStatisticsTask$VisorCachesToggleStatisticsJob -org.apache.ignite.internal.visor.cache.VisorCacheToggleStatisticsTaskArg org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceClosure org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceJobResult org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceTask org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceTask$FindAndDeleteGarbageInPersistenceJob org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceTaskArg org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceTaskResult -org.apache.ignite.internal.visor.cache.VisorMemoryMetrics -org.apache.ignite.internal.visor.cache.VisorModifyCacheMode -org.apache.ignite.internal.visor.cache.VisorPartitionMap +org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTask +org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTask$IndexForceRebuildJob +org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTaskArg +org.apache.ignite.internal.visor.cache.index.IndexForceRebuildTaskRes +org.apache.ignite.internal.visor.cache.index.IndexListInfoContainer +org.apache.ignite.internal.visor.cache.index.IndexListTask +org.apache.ignite.internal.visor.cache.index.IndexListTask$IndexListJob +org.apache.ignite.internal.visor.cache.index.IndexListTaskArg +org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusInfoContainer +org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusTask +org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusTask$IndexRebuildStatusJob +org.apache.ignite.internal.visor.cache.index.IndexRebuildStatusTaskArg +org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildJobRes +org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTask +org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTask$ScheduleIndexRebuildJob +org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTaskArg +org.apache.ignite.internal.visor.cache.index.ScheduleIndexRebuildTaskRes +org.apache.ignite.internal.visor.cache.metrics.CacheMetricsOperation +org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTask +org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTask$VisorCacheMetricsJob +org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTaskArg +org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTaskResult +org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionTask +org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionTask$VisorComputeCancelSessionJob +org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionTaskArg org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTaskArg -org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask -org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask$VisorComputeResetMetricsJob -org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask -org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask$VisorComputeToggleMonitoringJob -org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTaskArg -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.VisorThreadDumpTaskResult -org.apache.ignite.internal.visor.debug.VisorThreadInfo -org.apache.ignite.internal.visor.debug.VisorThreadLockInfo -org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo -org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityResult -org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityTask -org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityTask$VisorConnectivityJob -org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityTask$CheckNodesCallable -org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityArgs +org.apache.ignite.internal.visor.consistency.AbstractConsistencyTask +org.apache.ignite.internal.visor.consistency.VisorConsistencyCancelTask +org.apache.ignite.internal.visor.consistency.VisorConsistencyCancelTask$VisorConsistencyCancelJob +org.apache.ignite.internal.visor.consistency.VisorConsistencyCountersFinalizationTask +org.apache.ignite.internal.visor.consistency.VisorConsistencyCountersFinalizationTask$VisorConsistencyCountersFinalizationJob +org.apache.ignite.internal.visor.consistency.VisorConsistencyRepairTask +org.apache.ignite.internal.visor.consistency.VisorConsistencyRepairTask$VisorConsistencyRepairJob +org.apache.ignite.internal.visor.consistency.VisorConsistencyRepairTask$VisorConsistencyRepairJob$CacheConsistencyViolationEventListener +org.apache.ignite.internal.visor.consistency.VisorConsistencyRepairTaskArg +org.apache.ignite.internal.visor.consistency.VisorConsistencyStatusTask +org.apache.ignite.internal.visor.consistency.VisorConsistencyStatusTask$VisorConsistencyStatusJob +org.apache.ignite.internal.visor.consistency.VisorConsistencyTaskResult +org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationOperation org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTask org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTask$VisorDefragmentationJob -org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationOperation org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTaskArg org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTaskResult -org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent -org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent -org.apache.ignite.internal.visor.event.VisorGridEvent -org.apache.ignite.internal.visor.event.VisorGridEventsLost -org.apache.ignite.internal.visor.event.VisorGridJobEvent -org.apache.ignite.internal.visor.event.VisorGridTaskEvent -org.apache.ignite.internal.visor.file.VisorFileBlock -org.apache.ignite.internal.visor.file.VisorFileBlockTask -org.apache.ignite.internal.visor.file.VisorFileBlockTask$VisorFileBlockJob -org.apache.ignite.internal.visor.file.VisorFileBlockTaskArg -org.apache.ignite.internal.visor.file.VisorFileBlockTaskResult -org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask -org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask$VisorLatestTextFilesJob -org.apache.ignite.internal.visor.file.VisorLatestTextFilesTaskArg -org.apache.ignite.internal.visor.log.VisorLogFile -org.apache.ignite.internal.visor.log.VisorLogSearchResult -org.apache.ignite.internal.visor.log.VisorLogSearchTask -org.apache.ignite.internal.visor.log.VisorLogSearchTask$VisorLogSearchJob -org.apache.ignite.internal.visor.log.VisorLogSearchTaskArg -org.apache.ignite.internal.visor.log.VisorLogSearchTaskResult -org.apache.ignite.internal.visor.misc.VisorAckTask -org.apache.ignite.internal.visor.misc.VisorAckTask$VisorAckJob -org.apache.ignite.internal.visor.misc.VisorAckTaskArg -org.apache.ignite.internal.visor.misc.VisorChangeGridActiveStateTask -org.apache.ignite.internal.visor.misc.VisorChangeGridActiveStateTask$VisorChangeGridActiveStateJob -org.apache.ignite.internal.visor.misc.VisorChangeGridActiveStateTaskArg +org.apache.ignite.internal.visor.diagnostic.Operation +org.apache.ignite.internal.visor.diagnostic.VisorPageLocksResult +org.apache.ignite.internal.visor.diagnostic.VisorPageLocksTask +org.apache.ignite.internal.visor.diagnostic.VisorPageLocksTask$VisorPageLocksTrackerJob +org.apache.ignite.internal.visor.diagnostic.VisorPageLocksTrackerArgs +org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityArgs +org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityResult +org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityTask +org.apache.ignite.internal.visor.diagnostic.availability.VisorConnectivityTask$VisorConnectivityJob +org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTask +org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTask$VisorReencryptionBaseJob +org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTask$VisorSingleFieldDto +org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTaskArg +org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTaskResult +org.apache.ignite.internal.visor.encryption.VisorChangeCacheGroupKeyTask +org.apache.ignite.internal.visor.encryption.VisorChangeCacheGroupKeyTask$VisorChangeCacheGroupKeyJob +org.apache.ignite.internal.visor.encryption.VisorChangeMasterKeyTask +org.apache.ignite.internal.visor.encryption.VisorChangeMasterKeyTask$VisorChangeMasterKeyJob +org.apache.ignite.internal.visor.encryption.VisorEncryptionKeyIdsTask +org.apache.ignite.internal.visor.encryption.VisorEncryptionKeyIdsTask$VisorEncryptionKeyIdsJob +org.apache.ignite.internal.visor.encryption.VisorEncryptionKeyIdsTask$VisorEncryptionKeyIdsResult +org.apache.ignite.internal.visor.encryption.VisorGetMasterKeyNameTask +org.apache.ignite.internal.visor.encryption.VisorGetMasterKeyNameTask$VisorGetMasterKeyNameJob +org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTask +org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTask$ReencryptionRateJobResult +org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTask$VisorReencryptionRateJob +org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTaskArg +org.apache.ignite.internal.visor.encryption.VisorReencryptionResumeTask +org.apache.ignite.internal.visor.encryption.VisorReencryptionResumeTask$VisorReencryptionResumeJob +org.apache.ignite.internal.visor.encryption.VisorReencryptionStatusTask +org.apache.ignite.internal.visor.encryption.VisorReencryptionStatusTask$VisorReencryptionStatusJob +org.apache.ignite.internal.visor.encryption.VisorReencryptionStatusTask$VisorReencryptionStatusResult +org.apache.ignite.internal.visor.encryption.VisorReencryptionSuspendTask +org.apache.ignite.internal.visor.encryption.VisorReencryptionSuspendTask$VisorReencryptionSuspendJob +org.apache.ignite.internal.visor.encryption.VisorReencryptionSuspendTask$VisorReencryptionSuspendResumeJobResult +org.apache.ignite.internal.visor.metric.VisorMetricTask +org.apache.ignite.internal.visor.metric.VisorMetricTask$VisorMetricJob +org.apache.ignite.internal.visor.metric.VisorMetricTaskArg +org.apache.ignite.internal.visor.misc.VisorClusterChangeTagTask +org.apache.ignite.internal.visor.misc.VisorClusterChangeTagTask$VisorClusterChangeTagJob +org.apache.ignite.internal.visor.misc.VisorClusterChangeTagTaskArg +org.apache.ignite.internal.visor.misc.VisorClusterChangeTagTaskResult org.apache.ignite.internal.visor.misc.VisorClusterNode -org.apache.ignite.internal.visor.misc.VisorLatestVersionTask -org.apache.ignite.internal.visor.misc.VisorLatestVersionTask$VisorLatestVersionJob -org.apache.ignite.internal.visor.misc.VisorNopTask -org.apache.ignite.internal.visor.misc.VisorNopTask$VisorNopJob -org.apache.ignite.internal.visor.misc.VisorResolveHostNameTask -org.apache.ignite.internal.visor.misc.VisorResolveHostNameTask$VisorResolveHostNameJob +org.apache.ignite.internal.visor.misc.VisorIdAndTagViewTask +org.apache.ignite.internal.visor.misc.VisorIdAndTagViewTask$IdAndTagViewJob +org.apache.ignite.internal.visor.misc.VisorIdAndTagViewTaskResult org.apache.ignite.internal.visor.misc.VisorWalTask org.apache.ignite.internal.visor.misc.VisorWalTask$VisorWalJob org.apache.ignite.internal.visor.misc.VisorWalTaskArg org.apache.ignite.internal.visor.misc.VisorWalTaskOperation org.apache.ignite.internal.visor.misc.VisorWalTaskResult -org.apache.ignite.internal.visor.node.VisorAffinityTopologyVersion -org.apache.ignite.internal.visor.node.VisorAtomicConfiguration -org.apache.ignite.internal.visor.node.VisorBasicConfiguration -org.apache.ignite.internal.visor.node.VisorBinaryConfiguration -org.apache.ignite.internal.visor.node.VisorBinaryTypeConfiguration -org.apache.ignite.internal.visor.node.VisorCacheKeyConfiguration -org.apache.ignite.internal.visor.node.VisorCacheRebalanceCollectorJobResult -org.apache.ignite.internal.visor.node.VisorCacheRebalanceCollectorTask -org.apache.ignite.internal.visor.node.VisorCacheRebalanceCollectorTask$VisorCacheRebalanceCollectorJob -org.apache.ignite.internal.visor.node.VisorCacheRebalanceCollectorTaskArg -org.apache.ignite.internal.visor.node.VisorCacheRebalanceCollectorTaskResult -org.apache.ignite.internal.visor.node.VisorClientConnectorConfiguration -org.apache.ignite.internal.visor.node.VisorDataRegionConfiguration -org.apache.ignite.internal.visor.node.VisorDataStorageConfiguration -org.apache.ignite.internal.visor.node.VisorExecutorConfiguration -org.apache.ignite.internal.visor.node.VisorExecutorServiceConfiguration -org.apache.ignite.internal.visor.node.VisorGridConfiguration -org.apache.ignite.internal.visor.node.VisorHadoopConfiguration -org.apache.ignite.internal.visor.node.VisorLifecycleConfiguration -org.apache.ignite.internal.visor.node.VisorMemoryConfiguration -org.apache.ignite.internal.visor.node.VisorMemoryPolicyConfiguration -org.apache.ignite.internal.visor.node.VisorMetricsConfiguration -org.apache.ignite.internal.visor.node.VisorMvccConfiguration -org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus -org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorJob -org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask -org.apache.ignite.internal.visor.node.VisorNodeDataCollectorJob -org.apache.ignite.internal.visor.node.VisorNodeDataCollectorJobResult -org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTask -org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskArg -org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskResult -org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask -org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask$VisorNodeEventsCollectorJob -org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask$VisorNodeEventsCollectorJob$1 -org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg -org.apache.ignite.internal.visor.node.VisorNodeGcTask -org.apache.ignite.internal.visor.node.VisorNodeGcTask$VisorNodeGcJob -org.apache.ignite.internal.visor.node.VisorNodeGcTaskResult -org.apache.ignite.internal.visor.node.VisorNodePingTask -org.apache.ignite.internal.visor.node.VisorNodePingTask$VisorNodePingJob -org.apache.ignite.internal.visor.node.VisorNodePingTaskArg -org.apache.ignite.internal.visor.node.VisorNodePingTaskResult -org.apache.ignite.internal.visor.node.VisorNodeRestartTask -org.apache.ignite.internal.visor.node.VisorNodeRestartTask$VisorNodesRestartJob -org.apache.ignite.internal.visor.node.VisorNodeStopTask -org.apache.ignite.internal.visor.node.VisorNodeStopTask$VisorNodesStopJob -org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrors -org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask -org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask$VisorNodeSuppressedErrorsJob -org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTaskArg -org.apache.ignite.internal.visor.node.VisorPeerToPeerConfiguration -org.apache.ignite.internal.visor.node.VisorPersistenceMetrics -org.apache.ignite.internal.visor.node.VisorPersistentStoreConfiguration -org.apache.ignite.internal.visor.node.VisorRestConfiguration -org.apache.ignite.internal.visor.node.VisorSegmentationConfiguration -org.apache.ignite.internal.visor.node.VisorServiceConfiguration -org.apache.ignite.internal.visor.node.VisorSpiDescription -org.apache.ignite.internal.visor.node.VisorSpisConfiguration -org.apache.ignite.internal.visor.node.VisorSqlConnectorConfiguration -org.apache.ignite.internal.visor.node.VisorSuppressedError -org.apache.ignite.internal.visor.node.VisorTransactionConfiguration -org.apache.ignite.internal.visor.query.VisorQueryCancelTask -org.apache.ignite.internal.visor.query.VisorQueryCancelTask$VisorCancelQueriesJob -org.apache.ignite.internal.visor.query.VisorQueryCancelTaskArg -org.apache.ignite.internal.visor.query.VisorQueryCleanupTask -org.apache.ignite.internal.visor.query.VisorQueryCleanupTask$VisorQueryCleanupJob -org.apache.ignite.internal.visor.query.VisorQueryCleanupTaskArg +org.apache.ignite.internal.visor.performancestatistics.VisorPerformanceStatisticsOperation +org.apache.ignite.internal.visor.performancestatistics.VisorPerformanceStatisticsTask +org.apache.ignite.internal.visor.performancestatistics.VisorPerformanceStatisticsTask$VisorPerformanceStatisticsJob +org.apache.ignite.internal.visor.performancestatistics.VisorPerformanceStatisticsTaskArg +org.apache.ignite.internal.visor.persistence.PersistenceCleanAndBackupSettings +org.apache.ignite.internal.visor.persistence.PersistenceCleanAndBackupType +org.apache.ignite.internal.visor.persistence.PersistenceOperation +org.apache.ignite.internal.visor.persistence.PersistenceTask +org.apache.ignite.internal.visor.persistence.PersistenceTask$PersistenceJob +org.apache.ignite.internal.visor.persistence.PersistenceTaskArg +org.apache.ignite.internal.visor.persistence.PersistenceTaskResult +org.apache.ignite.internal.visor.query.VisorContinuousQueryCancelTask +org.apache.ignite.internal.visor.query.VisorContinuousQueryCancelTask$VisorContinuousQueryCancelJob +org.apache.ignite.internal.visor.query.VisorContinuousQueryCancelTaskArg +org.apache.ignite.internal.visor.query.VisorQueryCancelOnInitiatorTask +org.apache.ignite.internal.visor.query.VisorQueryCancelOnInitiatorTask$VisorCancelQueryOnInitiatorJob +org.apache.ignite.internal.visor.query.VisorQueryCancelOnInitiatorTaskArg org.apache.ignite.internal.visor.query.VisorQueryConfiguration -org.apache.ignite.internal.visor.query.VisorQueryDetailMetrics -org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTask -org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob -org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTaskArg org.apache.ignite.internal.visor.query.VisorQueryEntity -org.apache.ignite.internal.visor.query.VisorQueryFetchFirstPageTask -org.apache.ignite.internal.visor.query.VisorQueryFetchFirstPageTask$VisorQueryFetchFirstPageJob -org.apache.ignite.internal.visor.query.VisorQueryField org.apache.ignite.internal.visor.query.VisorQueryIndex org.apache.ignite.internal.visor.query.VisorQueryIndexField -org.apache.ignite.internal.visor.query.VisorQueryMetrics -org.apache.ignite.internal.visor.query.VisorQueryNextPageTask -org.apache.ignite.internal.visor.query.VisorQueryNextPageTask$VisorQueryNextPageJob -org.apache.ignite.internal.visor.query.VisorQueryNextPageTaskArg -org.apache.ignite.internal.visor.query.VisorQueryPingTask -org.apache.ignite.internal.visor.query.VisorQueryPingTask$VisorQueryFetchFirstPageJob -org.apache.ignite.internal.visor.query.VisorQueryPingTaskResult -org.apache.ignite.internal.visor.query.VisorQueryResetDetailMetricsTask -org.apache.ignite.internal.visor.query.VisorQueryResetDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob -org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTask -org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTask$VisorQueryResetMetricsJob -org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTaskArg -org.apache.ignite.internal.visor.query.VisorQueryResult -org.apache.ignite.internal.visor.query.VisorQueryScanRegexFilter -org.apache.ignite.internal.visor.query.VisorQueryTask -org.apache.ignite.internal.visor.query.VisorQueryTask$VisorQueryJob -org.apache.ignite.internal.visor.query.VisorQueryTaskArg -org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTask -org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTask$VisorCollectRunningQueriesJob -org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTaskArg -org.apache.ignite.internal.visor.query.VisorRunningQuery -org.apache.ignite.internal.visor.query.VisorScanQueryTask -org.apache.ignite.internal.visor.query.VisorScanQueryTask$VisorScanQueryJob -org.apache.ignite.internal.visor.query.VisorScanQueryTaskArg -org.apache.ignite.internal.visor.persistence.PersistenceTaskResult +org.apache.ignite.internal.visor.query.VisorScanQueryCancelTask +org.apache.ignite.internal.visor.query.VisorScanQueryCancelTask$VisorScanQueryCancelJob +org.apache.ignite.internal.visor.query.VisorScanQueryCancelTaskArg org.apache.ignite.internal.visor.service.VisorCancelServiceTask org.apache.ignite.internal.visor.service.VisorCancelServiceTask$VisorCancelServiceJob org.apache.ignite.internal.visor.service.VisorCancelServiceTaskArg -org.apache.ignite.internal.visor.service.VisorServiceDescriptor -org.apache.ignite.internal.visor.service.VisorServiceTask -org.apache.ignite.internal.visor.service.VisorServiceTask$VisorServiceJob -org.apache.ignite.internal.visor.snapshot.VisorSnapshotCreateTask -org.apache.ignite.internal.visor.snapshot.VisorSnapshotCreateTask$VisorSnapshotCreateJob +org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTask +org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTask$VisorShutdownPolicyJob +org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTaskArg +org.apache.ignite.internal.visor.shutdown.VisorShutdownPolicyTaskResult org.apache.ignite.internal.visor.snapshot.VisorSnapshotCancelTask -org.apache.ignite.internal.visor.snapshot.VisorSnapshotCancelTaskArg org.apache.ignite.internal.visor.snapshot.VisorSnapshotCancelTask$VisorSnapshotCancelJob -org.apache.ignite.internal.visor.snapshot.VisorSnapshotTaskResult +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCancelTaskArg +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCheckTask +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCheckTask$VisorSnapshotCheckJob +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCheckTaskArg +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCreateTask +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCreateTask$VisorSnapshotCreateJob +org.apache.ignite.internal.visor.snapshot.VisorSnapshotCreateTaskArg +org.apache.ignite.internal.visor.snapshot.VisorSnapshotOneNodeTask org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTask -org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTask$VisorSnapshotStartRestoreJob org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTask$VisorSnapshotRestoreCancelJob org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTask$VisorSnapshotRestoreStatusJob -org.apache.ignite.internal.visor.snapshot.VisorSnapshotCheckTaskArg -org.apache.ignite.internal.visor.snapshot.VisorSnapshotCreateTaskArg -org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTaskArg +org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTask$VisorSnapshotStartRestoreJob org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTaskAction +org.apache.ignite.internal.visor.snapshot.VisorSnapshotRestoreTaskArg +org.apache.ignite.internal.visor.snapshot.VisorSnapshotStatusTask +org.apache.ignite.internal.visor.snapshot.VisorSnapshotStatusTask$SnapshotOperation +org.apache.ignite.internal.visor.snapshot.VisorSnapshotStatusTask$SnapshotStatus +org.apache.ignite.internal.visor.snapshot.VisorSnapshotStatusTask$VisorSnapshotStatusJob +org.apache.ignite.internal.visor.snapshot.VisorSnapshotTaskResult +org.apache.ignite.internal.visor.systemview.VisorSystemViewTask +org.apache.ignite.internal.visor.systemview.VisorSystemViewTask$SimpleType +org.apache.ignite.internal.visor.systemview.VisorSystemViewTask$VisorSystemViewJob +org.apache.ignite.internal.visor.systemview.VisorSystemViewTaskArg +org.apache.ignite.internal.visor.systemview.VisorSystemViewTaskResult +org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationItem +org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationOperation +org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTask +org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTask$VisorTracingConfigurationJob +org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskArg +org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult org.apache.ignite.internal.visor.tx.FetchNearXidVersionTask org.apache.ignite.internal.visor.tx.FetchNearXidVersionTask$FetchNearXidVersionJob org.apache.ignite.internal.visor.tx.TxKeyLockType @@ -2311,52 +2305,20 @@ org.apache.ignite.internal.visor.tx.VisorTxTask$TxKillClosure org.apache.ignite.internal.visor.tx.VisorTxTask$VisorTxJob org.apache.ignite.internal.visor.tx.VisorTxTaskArg org.apache.ignite.internal.visor.tx.VisorTxTaskResult -org.apache.ignite.internal.visor.diagnostic.VisorPageLocksTrackerArgs -org.apache.ignite.internal.visor.diagnostic.VisorPageLocksResult -org.apache.ignite.internal.visor.diagnostic.VisorPageLocksTask -org.apache.ignite.internal.visor.diagnostic.VisorPageLocksTask$VisorPageLocksTrackerJob -org.apache.ignite.internal.visor.encryption.VisorGetMasterKeyNameTask -org.apache.ignite.internal.visor.encryption.VisorGetMasterKeyNameTask$VisorGetMasterKeyNameJob -org.apache.ignite.internal.visor.encryption.VisorChangeMasterKeyTask -org.apache.ignite.internal.visor.encryption.VisorChangeMasterKeyTask$VisorChangeMasterKeyJob -org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTaskArg -org.apache.ignite.internal.visor.encryption.VisorCacheGroupEncryptionTaskResult -org.apache.ignite.internal.visor.encryption.VisorChangeCacheGroupKeyTask -org.apache.ignite.internal.visor.encryption.VisorChangeCacheGroupKeyTask$VisorChangeCacheGroupKeyJob -org.apache.ignite.internal.visor.encryption.VisorEncryptionKeyIdsTask -org.apache.ignite.internal.visor.encryption.VisorEncryptionKeyIdsTask$VisorEncryptionKeyIdsJob -org.apache.ignite.internal.visor.encryption.VisorEncryptionKeyIdsTask$VisorEncryptionKeyIdsResult -org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTask -org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTask$VisorReencryptionRateJob -org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTask$ReencryptionRateJobResult -org.apache.ignite.internal.visor.encryption.VisorReencryptionRateTaskArg -org.apache.ignite.internal.visor.encryption.VisorReencryptionResumeTask -org.apache.ignite.internal.visor.encryption.VisorReencryptionResumeTask$VisorReencryptionResumeJob -org.apache.ignite.internal.visor.encryption.VisorReencryptionStatusTask -org.apache.ignite.internal.visor.encryption.VisorReencryptionStatusTask$VisorReencryptionStatusJob -org.apache.ignite.internal.visor.encryption.VisorReencryptionStatusTask$VisorReencryptionStatusResult -org.apache.ignite.internal.visor.encryption.VisorReencryptionSuspendTask -org.apache.ignite.internal.visor.encryption.VisorReencryptionSuspendTask$VisorReencryptionSuspendJob -org.apache.ignite.internal.visor.encryption.VisorReencryptionSuspendTask$VisorReencryptionSuspendResumeJobResult 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.verify.CacheFilterEnum org.apache.ignite.internal.visor.verify.IndexIntegrityCheckIssue org.apache.ignite.internal.visor.verify.IndexValidationIssue +org.apache.ignite.internal.visor.verify.ValidateIndexesCheckSizeIssue +org.apache.ignite.internal.visor.verify.ValidateIndexesCheckSizeResult +org.apache.ignite.internal.visor.verify.ValidateIndexesClosure org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult org.apache.ignite.internal.visor.verify.VisorContentionJobResult org.apache.ignite.internal.visor.verify.VisorContentionTask org.apache.ignite.internal.visor.verify.VisorContentionTask$VisorContentionJob org.apache.ignite.internal.visor.verify.VisorContentionTaskArg org.apache.ignite.internal.visor.verify.VisorContentionTaskResult -org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask -org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask$VisorIdleVerifyJob -org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask$VisorIdleVerifyJob$1 -org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask$VisorIdleVerifyJob$2 -org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTaskArg -org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTaskResult org.apache.ignite.internal.visor.verify.VisorIdleVerifyDumpTask org.apache.ignite.internal.visor.verify.VisorIdleVerifyDumpTaskArg org.apache.ignite.internal.visor.verify.VisorIdleVerifyJob @@ -2367,20 +2329,15 @@ org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskArg org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskResult org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskV2 org.apache.ignite.internal.visor.verify.VisorValidateIndexesJobResult +org.apache.ignite.internal.visor.verify.VisorValidateIndexesTask +org.apache.ignite.internal.visor.verify.VisorValidateIndexesTask$VisorValidateIndexesJob org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskArg org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskResult -org.apache.ignite.internal.visor.verify.ValidateIndexesCheckSizeIssue -org.apache.ignite.internal.visor.verify.ValidateIndexesCheckSizeResult org.apache.ignite.internal.visor.verify.VisorViewCacheCmd org.apache.ignite.internal.visor.verify.VisorViewCacheTask org.apache.ignite.internal.visor.verify.VisorViewCacheTask$VisorViewCacheJob org.apache.ignite.internal.visor.verify.VisorViewCacheTaskArg org.apache.ignite.internal.visor.verify.VisorViewCacheTaskResult -org.apache.ignite.internal.visor.systemview.VisorSystemViewTask -org.apache.ignite.internal.visor.systemview.VisorSystemViewTaskArg -org.apache.ignite.internal.visor.systemview.VisorSystemViewTaskResult -org.apache.ignite.internal.visor.systemview.VisorSystemViewTask$VisorSystemViewJob -org.apache.ignite.internal.visor.systemview.VisorSystemViewTask$SimpleAttributeType org.apache.ignite.internal.websession.WebSessionAttributeProcessor org.apache.ignite.internal.websession.WebSessionEntity org.apache.ignite.lang.IgniteBiClosure @@ -2402,7 +2359,7 @@ org.apache.ignite.lifecycle.LifecycleEventType org.apache.ignite.marshaller.MarshallerUtils$1 org.apache.ignite.marshaller.jdk.JdkMarshallerDummySerializable org.apache.ignite.messaging.MessagingListenActor -org.apache.ignite.mxbean.TransactionMetricsMxBean +org.apache.ignite.platform.PlatformType org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactoryNative @@ -2423,6 +2380,7 @@ org.apache.ignite.plugin.security.SecuritySubjectType org.apache.ignite.plugin.segmentation.SegmentationPolicy org.apache.ignite.plugin.segmentation.SegmentationResolver org.apache.ignite.services.Service +org.apache.ignite.services.ServiceCallInterceptor org.apache.ignite.services.ServiceConfiguration org.apache.ignite.services.ServiceContext org.apache.ignite.services.ServiceDeploymentException @@ -2435,22 +2393,15 @@ org.apache.ignite.spi.IgniteSpiOperationTimeoutException org.apache.ignite.spi.IgniteSpiVersionCheckException org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointData org.apache.ignite.spi.collision.jobstealing.JobStealingRequest -org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi$PriorityGridCollisionJobContextComparator -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$1 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$10 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$1 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$2 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$3 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure$1 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew$1 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$4 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$9 -org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeClosure +org.apache.ignite.spi.communication.tcp.internal.ConnectGateway org.apache.ignite.spi.communication.tcp.internal.HandshakeException +org.apache.ignite.spi.communication.tcp.internal.InboundConnectionHandler$ConnectClosure +org.apache.ignite.spi.communication.tcp.internal.InboundConnectionHandler$ConnectClosureNew +org.apache.ignite.spi.communication.tcp.internal.NodeUnreachableException +org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfiguration org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConnectionCheckFuture$SingleAddressConnectFuture$1 +org.apache.ignite.spi.communication.tcp.internal.TcpConnectionIndexAwareMessage +org.apache.ignite.spi.communication.tcp.internal.TcpConnectionRequestDiscoveryMessage org.apache.ignite.spi.communication.tcp.internal.TcpInverseConnectionResponseMessage org.apache.ignite.spi.communication.tcp.messages.HandshakeMessage org.apache.ignite.spi.communication.tcp.messages.HandshakeMessage2 @@ -2468,8 +2419,10 @@ org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode$1 org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodesRing$1 org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodesRing$2 org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodesRing$3 +org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodesRing$4 org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoverySpiState org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage +org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractTraceableMessage org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientAckResponse @@ -2499,6 +2452,11 @@ org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryRingLatencyCheckMessage org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryServerOnlyCustomEventMessage org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusCheckMessage org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionKey +org.apache.ignite.spi.systemview.view.ComputeJobView$ComputeJobState +org.apache.ignite.spi.tracing.Scope +org.apache.ignite.spi.tracing.SpanStatus +org.apache.ignite.spi.tracing.TracingConfigurationCoordinates +org.apache.ignite.spi.tracing.TracingConfigurationParameters org.apache.ignite.ssl.SslContextFactory org.apache.ignite.startup.BasicWarmupClosure org.apache.ignite.startup.cmdline.AboutDialog @@ -2516,7 +2474,6 @@ org.apache.ignite.transactions.TransactionDuplicateKeyException org.apache.ignite.transactions.TransactionException org.apache.ignite.transactions.TransactionHeuristicException org.apache.ignite.transactions.TransactionIsolation -org.apache.ignite.transactions.TransactionMetrics org.apache.ignite.transactions.TransactionMixedModeException org.apache.ignite.transactions.TransactionOptimisticException org.apache.ignite.transactions.TransactionRollbackException @@ -2525,5 +2482,3 @@ org.apache.ignite.transactions.TransactionState org.apache.ignite.transactions.TransactionTimeoutException org.apache.ignite.transactions.TransactionUnsupportedConcurrencyException org.apache.ignite.util.AttributeNodeFilter -org.apache.ignite.internal.processors.cache.SysCacheInconsistencyInternalKeyTest$KeyUtility -org.apache.ignite.util.deque.FastSizeDeque diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryConfigurationCustomSerializerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryConfigurationCustomSerializerSelfTest.java index 238b3e4c7a7b0..3ef52872a50a1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryConfigurationCustomSerializerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryConfigurationCustomSerializerSelfTest.java @@ -35,11 +35,13 @@ import org.apache.ignite.internal.client.GridClientProtocol; import org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer; import org.apache.ignite.internal.visor.VisorTaskArgument; -import org.apache.ignite.internal.visor.node.VisorNodePingTask; -import org.apache.ignite.internal.visor.node.VisorNodePingTaskArg; +import org.apache.ignite.internal.visor.systemview.VisorSystemViewTask; +import org.apache.ignite.internal.visor.systemview.VisorSystemViewTaskArg; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; +import static org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW; + /** * Tests that node will start with custom binary serializer and thin client will connect to such node. */ @@ -103,8 +105,8 @@ public void testThinClientConnected() throws Exception { GridClient client = GridClientFactory.start(clnCfg); // Execute some task. - client.compute().execute(VisorNodePingTask.class.getName(), - new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false)); + client.compute().execute(VisorSystemViewTask.class.getName(), + new VisorTaskArgument<>(nid, new VisorSystemViewTaskArg(CACHES_VIEW), false)); GridClientFactory.stop(client.id(), false); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java index b1fe03e59ea8c..4254edd0c66ed 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java @@ -19,7 +19,6 @@ import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Random; @@ -52,10 +51,6 @@ import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.visor.VisorTaskArgument; -import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTask; -import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskArg; -import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskResult; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.plugin.extensions.communication.Message; @@ -456,23 +451,11 @@ public void testRebalanceProgressUnderLoad() throws Exception { latch.await(); - VisorNodeDataCollectorTaskArg taskArg = new VisorNodeDataCollectorTaskArg(); - taskArg.setCacheGroups(Collections.emptySet()); - - VisorTaskArgument arg = new VisorTaskArgument<>( - Collections.singletonList(ignite.cluster().localNode().id()), - taskArg, - false - ); - GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { - VisorNodeDataCollectorTaskResult res = ignite.compute().execute(VisorNodeDataCollectorTask.class, arg); - CacheMetrics snapshot = ig.cache(CACHE1).metrics(); return snapshot.getRebalancedKeys() > snapshot.getEstimatedRebalancingKeys() - && Double.compare(res.getRebalance().get(ignite.cluster().localNode().id()), 1.0) == 0 && snapshot.getRebalancingPartitionsCount() == 0; } }, 5000); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/internal/GridInternalTasksLoadBalancingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/internal/GridInternalTasksLoadBalancingSelfTest.java index f2b51a58f2a8e..a4fb0c32ce55c 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/internal/GridInternalTasksLoadBalancingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/internal/GridInternalTasksLoadBalancingSelfTest.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.UUID; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteException; import org.apache.ignite.cluster.ClusterNode; @@ -32,10 +31,6 @@ import org.apache.ignite.compute.ComputeTaskSplitAdapter; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.task.GridInternal; -import org.apache.ignite.internal.visor.VisorTaskArgument; -import org.apache.ignite.internal.visor.node.VisorNodePingTask; -import org.apache.ignite.internal.visor.node.VisorNodePingTaskArg; -import org.apache.ignite.internal.visor.node.VisorNodePingTaskResult; import org.apache.ignite.spi.IgniteSpiAdapter; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport; @@ -99,15 +94,6 @@ public void testInternalTaskBalancing() throws Exception { // Task with GridInternal should pass. assertEquals(TASK_RESULT, ignite.compute().execute(GridInternalTestTask.class.getName(), null)); - // Visor task should pass. - UUID nid = ignite.cluster().localNode().id(); - - VisorNodePingTaskResult ping = ignite.compute() - .execute(VisorNodePingTask.class.getName(), - new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false)); - - assertTrue(ping.isAlive()); - // Custom task should fail, because special test load balancer SPI returns null as balanced node. try { ignite.compute().execute(CustomTestTask.class.getName(), null); @@ -132,15 +118,6 @@ public void testInternalTaskDefaultBalancing() throws Exception { // Task with GridInternal should pass. assertEquals(TASK_RESULT, ignite.compute().execute(GridInternalTestTask.class.getName(), null)); - // Visor task should pass. - UUID nid = ignite.cluster().localNode().id(); - - VisorNodePingTaskResult ping = ignite.compute() - .execute(VisorNodePingTask.class.getName(), - new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false)); - - assertTrue(ping.isAlive()); - // Custom task should pass. assertEquals(TASK_RESULT, ignite.compute().execute(CustomTestTask.class.getName(), null)); } diff --git a/modules/visor-console-2.10/README.txt b/modules/visor-console-2.10/README.txt deleted file mode 100644 index 1a018b919d69f..0000000000000 --- a/modules/visor-console-2.10/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -Apache Ignite Visor Console Module ---------------------------- - -Apache Ignite Visor Console module to be build with Scala 2.10. diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml deleted file mode 100644 index 850b358d8b438..0000000000000 --- a/modules/visor-console-2.10/pom.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - 4.0.0 - - - org.apache.ignite - ignite-parent-internal - ${revision} - ../../parent-internal/pom.xml - - - ignite-visor-console_2.10 - ${revision} - http://ignite.apache.org - - - - ${project.groupId} - ignite-core - - - - ${project.groupId} - ignite-ssh - - - - ${project.groupId} - ignite-spring - - - - org.springframework - spring-core - ${spring.version} - - - - org.springframework - spring-beans - ${spring.version} - - - - org.springframework - spring-context - ${spring.version} - - - - org.springframework - spring-expression - ${spring.version} - - - - org.scala-lang - scala-library - ${scala210.library.version} - - - - org.scala-lang - jline - ${scala210.jline.version} - - - - - - ${project.groupId} - ignite-indexing - test - - - - org.scalatest - scalatest_2.10 - 2.2.2 - test - - - org.scala-lang - scala-library - - - - - - - - - - ../visor-console/src/main/scala - - **/*.scala - - - - - - - ../visor-console/src/test/scala - - **/*.scala - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - false - - - - - diff --git a/modules/visor-console/licenses/apache-2.0.txt b/modules/visor-console/licenses/apache-2.0.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/modules/visor-console/licenses/apache-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml deleted file mode 100644 index 83f0c953dfaf0..0000000000000 --- a/modules/visor-console/pom.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - 4.0.0 - - - org.apache.ignite - ignite-parent-internal - ${revision} - ../../parent-internal/pom.xml - - - ignite-visor-console - - http://ignite.apache.org - - - - ${project.groupId} - ignite-core - - - - ${project.groupId} - ignite-ssh - - - - ${project.groupId} - ignite-spring - - - - org.springframework - spring-core - ${spring.version} - - - - org.springframework - spring-beans - ${spring.version} - - - - org.springframework - spring-context - ${spring.version} - - - - org.springframework - spring-expression - ${spring.version} - - - - org.scala-lang - scala-library - ${scala.library.version} - - - - jline - jline - 2.12.1 - - - - - - ${project.groupId} - ignite-indexing - test - - - - ${project.groupId} - ignite-tools - test - - - - org.scalatest - scalatest_2.11 - ${scala.test.version} - test - - - org.scala-lang - scala-library - - - - - - - - - - net.alchim31.maven - scala-maven-plugin - - - scaladoc - prepare-package - - doc - doc-jar - - - Ignite Console Visor - Ignite Console Visor - ${maven.javadoc.skip} - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - - javadoc-zip - - run - - prepare-package - - - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - false - - - - - diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala deleted file mode 100644 index 9989d00f24fc4..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala +++ /dev/null @@ -1,473 +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.visor.commands - -import org.apache.ignite.IgniteSystemProperties._ -import org.apache.ignite.internal.IgniteVersionUtils._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.startup.cmdline.AboutDialog -import org.apache.ignite.visor.visor -import org.apache.ignite.visor.visor._ - -import jline.TerminalSupport -import jline.console.ConsoleReader -import jline.console.completer.Completer -import jline.internal.Configuration - -import javax.swing.ImageIcon -import java._ -import java.awt.Image -import java.io._ -import java.text.SimpleDateFormat - -import scala.io._ - -/** - * Command line Visor. - */ -class VisorConsole { - /** Version number. */ - protected def version() = VER_STR - - /** Copyright. */ - protected def copyright() = COPYRIGHT - - /** Program name. */ - protected val progName = sys.props.getOrElse(IGNITE_PROG_NAME, "ignitevisorcmd") - - /** - * Built-in commands. - */ - protected def addCommands() { - // Note the importing of implicit conversions. - org.apache.ignite.visor.commands.ack.VisorAckCommand - org.apache.ignite.visor.commands.alert.VisorAlertCommand - org.apache.ignite.visor.commands.cache.VisorCacheClearCommand - org.apache.ignite.visor.commands.cache.VisorCacheResetCommand - org.apache.ignite.visor.commands.cache.VisorCacheRebalanceCommand - org.apache.ignite.visor.commands.cache.VisorCacheCommand - org.apache.ignite.visor.commands.cache.VisorCacheModifyCommand - org.apache.ignite.visor.commands.config.VisorConfigurationCommand - org.apache.ignite.visor.commands.deploy.VisorDeployCommand - org.apache.ignite.visor.commands.disco.VisorDiscoveryCommand - org.apache.ignite.visor.commands.events.VisorEventsCommand - org.apache.ignite.visor.commands.gc.VisorGcCommand - org.apache.ignite.visor.commands.kill.VisorKillCommand - org.apache.ignite.visor.commands.node.VisorNodeCommand - org.apache.ignite.visor.commands.open.VisorOpenCommand - org.apache.ignite.visor.commands.ping.VisorPingCommand - org.apache.ignite.visor.commands.start.VisorStartCommand - org.apache.ignite.visor.commands.tasks.VisorTasksCommand - org.apache.ignite.visor.commands.top.VisorTopologyCommand - org.apache.ignite.visor.commands.vvm.VisorVvmCommand - } - - protected def parse(args: String) = { - val argLst = parseArgs(args) - - if (hasArgFlag("?", argLst) || hasArgFlag("help", argLst)) { - println("Usage:") - println(s" $progName [? | -help]|[{-v}{-np} {-cfg=}]|[{-b=} {-e=command1;command2;...} -quiet]") - println(" Where:") - println(" ?, /help, -help - show this message.") - println(" -v - verbose mode (quiet by default).") - println(" -np - no pause on exit (pause by default).") - println(" -cfg= - connect with specified configuration.") - println(" -b= - batch mode with file.") - println(" -e=cmd1;cmd2;... - batch mode with commands.") - println(" -nq - batch mode will not quit after execution (useful for alerts monitoring).") - println(" -quiet - batch mode will not print inform message and node log.") - - visor.quit() - } - - argLst - } - - protected def buildReader(argLst: ArgList): ConsoleReader = { - val cfgFile = argValue("cfg", argLst) - val batchFile = argValue("b", argLst) - val batchCommand = argValue("e", argLst) - val noBatchQuit = hasArgName("nq", argLst) - val quiet = hasArgName("quiet", argLst) - - if (noBatchQuit && batchFile.isEmpty && batchCommand.isEmpty) - visor.warn("Option \"-nq\" will be ignored because batch mode options \"-b\" or \"-e\" were not specified.") - - if (quiet && batchFile.isEmpty && batchCommand.isEmpty) - visor.warn("Option \"-quiet\" will be ignored because batch mode options \"-b\" or \"-e\" were not specified.") - - cfgFile.foreach(cfg => { - if (cfg.trim.isEmpty) { - visor.warn("Expected path to configuration after \"-cfg\" option.") - - visor.quit() - } - - if (batchFile.isDefined || batchCommand.isDefined) { - visor.warn("Options can't contains both -cfg and one of -b or -e options.") - - visor.quit() - } - - visor.searchCmd("open").foreach(_.withArgs("-cpath=" + cfg)) - }) - - if (batchFile.isDefined && batchCommand.isDefined) { - visor.warn("Options can't contains both command file and commands.") - - visor.quit() - } - - var batchStream: Option[String] = None - - batchFile.foreach(name => { - val f = U.resolveIgnitePath(name) - - if (f == null) { - visor.warn( - "Can't find batch commands file: " + name, - s"Usage: $progName {-b=} {-e=command1;command2}" - ) - - visor.quit() - } - - batchStream = Some(Source.fromFile(f).getLines().mkString("\n")) - }) - - batchCommand.foreach(commands => batchStream = Some(commands.replaceAll(";", "\n"))) - - val inputStream = batchStream match { - case Some(cmd) => - visor.batchMode = true - visor.quiet = quiet - - val script = cmd + (if (cmd.last == '\n') "" else "\n") + (if (noBatchQuit) "" else "quit\n") - - new ByteArrayInputStream(script.getBytes("UTF-8")) - - case None => new FileInputStream(FileDescriptor.in) - } - - // Workaround for IDEA terminal. - val idea = Seq( - "com.intellij.rt.execution.application.AppMain", - "com.intellij.rt.execution.application.AppMainV2" - ).exists(cls => - try { - Class.forName(cls) - - true - } - catch { - case _: ClassNotFoundException => false - } - ) - - val term = if (idea) new TerminalSupport(false) {} else null - - val reader = new ConsoleReader(inputStream, System.out, term) - - reader.addCompleter(new VisorCommandCompleter(visor.commands)) - reader.addCompleter(new VisorFileNameCompleter()) - - reader - } - - protected def mainLoop(reader: ConsoleReader) { - if (!visor.quiet) - welcomeMessage() - - var ok = true - - // Wrap line symbol for user input. - val wrapLine = if (U.isWindows) "^" else "\\" - - val emptyArg = "^([a-zA-z!?]+)$".r - val varArg = "^([a-zA-z!?]+)\\s+(.+)$".r - - var line: String = null - - val buf = new StringBuilder - - while (ok) { - line = reader.readLine(if (visor.quiet) null else "visor> ") - - ok = line != null - - if (ok) { - line = line.trim - - if (line.endsWith(wrapLine)) { - buf.append(line.dropRight(1)) - } - else { - if (buf.nonEmpty) { - buf.append(line) - - line = buf.toString() - - buf.clear() - } - - try { - line match { - case emptyArg(c) => - visor.searchCmd(c) match { - case Some(cmdHolder) => cmdHolder.emptyArgs() - case _ => adviseToHelp(c) - } - case varArg(c, a) => - visor.searchCmd(c) match { - case Some(cmdHolder) => cmdHolder.withArgs(a.trim) - case _ => adviseToHelp(c) - } - case s if "".equals(s.trim) => // Ignore empty user input. - case _ => adviseToHelp(line) - } - } catch { - case ignore: Exception => - ignore.printStackTrace() - - adviseToHelp(line) - } - } - } - } - - if (visor.isConnected) { - visor.close() - } - } - - /** - * Prints standard 'Invalid command' error message. - */ - protected def adviseToHelp(input: String) { - visor.warn( - "Invalid command name: '" + input + "'", - "Type 'help' to print commands list." - ) - } - - /** - * Print banner, hint message on start. - */ - protected def welcomeMessage() { - println("___ _________________________ ________" + NL + - "__ | / /____ _/__ ___/__ __ \\___ __ \\" + NL + - "__ | / / __ / _____ \\ _ / / /__ /_/ /" + NL + - "__ |/ / __/ / ____/ / / /_/ / _ _, _/" + NL + - "_____/ /___/ /____/ \\____/ /_/ |_|" + NL + - NL + - "ADMIN CONSOLE" + NL + - copyright()) - - nl() - - status() - - println("\nType 'help' for more information.") - println("Type 'open' to join the grid.") - println("Type 'quit' to quit form Visor console.") - - nl() - } - - /** - * Setting up Mac OS specific system menu. - */ - protected def addAboutDialog() { - def urlIcon(iconName: String) = { - val iconPath = "org/apache/ignite/startup/cmdline/" + iconName - - val dockIconUrl = U.detectClassLoader(getClass).getResource(iconPath) - - assert(dockIconUrl != null, "Unknown icon path: " + iconPath) - - dockIconUrl - } - - try { - val appCls = Class.forName("com.apple.eawt.Application") - val aboutHndCls = Class.forName("com.apple.eawt.AboutHandler") - - val osxApp = appCls.getDeclaredMethod("getApplication").invoke(null) - - val dockIco = new ImageIcon(urlIcon("logo_ignite_128x128.png")) - - appCls.getDeclaredMethod("setDockIconImage", classOf[Image]).invoke(osxApp, dockIco.getImage) - - val bannerIconUrl = urlIcon("logo_ignite_48x48.png") - - val aboutHndProxy = java.lang.reflect.Proxy.newProxyInstance( - appCls.getClassLoader, - Array[Class[_]](aboutHndCls), - new java.lang.reflect.InvocationHandler { - def invoke(proxy: Any, mth: java.lang.reflect.Method, args: Array[Object]) = { - AboutDialog.centerShow("Visor - Ignite Shell Console", bannerIconUrl.toExternalForm, - version(), RELEASE_DATE, copyright()) - - null - } - }) - - appCls.getDeclaredMethod("setAboutHandler", aboutHndCls).invoke(osxApp, aboutHndProxy) - } - catch { - // Specifically ignore it here. - case _: Throwable => - } - } -} - -/** - * Command line Visor entry point. - */ -object VisorConsole extends VisorConsole with App { - addAboutDialog() - - addCommands() - - private val argLst = parse(args.mkString(" ")) - - private val reader = buildReader(argLst) - - visor.reader(reader) - - mainLoop(reader) -} - -/** - * Visor command list completer. - * - * @param commands Commands list. - */ -private[commands] class VisorCommandCompleter(commands: Seq[String]) extends Completer { - import scala.collection.JavaConversions._ - - /** ordered commands. */ - private final val strings = new util.TreeSet[String](commands) - - @impl def complete(buf: String, cursor: Int, candidates: util.List[CharSequence]): Int = { - // buffer could be null - assert(candidates != null) - - if (buf == null) - candidates.addAll(strings) - else - strings.tailSet(buf).takeWhile(_.startsWith(buf)).foreach(candidates.add) - - if (candidates.size == 1) - candidates.set(0, candidates.get(0) + " ") - - if (candidates.isEmpty) -1 else 0 - } -} - -/** - * File path completer for different place of path in command. - */ -private[commands] class VisorFileNameCompleter extends Completer { - protected lazy val getUserHome = Configuration.getUserHome - - protected lazy val separator = File.separator - - @impl def complete(buf: String, cursor: Int, candidates: util.List[CharSequence]): Int = { - assert(candidates != null) - - var ixBegin = 0 - - // extracted path from buffer. - val path = buf match { - case null => "" - case emptyStr if emptyStr.trim == "" => "" - case str => - // replace wrong '/' on windows. - val translated = if (U.isWindows) str.replace('/', '\\') else str - - // line before cursor. - val left = translated.substring(0, cursor) - - // path begin marker. - val quote = if (left.count(_ == '\"') % 2 == 1) "\"" - else if (left.count(_ == '\'') % 2 == 1) "\'" - else "" - - val splitterSz = quote.length + " ".length - - // path begin marker index. - ixBegin = left.lastIndexOf(" " + quote) - ixBegin = if (ixBegin != -1) ixBegin + splitterSz else left.length - 1 - - // path end marker index. - var ixEnd = translated.indexOf(quote + " ", cursor) - ixEnd = if (ixEnd != -1) ixEnd - splitterSz else translated.length - - // extract path. - translated.substring(ixBegin, ixEnd) - } - - // resolve path - val file = resolvePath(path) - - // file dir and part of file name for complete. - val (dir, partOfName) = if (file.isDirectory) (file, "") else (file.getParentFile, file.getName) - - // filter all files in directory by part of file name. - if (dir != null && dir.listFiles != null) { - val files = for (file <- dir.listFiles if file.getName.startsWith(partOfName)) yield file - - if (files.length == 1) { - val candidate = files(0) - - candidates.add(candidate.getName + (if (candidate.isDirectory) separator else " ")) - } - else - files.foreach(f => candidates.add(f.getName)) - } - - if (candidates.size > 0) ixBegin + path.lastIndexOf(separator) + separator.length else -1 - } - - /** - * Gets File representing the path passed in. First the check is made if path is in user home directory. - * If not, then the check is if path is absolute. - * If all checks fail, then related to the current dir File is returned. - * - * @param path - Path to resolve. - * @return Resolved path as File - */ - protected def resolvePath(path: String) = { - val homeDir = getUserHome - - val absFile = new File(path) - - // Special character: ~ maps to the user's home directory - if (path.startsWith("~" + separator)) - new File(homeDir.getPath, path.substring(1)) - else if (path.equals("~")) - homeDir.getParentFile - else if (absFile.exists() || absFile.getParentFile != null) // absolute path - absFile - else - new File(new File("").getAbsolutePath, path) - } -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ack/VisorAckCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ack/VisorAckCommand.scala deleted file mode 100644 index eadf64b23e762..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ack/VisorAckCommand.scala +++ /dev/null @@ -1,143 +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.visor.commands.ack - -import org.apache.ignite.cluster.ClusterGroupEmptyException -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.VisorConsoleCommand -import org.apache.ignite.visor.visor._ -import org.apache.ignite.internal.visor.misc.{VisorAckTask, VisorAckTaskArg} - -import scala.language.implicitConversions - -/** - * ==Overview== - * Visor 'ack' command implementation. - * - * ==Help== - * {{{ - * +-------------------------------------------+ - * | ack | Acks arguments on all remote nodes. | - * +-------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * ack {"s"} - * ack ("s", f) - * }}} - * - * ====Arguments==== - * {{{ - * s - * Optional string to print on each remote node. - * f - * Optional Scala predicate on 'ScalarRichNodePimp' filtering nodes in the topology. - * }}} - * - * ====Examples==== - * {{{ - * ack "Howdy!" - * Prints 'Howdy!' on all nodes in the topology. - * ack("Howdy!", _.id8.startsWith("123")) - * Prints 'Howdy!' on all nodes satisfying this predicate. - * ack - * Prints local node ID on all nodes in the topology. - * }}} - */ -class VisorAckCommand extends VisorConsoleCommand { - @impl protected val name = "ack" - - /** - * ===Command=== - * Acks local node ID on all nodes. Note that this command - * behaves differently from its sibling that takes an argument. - * - * ===Example=== - * ack - * Prints local node IDs on all nodes in the topology. - */ - def ack() { - ack(null) - } - - /** - * ===Command=== - * Acks its argument on all nodes. - * - * ===Example=== - * ack "Howdy!" - * prints 'Howdy!' on all nodes in the topology. - * - * @param msg Optional command argument. If `null` this function is no-op. - */ - def ack(msg: String) { - if (checkConnected()) { - try { - executeMulti(classOf[VisorAckTask], new VisorAckTaskArg(msg)) - } - catch { - case _: ClusterGroupEmptyException => scold("Topology is empty.") - case e: Exception => scold("System error: " + e.getMessage) - } - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorAckCommand { - /** Singleton command. */ - private val cmd = new VisorAckCommand - - // Adds command's help to visor. - addHelp( - name = "ack", - shortInfo = "Acks arguments on all remote nodes.", - spec = Seq( - "ack", - "ack " - ), - args = Seq( - "" -> - "Optional string to print on each remote node." - ), - examples = Seq( - "ack" -> - "Prints local node ID on all nodes in the topology.", - "ack Howdy!" -> - "Prints 'Howdy!' on all nodes in the topology." - ), - emptyArgs = cmd.ack, - withArgs = cmd.ack - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromAck2Visor(vs: VisorTag): VisorAckCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala deleted file mode 100644 index ffa6a949079f2..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala +++ /dev/null @@ -1,938 +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.visor.commands.alert - -import java.io.{File, FileNotFoundException} -import java.util.UUID -import java.util.concurrent.atomic._ - -import org.apache.ignite._ -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.events.EventType._ -import org.apache.ignite.events.{DiscoveryEvent, Event} -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.lang.IgnitePredicate -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.alert.VisorAlertCommand._ -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import scala.collection.immutable.HashMap -import scala.collection.mutable -import scala.language.implicitConversions -import scala.sys.process.{Process, ProcessLogger} -import scala.util.control.Breaks._ - -/** - * ==Overview== - * Visor 'alert' command implementation. - * - * ==Help== - * {{{ - * +---------------------------------------------------------------------+ - * | alert | Generates alerts for user-defined events. | - * | | Node events and grid-wide events are defined via mnemonics. | - * +---------------------------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * alert - * alert "-u {-id=|-a}" - * alert "-r {-t=} {-=} ... {-=}" - * }}} - * - * ====Arguments==== - * {{{ - * -n - * Alert name - * -u - * Unregisters alert(s). Either '-a' flag or '-id' parameter is required. - * Note that only one of the '-u' or '-r' is allowed. - * If neither '-u' or '-r' provided - all alerts will be printed. - * -a - * When provided with '-u' - all alerts will be unregistered. - * -id= - * When provided with '-u' - alert with matching ID will be unregistered. - * -r - * Register new alert with mnemonic predicate(s). - * Note that only one of the '-u' or '-r' is allowed. - * If neither '-u' or '-r' provided - all alerts will be printed. - * -t - * Defines notification frequency in seconds. Default is 60 seconds. - * This parameter can only appear with '-r'. - * -s - * Define script for execution when alert triggered. - * For configuration of throttle period see -i argument. - * Script will receive following arguments: - * 1) Alert name or alert ID when name is not defined. - * 2) Alert condition as string. - * 3, ...) Values of alert conditions ordered as in alert command. - * -i - * Configure alert notification minimal throttling interval in seconds. Default is 0 seconds. - * - * - - * This defines a mnemonic for the metric that will be measured: - * - * Grid-wide metrics (not node specific): - * cc - Total number of available CPUs in the grid. - * nc - Total number of nodes in the grid. - * hc - Total number of physical hosts in the grid. - * cl - Current average CPU load (in %) in the grid. - * - * Per-node current metrics: - * aj - Active jobs on the node. - * cj - Cancelled jobs on the node. - * tc - Thread count on the node. - * ut - Up time on the node. - * Note: can have 's', 'm', or 'h' suffix indicating - * seconds, minutes, and hours. By default (no suffix provided) - * value is assumed to be in milliseconds. - * je - Job execute time on the node. - * jw - Job wait time on the node. - * wj - Waiting jobs count on the node. - * rj - Rejected jobs count on the node. - * hu - Heap memory used (in MB) on the node. - * cd - Current CPU load on the node. - * hm - Heap memory maximum (in MB) on the node. - * ), - * - * Comparison part of the mnemonic predicate: - * eq - Equal '=' to '' number. - * neq - Not equal '!=' to '' number. - * gt - Greater than '>' to '' number. - * gte - Greater than or equal '>=' to '' number. - * lt - Less than '<' to 'NN' number. - * lte - Less than or equal '<=' to '' number. - * }}} - * - * ====Examples==== - * {{{ - * alert - * Prints all currently registered alerts. - * alert "-u -a" - * Unregisters all currently registered alerts. - * alert "-u -id=12345678" - * Unregisters alert with provided ID. - * alert "-r -t=900 -cc=gte4 -cl=gt50" - * Notify every 15 min if grid has >= 4 CPUs and > 50% CPU load. - * alert "-r -n=Nodes -t=15 -nc=gte3 -s=/home/user/scripts/alert.sh -i=300" - * Notify every 15 second if grid has >= 3 nodes and execute script "/home/user/scripts/alert.sh" with - * repeat interval not less than 5 min. - * }}} - */ -class VisorAlertCommand extends VisorConsoleCommand { - @impl protected val name = "alert" - - /** Alerts. */ - private var alerts = new HashMap[String, VisorAlert] - - /** Map of last sent notification per alert ID. */ - private var sent = new HashMap[String, Long] - - /** Map of alert statistics. */ - private var stats = new HashMap[String, VisorStats] - - /** Last 10 sent alerts. */ - private var last10 = List.empty[VisorSentAlert] - - /** Subscribe guard. */ - private val guard = new AtomicBoolean(false) - - /** Node metric update listener. */ - private var lsnr: IgnitePredicate[Event] = _ - - /** - * ===Command=== - * Lists all registered alerts. - * - * ===Examples=== - * alert - * Prints all currently registered alerts. - */ - def alert() { - alert("") - } - - /** - * ===Command=== - * Registers, unregisters and list alerts. - * - * ===Examples=== - * alert "-u -a" - * Unregisters all currently registered alerts. - * - * alert "-i" - * Starts command in interactive mode. - * - * alert "-u -id=12345678" - * Unregisters alert with provided ID. - * - * alert "-r -t=900 -cc=gte4 -cl=gt50" - * Notify every 15 min if grid has >= 4 CPUs and > 50% CPU load. - * - * @param args Command arguments. - */ - def alert(args: String) { - assert(args != null) - - val argLst = parseArgs(args) - - if (hasArgFlag("u", argLst)) - unregisterAlert(argLst) - else if (hasArgFlag("r", argLst)) - registerAlert(argLst) - else if (args.length() > 0) - scold("Invalid arguments: " + args) - else - printAlerts() - } - - /** - * Create function to check specific node condition. - * - * @param exprStr Expression string. - * @param value Value generator. - */ - private def makeNodeFilter(exprStr: String, value: (ClusterNode) => Long): Option[(ClusterNode) => (Long, Boolean)] = { - assert(exprStr != null) - assert(value != null) - - val expr = makeExpression(exprStr) - - // Note that if 'f(n)' is false - 'value' won't be evaluated. - expr match { - case Some(f) => Some((n: ClusterNode) => { - val v = value(n) - - (v, f.apply(v)) - }) - - case _ => throw new IgniteException("Invalid expression: " + exprStr) - } - } - - /** - * Create function to check specific grid condition. - * - * @param exprStr Expression string. - * @param value Value generator. - */ - private def makeGridFilter(exprStr: String, value: () => Long): Option[() => (Long, Boolean)] = { - assert(exprStr != null) - assert(value != null) - - val expr = makeExpression(exprStr) - - // Note that if 'f' is false - 'value' won't be evaluated. - expr match { - case Some(f) => - Some(() => { - val v = value() - - (v, f.apply(v)) - }) - case _ => - throw new IgniteException("Invalid expression: " + exprStr) - } - } - - /** - * @param args Parsed argument list. - */ - private def registerAlert(args: ArgList) { - breakable { - assert(args != null) - - if (checkConnected()) { - var name: Option[String] = None - var script: Option[String] = None - val conditions = mutable.ArrayBuffer.empty[VisorAlertCondition] - var freq = DFLT_FREQ - var interval = 0L - - try { - args.foreach(arg => { - val (n, v) = arg - - n match { - case c if ALERT_DESCRIPTORS.contains(c) && v != null => - val meta = ALERT_DESCRIPTORS(c) - - if (meta.byGrid) - conditions += VisorAlertCondition(arg, gridFunc = makeGridFilter(v, meta.gridFunc)) - else - conditions += VisorAlertCondition(arg, nodeFunc = makeNodeFilter(v, meta.nodeFunc)) - - // Other tags. - case "n" if v != null => name = Some(v) - case "t" if v != null => freq = v.toLong - case "s" if v != null => script = Option(v) - case "i" if v != null => interval = v.toLong - case "r" => () // Skipping. - case _ => throw new IgniteException("Invalid argument: " + makeArg(arg)) - } - }) - } - catch { - case e: NumberFormatException => - scold("Number conversion error: " + e.getMessage) - - break() - - case e: Exception => - scold(e) - - break() - } - - if (conditions.isEmpty) { - scold("No predicates have been provided in args: " + makeArgs(args)) - - break() - } - - val alert = VisorAlert( - id = id8, - name = name, - conditions = conditions, - perGrid = conditions.exists(_.gridFunc.isDefined), - perNode = conditions.exists(_.nodeFunc.isDefined), - spec = makeArgs(args.filter((arg) => arg._1 != "r")), - conditionSpec = makeArgs(conditions.map(_.arg)), - freq = freq, - createdOn = System.currentTimeMillis(), - varName = setVar(id8, "a"), - notification = VisorAlertNotification(script, interval * 1000) - ) - - // Subscribe for node metric updates - if needed. - registerListener() - - alerts = alerts + (alert.id -> alert) - stats = stats + (alert.id -> VisorStats()) - - // Set visor var pointing to created alert. - mset(alert.varName, alert.id) - - println("Alert '" + alert.id + "' (" + alert.varName + ") registered.") - } - } - } - - /** - * Registers node metrics update listener, if one wasn't registered already. - */ - private def registerListener() { - if (guard.compareAndSet(false, true)) { - assert(lsnr == null) - - lsnr = new IgnitePredicate[Event] { - override def apply(evt: Event): Boolean = { - val discoEvt = evt.asInstanceOf[DiscoveryEvent] - - val node = ignite.cluster.node(discoEvt.eventNode().id()) - - if (node != null && !node.isDaemon) - alerts foreach (t => { - val (id, alert) = t - - var check = (true, true) - var printNid = false - - val values = mutable.ArrayBuffer.empty[String] - var valuesView = mutable.ArrayBuffer.empty[String] - - try - check = alert.conditions.foldLeft(check) { - (res, cond) => { - val gridRes = cond.gridFunc.forall(f => { - val (value, check) = f() - - values += value.toString - valuesView += cond.arg._1 + "=" + value.toString - - check - }) - - val nodeRes = cond.nodeFunc.forall(f => { - val (value, check) = f(node) - - values += value.toString - valuesView += cond.arg._1 + "=" + value.toString - - printNid = true - - check - }) - - (res._1 && gridRes) -> (res._2 && nodeRes) - } - } - catch { - // In case of exception (like an empty projection) - simply return. - case _: Throwable => return true - } - - if (check._1 && check._2) { - val now = System.currentTimeMillis() - - var go: Boolean = false - - go = (now - sent.getOrElse(id, 0L)) / 1000 >= alert.freq - - if (go) { - sent = sent + (id -> now) - - val stat: VisorStats = stats(id) - - assert(stat != null) - - // Update stats. - if (stat.firstSnd == 0) - stat.firstSnd = now - - stat.cnt += 1 - stat.lastSnd = now - - stats = stats + (id -> stat) - - val nodeIdIp = nodeId8Addr(node.id()).split(", ") - - // Write to Visor log if it is started (see 'log' command). - logText( - "Alert [" + - "id=" + alert.id + "(@" + alert.varName + "), " + - (if (printNid) - "nid8=" + nodeIdIp(0) + ", ip=" + nodeIdIp.lift(1).getOrElse(NA) + ", " - else "") + - "spec=[" + alert.spec + "], " + - "values=[" + valuesView.mkString("; ") + "], " + - "created on=" + formatDateTime(alert.createdOn) + - "]" - ) - - executeAlertScript(alert, node, values) - - last10 = VisorSentAlert( - id = alert.id, - name = alert.name.getOrElse("(Not set)"), - spec = alert.spec, - createdOn = alert.createdOn, - sentTs = now - ) +: last10 - - if (last10.size > 10) - last10 = last10.take(10) - } - } - else - alert.notification.notified = false - }) - - true - } - } - - ignite.events().localListen(lsnr, EVT_NODE_METRICS_UPDATED) - } - } - - /** - * Unregisters previously registered node metric update listener. - */ - private def unregisterListener() { - if (guard.compareAndSet(true, false)) { - assert(lsnr != null) - - assert(ignite.events().stopLocalListen(lsnr)) - - lsnr = null - } - } - - /** - * Resets command. - */ - private def reset() { - unregisterAll() - unregisterListener() - } - - /** - * Prints advise. - */ - private def advise() { - println("\nType 'help alert' to see how to manage alerts.") - } - - /** - * Unregisters all alerts. - */ - private def unregisterAll() { - mclear("-al") - - alerts = new HashMap[String, VisorAlert] - } - - /** - * - * @param args Parsed argument list. - */ - private def unregisterAlert(args: ArgList) { - breakable { - assert(args != null) - - if (alerts.isEmpty) { - scold("No alerts have been registered yet.") - - break() - } - - // Unregister all alerts. - if (hasArgFlag("a", args)) { - unregisterAll() - - println("All alerts have been unregistered.") - } - // Unregister specific alert. - else if (hasArgName("id", args)) { - val idOpt = argValue("id", args) - - if (idOpt.isDefined) { - val id = idOpt.get - - val a = alerts.get(id) - - if (a.isDefined) { - alerts -= id - - // Clear variable host. - mclear(a.get.varName) - - println("Alert '" + id + "' unregistered.") - } - else { - scold("Failed to find alert with ID: " + id) - - break() - } - } - else { - scold("No value for '-id' parameter found.") - - break() - } - } - else { - scold("Failed to unregister alert.", "Either \"-a\" or \"-id\" parameter is required.") - - break() - } - - if (alerts.isEmpty) - unregisterListener() - } - } - - /** - * Prints out all alerts. - */ - private def printAlerts() { - if (alerts.isEmpty) - println("No alerts are registered.") - else { - println("Summary:") - - val sum = new VisorTextTable() - - val firstSnd = (-1L /: stats.values)((b, a) => if (b == -1) a.firstSnd else math.min(b, a.firstSnd)) - val lastSnd = (0L /: stats.values)((b, a) => math.max(b, a.lastSnd)) - - sum += ("Total alerts", alerts.size) - sum += ("Total sends", (0 /: stats.values)((b, a) => b + a.cnt)) - sum += ("First send", if (firstSnd == 0) NA else formatDateTime(firstSnd)) - sum += ("Last send", if (lastSnd == 0) NA else formatDateTime(lastSnd)) - - sum.render() - } - - if (last10.isEmpty) - println("\nNo alerts have been sent.") - else { - val last10T = VisorTextTable() - - last10T #= ("ID(@)/Name", "Spec", "Sent", "Registered", "Count") - - last10.foreach((a: VisorSentAlert) => last10T += ( - a.idVar + "/" + a.name, - a.spec, - formatDateTime(a.sentTs), - formatDateTime(a.createdOn), - stats(a.id).cnt - )) - - println("\nLast 10 Triggered Alerts:") - - last10T.render() - } - - if (alerts.nonEmpty) { - val tbl = new VisorTextTable() - - tbl #= ("ID(@)/Name", "Spec", "Count", "Registered", "First Send", "Last Send") - - val sorted = alerts.values.toSeq.sortWith(_.varName < _.varName) - - sorted foreach (a => { - val stat = stats(a.id) - - tbl += ( - a.id + "(@" + a.varName + ')' + "/" + a.name.getOrElse("Not set"), - a.spec, - stat.cnt, - formatDateTime(a.createdOn), - if (stat.firstSnd == 0) NA else formatDateTime(stat.firstSnd), - if (stat.lastSnd == 0) NA else formatDateTime(stat.lastSnd) - ) - }) - - println("\nAlerts: " + sorted.size) - - tbl.render() - - // Print advise. - advise() - } - } - - /** - * Gets unique ID8 id for the alert. - * - * @return 8-character locally unique alert ID. - */ - private def id8: String = { - while (true) { - val id = UUID.randomUUID().toString.substring(0, 8) - - // Have to check for guaranteed uniqueness. - if (!alerts.contains(id)) - return id - } - - assert(false, "Should never happen.") - - "" - } - - /** - * Try to execute specified script on alert. - * - * @param alert Alarmed alert. - * @param node Node where alert is alarmed. - * @param values Values ith that alert is generated. - */ - private def executeAlertScript(alert: VisorAlert, node: ClusterNode, values: Seq[String]) { - val n = alert.notification - - if (n.notified && System.currentTimeMillis() - n.notifiedTime < n.throttleInterval) - return - - try { - n.script.foreach(script => { - val scriptFile = new File(script) - - if (!scriptFile.exists()) - throw new FileNotFoundException("Script/executable not found: " + script) - - val scriptFolder = scriptFile.getParentFile - - val p = Process(Seq(script, alert.name.getOrElse(alert.id), alert.conditionSpec) ++ values, - Some(scriptFolder)) - - p.run(ProcessLogger((fn: String) => {})) - - n.notifiedTime = System.currentTimeMillis() - - n.notified = true - }) - } - catch { - case e: Throwable => logText("Script execution failed [" + - "id=" + alert.id + "(@" + alert.varName + "), " + - "error=" + e.getMessage + ", " + - "]") - } - } -} - -/** - * Visor alert. - * - * @param id Alert id. - * @param name Alert name. - * @param conditions List of alert condition metadata. - * @param perGrid Condition per grid exists. - * @param perNode Condition per node exists. - * @param freq Freq of alert check. - * @param spec Alert command specification. - * @param conditionSpec Alert condition command specification. - * @param varName Alert id short name. - * @param createdOn Timestamp of alert creation. - * @param notification Alert notification information. - */ -private case class VisorAlert( - id: String, - name: Option[String], - conditions: Seq[VisorAlertCondition], - perGrid: Boolean, - perNode: Boolean, - freq: Long, - spec: String, - conditionSpec: String, - varName: String, - createdOn: Long, - notification: VisorAlertNotification -) { - assert(id != null) - assert(spec != null) - assert(varName != null) -} - -/** - * Visor alert notification information. - * - * @param script Script to execute on alert firing. - * @param throttleInterval Minimal interval between script execution. - * @param notified `True` when on previous check of condition alert was fired or `false` otherwise. - * @param notifiedTime Time of first alert notification in series of firings. - */ -private case class VisorAlertNotification( - script: Option[String], - throttleInterval: Long, - var notified: Boolean = false, - var notifiedTime: Long = -1L -) { - assert(script != null) -} - -/** - * Visor alert condition information. - * - * @param arg Configuration argument. - * @param gridFunc Function to check grid condition. - * @param nodeFunc Function to check node condition. - */ -private case class VisorAlertCondition( - arg: (String, String), - gridFunc: Option[() => (Long, Boolean)] = None, - nodeFunc: Option[(ClusterNode) => (Long, Boolean)] = None -) - -/** - * Snapshot of the sent alert. - */ -private case class VisorSentAlert( - id: String, - name: String, - sentTs: Long, - createdOn: Long, - spec: String -) { - assert(id != null) - assert(spec != null) - - def idVar: String = { - val v = mfindHead(id) - - if (v.isDefined) id + "(@" + v.get._1 + ")" else id - } -} - -/** - * Statistics holder for visor alert. - */ -private case class VisorStats( - var cnt: Int = 0, - var firstSnd: Long = 0, - var lastSnd: Long = 0 -) - -/** - * Metadata object for visor alert. - * - * @param byGrid If `true` then `gridFunc` should be used. - * @param gridFunc Function to extract value to check in case of alert for grid metrics. - * @param nodeFunc Function to extract value to check in case of alert for node metrics - */ -private case class VisorAlertMeta( - byGrid: Boolean, - gridFunc: () => Long, - nodeFunc: (ClusterNode) => Long -) - -/** - * Companion object that does initialization of the command. - */ -object VisorAlertCommand { - /** Default alert frequency. */ - val DFLT_FREQ = 60L - - private val dfltNodeValF = (_: ClusterNode) => 0L - private val dfltGridValF = () => 0L - - private def cl(): IgniteCluster = ignite.cluster() - - private[this] val BY_GRID = true - private[this] val BY_NODE = false - - private val ALERT_DESCRIPTORS = Map( - "cc" -> VisorAlertMeta(BY_GRID, () => cl().metrics().getTotalCpus, dfltNodeValF), - "nc" -> VisorAlertMeta(BY_GRID, () => cl().nodes().size, dfltNodeValF), - "hc" -> VisorAlertMeta(BY_GRID, () => U.neighborhood(cl().nodes()).size, dfltNodeValF), - "cl" -> VisorAlertMeta(BY_GRID, () => (cl().metrics().getAverageCpuLoad * 100).toLong, dfltNodeValF), - "aj" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentActiveJobs), - "cj" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentCancelledJobs), - "tc" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentThreadCount), - "ut" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getUpTime), - "je" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentJobExecuteTime), - "jw" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentJobWaitTime), - "wj" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentWaitingJobs), - "rj" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getCurrentRejectedJobs), - "hu" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getHeapMemoryUsed), - "cd" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => node.metrics().getHeapMemoryMaximum), - "hm" -> VisorAlertMeta(BY_NODE, dfltGridValF, (node) => (node.metrics().getCurrentCpuLoad * 100).toLong)) - - /** Singleton command. */ - private val cmd = new VisorAlertCommand - - addHelp( - name = "alert", - shortInfo = "Alerts for user-defined events.", - longInfo = Seq( - "Generates alerts for user-defined events.", - "Node events and grid-wide events are defined via mnemonics." - ), - spec = Seq( - "alert", - "alert -u {-id=|-a}", - "alert -r {-t=} {-=} ... {-=}" - ), - args = Seq( - "-n" -> - "Alert name", - "-u" -> Seq( - "Unregisters alert(s). Either '-a' flag or '-id' parameter is required.", - "Note that only one of the '-u' or '-r' is allowed.", - "If neither '-u' or '-r' provided - all alerts will be printed." - ), - "-a" -> - "When provided with '-u' - all alerts will be unregistered.", - ("-id=", - "When provided with '-u' - alert with matching ID will be unregistered" + - "Note you can also use '@a0' ... '@an' variables as shortcut to ."), - "-r" -> Seq( - "Register new alert with mnemonic predicate(s).", - "Note that only one of the '-u' or '-r' is allowed.", - "If neither '-u' or '-r' provided - all alerts will be printed." - ), - "-t" -> Seq( - "Defines notification frequency in seconds. Default is 60 seconds.", - "This parameter can only appear with '-r'." - ), - "-s" -> Seq( - "Define script for execution when alert triggered.", - "For configuration of throttle period see -i argument.", - "Script will receive following arguments:", - " 1) Alert name or alert ID when name is not defined.", - " 2) Alert condition as string.", - " 3, ...) Values of alert conditions ordered as in alert command." - ), - "-i" -> "Configure alert notification minimal throttling interval in seconds. Default is 0 seconds.", - "-" -> Seq( - "This defines a mnemonic for the metric that will be measured:", - "", - "Grid-wide metrics (not node specific):", - " cc - Total number of available CPUs in the grid.", - " nc - Total number of nodes in the grid.", - " hc - Total number of physical hosts in the grid.", - " cl - Current average CPU load (in %) in the grid.", - "", - "Per-node current metrics:", - " aj - Active jobs on the node.", - " cj - Cancelled jobs on the node.", - " tc - Thread count on the node.", - " ut - Up time on the node.", - " Note: can have 's', 'm', or 'h' suffix indicating", - " seconds, minutes, and hours. By default (no suffix provided)", - " value is assumed to be in milliseconds.", - " je - Job execute time on the node.", - " jw - Job wait time on the node.", - " wj - Waiting jobs count on the node.", - " rj - Rejected jobs count on the node.", - " hu - Heap memory used (in MB) on the node.", - " cd - Current CPU load on the node.", - " hm - Heap memory maximum (in MB) on the node." - ), - "" -> Seq( - "Comparison part of the mnemonic predicate:", - " eq - Equal '=' to '' number.", - " neq - Not equal '!=' to '' number.", - " gt - Greater than '>' to '' number.", - " gte - Greater than or equal '>=' to '' number.", - " lt - Less than '<' to 'NN' number.", - " lte - Less than or equal '<=' to '' number." - ) - ), - examples = Seq( - "alert" -> - "Prints all currently registered alerts.", - "alert -u -a" -> - "Unregisters all currently registered alerts.", - "alert -u -id=12345678" -> - "Unregisters alert with provided ID.", - "alert -u -id=@a0" -> - "Unregisters alert with provided ID taken from '@a0' memory variable.", - "alert -r -t=900 -cc=gte4 -cl=gt50" -> - "Notify every 15 min if grid has >= 4 CPUs and > 50% CPU load.", - "alert \"-r -n=Nodes -t=15 -nc=gte3 -s=/home/user/scripts/alert.sh -i=300" -> - ("Notify every 15 second if grid has >= 3 nodes and execute script \"/home/user/scripts/alert.sh\" with " + - "repeat interval not less than 5 min.") - ), - - emptyArgs = cmd.alert, - withArgs = cmd.alert - ) - - addCloseCallback(() => { - cmd.reset() - }) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromAlert2Visor(vs: VisorTag): VisorAlertCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala deleted file mode 100644 index 96d0a86e10656..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala +++ /dev/null @@ -1,131 +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.visor.commands.cache - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.visor.commands.common.VisorTextTable -import org.apache.ignite.visor.visor._ -import org.apache.ignite.internal.visor.cache.{VisorCacheClearTask, VisorCacheClearTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ - -import scala.language.reflectiveCalls - -/** - * ==Overview== - * Visor 'clear' command implementation. - * - * ==Help== - * {{{ - * +------------------------------------------------------------+ - * | cache -clear | Clears all entries from cache on all nodes. | - * +------------------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * cache -clear - * cache -clear -c= - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * If not specified, default cache will be cleared. - * }}} - * - * ====Examples==== - * {{{ - * cache -clear - * Clears interactively selected cache. - * cache -clear -c=cache - * Clears cache with name 'cache'. - * }}} - */ -class VisorCacheClearCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - /** - * ===Command=== - * Clears cache by its name. - * - * ===Examples=== - * cache -clear -c=cache - * Clears cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def clear(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables.") - - return - - case Some(name) => name - } - - try { - val nid = groupForDataNode(node, cacheName).forRandom().node().id() - - val t = VisorTextTable() - - t #= ("Node ID8(@)", "Cache Size Before", "Cache Size After") - - val res = executeOne(nid, classOf[VisorCacheClearTask], new VisorCacheClearTaskArg(cacheName)) - - t += (nodeId8(nid), res.getSizeBefore, res.getSizeAfter) - - println("Cleared cache with name: " + escapeName(cacheName)) - - t.render() - } - catch { - case e: ClusterGroupEmptyException => scold(messageNodeNotFound(node, cacheName)) - case e: Throwable => scold(e) - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheClearCommand { - /** Singleton command. */ - private val cmd = new VisorCacheClearCommand - - /** - * Singleton. - */ - def apply() = cmd -} 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 deleted file mode 100755 index 5853610448c17..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala +++ /dev/null @@ -1,1032 +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.visor.commands.cache - -import java.util.{Collections, UUID, Collection => JavaCollection, List => JavaList} - -import org.apache.ignite._ -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.internal.util.lang.{GridFunc => F} -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.typedef.X -import org.apache.ignite.internal.visor.cache._ -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.cache.VisorCacheCommand._ -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ -import org.jetbrains.annotations._ - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} - -/** - * ==Overview== - * Visor 'cache' command implementation. - * - * ==Help== - * {{{ - * +--------------------------------------------------------------------------------------------+ - * | cache | Prints statistics about caches from specified node on the entire grid. | - * | | Output sorting can be specified in arguments. | - * | | | - * | | Output abbreviations: | - * | | # Number of nodes. | - * | | H/h Number of cache hits. | - * | | M/m Number of cache misses. | - * | | R/r Number of cache reads. | - * | | W/w Number of cache writes. | - * +--------------------------------------------------------------------------------------------+ - * | cache -clear | Clears all entries from cache on all nodes. | - * +--------------------------------------------------------------------------------------------+ - * | cache -scan | List all entries in cache with specified name. | - * +--------------------------------------------------------------------------------------------+ - * | cache -stop | Stop cache with specified name. | - * +--------------------------------------------------------------------------------------------+ - * | cache -reset | Reset metrics for cache with specified name. | - * +--------------------------------------------------------------------------------------------+ - * | cache -rebalance | Re-balance partitions for cache with specified name. | - * +--------------------------------------------------------------------------------------------+ - * | cache -slp | Show list of lost partitions for specified cache. | - * +--------------------------------------------------------------------------------------------+ - * | cache -rlp | Reset lost partitions for specified cache. | - * +--------------------------------------------------------------------------------------------+ - * | cache -statistics | Switch collection of statistics for specified cache. | - * +--------------------------------------------------------------------------------------------+ - * - * }}} - * - * ====Specification==== - * {{{ - * cache {-system} - * cache -i {-system} - * cache {-c=} {-id=|id8=} {-s=hi|mi|rd|wr|cn} {-a} {-r} {-system} - * cache -clear {-c=} - * cache -scan -c= {-near} {-id=|id8=} {-p=} {-system} - * cache -stop -c= - * cache -reset -c= - * cache -rebalance -c= - * cache -slp -c= - * cache -rlp -c= - * cache -statistics= -c= - * }}} - * - * ====Arguments==== - * {{{ - * -id8= - * ID8 of the node to get cache statistics from. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * If neither is specified statistics will be gathered from all nodes. - * -id= - * Full ID of the node to get cache statistics from. - * Either '-id8' or '-id' can be specified. - * If neither is specified statistics will be gathered from all nodes. - * -c= - * Name of the cache. - * -s=hi|mi|rd|wr|cn - * Defines sorting type. Sorted by: - * hi Hits. - * mi Misses. - * rd Reads. - * wr Writes. - * cn Cache name. - * If not specified - default sorting is 'cn'. - * -i - * Interactive mode. - * User can interactively select node for cache statistics. - * -r - * Defines if sorting should be reversed. - * Can be specified only with '-s' argument. - * -a - * Prints details statistics about each cache. - * By default only aggregated summary is printed. - * -system - * Enable showing of information about system caches. - * -clear - * Clears cache. - * -scan - * Prints list of all entries from cache. - * -near - * Prints list of all entries from near cache of cache. - * -stop - * Stop cache with specified name. - * -reset - * Reset metrics for cache with specified name. - * -rebalance - * Re-balance partitions for cache with specified name. - * -slp - * Show list of lost partitions for specified cache. - * -rlp - * Reset lost partitions for specified cache. - * -statistics=<-on|-off> - * Switch collection of statistics for specified cache. - * -p= - * Number of object to fetch from cache at once. - * Valid range from 1 to 100. - * By default page size is 25. - * }}} - * - * ====Examples==== - * {{{ - * cache - * Prints summary statistics about all no system caches. - * cache -system - * Prints summary statistics about all caches. - * cache -id8=12345678 -s=hi -r - * Prints summary statistics about caches from node with specified id8 - * sorted by number of hits in reverse order. - * cache -i - * Prints cache statistics for interactively selected node. - * cache -s=hi -r -a - * Prints detailed statistics about all caches sorted by number of hits in reverse order. - * cache -clear - * Clears interactively selected cache. - * cache -clear -c=cache - * Clears cache with name 'cache'. - * cache -scan - * Prints list entries from interactively selected cache. - * cache -scan -c=cache - * Prints list entries from cache with name 'cache' from all nodes with this cache. - * cache -scan -c=@c0 -p=50 - * Prints list entries from cache with name taken from 'c0' memory variable - * with page of 50 items from all nodes with this cache. - * cache -scan -c=cache -id8=12345678 - * Prints list entries from cache with name 'cache' and node '12345678' ID8. - * cache -scan -c=cache -near -id8=12345678 - * Prints list entries from near cache of cache with name 'cache' and node '12345678' ID8. - * cache -stop -c=cache - * Stops cache with name 'cache'. - * cache -reset -c=cache - * Reset metrics for cache with name 'cache'. - * cache -rebalance -c=cache - * Re-balance partitions for cache with name 'cache'. - * cache -slp -c=cache - * Show list of lost partitions for cache with name 'cache'. - * cache -rlp -c=cache - * Reset lost partitions for cache with name 'cache'. - * cache -statistics=on -c=cache - * Enable statistics for cache with name 'cache'. - * cache -statistics=off -c=cache - * Disable statistics for cache with name 'cache'. - * - * }}} - */ -class VisorCacheCommand extends VisorConsoleCommand { - @impl protected val name: String = "cache" - - /** - * ===Command=== - * Prints statistics about caches from nodes that pass mnemonic predicate. - * Sorting can be specified in arguments. - * - * ===Examples=== - * cache -id8=12345678 -s=no -r - * Prints statistics about caches from node with specified id8 sorted by number of nodes in reverse order. - *
- * cache -s=no -r - * Prints statistics about all caches sorted by number of nodes in reverse order. - *
- * cache -clear - * Clears interactively selected cache. - *
- * cache -clear -c=cache - * Clears cache with name 'cache'. - *
- * cache -scan - * Prints list entries from interactively selected cache. - *
- * cache -scan -c=cache - * Prints list entries from cache with name 'cache' from all nodes with this cache. - *
- * cache -scan -c=@c0 -p=50 - * Prints list entries from cache with name taken from 'c0' memory variable with page of 50 items - * from all nodes with this cache. - *
- * cache -scan -c=cache -id8=12345678 - * Prints list entries from cache with name 'cache' and node '12345678' ID8. - *
- * cache -scan -c=cache -near -id8=12345678 - * Prints list entries from near cache of cache with name 'cache' and node '12345678' ID8. - *
- * cache -stop -c=@c0 - * Stop cache with name taken from 'c0' memory variable. - *
- * cache -reset -c=@c0 - * Reset metrics for cache with name taken from 'c0' memory variable. - * - * @param args Command arguments. - */ - def cache(args: String) { - if (checkConnected() && checkActiveState()) { - var argLst = parseArgs(args) - - if (hasArgFlag("i", argLst)) { - askForNode("Select node from:") match { - case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match { - case "n" | "N" => nl(); cache("-id=" + nid); return; - case "y" | "Y" => nl(); cache("-a -id=" + nid); return; - case x => nl(); warn("Invalid answer: " + x); return; - } - case None => return - } - - return - } - - val node = parseNode(argLst) match { - case Left(msg) => - scold(msg) - - return - - case Right(n) => n match { - case None if hasArgName("scan", argLst) && hasArgName("near", argLst) => - askForNode("Select node from:") match { - case None => return - - case nidOpt => nidOpt.map(ignite.cluster.node(_)) - } - - case _ => n - } - } - - val showSystem = hasArgFlag("system", argLst) - - var cacheName = argValue("c", argLst) match { - case Some(dfltName) if dfltName == DFLT_CACHE_KEY || dfltName == DFLT_CACHE_NAME => - argLst = argLst.filter(_._1 != "c") ++ Seq("c" -> null) - - Some(null) - - case cn => cn - } - - /** Check that argument list has flag from list. */ - def hasArgFlagIn(flags: String *) = { - flags.exists(hasArgFlag(_, argLst)) - } - - // Get cache stats data from all nodes. - val aggrData = cacheData(node, cacheName, showSystem) - - if (hasArgFlagIn("clear", "scan", "stop", "reset", "rebalance", "slp", "rlp") - || hasArgName("statistics", argLst)) { - if (cacheName.isEmpty) - askForCache("Select cache from:", node, showSystem - && !hasArgFlagIn("clear", "stop", "reset", "rebalance"), aggrData) match { - case Some(name) => - argLst = argLst ++ Seq("c" -> name) - - cacheName = Some(name) - - case None => return - } - - cacheName.foreach(name => { - aggrData.find(cache => F.eq(cache.getName, name)) match { - case Some(cache) => - if (!cache.isSystem) { - if (hasArgFlag("scan", argLst)) - VisorCacheScanCommand().scan(argLst, node) - else if (hasArgFlag("clear", argLst)) - VisorCacheClearCommand().clear(argLst, node) - else if (hasArgFlag("stop", argLst)) - VisorCacheStopCommand().stop(argLst, node) - else if (hasArgFlag("reset", argLst)) - VisorCacheResetCommand().reset(argLst, node) - else if (hasArgFlag("rebalance", argLst)) - VisorCacheRebalanceCommand().rebalance(argLst, node) - else if (hasArgFlag("slp", argLst)) - VisorCacheLostPartitionsCommand().showLostPartitions(argLst, node) - else if (hasArgFlag("rlp", argLst)) - VisorCacheResetLostPartitionsCommand().resetLostPartitions(argLst, node) - else if (hasArgName("statistics", argLst)) - VisorCacheToggleStatisticsCommand().toggle(argLst, node) - } - else { - if (hasArgFlag("scan", argLst)) - warn("Scan of system cache is not allowed: " + name) - else if (hasArgFlag("clear", argLst)) - warn("Clearing of system cache is not allowed: " + name) - else if (hasArgFlag("stop", argLst)) - warn("Stopping of system cache is not allowed: " + name) - else if (hasArgFlag("reset", argLst)) - warn("Reset metrics of system cache is not allowed: " + name) - else if (hasArgFlag("rebalance", argLst)) - warn("Re-balance partitions of system cache is not allowed: " + name) - else if (hasArgName("statistics", argLst)) - warn("Toggle of statistics collection for system cache is not allowed: " + name) - } - case None => - warn("Cache with specified name not found: " + name) - } - }) - - return - } - - val all = hasArgFlag("a", argLst) - - val sortType = argValue("s", argLst) - val reversed = hasArgName("r", argLst) - - if (sortType.isDefined && !isValidSortType(sortType.get)) { - scold("Invalid '-s' argument in: " + args) - - return - } - - if (aggrData.isEmpty) { - scold("No caches found.") - - return - } - - node match { - case Some(n) => - println("ID8=" + nid8(n) + ", time of the snapshot: " + formatDateTime(System.currentTimeMillis)) - case None => - println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis)) - } - - val sumT = VisorTextTable() - - sumT #= ("Name(@)", "Mode", "Nodes", "Total entries (Heap / Off-heap)", "Primary entries (Heap / Off-heap)", "Hits", "Misses", "Reads", "Writes") - - sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach( - ad => { - // Add cache host as visor variable. - registerCacheName(ad.getName) - - sumT += ( - mkCacheName(ad.getName), - ad.getMode, - ad.getNodes.size(), - (ad.getTotalHeapSize + ad.getTotalOffHeapSize) + " (" + ad.getTotalHeapSize + " / " + ad.getTotalOffHeapSize + ")", - ( - "min: " + (ad.getMinimumHeapSize + ad.getMinimumOffHeapPrimarySize) + - " (" + ad.getMinimumHeapSize + " / " + ad.getMinimumOffHeapPrimarySize + ")", - "avg: " + formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapPrimarySize) + - " (" + formatDouble(ad.getAverageHeapSize) + " / " + formatDouble(ad.getAverageOffHeapPrimarySize) + ")", - "max: " + (ad.getMaximumHeapSize + ad.getMaximumOffHeapPrimarySize) + - " (" + ad.getMaximumHeapSize + " / " + ad.getMaximumOffHeapPrimarySize + ")" - ), - ( - "min: " + ad.getMinimumHits, - "avg: " + formatDouble(ad.getAverageHits), - "max: " + ad.getMaximumHits - ), - ( - "min: " + ad.getMinimumMisses, - "avg: " + formatDouble(ad.getAverageMisses), - "max: " + ad.getMaximumMisses - ), - ( - "min: " + ad.getMinimumReads, - "avg: " + formatDouble(ad.getAverageReads), - "max: " + ad.getMaximumReads - ), - ( - "min: " + ad.getMinimumWrites, - "avg: " + formatDouble(ad.getAverageWrites), - "max: " + ad.getMaximumWrites - ) - ) - } - ) - - sumT.render() - - if (all) { - val sorted = aggrData.sortWith((k1, k2) => { - if (k1.getName == null) - true - else if (k2.getName == null) - false - else k1.getName.compareTo(k2.getName) < 0 - }) - - val gCfg = node.map(config).collect { - case cfg if cfg != null => cfg - } - - sorted.foreach(ad => { - val cacheNameVar = mkCacheName(ad.getName) - - println("\nCache '" + cacheNameVar + "':") - - val m = ad.getMetrics - - val csT = VisorTextTable() - - csT += ("Name(@)", cacheNameVar) - csT += ("Total entries (Heap / Off-heap)", (ad.getTotalHeapSize + ad.getTotalOffHeapSize) + - " (" + ad.getTotalHeapSize + " / " + ad.getTotalOffHeapSize + ")") - csT += ("Nodes", m.size()) - csT += ("Total size Min/Avg/Max", (ad.getMinimumHeapSize + ad.getMinimumOffHeapPrimarySize) + " / " + - formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapPrimarySize) + " / " + - (ad.getMaximumHeapSize + ad.getMaximumOffHeapPrimarySize)) - csT += (" Heap size Min/Avg/Max", ad.getMinimumHeapSize + " / " + - formatDouble(ad.getAverageHeapSize) + " / " + ad.getMaximumHeapSize) - csT += (" Off-heap size Min/Avg/Max", ad.getMinimumOffHeapPrimarySize + " / " + - formatDouble(ad.getAverageOffHeapPrimarySize) + " / " + ad.getMaximumOffHeapPrimarySize) - - val ciT = VisorTextTable() - - ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU Load", "Up Time", "Size (Primary / Backup)", "Hi/Mi/Rd/Wr") - - sortData(m.toMap, sortType.getOrElse("hi"), reversed).foreach { case (nid, cm) => - val nm = ignite.cluster.node(nid).metrics() - - ciT += ( - nodeId8Addr(nid), - nm.getTotalCpus, - formatDouble(100d * nm.getHeapMemoryUsed / nm.getHeapMemoryMaximum) + " %", - - formatDouble(nm.getCurrentCpuLoad * 100d) + " %", - X.timeSpan2HMSM(nm.getUpTime), - ( - "Total: " + (cm.getHeapEntriesCount + cm.getOffHeapEntriesCount) + - " (" + (cm.getHeapEntriesCount + cm.getOffHeapPrimaryEntriesCount) + " / " + cm.getOffHeapBackupEntriesCount + ")", - " Heap: " + cm.getHeapEntriesCount + " (" + cm.getHeapEntriesCount + " / " + NA + ")", - " Off-Heap: " + cm.getOffHeapEntriesCount + - " (" + cm.getOffHeapPrimaryEntriesCount + " / " + cm.getOffHeapBackupEntriesCount + ")", - " Off-Heap Memory: " + (if (cm.getOffHeapPrimaryEntriesCount == 0) "0" - else if (cm.getOffHeapAllocatedSize > 0) formatMemory(cm.getOffHeapAllocatedSize) - else NA) - ), - ( - "Hi: " + cm.getHits, - "Mi: " + cm.getMisses, - "Rd: " + cm.getReads, - "Wr: " + cm.getWrites - ) - ) - } - - csT.render() - - nl() - println("Nodes for: " + cacheNameVar) - - ciT.render() - - // Print footnote. - println("'Hi' - Number of cache hits.") - println("'Mi' - Number of cache misses.") - println("'Rd' - number of cache reads.") - println("'Wr' - Number of cache writes.") - - // Print metrics. - nl() - println("Aggregated queries metrics:") - println(" Minimum execution time: " + X.timeSpan2HMSM(ad.getMinimumQueryTime)) - println(" Maximum execution time: " + X.timeSpan2HMSM(ad.getMaximumQueryTime)) - println(" Average execution time: " + X.timeSpan2HMSM(ad.getAverageQueryTime.toLong)) - println(" Total number of executions: " + ad.getQueryExecutions) - println(" Total number of failures: " + ad.getQueryFailures) - - gCfg.foreach(ccfgs => ccfgs.find(ccfg => F.eq(ccfg.getName, ad.getName)) - .foreach(ccfg => { - nl() - - printCacheConfiguration("Cache configuration:", ccfg) - })) - }) - } - else - println("\nUse \"-a\" flag to see detailed statistics.") - } - } - - /** - * Makes extended cache host attaching optional visor variable host - * associated with it. - * - * @param s Cache host. - */ - private def mkCacheName(@Nullable s: String): String = { - if (s == null) { - val v = mfindHead(DFLT_CACHE_KEY) - - DFLT_CACHE_NAME + (if (v.isDefined) "(@" + v.get._1 + ')' else "") - } - else { - val v = mfindHead(s) - - s + (if (v.isDefined) "(@" + v.get._1 + ')' else "") - } - } - - /** - * Registers cache host as a visor variable if one wasn't already registered. - * - * @param s Cache host. - */ - private def registerCacheName(@Nullable s: String) = setVarIfAbsent(if (s != null) s else DFLT_CACHE_KEY, "c") - - /** - * ===Command=== - * Prints unsorted statistics about all caches. - * - * ===Examples=== - * cache - * Prints unsorted statistics about all caches. - */ - def cache() { - this.cache("") - } - - /** - * Get metrics data for all caches from all node or from specified node. - * - * @param node Option of node for cache names extracting. All nodes if `None`. - * @param systemCaches Allow selection of system caches. - * @return Caches metrics data. - */ - private def cacheData(node: Option[ClusterNode], name: Option[String], systemCaches: Boolean = false): - List[VisorCacheAggregatedMetrics] = { - assert(node != null) - - try { - val caches: JavaList[String] = name.fold(Collections.emptyList[String]())(Collections.singletonList) - - val arg = new VisorCacheMetricsCollectorTaskArg(systemCaches, caches) - - node match { - case Some(n) => executeOne(n.id(), classOf[VisorCacheMetricsCollectorTask], arg).toList - case None => executeMulti(classOf[VisorCacheMetricsCollectorTask], arg).toList - } - } - catch { - case e: IgniteException => Nil - } - } - - /** - * Gets configuration of grid from specified node for collecting of node cache's configuration. - * - * @param node Specified node. - * @return Cache configurations for specified node. - */ - private def config(node: ClusterNode): JavaCollection[VisorCacheConfiguration] = { - try { - cacheConfigurations(node.id()) - } - catch { - case e: IgniteException => - scold(e) - - null - } - } - - /** - * Tests whether passed in parameter is a valid sorting type. - * - * @param arg Sorting type to test. - */ - private def isValidSortType(arg: String): Boolean = { - assert(arg != null) - - Set("hi", "mi", "rd", "wr", "cn").contains(arg.trim) - } - - /** - * Sort metrics data. - * - * @param data Unsorted list. - * @param arg Sorting command argument. - * @param reverse Whether to reverse sorting or not. - * @return Sorted data. - */ - private def sortData(data: Map[UUID, VisorCacheMetrics], arg: String, reverse: Boolean) = { - assert(data != null) - assert(arg != null) - - val sorted = arg.trim match { - case "hi" => data.toSeq.sortBy(_._2.getHits) - case "mi" => data.toSeq.sortBy(_._2.getMisses) - case "rd" => data.toSeq.sortBy(_._2.getReads) - case "wr" => data.toSeq.sortBy(_._2.getWrites) - case "cn" => data.toSeq.sortBy(_._1) - - case _ => - assert(false, "Unknown sorting type: " + arg) - - Nil - } - - if (reverse) sorted.reverse else sorted - } - - /** - * Sort aggregated metrics data. - * - * @param data Unsorted list. - * @param arg Command argument. - * @param reverse Whether to reverse sorting or not. - * @return Sorted data. - */ - private def sortAggregatedData(data: Iterable[VisorCacheAggregatedMetrics], arg: String, reverse: Boolean): - List[VisorCacheAggregatedMetrics] = { - - val sorted = arg.trim match { - case "hi" => data.toList.sortBy(_.getAverageHits) - case "mi" => data.toList.sortBy(_.getAverageMisses) - case "rd" => data.toList.sortBy(_.getAverageReads) - case "wr" => data.toList.sortBy(_.getAverageWrites) - case "cn" => data.toList.sortWith((x, y) => - x.getName == null || (y.getName != null && x.getName.toLowerCase < y.getName.toLowerCase)) - - case _ => - assert(false, "Unknown sorting type: " + arg) - - Nil - } - - if (reverse) sorted.reverse else sorted - } - - /** - * Asks user to select a cache from the list. - * - * @param title Title displayed before the list of caches. - * @param node Option of node for cache names extracting. All nodes if `None`. - * @param showSystem Allow selection of system caches. - * @return `Option` for ID of selected cache. - */ - def askForCache(title: String, node: Option[ClusterNode], showSystem: Boolean = false, - aggrData: Seq[VisorCacheAggregatedMetrics]): Option[String] = { - assert(title != null) - - if (aggrData.isEmpty) { - scold("No caches found.") - - return None - } - - val sortedAggrData = sortAggregatedData(aggrData, "cn", false) - - println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis)) - - val sumT = VisorTextTable() - - sumT #= ("#", "Name(@)", "Mode", "Size (Heap / Off-heap)") - - sortedAggrData.indices.foreach(i => { - val ad = sortedAggrData(i) - - // Add cache host as visor variable. - registerCacheName(ad.getName) - - sumT += ( - i, - mkCacheName(ad.getName), - ad.getMode, - ( - "min: " + (ad.getMinimumHeapSize + ad.getMinimumOffHeapPrimarySize) + - " (" + ad.getMinimumHeapSize + " / " + ad.getMinimumOffHeapPrimarySize + ")", - "avg: " + formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapPrimarySize) + - " (" + formatDouble(ad.getAverageHeapSize) + " / " + formatDouble(ad.getAverageOffHeapPrimarySize) + ")", - "max: " + (ad.getMaximumHeapSize + ad.getMaximumOffHeapPrimarySize) + - " (" + ad.getMaximumHeapSize + " / " + ad.getMaximumOffHeapPrimarySize + ")" - )) - }) - - sumT.render() - - val a = ask("\nChoose cache number ('c' to cancel) [c]: ", "0") - - if (a.toLowerCase == "c") - None - else { - try - Some(sortedAggrData(a.toInt).getName) - catch { - case e: Throwable => - warn("Invalid selection: " + a) - - None - } - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheCommand { - /** Singleton command */ - private val cmd = new VisorCacheCommand - - addHelp( - name = "cache", - shortInfo = "Prints cache statistics, clears cache, prints list of all entries from cache.", - longInfo = Seq( - "Prints statistics about caches from specified node on the entire grid.", - "Output sorting can be specified in arguments.", - " ", - "Output abbreviations:", - " # Number of nodes.", - " H/h Number of cache hits.", - " M/m Number of cache misses.", - " R/r Number of cache reads.", - " W/w Number of cache writes.", - " ", - "Clears cache.", - " ", - "Prints list of all entries from cache.", - " ", - "Prints or clear list lost partitions from cache." - ), - spec = Seq( - "cache", - "cache -i", - "cache {-c=} {-id=|id8=} {-s=hi|mi|rd|wr} {-a} {-r}", - "cache -clear {-c=} {-id=|id8=}", - "cache -scan -c= {-near} {-id=|id8=} {-p=}", - "cache -stop -c=", - "cache -reset -c=", - "cache -rebalance -c=", - "cache -slp -c=", - "cache -rlp -c=", - "cache -statistics= -c=" - ), - args = Seq( - "-id8=" -> Seq( - "ID8 of the node to get cache statistics from.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'.", - "If neither is specified statistics will be gathered from all nodes." - ), - "-id=" -> Seq( - "Full ID of the node to get cache statistics from.", - "Either '-id8' or '-id' can be specified.", - "If neither is specified statistics will be gathered from all nodes." - ), - "-c=" -> Seq( - "Name of the cache.", - "Note you can also use '@c0' ... '@cn' variables as shortcut to ." - ), - "-clear" -> "Clears cache.", - "-system" -> "Enable showing of information about system caches.", - "-scan" -> "Prints list of all entries from cache.", - "-near" -> "Prints list of all entries from near cache of cache.", - "-stop" -> "Stop cache with specified name.", - "-reset" -> "Reset metrics of cache with specified name.", - "-slp" -> "Show list of lost partitions for specified cache.", - "-rlp" -> "Reset lost partitions for specified cache.", - "-rebalance" -> "Re-balance partitions for cache with specified name.", - "-statistics=" -> "Change statistics collection state for cache with specified name.", - "-s=hi|mi|rd|wr|cn" -> Seq( - "Defines sorting type. Sorted by:", - " hi Hits.", - " mi Misses.", - " rd Reads.", - " wr Writes.", - " cn Cache name.", - "If not specified - default sorting is 'cn'." - ), - "-i" -> Seq( - "Interactive mode.", - "User can interactively select node for cache statistics." - ), - "-r" -> Seq( - "Defines if sorting should be reversed.", - "Can be specified only with '-s' argument." - ), - "-a" -> Seq( - "Prints details statistics about each cache.", - "By default only aggregated summary is printed." - ), - "-p=" -> Seq( - "Number of object to fetch from cache at once.", - "Valid range from 1 to 100.", - "By default page size is 25." - ) - ), - examples = Seq( - "cache" -> - "Prints summary statistics about all non-system caches.", - "cache -system" -> - "Prints summary statistics about all caches including system cache.", - "cache -i" -> - "Prints cache statistics for interactively selected node.", - "cache -id8=12345678 -s=hi -r" -> Seq( - "Prints summary statistics about caches from node with specified id8", - "sorted by number of hits in reverse order." - ), - "cache -id8=@n0 -s=hi -r" -> Seq( - "Prints summary statistics about caches from node with id8 taken from 'n0' memory variable.", - "sorted by number of hits in reverse order." - ), - "cache -c=@c0 -a" -> Seq( - "Prints detailed statistics about cache with name taken from 'c0' memory variable." - ), - "cache -s=hi -r -a" -> - "Prints detailed statistics about all caches sorted by number of hits in reverse order.", - "cache -clear" -> "Clears interactively selected cache.", - "cache -clear -c=cache" -> "Clears cache with name 'cache'.", - "cache -clear -c=@c0" -> "Clears cache with name taken from 'c0' memory variable.", - "cache -scan" -> "Prints list entries from interactively selected cache.", - "cache -scan -c=cache" -> "List entries from cache with name 'cache' from all nodes with this cache.", - "cache -scan -c=@c0 -p=50" -> ("Prints list entries from cache with name taken from 'c0' memory variable" + - " with page of 50 items from all nodes with this cache."), - "cache -scan -c=cache -id8=12345678" -> "Prints list entries from cache with name 'cache' and node '12345678' ID8.", - "cache -scan -near -c=cache -id8=12345678" -> - "Prints list entries from near cache of cache with name 'cache' and node '12345678' ID8.", - "cache -stop -c=@c0" -> "Stop cache with name taken from 'c0' memory variable.", - "cache -reset -c=@c0" -> "Reset metrics for cache with name taken from 'c0' memory variable.", - "cache -rebalance -c=cache" -> "Re-balance partitions for cache with name 'cache'.", - "cache -slp -c=@c0" -> "Show list of lost partitions for cache with name taken from 'c0' memory variable.", - "cache -rlp -c=@c0" -> "Reset lost partitions for cache with name taken from 'c0' memory variable.", - "cache -statistics=on -c=@c0" -> - "Enable statistics collection for cache with name taken from 'c0' memory variable.", - "cache -statistics=off -c=@c0" -> - "Disable statistics collection for cache with name taken from 'c0' memory variable." - ), - emptyArgs = cmd.cache, - withArgs = cmd.cache - ) - - /** Default cache name to show on screen. */ - private final val DFLT_CACHE_NAME = escapeName(null) - - /** Default cache key. */ - protected val DFLT_CACHE_KEY = DFLT_CACHE_NAME + "-" + UUID.randomUUID().toString - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromCinfo2Visor(vs: VisorTag): VisorCacheCommand = cmd - - /** - * Show table of cache configuration information. - * - * @param title Specified title for table. - * @param cfg Config to show information. - */ - private[commands] def printCacheConfiguration(title: String, cfg: VisorCacheConfiguration) { - val affinityCfg = cfg.getAffinityConfiguration - val nearCfg = cfg.getNearConfiguration - val rebalanceCfg = cfg.getRebalanceConfiguration - val evictCfg = cfg.getEvictionConfiguration - val storeCfg = cfg.getStoreConfiguration - val queryCfg = cfg.getQueryConfiguration - - val cacheT = VisorTextTable() - - cacheT #= ("Name", "Value") - - cacheT += ("Group", cfg.getGroupName) - cacheT += ("Dynamic Deployment ID", cfg.getDynamicDeploymentId) - cacheT += ("System", bool2Str(cfg.isSystem)) - - cacheT += ("Mode", cfg.getMode) - cacheT += ("Atomicity Mode", safe(cfg.getAtomicityMode)) - cacheT += ("Statistic Enabled", bool2Str(cfg.isStatisticsEnabled)) - cacheT += ("Management Enabled", bool2Str(cfg.isManagementEnabled)) - - cacheT += ("On-heap cache enabled", bool2Str(cfg.isOnheapCacheEnabled)) - cacheT += ("Partition Loss Policy", cfg.getPartitionLossPolicy) - cacheT += ("Query Parallelism", cfg.getQueryParallelism) - cacheT += ("Copy On Read", bool2Str(cfg.isCopyOnRead)) - cacheT += ("Listener Configurations", cfg.getListenerConfigurations) - cacheT += ("Load Previous Value", bool2Str(cfg.isLoadPreviousValue)) - cacheT += ("Memory Policy Name", cfg.getMemoryPolicyName) - cacheT += ("Node Filter", cfg.getNodeFilter) - cacheT += ("Read From Backup", bool2Str(cfg.isReadFromBackup)) - cacheT += ("Topology Validator", cfg.getTopologyValidator) - - cacheT += ("Time To Live Eager Flag", cfg.isEagerTtl) - - cacheT += ("Write Synchronization Mode", safe(cfg.getWriteSynchronizationMode)) - cacheT += ("Invalidate", bool2Str(cfg.isInvalidate)) - - cacheT += ("Affinity Function", safe(affinityCfg.getFunction)) - cacheT += ("Affinity Backups", affinityCfg.getPartitionedBackups) - cacheT += ("Affinity Partitions", safe(affinityCfg.getPartitions)) - cacheT += ("Affinity Exclude Neighbors", safe(affinityCfg.isExcludeNeighbors)) - cacheT += ("Affinity Mapper", safe(affinityCfg.getMapper)) - - cacheT += ("Rebalance Mode", rebalanceCfg.getMode) - cacheT += ("Rebalance Batch Size", rebalanceCfg.getBatchSize) - cacheT += ("Rebalance Timeout", rebalanceCfg.getTimeout) - cacheT += ("Rebalance Delay", rebalanceCfg.getPartitionedDelay) - cacheT += ("Time Between Rebalance Messages", rebalanceCfg.getThrottle) - cacheT += ("Rebalance Batches Count", rebalanceCfg.getBatchesPrefetchCnt) - cacheT += ("Rebalance Cache Order", rebalanceCfg.getRebalanceOrder) - - cacheT += ("Eviction Policy Enabled", bool2Str(evictCfg.getPolicy != null)) - cacheT += ("Eviction Policy Factory", safe(evictCfg.getPolicy)) - cacheT += ("Eviction Policy Max Size", safe(evictCfg.getPolicyMaxSize)) - cacheT += ("Eviction Filter", safe(evictCfg.getFilter)) - - cacheT += ("Near Cache Enabled", bool2Str(nearCfg.isNearEnabled)) - cacheT += ("Near Start Size", nearCfg.getNearStartSize) - cacheT += ("Near Eviction Policy Factory", safe(nearCfg.getNearEvictPolicy)) - cacheT += ("Near Eviction Policy Max Size", safe(nearCfg.getNearEvictMaxSize)) - - cacheT += ("Default Lock Timeout", cfg.getDefaultLockTimeout) - cacheT += ("Metadata type count", cfg.getJdbcTypes.size()) - cacheT += ("Cache Interceptor", safe(cfg.getInterceptor)) - - cacheT += ("Store Enabled", bool2Str(storeCfg.isEnabled)) - cacheT += ("Store Class", safe(storeCfg.getStore)) - cacheT += ("Store Factory Class", storeCfg.getStoreFactory) - cacheT += ("Store Keep Binary", storeCfg.isStoreKeepBinary) - cacheT += ("Store Read Through", bool2Str(storeCfg.isReadThrough)) - cacheT += ("Store Write Through", bool2Str(storeCfg.isWriteThrough)) - cacheT += ("Store Write Coalescing", bool2Str(storeCfg.getWriteBehindCoalescing)) - - cacheT += ("Write-Behind Enabled", bool2Str(storeCfg.isWriteBehindEnabled)) - cacheT += ("Write-Behind Flush Size", storeCfg.getFlushSize) - cacheT += ("Write-Behind Frequency", storeCfg.getFlushFrequency) - cacheT += ("Write-Behind Flush Threads Count", storeCfg.getFlushThreadCount) - cacheT += ("Write-Behind Batch Size", storeCfg.getBatchSize) - - cacheT += ("Concurrent Asynchronous Operations Number", cfg.getMaxConcurrentAsyncOperations) - - cacheT += ("Loader Factory Class Name", safe(cfg.getLoaderFactory)) - cacheT += ("Writer Factory Class Name", safe(cfg.getWriterFactory)) - cacheT += ("Expiry Policy Factory Class Name", safe(cfg.getExpiryPolicyFactory)) - - cacheT +=("Query Execution Time Threshold", queryCfg.getLongQueryWarningTimeout) - cacheT +=("Query Escaped Names", bool2Str(queryCfg.isSqlEscapeAll)) - cacheT +=("Query Schema Name", queryCfg.getSqlSchema) - cacheT +=("Query Indexed Types", queryCfg.getIndexedTypes) - cacheT +=("Maximum payload size for offheap indexes", cfg.getSqlIndexMaxInlineSize) - cacheT +=("Query Metrics History Size", cfg.getQueryDetailMetricsSize) - - val sqlFxs = queryCfg.getSqlFunctionClasses - - val hasSqlFxs = sqlFxs != null && sqlFxs.nonEmpty - - if (!hasSqlFxs) - cacheT +=("Query SQL functions", NA) - - val indexedTypes = queryCfg.getIndexedTypes - - val hasIndexedTypes = indexedTypes != null && indexedTypes.nonEmpty - - if (!hasIndexedTypes) - cacheT +=("Query Indexed Types", NA) - - println(title) - - cacheT.render() - - if (hasSqlFxs) { - println("\nQuery SQL functions:") - - val sqlFxsT = VisorTextTable() - - sqlFxsT #= "Function Class Name" - - sqlFxs.foreach(s => sqlFxsT += s) - - sqlFxsT.render() - } - - if (hasIndexedTypes) { - println("\nQuery Indexed Types:") - - val indexedTypesT = VisorTextTable() - - indexedTypesT #= ("Key Class Name", "Value Class Name") - - indexedTypes.grouped(2).foreach(types => indexedTypesT += (types(0), types(1))) - - indexedTypesT.render() - } - } -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheLostPartitionsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheLostPartitionsCommand.scala deleted file mode 100644 index d6830310d11d1..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheLostPartitionsCommand.scala +++ /dev/null @@ -1,170 +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.visor.commands.cache - -import java.util.Collections - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.internal.visor.cache.{VisorCacheLostPartitionsTask, VisorCacheLostPartitionsTaskArg} -import org.apache.ignite.visor.commands.common.VisorTextTable -import org.apache.ignite.visor.visor._ -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ - -import scala.collection.JavaConversions._ -import scala.collection.mutable - -/** - * ==Overview== - * Visor 'lost partitions' command implementation. - * - * ====Specification==== - * {{{ - * cache -slp -c= - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * }}} - * - * ====Examples==== - * {{{ - * cache -slp -c=cache - * Show list of lost partitions for cache with name 'cache'. - * }}} - */ -class VisorCacheLostPartitionsCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Throwable) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * Show list of lost partitions in cache with specified name. - * - * ===Examples=== - * cache -slp -c=cache - * Show list of lost partitions from cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def showLostPartitions(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val lostPartitions = - try - executeRandom(groupForDataNode(node, cacheName), classOf[VisorCacheLostPartitionsTask], - new VisorCacheLostPartitionsTaskArg(Collections.singletonList(cacheName))) - catch { - case _: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - case e: Throwable => - error(e) - - return - } - - if (lostPartitions.getLostPartitions.isEmpty) { - println(s"""Lost partitions for cache: "${escapeName(cacheName)}" is not found""") - - return - } - - lostPartitions.getLostPartitions.foreach(cacheLostPartitions => { - val t = VisorTextTable() - - t #= ("Interval", "Partitions") - - val partitions = cacheLostPartitions._2.toIndexedSeq - val partitionCnt = partitions.size - - val indexes = mutable.ArrayBuffer.empty[String] - val partitionRows = mutable.ArrayBuffer.empty[String] - var startIdx = 0 - var idx = 0 - val b = new StringBuilder - - partitions.foreach((part) => { - if (idx % 10 == 0) - startIdx = part - - b.append(part) - idx += 1 - - if (idx != partitionCnt) - b.append(", ") - - - if (idx % 10 == 0 || idx == partitionCnt) { - indexes += startIdx + "-" + part - partitionRows += b.toString().trim - b.clear() - } - }) - - t += (indexes, partitionRows) - println(s"Lost partitions for cache: ${escapeName(cacheLostPartitions._1)} ($partitionCnt)") - t.render() - }) - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheLostPartitionsCommand { - /** Singleton command. */ - private val cmd = new VisorCacheLostPartitionsCommand - - /** - * Singleton. - */ - def apply(): VisorCacheLostPartitionsCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheModifyCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheModifyCommand.scala deleted file mode 100644 index 7461889f316c0..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheModifyCommand.scala +++ /dev/null @@ -1,413 +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.visor.commands.cache - -import java.util.{Calendar, Date, GregorianCalendar, UUID} - -import org.apache.ignite.internal.util.lang.{GridFunc => F} -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.visor.cache._ -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.commands.cache.VisorCacheModifyCommand._ -import org.apache.ignite.visor.commands.common.VisorConsoleCommand -import org.apache.ignite.visor.visor._ - -/** - * ==Overview== - * Visor 'modify' command implementation. - * - * ==Help== - * {{{ - * +-----------------------------------------------------------------------------------------+ - * | modify -put | Put custom value into cache. | - * +-----------------------------------------------------------------------------------------+ - * | modify -get | Get value with specified key from cache. | - * +-----------------------------------------------------------------------------------------+ - * | modify -remove | Remove value with specified key from cache. | - * +-----------------------------------------------------------------------------------------+ - * - * }}} - * - * ====Specification==== - * {{{ - * modify -put -c= {-kt=} {-kv=} {-vt=} {-v=} - * modify -get -c= {-kt=} {-kv=} - * modify -remove -c= {-kt=} {-kv=} - * }}} - * - * ====Arguments==== - * {{{ - * -c= - * Name of the cache. - * -kt= - * Type of key. Default value is java.lang.String. Short type name can be specified. - * -kv= - * Key. Asked in interactive mode when it is not specified. - * -vt=. - * Type of value. Default value is java.lang.String. Short type name can be specified. - * Value type is equals to key type when value is not specified. - * -v= - * Value. Equals to key when it is not specified. - * Asked in interactive mode when key and value are not specified. - * }}} - * - * ====Examples==== - * {{{ - * modify -put -c=@c0 - * Put value into cache in interactive mode. - * modify -get -c=@c0 - * Get value from cache in interactive mode. - * modify -remove -c=@c0 - * Remove value from cache in interactive mode. - * modify -put -c=cache -kv=key1 - * Put value into cache with name cache with key of default String type equal to key1 - * and value equal to key. - * modify -put -c=cache -kt=java.lang.String -kv=key1 -vt=lava.lang.String -v=value1 - * Put value into cache with name cache with key of String type equal to key1 - * and value of String type equal to value1 - * modify -get -c=cache -kt=java.lang.String -kv=key1 - * Get value from cache with name cache with key of String type equal to key1 - * modify -remove -c=cache -kt=java.lang.String -kv=key1 - * Remove value from cache with name cache with key of String type equal to key1. - * - * }}} - */ -class VisorCacheModifyCommand extends VisorConsoleCommand { - @impl protected val name = "modify" - - /** - * ===Command=== - * Modify cache value in specified cache. - * - * ===Examples=== - * modify -put -c=@c0 - * Put value into cache with name taken from 'c0' memory variable in interactive mode. - *
- * modify -get - * Get value from cache with name taken from 'c0' memory variable in interactive mode. - *
- * modify -remove - * Remove value from cache with name taken from 'c0' memory variable in interactive mode. - *
- * modify -put -c=cache -kt=java.lang.String -k=key1 -vt=lava.lang.String -v=value1 - * Put value into cache with name 'cache' with key of String type equal to 'key1' - * and value of String type equal to 'value1' - *
- * modify -get -c=cache -kt=java.lang.String -k=key1 - * Get value from cache with name 'cache' with key of String type equal to 'key1' - *
- * modify -remove -c=cache -kt=java.lang.String -k=key1 - * Remove value from cache with name 'cache' with key of String type equal to 'key1'. - * - * @param args Command arguments. - */ - def modify(args: String) { - if (checkConnected() && checkActiveState()) { - def argNonEmpty(argLst: ArgList, arg: Option[String], key: String): Boolean = { - if (hasArgName(key, argLst) && arg.forall((a) => F.isEmpty(a))) { - warn(s"Argument $key is specified and can not be empty") - - false - } - else - true - } - - var argLst = parseArgs(args) - - val put = hasArgFlag("put", argLst) - val get = hasArgFlag("get", argLst) - val remove = hasArgFlag("remove", argLst) - - if (!put && !get && !remove) { - warn("Put, get, or remove operation should be specified") - - return - } - - if (put && get || get && remove || get && remove) { - warn("Only one operation put, get or remove allowed in one command invocation") - - return - } - - if (!hasArgName("c", argLst)) { - warn("Cache name should be specified") - - return - } - - val cacheName = argValue("c", argLst) match { - case Some(dfltName) if dfltName == DFLT_CACHE_KEY || dfltName == DFLT_CACHE_NAME => - argLst = argLst.filter(_._1 != "c") ++ Seq("c" -> null) - - Some(null) - - case cn => cn - } - - if (cacheName.isEmpty) { - warn("Cache with specified name is not found") - - return - } - - val keyTypeStr = argValue("kt", argLst) - val keyStr = argValue("k", argLst) - var key: Object = null - - if (keyTypeStr.nonEmpty && keyStr.isEmpty) { - warn("Key should be specified when key type is specified") - - return - } - - val valueTypeStr = argValue("vt", argLst) - val valueStr = argValue("v", argLst) - var value: Object = null - - if (valueTypeStr.nonEmpty && valueStr.isEmpty) { - warn("Value should be specified when value type is specified") - - return - } - - if (!argNonEmpty(argLst, keyTypeStr, "kt") - || !argNonEmpty(argLst, keyStr, "k") - || !argNonEmpty(argLst, valueTypeStr, "vt") - || !argNonEmpty(argLst, valueStr, "v")) - return - - keyTypeStr match { - case Some(clsStr) => - try { - INPUT_TYPES.find(_._3.getName.indexOf(clsStr) >= 0) match { - case Some(t) => key = t._2(keyStr.get) - case None => - warn("Specified type is not allowed") - - return - } - } - catch { - case e: Throwable => - warn("Failed to read key: " + e.getMessage) - - return - } - - case None if keyStr.nonEmpty => - key = keyStr.get - - case None if put && valueStr.nonEmpty => // No-op. - - case None => - askTypedValue("key") match { - case Some(k) if k.toString.nonEmpty => key = k - case _ => - warn("Key can not be empty.") - - return - } - } - - if (put) { - valueTypeStr match { - case Some(clsStr) => - try { - INPUT_TYPES.find(_._3.getName.indexOf(clsStr) >= 0) match { - case Some(t) => value = t._2(valueStr.get) - case None => warn("Specified type is not allowed") - - return - } - } - catch { - case e: Throwable => - warn("Failed to read value: " + e.getMessage) - - return - } - case None if valueStr.nonEmpty => - value = valueStr.get - - case None => - askTypedValue("value") match { - case Some(v) if v.toString.nonEmpty => value = v - case _ => - warn("Value can not be empty.") - - return - } - } - - if (key == null) - key = value - } - - if ((get || remove) && valueTypeStr.nonEmpty) - warn("Specified value is not used by selected operation and will be ignored") - - val arg = new VisorCacheModifyTaskArg(cacheName.get, - if (put) VisorModifyCacheMode.PUT else if (get) VisorModifyCacheMode.GET else VisorModifyCacheMode.REMOVE, - key, value - ) - - try { - val taskResult = executeRandom(classOf[VisorCacheModifyTask], arg) - val resultObj = taskResult.getResult match { - case d: Date => - val cal = new GregorianCalendar() - cal.setTime(d) - - if (cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0 - && cal.get(Calendar.SECOND) == 0) - formatDate(d) - else - formatDateTime(d) - - case v => v - } - val affinityNode = taskResult.getAffinityNode - - if (put) { - println("Put operation success" + "; Affinity node: " + nid8(affinityNode)) - - if (resultObj != null) - println("Previous value is: " + resultObj) - } - - if (get) { - if (resultObj != null) - println("Value with specified key: " + resultObj + "; Affinity node: " + nid8(affinityNode)) - else - println("Value with specified key not found") - } - - if (remove) { - if (resultObj != null) - println("Removed value: " + resultObj + "; Affinity node: " + nid8(affinityNode)) - else - println("Value with specified key not found") - } - } - catch { - case e: Throwable => - warn("Failed to execute cache modify operation: " + e.getMessage) - } - } - } - - /** - * ===Command=== - * Modify cache data by execution of put/get/remove command. - * - * ===Examples=== - * modify -put -c=@c0 - * Put entity in cache with name taken from 'c0' memory variable in interactive mode - */ - def modify() { - this.modify("") - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheModifyCommand { - /** Singleton command */ - private val cmd = new VisorCacheModifyCommand - - /** Default cache name to show on screen. */ - private final val DFLT_CACHE_NAME = escapeName(null) - - /** Default cache key. */ - protected val DFLT_CACHE_KEY: String = DFLT_CACHE_NAME + "-" + UUID.randomUUID().toString - - addHelp( - name = "modify", - shortInfo = "Modify cache by put/get/remove value.", - longInfo = Seq( - "Execute modification of cache data:", - " ", - "Put new value into cache.", - " ", - "Get value from cache.", - " ", - "Remove value from cache." - ), - spec = Seq( - "modify -put -c= {-kt=} {-k=} {-vt=} {-v=}", - "modify -get -c= {-kt=} {-k=}", - "modify -remove -c= {-kt=} {-k=}" - ), - args = Seq( - "-c=" -> - "Name of the cache", - "-put" -> Seq( - "Put value into cache and show its affinity node.", - "If the cache previously contained a mapping for the key, the old value is shown", - "Key and value are asked in interactive mode when they are not specified.", - "Key is equals to value when key is not specified." - ), - "-get" -> Seq( - "Get value from cache and show its affinity node.", - "Key is asked in interactive mode when it is not specified." - ), - "-remove" -> Seq( - "Remove value from cache and show its affinity node.", - "Key is asked in interactive mode when it is not specified." - ), - "-kt=" -> - "Type of key. Default type is java.lang.String. Type name can be specified without package.", - "-k=" -> - "Key. Must be specified when key type is specified.", - "-vt=" -> - "Type of value. Default type is java.lang.String. Type name can be specified without package.", - "-v=" -> - "Value. Must be specified when value type is specified." - ), - examples = Seq( - "modify -put -c=@c0" -> - "Put value into cache with name taken from 'c0' memory variable in interactive mode.", - "modify -get -c=@c0" -> - "Get value from cache with name taken from 'c0' memory variable in interactive mode.", - "modify -remove -c=@c0" -> - "Remove value from cache with name taken from 'c0' memory variable in interactive mode.", - "modify -put -c=cache -v=value1" -> Seq( - "Put the value 'value1' into the cache 'cache'.", - "Other params have default values: -kt = java.lang.String , -k = value1, -vt = java.lang.String" - ), - "modify -put -c=@c0 -kt=java.lang.String -k=key1 -vt=lava.lang.String -v=value1" -> Seq( - "Put value into cache with name taken from 'c0' memory variable", - "with key of String type equal to 'key1' and value of String type equal to 'value1'" - ), - "modify -get -c=@c0 -kt=java.lang.String -k=key1" -> - "Get value from cache with name taken from 'c0' memory variable with key of String type equal to key1", - "modify -remove -c=@c0 -kt=java.lang.String -k=key1" -> - "Remove value from cache with name taken from 'c0' memory variable with key of String type equal to key1." - ), - emptyArgs = cmd.modify, - withArgs = cmd.modify - ) - - /** - * Singleton. - */ - def apply(): VisorCacheModifyCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheRebalanceCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheRebalanceCommand.scala deleted file mode 100644 index b416e6af8dfc3..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheRebalanceCommand.scala +++ /dev/null @@ -1,134 +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.visor.commands.cache - -import java.util.{HashSet => JavaSet} - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.internal.visor.cache.{VisorCacheRebalanceTask, VisorCacheRebalanceTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.visor._ - -import scala.language.reflectiveCalls - -/** - * ==Overview== - * Visor 'rebalance' command implementation. - * - * ====Specification==== - * {{{ - * cache -rebalance -c= - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * }}} - * - * ====Examples==== - * {{{ - * cache -rebalance -c=@c0 - * Re-balance partitions for cache with name taken from 'c0' memory variable. - * }}} - */ -class VisorCacheRebalanceCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Exception) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * Re-balance partitions for cache with specified name. - * - * ===Examples=== - * cache -c=cache -rebalance - * Re-balance partitions for cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def rebalance(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val grp = try { - groupForDataNode(node, cacheName) - } - catch { - case _: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - } - - try { - val cacheNames = new JavaSet[String]() - cacheNames.add(cacheName) - - executeRandom(grp, classOf[VisorCacheRebalanceTask], new VisorCacheRebalanceTaskArg(cacheNames)) - - println("Visor successfully re-balance partitions for cache: " + escapeName(cacheName)) - } - catch { - case _: ClusterGroupEmptyException => scold(messageNodeNotFound(node, cacheName)) - case e: Exception => error(e) - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheRebalanceCommand { - /** Singleton command. */ - private val cmd = new VisorCacheRebalanceCommand - - /** - * Singleton. - */ - def apply(): VisorCacheRebalanceCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommand.scala deleted file mode 100644 index 4c4d21b17bd8c..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommand.scala +++ /dev/null @@ -1,129 +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.visor.commands.cache - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.internal.visor.cache.{VisorCacheResetMetricsTask, VisorCacheResetMetricsTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.visor._ - -import scala.language.reflectiveCalls - -/** - * ==Overview== - * Visor 'reset' command implementation. - * - * ====Specification==== - * {{{ - * cache -reset -c= - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * }}} - * - * ====Examples==== - * {{{ - * cache -reset -c=@c0 - * Reset metrics for cache with name taken from 'c0' memory variable. - * }}} - */ -class VisorCacheResetCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Exception) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * Reset metrics for cache with specified name. - * - * ===Examples=== - * cache -c=cache -reset - * Reset metrics for cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def reset(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val grp = try { - groupForDataNode(node, cacheName) - } - catch { - case _: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - } - - try { - executeRandom(grp, classOf[VisorCacheResetMetricsTask], new VisorCacheResetMetricsTaskArg(cacheName)) - - println("Visor successfully reset metrics for cache: " + escapeName(cacheName)) - } - catch { - case _: ClusterGroupEmptyException => scold(messageNodeNotFound(node, cacheName)) - case e: Exception => error(e) - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheResetCommand { - /** Singleton command. */ - private val cmd = new VisorCacheResetCommand - - /** - * Singleton. - */ - def apply() = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetLostPartitionsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetLostPartitionsCommand.scala deleted file mode 100644 index a72a80f46ff4d..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetLostPartitionsCommand.scala +++ /dev/null @@ -1,132 +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.visor.commands.cache - -import java.util.Collections - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.internal.visor.cache.{VisorCacheResetLostPartitionsTask, VisorCacheResetLostPartitionsTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.visor._ - -import scala.language.reflectiveCalls - -/** - * ==Overview== - * Visor 'lost partition reset' command implementation. - * - * ====Specification==== - * {{{ - * cache -rlp -c= - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * }}} - * - * ====Examples==== - * {{{ - * cache -rlp -c=@c0 - * Reset lost partition for cache with name taken from 'c0' memory variable. - * }}} - */ -class VisorCacheResetLostPartitionsCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Exception) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * Reset lost partitions for cache with specified name. - * - * ===Examples=== - * cache -c=cache -rlp - * Reset lost partitions for cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def resetLostPartitions(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val grp = try { - groupForDataNode(node, cacheName) - } - catch { - case _: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - } - - try { - executeRandom(grp, classOf[VisorCacheResetLostPartitionsTask], - new VisorCacheResetLostPartitionsTaskArg(Collections.singletonList(cacheName))) - - println("Visor successfully reset lost partitions for cache: " + escapeName(cacheName)) - } - catch { - case _: ClusterGroupEmptyException => scold(messageNodeNotFound(node, cacheName)) - case e: Exception => error(e) - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheResetLostPartitionsCommand { - /** Singleton command. */ - private val cmd = new VisorCacheResetLostPartitionsCommand - - /** - * Singleton. - */ - def apply() = cmd -} 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 deleted file mode 100644 index 8d1983948fad9..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala +++ /dev/null @@ -1,237 +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.visor.commands.cache - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.visor.commands.common.VisorTextTable -import org.apache.ignite.visor.visor._ - -import org.apache.ignite.internal.visor.query._ -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ - -import scala.collection.JavaConversions._ - -/** - * ==Overview== - * Visor 'scan' command implementation. - * - * ====Specification==== - * {{{ - * cache -scan -c= {-near} {-id=|-id8=} {-p=} - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * - * Prints list of all entries from near cache of cache. - * - * Full node ID. - * - * Node ID8. - * - * Number of object to fetch from cache at once. - * }}} - * - * ====Examples==== - * {{{ - * cache -c=cache - * List entries from cache with name 'cache' from all nodes with this cache. - * cache -c=@c0 -scan -p=50 - * List entries from cache with name taken from 'c0' memory variable with page of 50 items - * from all nodes with this cache. - * cache -scan -c=cache -id8=12345678 - * List entries from cache with name 'cache' and node '12345678' ID8. - * cache -scan -near -c=cache -id8=12345678 - * List entries from near cache of cache with name 'cache' and node '12345678' ID8. - * }}} - */ -class VisorCacheScanCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Throwable) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * List all entries in cache with specified name. - * - * ===Examples=== - * cache -c=cache -scan - * List entries from cache with name 'cache' from all nodes with this cache. - *
- * cache -c=@c0 -scan -p=50 - * List entries from cache with name taken from 'c0' memory variable with page of 50 items - * from all nodes with this cache. - *
- * cache -c=cache -scan -id8=12345678 - * List entries from cache with name 'cache' and node '12345678' ID8. - * - * @param argLst Command arguments. - */ - def scan(argLst: ArgList, node: Option[ClusterNode]) { - val pageArg = argValue("p", argLst) - val cacheArg = argValue("c", argLst) - val near = hasArgName("near", argLst) - - var pageSize = 25 - - if (pageArg.isDefined) { - val page = pageArg.get - - try - pageSize = page.toInt - catch { - case nfe: NumberFormatException => - scold("Invalid value for 'page size': " + page) - - return - } - - if (pageSize < 1 || pageSize > 100) { - scold("'Page size' should be in range [1..100] but found: " + page) - - return - } - } - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val firstPage = - try - executeRandom(groupForDataNode(node, cacheName), - classOf[VisorScanQueryTask], new VisorScanQueryTaskArg(cacheName, null, false, false, near, false, pageSize)) match { - case x if x.getError != null => - error(x.getError) - - return - case x if x.getResult.getRows != null => - x.getResult - - case x => - var res = x.getResult - - Thread.sleep(100) - - while (res.getRows == null) { - res = executeOne(res.getResponseNodeId, classOf[VisorQueryFetchFirstPageTask], - new VisorQueryNextPageTaskArg(res.getQueryId, pageSize)) match { - case x if x.getError != null => - error(x.getError) - - return - case x => x.getResult - } - - if (res.getRows == null) - Thread.sleep(500) - } - - res - } - catch { - case e: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - case e: Throwable => - error(e) - - return - } - - if (firstPage.getRows.isEmpty) { - println(s"${if (near) "Near cache" else "Cache"}: ${escapeName(cacheName)} is empty") - - return - } - - var nextPage: VisorQueryResult = firstPage - - def render() { - println(s"Entries in ${if (near) "near" else ""} cache: " + escapeName(cacheName)) - - val t = VisorTextTable() - - t #= ("Key Class", "Key", "Value Class", "Value") - - nextPage.getRows.foreach(r => t += (r(0), r(1), r(2), r(3))) - - t.render() - } - - render() - - while (nextPage.isHasMore) { - ask("\nFetch more objects (y/n) [y]:", "y") match { - case "y" | "Y" => - try { - nextPage = executeOne(firstPage.getResponseNodeId, classOf[VisorQueryNextPageTask], - new VisorQueryNextPageTaskArg(firstPage.getQueryId, pageSize)) - - render() - } - catch { - case e: Exception => error(e) - } - case _ => return - } - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheScanCommand { - /** Singleton command. */ - private val cmd = new VisorCacheScanCommand - - /** - * Singleton. - */ - def apply() = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala deleted file mode 100644 index 185b452b35e63..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala +++ /dev/null @@ -1,136 +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.visor.commands.cache - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.visor.visor._ -import org.apache.ignite.internal.visor.cache.{VisorCacheStopTask, VisorCacheStopTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ - -/** - * ==Overview== - * Visor 'stop' command implementation. - * - * ====Specification==== - * {{{ - * cache -c= -stop - * }}} - * - * ====Arguments==== - * {{{ - * - * Name of the cache. - * }}} - * - * ====Examples==== - * {{{ - * cache -c=@c0 -stop - * Stops cache with name taken from 'c0' memory variable. - * }}} - */ -class VisorCacheStopCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Exception) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * Stop cache with specified name. - * - * ===Examples=== - * cache -c=cache -stop - * Stop cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def stop(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val grp = try { - groupForDataNode(node, cacheName) - } - catch { - case _: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - } - - val dflt = if (batchMode) "y" else "n" - - ask(s"Are you sure you want to stop cache: ${escapeName(cacheName)}? (y/n) [$dflt]: ", dflt) match { - case "y" | "Y" => - try { - executeRandom(grp, classOf[VisorCacheStopTask], new VisorCacheStopTaskArg(cacheName)) - - println("Visor successfully stop cache: " + escapeName(cacheName)) - } - catch { - case _: ClusterGroupEmptyException => scold(messageNodeNotFound(node, cacheName)) - case e: Exception => error(e) - } - - case "n" | "N" => - - case x => - nl() - - warn("Invalid answer: " + x) - } - } -} - -object VisorCacheStopCommand { - /** Singleton command. */ - private val cmd = new VisorCacheStopCommand - - /** - * Singleton. - */ - def apply() = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheToggleStatisticsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheToggleStatisticsCommand.scala deleted file mode 100644 index 2156de03390bd..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheToggleStatisticsCommand.scala +++ /dev/null @@ -1,152 +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.visor.commands.cache - -import java.util.{HashSet => JavaSet} - -import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode} -import org.apache.ignite.internal.visor.cache.{VisorCacheToggleStatisticsTask, VisorCacheToggleStatisticsTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.visor._ - -import scala.language.reflectiveCalls - -/** - * ==Overview== - * Visor 'statistics' command implementation. - * - * ====Specification==== - * {{{ - * cache -statistics= -c= - * }}} - * - * ====Arguments==== - * {{{ - * - * Statistics collection state to set for cache. - * - * Name of the cache. - * }}} - * - * ====Examples==== - * {{{ - * cache -statistics=on -c=@c0 - * Enable collection of statistics for cache with name taken from 'c0' memory variable. - * cache -statistics=off -c=@c0 - * Disable collection of statistics for cache with name taken from 'c0' memory variable. - * }}} - */ -class VisorCacheToggleStatisticsCommand { - /** - * Prints error message and advise. - * - * @param errMsgs Error messages. - */ - private def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help cache' to see how to use this command.") - } - - private def error(e: Exception) { - var cause: Throwable = e - - while (cause.getCause != null) - cause = cause.getCause - - scold(cause.getMessage) - } - - /** - * ===Command=== - * Toggle statistics collection for cache with specified name. - * - * ===Examples=== - * cache -statistics=on -c=cache - * Enable collection of statistics for cache with name 'cache'. - * cache -statistics=off -c=cache - * Disable collection of statistics for cache with name 'cache'. - * - * @param argLst Command arguments. - */ - def toggle(argLst: ArgList, node: Option[ClusterNode]) { - val cacheArg = argValue("c", argLst) - - val cacheName = cacheArg match { - case None => null // default cache. - - case Some(s) if s.startsWith("@") => - warn("Can't find cache variable with specified name: " + s, - "Type 'cache' to see available cache variables." - ) - - return - - case Some(name) => name - } - - val grp = try { - groupForDataNode(node, cacheName) - } - catch { - case _: ClusterGroupEmptyException => - scold(messageNodeNotFound(node, cacheName)) - - return - } - - try { - val cacheNames = new JavaSet[String]() - cacheNames.add(cacheName) - - val enable = argValue("statistics", argLst) match { - case Some(state) if "on".equalsIgnoreCase(state) => true - case Some(state) if "off".equalsIgnoreCase(state) => false - case _ => - warn("Goal state for collection of cache statistics is not specified.", - "Use \"on\" and \"off\" value of \"statistics\" argument to toggle collection of cache statistics.") - - return - } - - executeRandom(grp, classOf[VisorCacheToggleStatisticsTask], - new VisorCacheToggleStatisticsTaskArg(enable, cacheNames)) - - println("Visor successfully " + (if (enable) "enable" else "disable") + - " collection of statistics for cache: " + escapeName(cacheName)) - } - catch { - case _: ClusterGroupEmptyException => scold(messageNodeNotFound(node, cacheName)) - case e: Exception => error(e) - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorCacheToggleStatisticsCommand { - /** Singleton command. */ - private val cmd = new VisorCacheToggleStatisticsCommand - - /** - * Singleton. - */ - def apply() = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorConsoleCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorConsoleCommand.scala deleted file mode 100644 index 0658ad47a5233..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorConsoleCommand.scala +++ /dev/null @@ -1,104 +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.visor.commands.common - -import org.apache.ignite.visor.visor.NA -import org.apache.ignite.visor.visor - -import scala.collection.JavaConversions._ - -/** - * Command implementation. - */ -trait VisorConsoleCommand { - protected def name: String - - /** - * Prints properly formatted error message like: - * {{{ - * (wrn) : warning message - * }}} - * - * @param warnMsgs Error messages to print. If `null` - this function is no-op. - */ - protected def warn(warnMsgs: Any*) { - assert(warnMsgs != null) - - warnMsgs.foreach{ - case ex: Throwable => visor.warn(ex.getMessage) - case line => visor.warn(line) - } - } - - /** - * Prints standard 'not connected' warn message. - */ - protected def adviseToConnect() { - warn( - "Visor is disconnected.", - "Type 'open' to connect Visor console or 'help open' to get help." - ) - } - - /** - * Check cluster active state and show inform message when cluster has inactive state. - * - * @return `True` when cluster is active. - */ - protected def checkActiveState(): Boolean = { - visor.isActive || { - warn("Can not perform the operation because the cluster is inactive.", - "Note, that the cluster is considered inactive by default if Ignite Persistent Store is used to let all the nodes join the cluster.", - "To activate the cluster execute following command: top -activate.") - - false - } - } - - /** - * Prints warn message and advise. - * - * @param warnMsgs Warning messages. - */ - protected def scold(warnMsgs: Any*) { - assert(warnMsgs != null) - - warn(warnMsgs: _*) - warn(s"Type 'help $name' to see how to use this command.") - } - - /** - * Joins array of strings to a single string with line feed. - * - * @param lines Lines to join together. - * @return Joined line. - */ - protected def join(lines: java.lang.Iterable[_ <: Any]): String = { - if (lines == null || lines.isEmpty) - NA - else - lines.mkString("[", ", ", "]") - } - - protected def join(lines: Array[_ <: Any]): String = { - if (lines == null || lines.isEmpty) - NA - else - lines.mkString("[", ", ", "]") - } -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorTextTable.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorTextTable.scala deleted file mode 100644 index 6612ba4692589..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/common/VisorTextTable.scala +++ /dev/null @@ -1,541 +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.visor.commands.common - -import org.apache.ignite.internal.util.GridStringBuilder -import org.apache.ignite.visor.commands.common.VisorTextTable._ - -import scala.collection.Traversable - -/** - * ==Overview== - * Provides `ASCII`-based table with minimal styling support. - */ -class VisorTextTable { - /** - * Cell style. - */ - private sealed class Style( - var leftPad: Int = 1, // >= 0 - var rightPad: Int = 1, // >= 0 - var align: String = "center" // center, left, right - ) { - assert(leftPad >= 0) - assert(rightPad >= 0) - assert(align != null) - - /** - * Gets overall padding (left + right). - */ - def padding: Int = - leftPad + rightPad - } - - /** - * Cell style. - */ - private object Style { - /** - * - * @param sty Style. - */ - def apply(sty: String): Style = { - assert(sty != null) - - val cs = new Style - - if (!sty.isEmpty) { - for (e <- sty.split(',')) { - val a = e.split(":") - - assert(a.length == 2, "Invalid cell style: " + e.trim) - - val a0 = a(0).trim - val a1 = a(1).trim - - a0 match { - case "leftPad" => cs.leftPad = a1.toInt - case "rightPad" => cs.rightPad = a1.toInt - case "align" => cs.align = a1 - case _ => assert(false, "Invalid style: " + e.trim) - } - } - } - - cs - } - } - - /** - * Cell holder. - */ - private sealed case class Cell(style: Style, lines: Seq[String]) { - assert(style != null) - assert(lines != null) - - /** - * Cell's calculated width including padding. - */ - lazy val width = - if (height > 0) - style.padding + lines.max(Ordering.by[String, Int](_.length)).length - else - style.padding - - /** - * Gets height of the cell. - */ - def height: Int = lines.length - } - - /** - * Margin holder. - */ - private sealed case class Margin( - top: Int = 0, - right: Int = 0, - bottom: Int = 0, - left: Int = 0) { - assert(top >= 0) - assert(right >= 0) - assert(bottom >= 0) - assert(left >= 0) - } - - /** */ - private val NL = '\n' - - /** Headers. */ - private val hdr = collection.mutable.ArrayBuffer.empty[Cell] - - /** Rows. */ - private val rows = collection.mutable.ArrayBuffer.empty[Seq[Cell]] - - /** Current row, if any. */ - private var curRow: collection.mutable.ArrayBuffer[Cell] = _ - - /** Table's margin, if any. */ - private var margin: Margin = Margin() - - /** Default row cell style, if any. */ - private var rowSty: String = "align:left" - - /** Default header cell style, if any. */ - private var hdrSty: String = "align:center" - - /** - * Flag indicating whether or not to draw inside horizontal lines - * between individual rows. - */ - var insideBorder = false - - /** - * Flag indicating whether of not to automatically draw horizontal lines - * for multi line rows. - */ - var autoBorder = true - - /** - * Maximum width of the cell. If any line in the cell exceeds this width - * it will be cut in two or more lines. - * - * '''NOTE''': it doesn't include into account the padding. Only the actual - * string length is counted. - */ - var maxCellWidth = Int.MaxValue - - /** - * - * @param ch Char. - * @param len Dash length. - */ - private def dash(ch: Char, len: Int): String = { - assert(len >= 0) - - new String().padTo(len, ch) - } - - /** - * - * @param s String. - * @param len Dash length. - */ - private def dash(s: String, len: Int): String = { - assert(len >= 0) - - var i = 0 - - val sb = new GridStringBuilder(s.length * len) - - while (i < len) { - sb.a(s) - - i += 1 - } - - sb.toString - } - - /** - * - * @param len Length. - */ - private def blank(len: Int): String = - dash(' ', len) - - /** - * Sets table's margin. - * - * @param top Top margin. - * @param right Right margin. - * @param bottom Bottom margin. - * @param left Left margin. - */ - def margin(top: Int = 0, right: Int = 0, bottom: Int = 0, left: Int = 0) { - assert(top >= 0) - assert(right >= 0) - assert(bottom >= 0) - assert(left >= 0) - - margin = Margin(top, right, bottom, left) - } - - /** - * Starts data row. - */ - def startRow() { - assert(curRow == null) - - curRow = collection.mutable.ArrayBuffer.empty[Cell] - } - - /** - * Ends data row. - */ - def endRow() { - assert(curRow.nonEmpty) - - rows += curRow - - curRow = null - } - - /** - * Adds row (one or more row cells). - * - * @param cells Row cells. For multi-line cells - use `Seq(...)`. - */ - def +=(cells: Any*): VisorTextTable = { - startRow() - - cells foreach { - case s: scala.collection.Iterable[Any] => addRowCell(s.toSeq: _*) - case p: Product => addRowCell(p.productIterator.toSeq: _*) - case a => addRowCell(a) - } - - endRow() - - this - } - - /** - * Adds header (one or more header cells). - * - * @param cells Header cells. For multi-line cells - use `Seq(...)`. - */ - def #=(cells: Any*): VisorTextTable = { - cells foreach { - case s: scala.collection.Iterable[Any] => addHeaderCell(s.toSeq: _*) - case p: Product => addHeaderCell(p.productIterator.toSeq: _*) - case a => addHeaderCell(a) - } - - this - } - - /** - * Adds single header cell. - * - * @param lines One or more cell lines. - */ - def addHeaderCell(lines: Any*): VisorTextTable = { - assert(lines != null) - assert(lines.nonEmpty) - - // Break up long line into multiple ones - if necessary. - val lst = lines flatten(_.toString.grouped(maxCellWidth)) - - hdr += Cell(Style(hdrSty), lst) - - this - } - - /** - * Gets current row style. - */ - def rowStyle = - rowSty - - /** - * Sets current row style. - * - * @param rowSty Row style to set. - */ - def rowStyle(rowSty: String) { - this.rowSty = rowSty - } - - /** - * Gets current header style. - */ - def headerStyle = - rowSty - - /** - * Sets current header style. - * - * @param hdrSty Header style to set. - */ - def headerStyle(hdrSty: String) { - this.hdrSty = hdrSty - } - - /** - * Adds single row cell. - * - * @param lines One or more row cells. Multiple lines will be printed on separate lines. - */ - def addRowCell(lines: Any*): VisorTextTable = { - assert(lines != null) - assert(lines.length >= 0) - assert(curRow != null) - - // Break up long line into multiple ones - if necessary. - val lst = lines flatten { - case it: Traversable[_] => it.flatten(_.toString.grouped(maxCellWidth)) - case null => Seq("") - case obj => obj.toString.grouped(maxCellWidth) - } - - curRow += Cell(Style(rowSty), lst) - - this - } - - /** - * - * @param txt Text to align. - * @param width Width already accounts for padding. - * @param sty Style. - */ - private def aligned(txt: String, width: Int, sty: Style): String = { - assert(txt != null) - assert(width > 0) - assert(sty != null) - assert(txt.length <= width) - - val d = width - txt.length - - val styTxt = txt - - sty.align.trim match { - case "center" => - blank(d / 2) + styTxt + blank(d / 2 + d % 2) - case "left" => - blank(sty.leftPad) + styTxt + blank(d - sty.leftPad) - case "right" => - blank(d - sty.rightPad) + styTxt + blank(sty.rightPad) - case _ => - throw new AssertionError("Invalid align option in: " + sty) - } - } - - /** - * Renders this table. - */ - def render() { - // Make sure table is not empty. - if (hdr.isEmpty && rows.isEmpty) - return - - var colsNum = -1 - - val isHdr = hdr.nonEmpty - - if (isHdr) - colsNum = hdr.size - - // Calc number of columns and make sure all rows are even. - for (r <- rows) - if (colsNum == -1) - colsNum = r.size - else if (colsNum != r.size) - assert(false, "Table with uneven rows.") - - assert(colsNum > 0) - - // At this point all rows in the table have the - // the same number of columns. - - val colWs = new Array[Int](colsNum) // Column widths. - val rowHs = new Array[Int](rows.length) // Row heights. - - // Header height. - var hdrH = 0 - - // Initialize column widths with header row (if any). - for (i <- hdr.indices) { - val c = hdr(i) - - colWs(i) = c.width - - hdrH = math.max(hdrH, c.height) - } - - // Calc row heights and column widths. - for (i <- rows.indices; j <- 0 until colsNum) { - val c = rows(i)(j) - - rowHs(i) = math.max(rowHs(i), c.height) - colWs(j) = math.max(colWs(j), c.width) - } - - // Table width without the border. - val tblW = colWs.sum + colsNum - 1 - - val tbl = new GridStringBuilder() - - // Top margin. - for (_ <- 0 until margin.top) - tbl.a(" ").a(NL) - - // Print header, if any. - if (isHdr) { - tbl.a(blank(margin.left)).a(HDR_CRS).a(dash(HDR_HOR, tblW)).a(HDR_CRS).a(blank(margin.right)).a(NL) - - for (i <- 0 until hdrH) { - // Left margin and '|'. - tbl.a(blank(margin.left)).a(HDR_VER) - - for (j <- hdr.indices) { - val c = hdr(j) - - if (i >= 0 && i < c.height) - tbl.a(aligned(c.lines(i), colWs(j), c.style)) - else - tbl.a(blank(colWs(j))) - - tbl.a(HDR_VER) // '|' - } - - // Right margin. - tbl.a(blank(margin.right)).a(NL) - } - - tbl.a(blank(margin.left)).a(HDR_CRS).a(dash(HDR_HOR, tblW)).a(HDR_CRS).a(blank(margin.right)).a(NL) - } - else - tbl.a(blank(margin.left)).a(ROW_CRS).a(dash(ROW_HOR, tblW)).a(ROW_CRS).a(blank(margin.right)).a(NL) - - // Print rows, if any. - if (rows.nonEmpty) { - val horLine = (i: Int) => { - // Left margin and '+' - tbl.a(blank(margin.left)).a(ROW_CRS) - - for (k <- rows(i).indices) - tbl.a(dash(ROW_HOR, colWs(k))).a(ROW_CRS) - - // Right margin. - tbl.a(blank(margin.right)).a(NL) - } - - for (i <- rows.indices) { - val r = rows(i) - - val rowH = rowHs(i) - - if (i > 0 && ((rowH > 1 && autoBorder) || insideBorder) && rowHs(i - 1) == 1) - horLine(i) - - for (j <- 0 until rowH) { - // Left margin and '|' - tbl.a(blank(margin.left)).a(ROW_VER) - - for (k <- r.indices) { - val c = r(k) - val w = colWs(k) - - if (j < c.height) - tbl.a(aligned(c.lines(j), w, c.style)) - else - tbl.a(blank(w)) - - tbl.a(ROW_VER) // '|' - } - - // Right margin. - tbl.a(blank(margin.right)).a(NL) - } - - if (i < rows.size - 1 && ((rowH > 1 && autoBorder) || insideBorder)) - horLine(i) - } - - tbl.a(blank(margin.left)).a(ROW_CRS).a(dash(ROW_HOR, tblW)).a(ROW_CRS).a(blank(margin.right)).a(NL) - } - - // Bottom margin. - for (_ <- 1 to margin.bottom) - tbl.a(" ").a(NL) - - print(tbl.toString) - } - - def nonEmpty = rows.nonEmpty -} - -/** - * Static context. - */ -object VisorTextTable { - /** Table header horizontal line. */ - private val HDR_HOR = "=" - - /** Table header vertical line. */ - private val HDR_VER = "|" - - /** Table header crossroad line. */ - private val HDR_CRS = "+" - - /** Table row horizontal line. */ - private val ROW_HOR = '-' - - /** Table row vertical line. */ - private val ROW_VER = '|' - - /** Table row crossroad line. */ - private val ROW_CRS = "+" - - /** - * Creates new Visor text table. - */ - def apply() = - new VisorTextTable -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala deleted file mode 100644 index eb5b9787a7c80..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala +++ /dev/null @@ -1,461 +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.visor.commands.config - -import java.util.UUID - -import org.apache.ignite.cluster.ClusterGroupEmptyException -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.internal.visor.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask, VisorSpiDescription} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.cache.VisorCacheCommand._ -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import scala.collection.JavaConversions._ -import scala.language.implicitConversions - -/** - * ==Overview== - * Visor 'config' command implementation. - * - * ==Help== - * {{{ - * +-------------------------------------+ - * | config | Prints node configuration. | - * +-------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * config - * config "{-id=|id8=}" - * }}} - * - * ====Arguments==== - * {{{ - * -id8= - * Node ID8. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * If neither is specified - command starts in interactive mode. - * -id= - * Full node ID. Either '-id8' or '-id' can be specified. - * If neither is specified - command starts in interactive mode. - * }}} - * - * ====Examples==== - * {{{ - * config "-id8=12345678" - * Prints configuration for node with '12345678' ID8. - * config - * Starts command in interactive mode. - * }}} - */ -class VisorConfigurationCommand extends VisorConsoleCommand { - @impl protected val name = "config" - - /** - * ===Command=== - * Run command in interactive mode. - * - * ===Examples=== - * config - * Starts command in interactive mode. - */ - def config() { - if (checkConnected()) { - askForNode("Select node from:") match { - case Some(id) => config("-id=" + id) - case None => () - } - } - } - - /** - * ===Command=== - * Prints configuration of specified node including all caches. - * - * ===Examples=== - * config "-id8=12345678" - * Prints configuration of node with '12345678' ID8. - * - * @param args Command arguments. - */ - def config(args: String) { - if (checkConnected()) { - val argLst = parseArgs(args) - - val nid = parseNode(argLst) match { - case Left(msg) => - scold(msg) - - return - - case Right(None) => - scold("One of -id8 or -id is required.") - - return - - case Right(Some(n)) => - assert(n != null) - - n.id() - } - - try { - val cfg = collectConfiguration(nid) - - printConfiguration(cfg) - - cacheConfigurations(nid).foreach(ccfg => { - println() - - printCacheConfiguration(s"Cache '${escapeName(ccfg.getName)}':", ccfg) - }) - } - catch { - case e: Throwable => scold(e) - } - } - } - - @throws[ClusterGroupEmptyException]("In case of empty topology.") - protected def collectConfiguration(nid: UUID) = { - executeOne(nid, classOf[VisorNodeConfigurationCollectorTask], null) - } - - protected def printConfiguration(cfg: VisorGridConfiguration) { - println("Common Parameters:") - - val cmnT = VisorTextTable() - - val basic = cfg.getBasic - - cmnT += ("Grid name", escapeName(basic.getIgniteInstanceName)) - cmnT += ("Ignite home", safe(basic.getGgHome)) - cmnT += ("Localhost", safe(basic.getLocalHost)) - cmnT += ("Consistent ID", safe(basic.getConsistentId, "")) - cmnT += ("Marshaller", basic.getMarshaller) - cmnT += ("Deployment mode", safe(basic.getDeploymentMode)) - cmnT += ("ClientMode", javaBoolToStr(basic.isClientMode)) - cmnT += ("Daemon", bool2Str(basic.isDaemon)) - cmnT += ("Remote JMX enabled", bool2Str(basic.isJmxRemote)) - cmnT += ("Node restart enabled", bool2Str(basic.isRestart)) - cmnT += ("Network timeout", basic.getNetworkTimeout + "ms") - cmnT += ("Grid logger", safe(basic.getLogger)) - cmnT += ("Discovery startup delay", basic.getDiscoStartupDelay + "ms") - cmnT += ("MBean server", safe(basic.getMBeanServer)) - cmnT += ("ASCII logo disabled", bool2Str(basic.isNoAscii)) - cmnT += ("Discovery order not required", bool2Str(basic.isNoDiscoOrder)) - cmnT += ("Shutdown hook disabled", bool2Str(basic.isNoShutdownHook)) - cmnT += ("Program name", safe(basic.getProgramName)) - cmnT += ("Quiet mode", bool2Str(basic.isQuiet)) - cmnT += ("Success filename", safe(basic.getSuccessFile)) - cmnT += ("Update notification enabled", bool2Str(basic.isUpdateNotifier)) - cmnT += ("Include properties", safe(cfg.getIncludeProperties)) - - val atomic = cfg.getAtomic - - cmnT += ("Atomic Cache Mode", atomic.getCacheMode) - cmnT += ("Atomic Sequence Reservation Size", atomic.getAtomicSequenceReserveSize) - cmnT += ("Atomic Number Of Backup Nodes", atomic.getBackups) - - val trn = cfg.getTransaction - - cmnT += ("Transaction Concurrency", trn.getDefaultTxConcurrency) - cmnT += ("Transaction Isolation", trn.getDefaultTxIsolation) - cmnT += ("Transaction Timeout", trn.getDefaultTxTimeout + "ms") - cmnT += ("Transaction Log Cleanup Delay", trn.getPessimisticTxLogLinger + "ms") - cmnT += ("Transaction Log Size", trn.getPessimisticTxLogSize) - cmnT += ("Transaction Manager Factory", trn.getTxManagerFactory) - cmnT += ("Transaction Use JTA", bool2Str(trn.isUseJtaSync)) - - cmnT.render() - - println("\nMetrics:") - - val metricsT = VisorTextTable() - - val metricsCfg = cfg.getMetrics - - val expTime = metricsCfg.getExpireTime - - metricsT += ("Metrics expire time", if (expTime != Long.MaxValue) expTime + "ms" else "") - metricsT += ("Metrics history size", metricsCfg.getHistorySize) - metricsT += ("Metrics log frequency", metricsCfg.getLoggerFrequency) - - metricsT.render() - - println("\nSPIs:") - - val spisT = VisorTextTable() - - def spiClass(spi: VisorSpiDescription) = { - if (spi != null) spi.getFieldDescriptions.getOrElse("Class Name", NA) else NA - } - - def spisClass(spis: Array[VisorSpiDescription]) = { - spis.map(spiClass).mkString("[", ", ", "]") - } - - val spisCfg = cfg.getSpis - - spisT += ("Discovery", spiClass(spisCfg.getDiscoverySpi)) - spisT += ("Communication", spiClass(spisCfg.getCommunicationSpi)) - spisT += ("Event storage", spiClass(spisCfg.getEventStorageSpi)) - spisT += ("Collision", spiClass(spisCfg.getCollisionSpi)) - spisT += ("Deployment", spiClass(spisCfg.getDeploymentSpi)) - spisT += ("Checkpoints", spisClass(spisCfg.getCheckpointSpis)) - spisT += ("Failovers", spisClass(spisCfg.getFailoverSpis)) - spisT += ("Load balancings", spisClass(spisCfg.getLoadBalancingSpis)) - spisT += ("Indexing", spisClass(spisCfg.getIndexingSpis)) - - spisT.render() - - println("\nClient connector configuration") - - val cliConnCfg = cfg.getClientConnectorConfiguration - val cliConnTbl = VisorTextTable() - - if (cliConnCfg != null) { - cliConnTbl += ("Host", safe(cliConnCfg.getHost, safe(basic.getLocalHost))) - cliConnTbl += ("Port", cliConnCfg.getPort) - cliConnTbl += ("Port range", cliConnCfg.getPortRange) - cliConnTbl += ("Socket send buffer size", formatMemory(cliConnCfg.getSocketSendBufferSize)) - cliConnTbl += ("Socket receive buffer size", formatMemory(cliConnCfg.getSocketReceiveBufferSize)) - cliConnTbl += ("Max connection cursors", cliConnCfg.getMaxOpenCursorsPerConnection) - cliConnTbl += ("Pool size", cliConnCfg.getThreadPoolSize) - cliConnTbl += ("Idle Timeout", cliConnCfg.getIdleTimeout + "ms") - cliConnTbl += ("TCP_NODELAY", bool2Str(cliConnCfg.isTcpNoDelay)) - cliConnTbl += ("JDBC Enabled", bool2Str(cliConnCfg.isJdbcEnabled)) - cliConnTbl += ("ODBC Enabled", bool2Str(cliConnCfg.isOdbcEnabled)) - cliConnTbl += ("Thin Client Enabled", bool2Str(cliConnCfg.isThinClientEnabled)) - cliConnTbl += ("SSL Enabled", bool2Str(cliConnCfg.isSslEnabled)) - cliConnTbl += ("Ssl Client Auth", bool2Str(cliConnCfg.isSslClientAuth)) - cliConnTbl += ("Use Ignite SSL Context Factory", bool2Str(cliConnCfg.isUseIgniteSslContextFactory)) - cliConnTbl += ("SSL Context Factory", safe(cliConnCfg.getSslContextFactory)) - - cliConnTbl.render() - } - else - println("Client Connection is not configured") - - println("\nPeer-to-Peer:") - - val p2pT = VisorTextTable() - - val p2pCfg = cfg.getP2p - - p2pT += ("Peer class loading enabled", bool2Str(p2pCfg.isPeerClassLoadingEnabled)) - p2pT += ("Missed resources cache size", p2pCfg.getPeerClassLoadingMissedResourcesCacheSize) - p2pT += ("Peer-to-Peer loaded packages", safe(p2pCfg.getPeerClassLoadingLocalClassPathExclude)) - - p2pT.render() - - println("\nLifecycle:") - - val lifecycleT = VisorTextTable() - - lifecycleT += ("Beans", safe(cfg.getLifecycle.getBeans)) - - lifecycleT.render() - - println("\nExecutor services:") - - val execSvcT = VisorTextTable() - - val execCfg = cfg.getExecutorService - - execSvcT += ("Public thread pool size", safe(execCfg.getPublicThreadPoolSize)) - execSvcT += ("System thread pool size", safe(execCfg.getSystemThreadPoolSize)) - execSvcT += ("Management thread pool size", safe(execCfg.getManagementThreadPoolSize)) - execSvcT += ("Peer-to-Peer thread pool size", safe(execCfg.getPeerClassLoadingThreadPoolSize)) - execSvcT += ("Rebalance Thread Pool size", execCfg.getRebalanceThreadPoolSize) - execSvcT += ("REST thread pool size", safe(execCfg.getRestThreadPoolSize)) - execSvcT += ("Client connector thread pool size", safe(execCfg.getClientConnectorConfigurationThreadPoolSize)) - - execSvcT.render() - - println("\nSegmentation:") - - val segT = VisorTextTable() - - val segmentationCfg = cfg.getSegmentation - - segT += ("Segmentation policy", safe(segmentationCfg.getPolicy)) - segT += ("Segmentation resolvers", safe(segmentationCfg.getResolvers)) - segT += ("Segmentation check frequency", segmentationCfg.getCheckFrequency) - segT += ("Wait for segmentation on start", bool2Str(segmentationCfg.isWaitOnStart)) - segT += ("All resolvers pass required", bool2Str(segmentationCfg.isAllSegmentationResolversPassRequired)) - - segT.render() - - println("\nEvents:") - - val evtsT = VisorTextTable() - - val inclEvtTypes = Option(cfg.getIncludeEventTypes).fold(NA)(et => arr2Str(et.map(U.gridEventName))) - - evtsT += ("Included event types", inclEvtTypes) - - evtsT.render() - - println("\nREST:") - - val restT = VisorTextTable() - - val restCfg = cfg.getRest - - restT += ("REST enabled", bool2Str(restCfg.isRestEnabled)) - restT += ("Jetty path", safe(restCfg.getJettyPath)) - restT += ("Jetty host", safe(restCfg.getJettyHost)) - restT += ("Jetty port", safe(restCfg.getJettyPort)) - restT += ("Tcp ssl enabled", bool2Str(restCfg.isTcpSslEnabled)) - restT += ("Tcp ssl context factory", safe(restCfg.getTcpSslContextFactory)) - restT += ("Tcp host", safe(restCfg.getTcpHost)) - restT += ("Tcp port", safe(restCfg.getTcpPort)) - - restT.render() - - if (cfg.getUserAttributes.nonEmpty) { - println("\nUser attributes:") - - val uaT = VisorTextTable() - - uaT #= ("Name", "Value") - - cfg.getUserAttributes.foreach(a => uaT += (a._1, a._2)) - - uaT.render() - } else - println("\nNo user attributes defined.") - - if (cfg.getEnv.nonEmpty) { - println("\nEnvironment variables:") - - val envT = VisorTextTable() - - envT.maxCellWidth = 80 - - envT #= ("Name", "Value") - - cfg.getEnv.foreach(v => envT += (v._1, compactProperty(v._1, v._2))) - - envT.render() - } else - println("\nNo environment variables defined.") - - val sysProps = cfg.getSystemProperties.toMap - - if (sysProps.nonEmpty) { - println("\nSystem properties:") - - val spT = VisorTextTable() - - spT.maxCellWidth = 80 - - spT #= ("Name", "Value") - - sysProps.foreach(p => spT += (p._1, compactProperty(p._1, p._2))) - - spT.render() - } else - println("\nNo system properties defined.") - } - - /** - * Splits a string by path separator if it's longer than 100 characters. - * - * @param value String. - * @return List of strings. - */ - private[this] def compactProperty(name: String, value: String): List[String] = { - val ps = System.getProperty("path.separator") - - // Split all values having path separator into multiple lines (with few exceptions...). - val lst = - if (name != "path.separator" && value.indexOf(ps) != -1 && value.indexOf("http:") == -1 && - value.length() > 80) - value.split(ps).toList - else - List(value) - - // Replace whitespaces - lst.collect { - case v => v.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "") - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorConfigurationCommand { - /** Singleton command. */ - private val cmd = new VisorConfigurationCommand - - addHelp( - name = cmd.name, - shortInfo = "Prints node configuration.", - spec = List( - cmd.name, - s"${cmd.name} {-id=|id8=}" - ), - args = List( - "-id8=" -> List( - "Node ID8.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'.", - "If neither is specified - command starts in interactive mode." - ), - "-id=" -> List( - "Full node ID. Either '-id8' or '-id' can be specified.", - "If neither is specified - command starts in interactive mode." - ) - ), - examples = List( - s"${cmd.name} -id8=12345678" -> - "Prints configuration for node with '12345678' id8.", - s"${cmd.name} -id8=@n0" -> - "Prints configuration for node with id8 taken from '@n0' memory variable.", - cmd.name -> - "Starts command in interactive mode." - ), - emptyArgs = cmd.config, - withArgs = cmd.config - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromConfig2Visor(vs: VisorTag): VisorConfigurationCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala deleted file mode 100644 index ac6a1dc85b916..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala +++ /dev/null @@ -1,582 +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.visor.commands.deploy - -import org.apache.ignite.internal.util.io.GridFilenameUtils -import org.apache.ignite.internal.util.lang.{GridFunc => F} -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.typedef.X -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.VisorConsoleCommand -import org.apache.ignite.visor.visor._ - -import com.jcraft.jsch._ - -import java.io._ -import java.net.UnknownHostException -import java.util.concurrent._ - -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * Host data. - */ -private case class VisorHost( - name: String, - port: Int, - uname: String, - passwd: Option[String] -) { - assert(name != null) - assert(port > 0) - assert(uname != null) - assert(passwd != null) - - override def equals(r: Any) = - if (this eq r.asInstanceOf[AnyRef]) - true - else if (r == null || !r.isInstanceOf[VisorHost]) - false - else - r.asInstanceOf[VisorHost].name == name - - override def hashCode() = - name.hashCode() -} - -/** - * Runnable that copies file or directory. - */ -private case class VisorCopier( - host: VisorHost, - key: Option[String], - src: String, - dest: String -) extends Runnable { - assert(host != null) - assert(key != null) - assert(src != null) - assert(dest != null) - - assert(host.passwd.isDefined || key.isDefined) - assert(!(host.passwd.isDefined && key.isDefined)) - - /** SSH session. */ - private var ses: Session = null - - override def run() { - assert(ses == null) - - val ssh = new JSch - - if (key.isDefined) - ssh.addIdentity(key.get) - - ses = ssh.getSession(host.uname, host.name, host.port) - - if (host.passwd.isDefined) - ses.setPassword(host.passwd.get) - - ses.setConfig("StrictHostKeyChecking", "no") - - try { - ses.connect() - - var ch: ChannelSftp = null - - try { - val ggh = ggHome() - - if (ggh == "") - warn("IGNITE_HOME is not set on " + host.name) - else { - ch = ses.openChannel("sftp").asInstanceOf[ChannelSftp] - - ch.connect() - - copy(ch, src, GridFilenameUtils.separatorsToUnix(ggh + "/" + dest)) - - println("ok => " + host.name) - } - } - finally { - if (ch != null && ch.isConnected) - ch.disconnect() - } - } - catch { - case e: JSchException if X.hasCause(e, classOf[UnknownHostException]) => - println("Visor Console failed to deploy. Reason: unknown host - " + host.name) - - case e: JSchException => - println("Visor Console failed to deploy. Reason: " + e.getMessage) - - case e: Exception => - warn(e.getMessage) - } - finally { - if (ses.isConnected) - ses.disconnect() - } - } - - /** - * Gets `IGNITE_HOME` from remote host. - * - * @return `IGNITE_HOME` value. - */ - private def ggHome(): String = { - // Non interactively execute command. - def exec(cmd: String) = { - try { - val ch = ses.openChannel("exec").asInstanceOf[ChannelExec] - - try { - ch.setCommand(cmd) - - ch.connect() - - new BufferedReader(new InputStreamReader(ch.getInputStream)).readLine - } - finally { - if (ch.isConnected) - ch.disconnect() - } - } - catch { - case e: Throwable => - warn(e.getMessage) - - "" - } - } - - // Interactively execute command. - def shell(cmd: String) = { - try { - val ch = ses.openChannel("shell").asInstanceOf[ChannelShell] - - try { - ch.connect() - - // Added to skip login message. - U.sleep(1000) - - val writer = new PrintStream(ch.getOutputStream, true) - - val reader = new BufferedReader(new InputStreamReader(ch.getInputStream)) - - // Send command. - writer.println(cmd) - - // Read echo command. - reader.readLine() - - // Read command result. - reader.readLine() - } - finally { - if (ch.isConnected) - ch.disconnect() - } - } - catch { - case e: Throwable => - warn(e.getMessage) - - "" - } - } - - // Use interactive shell under nix because need read env from .profile and etc. - if (F.isEmpty(exec("cmd.exe"))) - shell("echo $IGNITE_HOME") - else - exec("echo %IGNITE_HOME%") - } - - /** - * Copies file or directory. - * - * @param ch SFTP channel. - * @param src Source path. - * @param dest Destination path. - */ - private def copy(ch: ChannelSftp, src: String, dest: String) { - assert(ch != null) - assert(src != null) - assert(dest != null) - - val root = new File(src) - - if (!root.exists) - throw new Exception("File or folder not found: " + src) - - try { - if (root.isDirectory) { - try - ch.ls(dest) - catch { - case _: SftpException => ch.mkdir(dest) - } - - root.listFiles.foreach( - f => copy(ch, f.getPath, GridFilenameUtils.separatorsToUnix(dest + "/" + f.getName))) - } - else - ch.put(src, dest) - } - catch { - case e: SftpException => - println("Visor Console failed to deploy from: " + src + " to: " + dest + ". Reason: " + e.getMessage) - case e: IOException => - println("Visor Console failed to deploy from: " + src + " to: " + dest + ". Reason: " + e.getMessage) - } - } -} - -/** - * ==Overview== - * Visor 'deploy' command implementation. - * - * ==Help== - * {{{ - * +---------------------------------------------------+ - * | deploy | Copies file or directory to remote host. | - * | | Command relies on SFTP protocol. | - * +---------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * deploy "-h={{:}@}{:} {-u=} - * {-p=} {-k=} -s= {-d}" - * }}} - * - * ====Arguments==== - * {{{ - * -h={{:}@}{:} - * Host specification. - * - * can be a hostname, IP or range of IPs. - * Example of range is 192.168.1.100~150, - * which means all IPs from 192.168.1.100 to 192.168.1.150 inclusively. - * - * Default port number is 22. - * - * This option can be provided multiple times. - * -u= - * Default username. - * Used if specification doesn't contain username. - * If default is not provided as well, current local username will be used. - * -p= - * Default password. - * Used if specification doesn't contain password. - * If default is not provided as well, it will be asked interactively. - * -k= - * Path to private key file. - * If provided, it will be used for all specifications that doesn't contain password. - * -s= - * Source path. - * -d= - * Destination path (relative to IGNITE_HOME). - * If not provided, files will be copied to the root of IGNITE_HOME. - * }}} - * - * ====Examples==== - * {{{ - * deploy "-h=uname:passwd@host -s=/local/path -d=remote/path" - * Copies file or directory to remote host (password authentication). - * deploy "-h=uname@host -k=ssh-key.pem -s=/local/path -d=remote/path" - * Copies file or directory to remote host (private key authentication). - * }}} - */ -class VisorDeployCommand extends VisorConsoleCommand { - @impl protected val name: String = "deploy" - - /** Default port. */ - private val DFLT_PORT = 22 - - /** String that specifies range of IPs. */ - private val RANGE_SMB = "~" - - /** - * Catch point for missing arguments case. - */ - def deploy() { - scold("Missing arguments.") - } - - /** - * ===Command=== - * Copies file or directory to remote host. - * - * ===Examples=== - * deploy "-h=uname:passwd@host -s=/local/path -d=/remote/path" - * Copies file or directory to remote host (password authentication). - * - * deploy "-h=uname@host -k=ssh-key.pem -s=/local/path -d=/remote/path" - * Copies file or directory to remote host (private key authentication). - */ - def deploy(args: String) = breakable { - assert(args != null) - - val argLst = parseArgs(args) - - val dfltUname = argValue("u", argLst) - val dfltPasswd = argValue("p", argLst) - val key = argValue("k", argLst) - val src = argValue("s", argLst) - val dest = argValue("d", argLst) - - if (!src.isDefined) - scold("Source is not defined.").^^ - - var hosts = Set.empty[VisorHost] - - argLst.filter(_._1 == "h").map(_._2).foreach(h => { - try - hosts ++= mkHosts(h, dfltUname, dfltPasswd, key.isDefined) - catch { - case e: IllegalArgumentException => scold(e).^^ - } - }) - - if (hosts.isEmpty) - scold("At least one remote host should be specified.").^^ - - val copiers = hosts.map(VisorCopier(_, key, src.get, dest getOrElse "")) - - try - copiers.map(pool.submit(_)).foreach(_.get) - catch { - case _: RejectedExecutionException => scold("Failed due to system error.").^^ - } - } - - /** - * Parses host string. - * - * @param host Host string. - * @param dfltUname `Option` for default username. - * @param dfltPasswd `Option` for default password. - * @param hasKey Whether private key file is defined. - * @return Set of `Host` instances. - */ - private def mkHosts( - host: String, - dfltUname: Option[String], - dfltPasswd: Option[String], - hasKey: Boolean): Set[VisorHost] = { - assert(host != null) - assert(dfltUname != null) - assert(dfltPasswd != null) - - assert(host != null) - assert(dfltUname != null) - assert(dfltPasswd != null) - - var arr = host.split('@') - - def extractHostsPort(s: String) = { - val hostPort = s.split(':') - - val hosts = expandHost(hostPort(0)) - - val port = - try - if (hostPort.length > 1) hostPort(1).toInt else DFLT_PORT - catch { - case e: NumberFormatException => - scold("Invalid port number: " + hostPort(1)).^^ - - // Never happens. - 0 - } - - if (port <= 0) - scold("Invalid port number: " + port).^^ - - (hosts, port) - } - - if (arr.length == 1) { - val (hosts, port) = extractHostsPort(arr(0)) - - val uname = dfltUname getOrElse System.getProperty("user.name") - val passwd = if (!hasKey) Some(dfltPasswd getOrElse askPassword(uname)) else None - - hosts.map(VisorHost(_, port, uname, passwd)) - } - else if (arr.length == 2) { - val (hosts, port) = extractHostsPort(arr(1)) - - arr = arr(0).split(':') - - val uname = arr(0) - - val passwd = - if (arr.length > 1) - Some(arr(1)) - else if (!hasKey) - Some(dfltPasswd getOrElse askPassword(uname)) - else - None - - hosts.map(VisorHost(_, port, uname, passwd)) - } - else { - scold("Invalid host string: " + host).^^ - - // Never happens. - Set.empty - } - } - - /** - * Parses and expands range of IPs, if needed. Host names without the range - * returned as is. - * - * @param addr Host host with or without `~` range. - * @return Set of individual host names (IPs). - */ - private def expandHost(addr: String): Set[String] = { - assert(addr != null) - - if (addr.contains(RANGE_SMB)) { - val parts = addr.split(RANGE_SMB) - - if (parts.size != 2) - scold("Invalid IP range: " + addr).^^ - - val lastDot = parts(0).lastIndexOf('.') - - if (lastDot < 0) - scold("Invalid IP range: " + addr).^^ - - val (base, begin) = parts(0).splitAt(lastDot) - val end = parts(1) - - try { - val a = begin.substring(1).toInt - val b = end.toInt - - if (a > b) - scold("Invalid IP range: " + addr).^^ - - (a to b).map(base + "." + _).toSet - } - catch { - case _: NumberFormatException => - scold("Invalid IP range: " + addr).^^ - - // Never happens. - Set.empty - } - } - else - Set(addr) - } - - /** - * Interactively asks for password. - * - * @param uname Username. - * @return Password. - */ - private def askPassword(uname: String): String = { - assert(uname != null) - - ask("Password for '" + uname + "': ", "", true) - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorDeployCommand { - /** Singleton command. */ - private val cmd = new VisorDeployCommand - - addHelp( - name = cmd.name, - shortInfo = "Copies file or folder to remote host.", - longInfo = List( - "Copies file or folder to remote host.", - "Command relies on SFTP protocol." - ), - spec = List( - s"${cmd.name} -h={{:}@}{:} {-u=}", - " {-p=} {-k=} -s= {-d}" - ), - args = List( - "-h={{:}@}{:}" -> List( - "Host specification.", - " ", - " can be a hostname, IP or range of IPs.", - "Example of range is 192.168.1.100~150,", - "which means all IPs from 192.168.1.100 to 192.168.1.150 inclusively.", - " ", - "Default port number is 22.", - " ", - "This option can be provided multiple times." - ), - "-u=" -> List( - "Default username.", - "Used if specification doesn't contain username.", - "If default is not provided as well, current local username will be used." - ), - "-p=" -> List( - "Default password.", - "Used if specification doesn't contain password.", - "If default is not provided as well, it will be asked interactively." - ), - "-k=" -> List( - "Path to private key file.", - "If provided, it will be used for all specifications that doesn't contain password." - ), - "-s=" -> "Source path.", - "-d=" -> List( - "Destination path (relative to $IGNITE_HOME).", - "If not provided, files will be copied to the root of $IGNITE_HOME." - ) - ), - examples = List( - s"${cmd.name} -h=uname:passwd@host -s=/local/path -d=/remote/path" -> - "Copies file or folder to remote host (password authentication).", - s"${cmd.name} -h=uname@host -k=ssh-key.pem -s=/local/path -d=/remote/path" -> - "Copies file or folder to remote host (private key authentication)." - ), - emptyArgs = cmd.deploy, - withArgs = cmd.deploy - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromDeploy2Visor(vs: VisorTag): VisorDeployCommand = cmd -} 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 deleted file mode 100644 index d8e768ba18be7..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala +++ /dev/null @@ -1,301 +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.visor.commands.disco - -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.events.EventType._ -import org.apache.ignite.internal.util.lang.{GridFunc => F} -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent -import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask -import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg - -import scala.collection.JavaConversions._ -import scala.collection.immutable._ -import scala.language.{implicitConversions, reflectiveCalls} - -/** - * ==Overview== - * Visor 'disco' command implementation. - * - * ==Help== - * {{{ - * +---------------------------------------------------------------------------------------+ - * | disco | Prints topology change log as seen from the oldest node. | - * | | Time frame for querying events can be specified in arguments. | - * | | | - * | | Note that this command depends on Ignite events. | - * | | | - * | | Ignite events can be individually enabled and disabled and disabled events | - * | | can affect the results produced by this command. Note also that configuration | - * | | of Event Storage SPI that is responsible for temporary storage of generated | - * | | events on each node can also affect the functionality of this command. | - * | | | - * | | By default - all events are DISABLED. But if events enabled then Ignite will | - * | | stores last 10,000 local events on each node. | - * | | Both of these defaults can be changed in configuration. | - * +---------------------------------------------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * disco - * disco "{-t=s|m|h|d} {-r} {-c=}" - * }}} - * - * ====Arguments==== - * {{{ - * -t=s|m|h|d - * Defines time frame for querying events: - * =s Events fired during last seconds. - * =m Events fired during last minutes. - * =h Events fired during last hours. - * =d Events fired during last days. - * -r - * Defines whether sorting should be reversed. - * -c= - * Defines the maximum events count that can be shown. - * }}} - * - * ====Examples==== - * {{{ - * disco - * Prints all discovery events sorted chronologically (oldest first). - * disco "-r" - * Prints all discovery events sorted chronologically in reversed order (newest first). - * disco "-t=2m" - * Prints discovery events fired during last two minutes sorted chronologically. - * }}} - */ -class VisorDiscoveryCommand extends VisorConsoleCommand { - @impl protected val name: String = "disco" - - /** */ - private type TimeFilter = EventFilter - - /** - * ===Command=== - * Prints all discovery events. - * - * ===Examples=== - * disco - * Prints all discovery events sorted chronologically (oldest first). - */ - def disco() { - disco("") - } - - /** - * ===Command=== - * Prints discovery events within specified time frame. - * - * ===Examples=== - * disco "-r" - * Prints all discovery events sorted chronologically in reversed order (newest first). - * - * disco "-t=2m" - * Prints discovery events fired during last two minutes. - */ - def disco(args: String) { - if (checkConnected()) { - val argLst = parseArgs(args) - - val fs = argValue("t", argLst) - - val tm = try - timeFilter(fs) - catch { - case e: IllegalArgumentException => - scold(e.getMessage) - - return; - } - - if (tm > 0) { - val nodes = ignite.cluster.nodes() - - if (nodes.isEmpty) { - scold("Topology is empty.") - - return - } - - val node = ignite.cluster.forOldest().node() - - val cntOpt = argValue("c", argLst) - - val cnt = - try - cntOpt.fold(Int.MaxValue)(_.toInt) - catch { - case _: NumberFormatException => - scold("Invalid count: " + cntOpt.get) - - return - } - - println("Oldest alive node in grid: " + nodeId8Addr(node.id())) - - val evts = - try - events(node, tm, hasArgFlag("r", argLst)) - catch { - case e: Throwable => - scold(e) - - return - } - - if (evts.isEmpty) { - scold( - "No discovery events found.", - "Make sure events are not disabled and Event Storage SPI is properly configured." - ) - - return - } - - nl() - - if (evts.size > cnt) - println("Top " + cnt + " Events:") - else - println("All Events:") - - val t = VisorTextTable() - - // Spaces between ID8(@) and IP are intentional! - t #= ("Timestamp", "Event", "Node ID8(@)", "IP") - - evts.take(cnt).foreach { - case de: VisorGridDiscoveryEvent => - t +=(formatDateTime(de.getTimestamp), de.getName, - nodeId8(de.getEventNodeId) + (if (de.isDaemon) "(daemon)" else ""), - if (F.isEmpty(de.getAddress)) NA else de.getAddress) - case _ => - } - - t.render() - - nl() - } - } - } - - /** - * Gets chronologically sorted list of discovery events. - * - * @param node Node. - * @param tmFrame Time frame to select events. - * @param reverse `True` if sort events in reverse order. - * @return Discovery events. - */ - private def events(node: ClusterNode, tmFrame: Long, reverse: Boolean) = { - assert(node != null) - assert(!node.isDaemon) - - var evts = executeOne(node.id(), classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createEventsArg(EVTS_DISCOVERY, tmFrame)).toSeq - - val nodeStartTime = node.metrics().getStartTime - - 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, 0L) - - evts = Seq(root) ++ evts - } - - evts = evts.sortBy(_.getTimestamp) - - if (reverse) evts.reverse else evts - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorDiscoveryCommand { - /** Singleton command. */ - private val cmd = new VisorDiscoveryCommand - - addHelp( - name = cmd.name, - shortInfo = "Prints topology change log.", - longInfo = List( - "Prints topology change log as seen from the oldest node.", - "Time frame for querying events can be specified in arguments.", - " ", - "Note that this command depends on Ignite events.", - " ", - "Ignite events can be individually enabled and disabled and disabled events", - "can affect the results produced by this command. Note also that configuration", - "of Event Storage SPI that is responsible for temporary storage of generated", - "events on each node can also affect the functionality of this command.", - " ", - "By default - all events are disabled. But if events enabled then Ignite will stores last 10,000 local", - "events on each node. Both of these defaults can be changed in configuration." - ), - spec = List( - cmd.name, - s"${cmd.name} {-t=s|m|h|d} {-r} {-c=}" - ), - args = List( - "-t=s|m|h|d" -> List( - "Defines time frame for querying events:", - " =s Events fired during last seconds.", - " =m Events fired during last minutes.", - " =h Events fired during last hours.", - " =d Events fired during last days." - ), - "-r" -> List( - "Defines whether sorting should be reversed." - ), - "-c=" -> List( - "Defines the maximum events count that can be shown." - ) - ), - examples = List( - cmd.name -> - "Prints all discovery events sorted chronologically (oldest first).", - s"${cmd.name} -r" -> - "Prints all discovery events sorted chronologically in reversed order (newest first).", - s"${cmd.name} -t=2m" -> - "Prints discovery events fired during last two minutes sorted chronologically." - ), - emptyArgs = cmd.disco, - withArgs = cmd.disco - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromDisco2Visor(vs: VisorTag): VisorDiscoveryCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala deleted file mode 100644 index e1d36c78d1791..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala +++ /dev/null @@ -1,474 +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.visor.commands.events - -import org.apache.ignite.events.EventType._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import java.util.UUID - -import org.apache.ignite.internal.visor.event.VisorGridEvent -import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask -import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg - -import scala.collection.JavaConversions._ -import scala.collection.immutable._ -import scala.language.implicitConversions - -/** - * ==Overview== - * Visor 'events' commands implementation. - * - * ==Help== - * {{{ - * +----------------------------------------------------------------------------------------+ - * | events | Prints events from a node. | - * | | | - * | | Note that this command depends on Ignite events. | - * | | | - * | | Ignite events can be individually enabled and disabled and disabled events | - * | | can affect the results produced by this command. Note also that configuration | - * | | of Event Storage SPI that is responsible for temporary storage of generated | - * | | events on each node can also affect the functionality of this command. | - * | | | - * | | By default - all events are DISABLED. But if events enabled then Ignite will | - * | | stores last 10,000 local events on each node. | - * | | Both of these defaults can be changed in configuration. | - * +----------------------------------------------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * events - * events "{-id=|-id8=} {-e=} - * {-t=s|m|h|d} {-s=e|t} {-r} {-c=}" - * }}} - * - * ====Arguments==== - * {{{ - * -id8 - * Node ID8. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * If called without the arguments - starts in interactive mode. - * -id= - * Full node ID. - * Either '-id' or '-id8' can be specified. - * If called without the arguments - starts in interactive mode. - * -e= - * Comma separated list of event types that should be queried: - * ch Checkpoint events. - * de Deployment events. - * di Discovery events. - * jo Job execution events. - * ta Task execution events. - * cl Cloud events. - * ca Cache events. - * cr Cache rebalance events. - * -t=s|m|h|d - * Defines time frame for querying events: - * =s Queries events fired during last seconds. - * =m Queries events fired during last minutes. - * =h Queries events fired during last hours. - * =d Queries events fired during last days. - * -s=e|t - * Defines sorting of queried events: - * =e Sorted by event type. - * =t Sorted chronologically. - * Only one '=e' or '=t' can be specified. - * -r - * Defines if sorting should be reversed. - * Can be specified only with -s argument. - * -c= - * Defines the maximum events count that can be shown. - * Values in summary tables are calculated over the whole list of events. - * }}} - * - * ====Examples==== - * {{{ - * events "-id8=12345678" - * Queries all events from node with '12345678' ID8. - * events "-id8=12345678 -e=di,ca" - * Queries discovery and cache events from node with '12345678' ID8. - * events - * Starts command in interactive mode. - * }}} - */ -class VisorEventsCommand extends VisorConsoleCommand { - @impl protected val name: String = "events" - - /** - * ===Command=== - * Starts command in interactive mode. - * - * ===Examples=== - * events - * Starts command in interactive mode. - */ - def events() { - if (checkConnected()) { - askForNode("Select node from:") match { - case Some(id) => ask("Sort [c]ronologically or by [e]vent type (c/e) [c]: ", "c") match { - case "c" | "C" => nl(); events("-s=t -id=" + id) - case "e" | "E" => nl(); events("-s=e -id=" + id) - case x => nl(); warn("Invalid answer: " + x) - } - case None => () - } - } - } - - /** - * Gets type filter by mnemonics. - * @param typeArg Type mnemonics. - * @throws IllegalArgumentException In case unknown event mnemonic. - * @return Type id filter. - */ - @throws[IllegalArgumentException]("In case unknown event mnemonic.") - protected def typeFilter(typeArg: Option[String]) = { - typeArg.map(_.split(",").flatMap(typeIds)).orNull - } - - /** - * Gets type filter by mnemonic. - * @param mnemonic Type mnemonic. - * @throws IllegalArgumentException In case unknown event mnemonic. - * @return Type id filter. - */ - @throws[IllegalArgumentException]("In case unknown event mnemonic.") - protected def typeIds(mnemonic: String) = { - mnemonic match { - case "ch" => EVTS_CHECKPOINT - case "de" => EVTS_DEPLOYMENT - case "di" => EVTS_DISCOVERY - case "jo" => EVTS_JOB_EXECUTION - case "ta" => EVTS_TASK_EXECUTION - case "ca" => EVTS_CACHE - case "cr" => EVTS_CACHE_REBALANCE - case t => throw new IllegalArgumentException("Unknown event mnemonic: " + t) - } - } - - /** - * Gets command's mnemonic for given event. - * - * @param e Event to get mnemonic for. - * @throws IllegalArgumentException In case unknown event type. - * @return Type mnemonic. - */ - @throws[IllegalArgumentException]("In case unknown event type.") - protected def mnemonic(e: VisorGridEvent) = { - assert(e != null) - - e.getTypeId match { - case t if EVTS_CHECKPOINT.contains(t) => "ch" - case t if EVTS_DEPLOYMENT.contains(t) => "de" - case t if EVTS_DISCOVERY_ALL.contains(t) => "di" - case t if EVTS_JOB_EXECUTION.contains(t)=> "jo" - case t if EVTS_TASK_EXECUTION.contains(t) => "ta" - case t if EVTS_CACHE.contains(t) => "ca" - case t if EVTS_CACHE_REBALANCE.contains(t) => "cr" - case t => throw new IllegalArgumentException("Unknown event type: " + t) - } - } - - /** - * ===Command=== - * Queries events from specified node filtered by type and/or time frame. - * - * ===Examples=== - * events "-id8=12345678" - * Queries all events from node with '12345678' ID8. - * - * events "-id8=12345678 -e=di,ca" - * Queries discovery and cache events from node with '12345678' ID8. - * - * @param args Command parameters. - */ - def events(args: String) { - if (checkConnected()) { - val argLst = parseArgs(args) - - parseNode(argLst) match { - case Left(msg) => scold(msg) - case Right(None) => scold("Either '-id8' or '-id' must be provided.") - case Right(Some(node)) => - val nid = node.id() - - val typeArg = argValue("e", argLst) - val timeArg = argValue("t", argLst) - - val evts = try - collectEvents(nid, typeArg, timeArg) - catch { - case e: Exception => - scold(e) - - return - } - - println("ID8=" + nid8(node)) - - if (evts == null || evts.isEmpty) { - println("No events found.") - - return - } - - val sortedOpt = sort(evts.toList, argValue("s", argLst), hasArgName("r", argLst)) - - if (sortedOpt.isEmpty) - return - - val sorted = sortedOpt.get - - val cntOpt = argValue("c", argLst) - - var cnt = Int.MaxValue - - if (cntOpt.isDefined) - try - cnt = cntOpt.get.toInt - catch { - case e: NumberFormatException => - scold("Invalid count: " + cntOpt.get) - - return - } - - println("Summary:") - - val st = VisorTextTable() - - st += ("Node ID8(@ID)", nodeId8Addr(nid)) - st += ("Total", sorted.size) - st += ("Earliest timestamp", formatDateTime(evts.maxBy(_.getTimestamp).getTimestamp)) - st += ("Oldest timestamp", formatDateTime(evts.minBy(_.getTimestamp).getTimestamp)) - - st.render() - - nl() - - println("Per-Event Summary:") - - var sum = Map[Int, (String, Int, Long, Long)]() - - evts.foreach(evt => { - val info = sum.getOrElse(evt.getTypeId, (null, 0, Long.MinValue, Long.MaxValue)) - - sum += (evt.getTypeId -> ( - "(" + mnemonic(evt) + ") " + evt.getName, - info._2 + 1, - if (evt.getTimestamp > info._3) evt.getTimestamp else info._3, - if (evt.getTimestamp < info._4) evt.getTimestamp else info._4) - ) - }) - - val et = VisorTextTable() - - et #= ( - "Event", - "Total", - ("Earliest/Oldest", "Timestamp"), - ("Rate", "events/sec") - ) - - sum.values.toList.sortBy(_._2).reverse.foreach(v => { - val range = v._3 - v._4 - - et += ( - v._1, - v._2, - (formatDateTime(v._3), formatDateTime(v._4)), - formatDouble(if (range != 0) (v._2.toDouble * 1000) / range else v._2) - ) - }) - - et.render() - - nl() - - if (sorted.size > cnt) - println("Top " + cnt + " Events:") - else - println("All Events:") - - val all = VisorTextTable() - - all.maxCellWidth = 50 - - all #= ("Timestamp", "Description") - - sorted.take(cnt).foreach(evt => - all += (formatDateTime(evt.getTimestamp), U.compact(evt.getShortDisplay)) - ) - - all.render() - } - } - } - - /** - * Collect events. - * - * @param nid Node id. - * @param typeArg Type ids argument. - * @param timeArg Time argument. - * @return - */ - @throws[Exception]("In case of error.") - protected def collectEvents(nid: UUID, typeArg: Option[String], timeArg: Option[String]) = { - val tpFilter = typeFilter(typeArg) - - val tmFilter = timeFilter(timeArg) - - executeOne(nid, classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createEventsArg(tpFilter, tmFilter)) - } - - /** - * Sort events. - * - * @param evts Events to sort. - * @param arg Command argument. - * @param reverse If `true` sorting is reversed. - * @return Sorted events. - */ - private def sort(evts: List[_ <: VisorGridEvent], arg: Option[String], reverse: Boolean) = { - assert(evts != null) - - if (arg.isEmpty) - Some(evts) - else - arg.get.trim match { - case "e" => Some(if (reverse) evts.sortBy(_.getName).reverse else evts.sortBy(_.getName)) - case "t" => Some(if (reverse) evts.sortBy(_.getTimestamp).reverse else evts.sortBy(_.getTimestamp)) - case a: String => - scold("Invalid sorting argument: " + a) - - None - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorEventsCommand { - /** Singleton command. */ - private val cmd = new VisorEventsCommand - - addHelp( - name = "events", - shortInfo = "Print events from a node.", - longInfo = List( - "Print events from a node.", - " ", - "Note that this command depends on Ignite events.", - " ", - "Ignite events can be individually enabled and disabled and disabled events", - "can affect the results produced by this command. Note also that configuration", - "of Event Storage SPI that is responsible for temporary storage of generated", - "events on each node can also affect the functionality of this command.", - " ", - "By default - all events are disabled. But if events enabled then Ignite will stores last 10,000 local", - "events on each node. Both of these defaults can be changed in configuration." - ), - spec = List( - "events", - "events {-id=|-id8=} {-e=}", - " {-t=s|m|h|d} {-s=e|t} {-r} {-c=}" - ), - args = List( - "-id8=" -> List( - "Node ID8.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'.", - "If called without the arguments - starts in interactive mode." - ), - "-id=" -> List( - "Full node ID.", - "Either '-id' or '-id8' can be specified.", - "If called without the arguments - starts in interactive mode." - ), - "-e=" -> List( - "Comma separated list of event types that should be queried:", - " ch Checkpoint events.", - " de Deployment events.", - " di Discovery events.", - " jo Job execution events.", - " ta Task execution events.", - " ca Cache events.", - " cr Cache rebalance events." - ), - "-t=s|m|h|d" -> List( - "Defines time frame for querying events:", - " =s Queries events fired during last seconds.", - " =m Queries events fired during last minutes.", - " =h Queries events fired during last hours.", - " =d Queries events fired during last days." - ), - "-s=e|t" -> List( - "Defines sorting of queried events:", - " =e Sorted by event type.", - " =t Sorted chronologically.", - "Only one '=e' or '=t' can be specified." - ), - "-r" -> List( - "Defines if sorting should be reversed.", - "Can be specified only with -s argument." - ), - "-c=" -> List( - "Defines the maximum events count that can be shown.", - "Values in summary tables are calculated over the whole list of events." - ) - ), - examples = List( - "events -id8=12345678" -> - "Queries all events from node with '12345678' id8.", - "events -id8=@n0" -> - "Queries all events from node with id8 taken from 'n0' memory variable.", - "events -id8=12345678 -e=di,ca" -> - "Queries discovery and cache events from node with '12345678' ID8.", - "events" -> - "Starts command in interactive mode." - ), - emptyArgs = cmd.events, - withArgs = cmd.events - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromEvts2Visor(vs: VisorTag): VisorEventsCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala deleted file mode 100644 index 6f2ddb772fb77..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala +++ /dev/null @@ -1,196 +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.visor.commands.gc - -import org.apache.ignite._ -import org.apache.ignite.cluster.ClusterGroupEmptyException -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import org.apache.ignite.internal.visor.node.VisorNodeGcTask - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} - -/** - * ==Overview== - * Contains Visor command `gc` implementation. - * - * ==Help== - * {{{ - * +---------------------------------------------------------------------------+ - * | gc | Runs garbage collector on remote nodes. | - * | | If specific node is provided, garbage collector is run on that node. | - * | | Otherwise, it will be run on all nodes in topology. | - * +---------------------------------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * gc - * gc "{-id8=|-id=}" - * }}} - * - * ====Arguments==== - * {{{ - * -id8= - * ID8 of the node. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * -id= - * ID of the node. - * Note that either '-id8' or '-id' can be specified. - * }}} - * - * ====Examples==== - * {{{ - * gc "-id8=12345678" - * Runs garbage collector on specified node. - * gc - * Runs garbage collector on all nodes in topology. - * }}} - */ -class VisorGcCommand extends VisorConsoleCommand { - @impl protected val name = "gc" - - /** - * ===Command=== - * Runs `System.gc()` on specified node or on all nodes in topology. - * - * ===Examples=== - * gc "-id8=12345678" - * Runs `System.gc()` on specified node. - */ - def gc(args: String) { - assert(args != null) - - if (checkConnected()) { - val argLst = parseArgs(args) - - try { - val t = VisorTextTable() - - t #= ("Node ID8(@)", "Free Heap Before", "Free Heap After", "Free Heap Delta") - - val NULL: Void = null - - val res = parseNode(argLst) match { - case Left(msg) => - scold(msg) - - return - case Right(None) => executeMulti(classOf[VisorNodeGcTask], NULL) - case Right(Some(node)) => executeOne(node.id, classOf[VisorNodeGcTask], NULL) - } - - res.foreach { - case (nid, stat) => - val roundHb = stat.getSizeBefore / (1024L * 1024L) - val roundHa = stat.getSizeAfter / (1024L * 1024L) - - val sign = if (roundHa > roundHb) "+" else "" - - val deltaPercent = math.round(roundHa * 100d / roundHb - 100) - - t += (nodeId8(nid), roundHb + "mb", roundHa + "mb", sign + deltaPercent + "%") - } - - println("Garbage collector procedure results:") - - t.render() - } - catch { - case e: ClusterGroupEmptyException => scold("Topology is empty.") - case e: IgniteException => scold(e) - } - } - } - - /** - * ===Command=== - * Runs `System.gc()` on all nodes in topology. - * - * ===Examples=== - * gc - * Runs `System.gc()` on all nodes in topology. - */ - def gc() { - gc("") - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorGcCommand { - /** Singleton command. */ - private val cmd = new VisorGcCommand - - addHelp( - name = cmd.name, - shortInfo = "Runs GC on remote nodes.", - longInfo = List( - "Runs garbage collector on remote nodes.", - "If specific node is provided, garbage collector is run on that node.", - "Otherwise, it will be run on all nodes in topology." - ), - spec = List( - cmd.name, - s"${cmd.name} {-id8=|-id=}" - ), - args = List( - "-id8=" -> List( - "ID8 of the node.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'." - ), - "-id=" -> List( - "ID of the node.", - "Note that either '-id8' or '-id' can be specified." - ) - ), - examples = List( - s"${cmd.name} -id8=12345678" -> - "Runs garbage collector on specified node.", - cmd.name -> - "Runs garbage collector on all nodes in topology.", - s"${cmd.name} -id8=@n0" -> - "Runs garbage collector on specified node with id8 taken from 'n0' memory variable." - ), - emptyArgs = cmd.gc, - withArgs = cmd.gc - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromGc2Visor(vs: VisorTag): VisorGcCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala deleted file mode 100644 index 059c38761ffba..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala +++ /dev/null @@ -1,431 +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.visor.commands.kill - -import org.apache.ignite._ -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.internal.IgniteNodeAttributes._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.VisorConsoleCommand -import org.apache.ignite.visor.visor._ - -import java.util.{Collections, UUID} - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * ==Overview== - * Contains Visor command `kill` implementation. - * - * ==Help== - * {{{ - * +--------------------------------+ - * | kill | Kills or restarts node. | - * +--------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * kill - * kill "-in|-ih" - * kill "{-r|-k} {-sc} {-al|-ar|-id8=|-id=}" - * }}} - * - * ====Arguments==== - * {{{ - * -in - * Run command in interactive mode with ability to - * choose a node to kill or restart. - * Note that either '-in' or '-ih' can be specified. - * - * This mode is used by default. - * -ih - * Run command in interactive mode with ability to - * choose a host where to kill or restart nodes. - * Note that either '-in' or '-ih' can be specified. - * -al - * Kill or restart all nodes on this host. - * Note that either '-al' or '-ar' can be specified. - * -ar - * Kill or restart all nodes on other hosts. - * Note that either '-al', '-ar' can be specified. - * -sc - * Skip kill or restart of client nodes for group nodes command. - * -r - * Restart node mode. - * Note that either '-r' or '-k' can be specified. - * If no other parameters provided - command executes on all nodes. - * -k - * Kill (stop) node mode. - * Note that either '-r' or '-k' can be specified. - * If no other parameters provided - command executes on all nodes. - * -id8= - * ID8 of the node to kill or restart. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * If no parameters provided - command starts in interactive mode. - * -id= - * ID of the node to kill or restart. - * Note that either '-id8' or '-id' can be specified. - * If no parameters provided - command starts in interactive mode. - * }}} - * - * ====Examples==== - * {{{ - * kill - * Starts command in interactive mode. - * kill "-id8=12345678 -r" - * Restart node with '12345678' ID8. - * kill -id8=@n0 -r" -> - * Restart specified node with id8 taken from 'n0' memory variable. - * kill -id8=@nl -r" -> - * Restart oldest local node with id8 taken from 'nl' memory variable. - * kill -id8=@nl -k" -> - * Kill (stop) oldest remote node with id8 taken from 'nr' memory variable. - * kill -r -ar" -> - * Restart all remote nodes. - * kill -k -sc -al" -> - * Kill (stop) all local server nodes. - * kill "-k" - * Kill (stop) all nodes. - * }}} - */ -class VisorKillCommand extends VisorConsoleCommand { - @impl protected val name = "kill" - - /** - * ===Command=== - * Stops or restarts a JVM indicated by the node ID. - * - * ===Examples=== - * kill "-id8=12345678 -r" - * Restarts the specified node. - * - * kill "-k" - * Stops all nodes. - * - * @param args Command arguments. - */ - def kill(args: String) = breakable { - if (checkConnected()) { - val argLst = parseArgs(args) - - val iNodes = hasArgFlag("in", argLst) - val iHosts = hasArgFlag("ih", argLst) - - val skipClient = hasArgFlag("sc", argLst) - - if (iNodes && iHosts) - scold("Only one of '-in' or '-ih' can be specified.").^^ - else if ((iNodes || iHosts) && skipClient) - scold("Skip client flag is not allowed in interactive mode.").^^ - else if (iNodes) - interactiveNodes().^^ - else if (iHosts) - interactiveHosts().^^ - - val id8 = argValue("id8", argLst) - val id = argValue("id", argLst) - val restart = hasArgFlag("r", argLst) - val kill = hasArgFlag("k", argLst) - - val allLocal = hasArgFlag("al", argLst) - val allRemote = hasArgFlag("ar", argLst) - - if (kill && restart) - scold("Only one of '-k' or '-r' can be specified.") - else if (!kill && !restart) - scold("Missing '-k' or '-r' option in command: " + args) - else if (Seq(allLocal, allRemote, id8.isDefined, id.isDefined).count((v) => v) > 1) - scold("Only one of -al, -ar, -id8 or -id is allowed.") - else if ((id8.isDefined || id.isDefined) && skipClient) - scold("Skip client flag is allowed only for group command.") - else { - val localGroup = ignite.cluster.forHost(ignite.localNode) - - var nodes = if (id8.isDefined) { - val ns = nodeById8(id8.get) - - if (ns.isEmpty) - scold("Unknown 'id8' value: " + id8.get).^^ - - if (ns.size != 1) - scold("'id8' resolves to more than one node (use full 'id' instead) : " + args).^^ - - ns.toSeq - } - else if (id.isDefined) { - var nid: UUID = null - - try { - nid = UUID.fromString(id.get) - } - catch { - case e: IllegalArgumentException => scold("Invalid node 'id' in args: " + args).^^ - } - - val nodes = ignite.cluster.forNodeId(nid).nodes() - - if (nodes.isEmpty) - scold("'id' does not match any node : " + args).^^ - - nodes.toSeq - } else if (allLocal) { - if (skipClient) - localGroup.forServers().nodes().toSeq - else - localGroup.nodes().toSeq - } - else if (allRemote) { - val remoteGroup = ignite.cluster.forOthers(localGroup) - - if (skipClient) - remoteGroup.forServers().nodes().toSeq - else - remoteGroup.nodes().toSeq - } - else { - if (skipClient) - ignite.cluster.forServers().nodes().toSeq - else - ignite.cluster.nodes().toSeq - } - - if (nodes.isEmpty) { - if (id.isDefined || id8.isDefined) - scold("Node with given ID cannot be found.").^^ - else if (allLocal) - scold("Local nodes cannot be found.").^^ - else if (allRemote) - scold("Remote nodes cannot be found.").^^ - } - - if (restart) { - val excludeNodes = nodes.filter(_.attribute[String](ATTR_RESTART_ENABLED) == "false") - - nodes = nodes.filter(_.attribute[String](ATTR_RESTART_ENABLED) == "true") - - // In case of the restart - check that target node supports it. - if (excludeNodes.nonEmpty) - scold("Node(s) doesn't support restart: " + excludeNodes.map(nid8).mkString("[", ", ", "]")).^^ - - if (nodes.isEmpty) - break - } - - val op = if (restart) "restart" else "kill" - - try - killOrRestart(nodes.map(_.id()), restart) - catch { - case _: IgniteException => scold("Failed to " + op + " due to system error.").^^ - } - } - } - } - - /** - * ===Command=== - * Run command in interactive mode. - * - * ===Examples=== - * kill - * Starts command in interactive mode. - */ - def kill() { - kill("-in") - } - - /** - * Kills or restarts nodes in provided projection. - * - * @param nodes Projection. - * @param restart Restart flag. - */ - private def killOrRestart(nodes: Iterable[UUID], restart: Boolean) { - assert(nodes != null) - - if (nodes.isEmpty) - warn("Topology is empty.").^^ - - val op = if (restart) "restart" else "kill" - - if (!batchMode) { - if (nodes.size == ignite.cluster.nodes().size()) - ask("Are you sure you want to " + op + " ALL nodes? (y/n) [n]: ", "n") match { - case "y" | "Y" => ask("You are about to " + op + " ALL nodes. " + - "Are you 100% sure? (y/n) [n]: ", "n") match { - case "y" | "Y" => () - case "n" | "N" => break() - case x => nl(); warn("Invalid answer: " + x); break() - } - case "n" | "N" => break() - case x => nl(); warn("Invalid answer: " + x); break() - } - else if (nodes.size > 1) - ask("Are you sure you want to " + op + " several nodes? (y/n) [n]: ", "n") match { - case "y" | "Y" => () - case "n" | "N" => break() - case x => nl(); warn("Invalid answer: " + x); break() - } - else - ask("Are you sure you want to " + op + " " + nid8(nodes.head) + " node? (y/n) [n]: ", "n") match { - case "y" | "Y" => () - case "n" | "N" => break() - case x => nl(); warn("Invalid answer: " + x); break() - } - } - - if (restart) - ignite.cluster.restartNodes(nodes) - else - ignite.cluster.stopNodes(nodes) - } - - /** - * Runs interactive mode of the command (choosing node). - */ - private def interactiveNodes() { - askForNode("Select node from:") match { - case Some(id) => ask("Do you want to [k]ill or [r]estart? (k/r) [r]: ", "r") match { - case "k" | "K" => killOrRestart(Seq(id), false) - case "r" | "R" => killOrRestart(Seq(id), true) - case x => nl(); warn("Invalid answer: " + x) - } - case None => () - } - } - - /** - * Runs interactive mode of the command (choosing host). - */ - private def interactiveHosts() { - askForHost("Select host from:") match { - case Some(p) => ask("Do you want to [k]ill or [r]estart? (k/r) [r]: ", "r") match { - case "k" | "K" => killOrRestart(p.nodes().map(_.id), false) - case "r" | "R" => killOrRestart(p.nodes().map(_.id), true) - case x => nl(); warn("Invalid answer: " + x) - } - case None => () - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorKillCommand { - /** Singleton command. */ - private val cmd = new VisorKillCommand - - // Adds command's help to visor. - addHelp( - name = cmd.name, - shortInfo = "Kills or restarts node.", - spec = List( - cmd.name, - s"${cmd.name} -in|-ih", - s"${cmd.name} {-r|-k} {-sc} {-al|-ar|-id8=|-id=}" - ), - args = List( - "-in" -> List( - "Run command in interactive mode with ability to", - "choose a node to kill or restart.", - "Note that either '-in' or '-ih' can be specified.", - " ", - "This mode is used by default." - ), - "-ih" -> List( - "Run command in interactive mode with ability to", - "choose a host where to kill or restart nodes.", - "Note that either '-in' or '-ih' can be specified." - ), - "-al" -> List( - "Kill (stop) all local nodes.", - "Note that either '-al' or '-ar' can be specified." - ), - "-ar" -> List( - "Kill (stop) all remote nodes.", - "Note that either '-al' or '-ar' can be specified." - ), - "-sc" -> List( - "Skip kill or restart of client nodes for group nodes command." - ), - "-r" -> List( - "Restart node mode.", - "Note that either '-r' or '-k' can be specified.", - "If no parameters provided - command starts in interactive mode." - ), - "-k" -> List( - "Kill (stop) node mode.", - "Note that either '-r' or '-k' can be specified.", - "If no parameters provided - command starts in interactive mode." - ), - "-id8=" -> List( - "ID8 of the node to kill or restart.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'.", - "If no parameters provided - command starts in interactive mode." - ), - "-id=" -> List( - "ID of the node to kill or restart.", - "Note that either '-id8' or '-id' can be specified.", - "If no parameters provided - command starts in interactive mode." - ) - ), - examples = List( - cmd.name -> - "Starts command in interactive mode.", - s"${cmd.name} -id8=12345678 -r" -> - "Restart node with id8.", - s"${cmd.name} -id8=@n0 -r" -> - "Restart specified node with id8 taken from 'n0' memory variable.", - s"${cmd.name} -id8=@nl -r" -> - "Restart oldest local node with id8 taken from 'nl' memory variable.", - s"${cmd.name} -id8=@nl -k" -> - "Kill (stop) oldest remote node with id8 taken from 'nr' memory variable.", - s"${cmd.name} -r -ar" -> - "Restart all remote nodes.", - s"${cmd.name} -k -sc -al" -> - "Kill (stop) all local server nodes.", - s"${cmd.name} -k" -> - "Kill (stop) all nodes." - ), - emptyArgs = cmd.kill, - withArgs = cmd.kill - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromKill2Visor(vs: VisorTag): VisorKillCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala deleted file mode 100644 index 861ed5dc2e417..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala +++ /dev/null @@ -1,379 +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.visor.commands.node - -import java.util.UUID - -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.internal.IgniteNodeAttributes._ -import org.apache.ignite.internal.util.lang.{GridFunc => F} -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.typedef.X -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.internal.visor.node.{VisorNodeDataCollectorTask, VisorNodeDataCollectorTaskArg} -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import org.jetbrains.annotations._ - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * ==Overview== - * Contains Visor command `node` implementation. - * - * ==Help== - * {{{ - * +--------------------------------+ - * | node | Prints node statistics. | - * +--------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * node "{-id8=|-id=} {-a}" - * node - * }}} - * - * ====Arguments==== - * {{{ - * -id8= - * ID8 of node. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * If neither specified - command starts in interactive mode. - * -id= - * Full ID of node. Either '-id8' or '-id' can be specified. - * If neither specified - command starts in interactive mode. - * -a - * Print extended information. - * By default - only abbreviated statistics is printed. - * }}} - * - * ====Examples==== - * {{{ - * node - * Starts command in interactive mode. - * node "-id8=12345678" - * Prints statistics for specified node. - * node "-id8=12345678 -a" - * Prints full statistics for specified node. - * }}} - */ -class VisorNodeCommand extends VisorConsoleCommand { - @impl protected val name = "node" - - /** - * ===Command=== - * Run command in interactive mode. - * - * ===Examples=== - * node - * Starts command in interactive mode. - */ - def node() { - if (checkConnected()) { - askForNode("Select node from:") match { - case Some(id) => ask("Detailed statistics (y/n) [n]: ", "n") match { - case "n" | "N" => nl(); node("-id=" + id) - case "y" | "Y" => nl(); node("-a -id=" + id) - case x => nl(); warn("Invalid answer: " + x) - } - case None => () - } - } - } - - private def printDataRegions(node: ClusterNode) { - val arg = new VisorNodeDataCollectorTaskArg(false, EVT_LAST_ORDER_KEY, EVT_THROTTLE_CNTR_KEY, false, false) - - val res = executeMulti(Seq(node.id()), classOf[VisorNodeDataCollectorTask], arg) - - val t = VisorTextTable() - - t #= ("Name", "Page size", "Pages", "Memory", "Rates", "Checkpoint buffer", "Large entries") - - val mm = res.getMemoryMetrics - - mm.values().flatten.toSeq.sortBy(_.getName.toLowerCase).foreach(m => { - // Add row. - t += ( - m.getName, - formatMemory(m.getPageSize), - ( - "Total: " + formatNumber(m.getTotalAllocatedPages), - "Dirty: " + formatNumber(m.getDirtyPages), - "Memory: " + formatNumber(m.getPhysicalMemoryPages), - "Fill factor: " + formatDouble(m.getPagesFillFactor * 100) + "%" - ), - ( - "Total: " + formatMemory(m.getTotalAllocatedSize), - "In RAM: " + formatMemory(m.getPhysicalMemorySize) - ), - ( - "Allocation: " + formatDouble(m.getAllocationRate), - "Eviction: " + formatDouble(m.getEvictionRate), - "Replace: " + formatDouble(m.getPagesReplaceRate) - ), - ( - "Pages: " + formatNumber(m.getCheckpointBufferPages), - "Size: " + formatMemory(m.getCheckpointBufferSize) - ), - formatDouble(m.getLargeEntriesPagesPercentage * 100) + "%" - ) - }) - - nl() - - println("Data region metrics:") - - t.render() - - nl() - } - - /** - * ===Command=== - * Prints full node information. - * - * ===Examples=== - * node "-id8=12345678" - * Prints information for specified node. - * - * node "-id8=12345678 -all" - * Prints full information for specified node. - * - * @param args Command arguments. - */ - def node(@Nullable args: String) = breakable { - if (checkConnected()) { - try { - val argLst = parseArgs(args) - - if (argLst.isEmpty) - warn("Missing arguments.").^^ - else { - val id8 = argValue("id8", argLst) - val id = argValue("id", argLst) - val all = hasArgFlag("a", argLst) - - var node: ClusterNode = null - - if (id8.isDefined) { - val ns = nodeById8(id8.get) - - if (ns.size != 1) - warn("Unknown (invalid) node ID8: " + id8.get).^^ - else - node = ns.head - } - else if (id.isDefined) - try - node = ignite.cluster.node(UUID.fromString(id.get)) - catch { - case _: IllegalArgumentException => warn("Invalid node ID: " + id.get).^^ - } - else - warn("Invalid arguments: " + args).^^ - - if (node != null) { - val t = VisorTextTable() - - t.autoBorder = false - - t.maxCellWidth = 60 - - t += ("ID", node.id) - t += ("ID8", nid8(node)) - t += ("Consistent ID", node.consistentId()) - t += ("Node Type", if (node.isClient) "Client" else "Server") - t += ("Order", node.order) - - (0 /: sortAddresses(node.addresses))((b, a) => { t += ("Address (" + b + ")", a); b + 1 }) - - t += ("OS info", "" + - node.attribute("os.name") + " " + - node.attribute("os.arch") + " " + - node.attribute("os.version")) - - t += ("OS user", node.attribute(ATTR_USER_NAME)) - t += ("Deployment mode", node.attribute(ATTR_DEPLOYMENT_MODE)) - t += ("Language runtime", node.attribute(ATTR_LANG_RUNTIME)) - - val ver = U.productVersion(node) - val verStr = ver.major() + "." + ver.minor() + "." + ver.maintenance() + - (if (F.isEmpty(ver.stage())) "" else "-" + ver.stage()) - - t += ("Ignite version", verStr) - - val igniteInstanceName: String = node.attribute(ATTR_IGNITE_INSTANCE_NAME) - - t += ("Ignite instance name", escapeName(igniteInstanceName)) - - t += ("JRE information", node.attribute(ATTR_JIT_NAME)) - - val m = node.metrics - - t += ("JVM start time", formatDateTime(m.getStartTime)) - t += ("Node start time", formatDateTime(m.getNodeStartTime)) - t += ("Up time", X.timeSpan2HMSM(m.getUpTime)) - t += ("CPUs", formatNumber(m.getTotalCpus)) - t += ("Last metric update", formatDateTime(m.getLastUpdateTime)) - - if (all) { - t += ("Non-loopback IPs", node.attribute(ATTR_IPS)) - t += ("Enabled MACs", node.attribute(ATTR_MACS)) - t += ("Maximum active jobs", formatNumber(m.getMaximumActiveJobs)) - t += ("Current active jobs", formatNumber(m.getCurrentActiveJobs)) - t += ("Average active jobs", formatDouble(m.getAverageActiveJobs)) - t += ("Maximum waiting jobs", formatNumber(m.getMaximumWaitingJobs)) - t += ("Current waiting jobs", formatNumber(m.getCurrentWaitingJobs)) - t += ("Average waiting jobs", formatDouble(m.getAverageWaitingJobs)) - t += ("Maximum rejected jobs", formatNumber(m.getMaximumRejectedJobs)) - t += ("Current rejected jobs", formatNumber(m.getCurrentRejectedJobs)) - t += ("Average rejected jobs", formatDouble(m.getAverageRejectedJobs)) - t += ("Maximum cancelled jobs", formatNumber(m.getMaximumCancelledJobs)) - t += ("Current cancelled jobs", formatNumber(m.getCurrentCancelledJobs)) - t += ("Average cancelled jobs", formatDouble(m.getAverageCancelledJobs)) - t += ("Total rejected jobs", formatNumber(m.getTotalRejectedJobs)) - t += ("Total executed jobs", formatNumber(m.getTotalExecutedJobs)) - t += ("Total cancelled jobs", formatNumber(m.getTotalCancelledJobs)) - t += ("Maximum job wait time", formatNumber(m.getMaximumJobWaitTime) + "ms") - t += ("Current job wait time", formatNumber(m.getCurrentJobWaitTime) + "ms") - t += ("Average job wait time", formatDouble(m.getAverageJobWaitTime) + "ms") - t += ("Maximum job execute time", formatNumber(m.getMaximumJobExecuteTime) + "ms") - t += ("Current job execute time", formatNumber(m.getCurrentJobExecuteTime) + "ms") - t += ("Average job execute time", formatDouble(m.getAverageJobExecuteTime) + "ms") - t += ("Total busy time", formatNumber(m.getTotalBusyTime) + "ms") - t += ("Busy time %", formatDouble(m.getBusyTimePercentage * 100) + "%") - t += ("Current CPU load %", formatDouble(m.getCurrentCpuLoad * 100) + "%") - t += ("Average CPU load %", formatDouble(m.getAverageCpuLoad * 100) + "%") - t += ("Heap memory initialized", formatMemory(m.getHeapMemoryInitialized)) - t += ("Heap memory used", formatMemory(m.getHeapMemoryUsed)) - t += ("Heap memory committed", formatMemory(m.getHeapMemoryCommitted)) - t += ("Heap memory maximum", formatMemory(m.getHeapMemoryMaximum)) - t += ("Non-heap memory initialized", formatMemory(m.getNonHeapMemoryInitialized)) - t += ("Non-heap memory used", formatMemory(m.getNonHeapMemoryUsed)) - t += ("Non-heap memory committed", formatMemory(m.getNonHeapMemoryCommitted)) - t += ("Non-heap memory maximum", formatMemory(m.getNonHeapMemoryMaximum)) - t += ("Current thread count", formatNumber(m.getCurrentThreadCount)) - t += ("Maximum thread count", formatNumber(m.getMaximumThreadCount)) - t += ("Total started thread count", formatNumber(m.getTotalStartedThreadCount)) - t += ("Current daemon thread count", formatNumber(m.getCurrentDaemonThreadCount)) - } - else { - t += ("Threads count", formatNumber(m.getCurrentThreadCount)) - t += ("Cur/avg active jobs", formatNumber(m.getCurrentActiveJobs) + - "/" + formatDouble(m.getAverageActiveJobs)) - t += ("Cur/avg waiting jobs", formatNumber(m.getCurrentWaitingJobs) + - "/" + formatDouble(m.getAverageWaitingJobs)) - t += ("Cur/avg rejected jobs", formatNumber(m.getCurrentRejectedJobs) + - "/" + formatDouble(m.getAverageRejectedJobs)) - t += ("Cur/avg cancelled jobs", formatNumber(m.getCurrentCancelledJobs) + - "/" + formatDouble(m.getAverageCancelledJobs)) - t += ("Cur/avg job wait time", formatNumber(m.getCurrentJobWaitTime) + - "/" + formatDouble(m.getAverageJobWaitTime) + "ms") - t += ("Cur/avg job execute time", formatNumber(m.getCurrentJobExecuteTime) + - "/" + formatDouble(m.getAverageJobExecuteTime) + "ms") - t += ("Cur/avg CPU load %", formatDouble(m.getCurrentCpuLoad * 100) + - "/" + formatDouble(m.getAverageCpuLoad * 100) + "%") - t += ("Heap memory used/max", formatMemory(m.getHeapMemoryUsed) + - "/" + formatMemory(m.getHeapMemoryMaximum)) - } - - println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis)) - - t.render() - - if (all) - printDataRegions(node) - else - println("\nUse \"-a\" flag to see detailed statistics.") - } - } - } - catch { - case e: Exception => scold(e) - } - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorNodeCommand { - /** Singleton command. */ - private val cmd = new VisorNodeCommand - - // Adds command's help to visor. - addHelp( - name = cmd.name, - shortInfo = "Prints node statistics.", - spec = List( - cmd.name, - s"${cmd.name} {-id8=|-id=} {-a}" - ), - args = List( - "-id8=" -> List( - "ID8 of node.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'.", - "If neither specified - command starts in interactive mode." - ), - "-id=" -> List( - "Full ID of node. Either '-id8' or '-id' can be specified.", - "If neither specified - command starts in interactive mode." - ), - "-a" -> List( - "Print extended information.", - "By default - only abbreviated statistics is printed." - ) - ), - examples = List( - cmd.name -> - "Starts command in interactive mode.", - s"${cmd.name} -id8=12345678" -> - "Prints statistics for specified node.", - s"${cmd.name} -id8=@n0 -a" -> - "Prints full statistics for specified node with id8 taken from 'n0' memory variable." - ), - emptyArgs = cmd.node, - withArgs = cmd.node - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromNode2Visor(vs: VisorTag): VisorNodeCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala deleted file mode 100644 index 6801c21ae5679..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala +++ /dev/null @@ -1,307 +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.visor.commands.open - -import java.net.URL -import java.util.logging.{ConsoleHandler, Level, Logger} - -import org.apache.ignite.IgniteSystemProperties._ -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.internal.IgniteComponentType._ -import org.apache.ignite.internal.IgniteEx -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.spring.IgniteSpringHelper -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.logger.NullLogger -import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ -import org.apache.ignite.visor.{VisorTag, visor} -import org.apache.ignite.{IgniteException, IgniteSystemProperties, Ignition} - -import scala.language.{implicitConversions, reflectiveCalls} - -/** - * ==Overview== - * Contains Visor command `node` implementation. - * - * ==Help== - * {{{ - * +--------------------------------+ - * | node | Prints node statistics. | - * +--------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * node "{-id8=|-id=} {-a}" - * node - * }}} - * - * ====Arguments==== - * {{{ - * -id8= - * ID8 of node. Either '-id8' or '-id' can be specified. - * If neither specified - command starts in interactive mode. - * -id= - * Full ID of node. Either '-id8' or '-id' can be specified. - * If neither specified - command starts in interactive mode. - * -a - * Print extended information. - * By default - only abbreviated statistics is printed. - * }}} - * - * ====Examples==== - * {{{ - * node - * Starts command in interactive mode. - * node "-id8=12345678" - * Prints statistics for specified node. - * node "-id8=12345678 -a" - * Prints full statistics for specified node. - * }}} - */ -class VisorOpenCommand extends VisorConsoleCommand { - @impl protected val name = "open" - - /** Default configuration path relative to Ignite home. */ - private final val DFLT_CFG = "config/default-config.xml" - - /** - * ==Command== - * Connects Visor console to the default grid. - * - * ==Example== - * open - * Connects to the default grid. - */ - def open() { - open("") - } - - /** - * ==Command== - * Connects Visor console to default or named grid. - * - * ==Examples== - * open -g=mygrid - * Connects to 'mygrid' grid. - * - * @param args Command arguments. - */ - def open(args: String) { - assert(args != null) - - if (isConnected) { - warn("Visor is already connected. Disconnect first.") - - return - } - - try { - def configuration(path: String): IgniteConfiguration = { - assert(path != null) - - val url = - try - new URL(path) - catch { - case e: Exception => - val url = U.resolveIgniteUrl(path) - - if (url == null) - throw new IgniteException("Ignite configuration path is invalid: " + path, e) - - url - } - - if (visor.quiet) { - val springLog = Logger.getLogger("org.springframework") - - if (springLog != null) - springLog.setLevel(Level.WARNING) - } - - val spring: IgniteSpringHelper = SPRING.create(false) - - val cfgs = - // Cache, indexing SPI configurations should be excluded from daemon node config. - spring.loadConfigurations(url, "cacheConfiguration", "lifecycleBeans", "indexingSpi").get1() - - if (cfgs == null || cfgs.isEmpty) - throw new IgniteException("Can't find grid configuration in: " + url) - - if (cfgs.size > 1) - throw new IgniteException("More than one grid configuration found in: " + url) - - val cfg = cfgs.iterator().next() - - if (visor.quiet) - cfg.setGridLogger(new NullLogger) - else { - if (classOf[Ignition].getClassLoader.getResource("org/apache/logging/log4j/core/Appender.class") != null) - System.setProperty(IgniteSystemProperties.IGNITE_CONSOLE_APPENDER, "false") - else - Logger.getGlobal.getHandlers.foreach({ - case handler: ConsoleHandler => Logger.getGlobal.removeHandler(handler) - }) - } - - // Setting up 'Config URL' for properly print in console. - System.setProperty(IgniteSystemProperties.IGNITE_CONFIG_URL, url.getPath) - - cfg.setConnectorConfiguration(null) - - var ioSpi = cfg.getCommunicationSpi - - if (ioSpi == null) - ioSpi = new TcpCommunicationSpi() - - cfg - } - - val argLst = parseArgs(args) - - val path = argValue("cpath", argLst) - val dflt = hasArgFlag("d", argLst) - - val (cfg, cfgPath) = - if (path.isDefined) - (configuration(path.get), path.get) - else if (dflt) - (configuration(DFLT_CFG), "") - else { - // If configuration file is not defined in arguments, - // ask to choose from the list - askConfigFile() match { - case Some(p) => - nl() - - (VisorTextTable() +=("Using configuration", p)) render() - - nl() - - (configuration(p), p) - case None => - return - } - } - - open(cfg, cfgPath) - } - catch { - case e: IgniteException => - warn("Type 'help open' to see how to use this command.") - - status("q") - - throw e; - } - } - - /** - * Connects Visor console to configuration with path. - * - * @param cfg Configuration. - * @param cfgPath Configuration path. - */ - def open(cfg: IgniteConfiguration, cfgPath: String) = { - val daemon = Ignition.isDaemon - - val shutdownHook = IgniteSystemProperties.getString(IGNITE_NO_SHUTDOWN_HOOK, "false") - - // Make sure Visor console starts as daemon node. - Ignition.setDaemon(true) - - // Make sure visor starts without shutdown hook. - System.setProperty(IGNITE_NO_SHUTDOWN_HOOK, "true") - - ignite = try { - // We need to stop previous daemon node before to start new one. - prevIgnite.foreach(g => Ignition.stop(g.name(), true)) - - Ignition.start(cfg).asInstanceOf[IgniteEx] - } - finally { - Ignition.setDaemon(daemon) - - System.setProperty(IGNITE_NO_SHUTDOWN_HOOK, shutdownHook) - } - - prevIgnite = Some(ignite) - - visor.open(ignite.name(), cfgPath) - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorOpenCommand { - /** Singleton command. */ - private val cmd = new VisorOpenCommand - - // Adds command's help to visor. - addHelp( - name = "open", - shortInfo = "Connects Visor console to the grid.", - longInfo = Seq( - "Connects Visor console to the grid. Note that P2P class loading", - "should be enabled on all nodes.", - " ", - "If neither '-cpath' or '-d' are provided, command will ask", - "user to select Ignite configuration file in interactive mode." - ), - spec = Seq( - "open -cpath=", - "open -d" - ), - args = Seq( - "-cpath=" -> Seq( - "Ignite configuration path.", - "Can be absolute, relative to Ignite home folder or any well formed URL." - ), - "-d" -> Seq( - "Flag forces the command to connect to grid using default Ignite configuration file.", - "without interactive mode." - ) - ), - examples = Seq( - "open" -> - "Prompts user to select Ignite configuration file in interactive mode.", - "open -d" -> - "Connects Visor console to grid using default Ignite configuration file.", - "open -cpath=/gg/config/mycfg.xml" -> - "Connects Visor console to grid using Ignite configuration from provided file." - ), - emptyArgs = cmd.open, - withArgs = cmd.open - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromNode2Visor(vs: VisorTag): VisorOpenCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala deleted file mode 100644 index 307b78d672430..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala +++ /dev/null @@ -1,217 +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.visor.commands.ping - -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import java.util.concurrent._ - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * Ping result container. - */ -private class Result { - /** Total pings count. */ - var total = 0 - - /** Successful pings count. */ - var oks = 0 - - /** Failed pings count */ - var fails = 0 - - /** Failed nodes. */ - val failedNodes = collection.mutable.Set.empty[ClusterNode] -} - -/** - * Thread that pings one node. - */ -private case class Pinger(n: ClusterNode, res: Result) extends Runnable { - assert(n != null) - assert(res != null) - - override def run() { - val ok = ignite.cluster.pingNode(n.id()) - - res.synchronized { - res.total += 1 - - if (ok) - res.oks += 1 - else { - res.fails += 1 - res.failedNodes += n - } - } - } -} - -/** - * ==Command== - * Visor 'ping' command implementation. - * - * ==Help== - * {{{ - * +--------------------+ - * | ping | Pings node. | - * +--------------------+ - * }}} - * - * ====Specification==== - * {{{ - * ping {"id81 id82 ... id8k"} - * }}} - * - * ====Arguments==== - * {{{ - * id8k - * ID8 of the node to ping. - * }}} - * - * ====Examples==== - * {{{ - * ping "12345678" - * Pings node with '12345678' ID8. - * ping - * Pings all nodes in the topology. - * }}} - */ -class VisorPingCommand extends VisorConsoleCommand { - @impl protected val name = "ping" - - /** - * ===Command=== - * Pings node(s) by its ID8. - * - * ===Examples=== - * ping "12345678 56781234" - * Pings nodes with '12345678' and '56781234' ID8s. - * - * @param args List of node ID8s. If empty or null - pings all nodes in the topology. - */ - def ping(args: String) = breakable { - if (checkConnected()) { - val argLst = parseArgs(args) - - val res = new Result() - - var pings = List.empty[Pinger] - - if (argLst.isEmpty) - pings ++= ignite.cluster.nodes().map(Pinger(_, res)) - else { - for (id8 <- argLst) { - if (id8._1 != null || id8._2 == null) - scold("Invalid ID8: " + argName(id8)) - else { - val ns = nodeById8(id8._2) - - if (ns.size != 1) - scold("Unknown ID8: " + argName(id8)) - else - pings +:= Pinger(ns.head, res) - } - } - } - - if (pings.isEmpty) - scold("Topology is empty.") - else { - try - pings.map(pool.submit(_)).foreach(_.get) - catch { - case _: RejectedExecutionException => scold("Ping failed due to system error.").^^ - } - - val t = VisorTextTable() - - // No synchronization on 'res' is needed since all threads - // are finished and joined. - t += ("Total pings", res.total) - t += ("Successful pings", res.oks + " (" + formatInt(100 * res.oks / res.total) + "%)") - t += ("Failed pings", res.fails + " (" + formatInt(100 * res.fails / res.total) + "%)") - - if (res.failedNodes.nonEmpty) - t += ("Failed nodes", res.failedNodes.map(n => nodeId8Addr(n.id))) - - t.render() - } - } - } - - /** - * ===Command=== - * Pings all nodes in the topology. - * - * ===Examples=== - * ping - * Pings all nodes in the topology. - */ - def ping() { - ping("") - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorPingCommand { - /** Singleton command. */ - private val cmd = new VisorPingCommand - - // Adds command's help to visor. - addHelp( - name = cmd.name, - shortInfo = "Pings node.", - spec = List(s"${cmd.name} ... "), - args = List( - ("", - "ID8 of the node to ping. Note you can also use '@n0' ... '@nn' variables as shortcut to .") - ), - examples = List( - s"${cmd.name} 12345678" -> - "Pings node with '12345678' ID8.", - s"${cmd.name} @n0" -> - "Pings node with 'specified node with ID8 taken from 'n0' memory variable.", - cmd.name -> - "Pings all nodes in the topology." - ), - emptyArgs = cmd.ping, - withArgs = cmd.ping - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromPing2Visor(vs: VisorTag): VisorPingCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala deleted file mode 100644 index 86273e6b301f5..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala +++ /dev/null @@ -1,425 +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.visor.commands.start - -import org.apache.ignite._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import java.io._ -import java.util.concurrent._ - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * Node start attempt result. - */ -private case class Result( - host: String, - ok: Boolean, - errMsg: String = null -) { - assert(host != null) -} - -/** - * ==Overview== - * Contains Visor command `start` implementation. - * - * ==Help== - * {{{ - * +-----------------------------------------------------+ - * | start | Starts one or more nodes on remote host(s). | - * | | Uses SSH protocol to execute commands. | - * +-----------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * start "-f= {-m=} {-r}" - * start "-h= {-p=} {-u=} {-pw=} {-k=} - * {-n=} {-g=} {-c=} {-s=} {-m=} {-r}" - * }}} - * - * ====Arguments==== - * {{{ - * -f= - * Path to INI file that contains topology specification. - * -h= - * Hostname where to start nodes. - * - * Can define several hosts if their IPs are sequential. - * Example of range is 192.168.1.100~150, - * which means all IPs from 192.168.1.100 to 192.168.1.150 inclusively. - * -p= - * Port number (default is 22). - * -u= - * Username (if not defined, current local username will be used). - * -pw= - * Password (if not defined, private key file must be defined). - * -k= - * Path to private key file. Define if key authentication is used. - * -n= - * 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 '-r' flag is not set, then nothing will happen. - * -g= - * Path to Ignite installation folder. - * If not defined, IGNITE_HOME environment variable must be set on remote hosts. - * -c= - * Path to configuration file (relative to Ignite home). - * If not provided, default Ignite configuration is used. - * -s= - * Path to start script (relative to Ignite home). - * Default is "bin/ignite.sh" for Unix or - * "bin\ignite.bat" for Windows. - * -m= - * Defines maximum number of nodes that can be started in parallel on one host. - * This actually means number of parallel SSH connections to each SSH server. - * Default is 5. - * -t= - * Defines connection timeout in milliseconds. - * Default is 2000. - * -r - * Indicates that existing nodes on the host will be restarted. - * By default, if flag is not present, existing nodes will be left as is. - * }}} - * - * ====Examples==== - * {{{ - * start "-h=10.1.1.10 -u=uname -pw=passwd -n=3" - * Starts three nodes with default configuration (password authentication). - * start "-h=192.168.1.100~104 -u=uname -k=/home/uname/.ssh/is_rsa -n=5" - * Starts 25 nodes on 5 hosts (5 nodes per host) with default configuration (key-based authentication). - * start "-f=start-nodes.ini -r" - * Starts topology defined in 'start-nodes.ini' file. Existing nodes are stopped. - * }}} - */ -class VisorStartCommand extends VisorConsoleCommand { - @impl protected val name = "start" - - /** Default maximum number of parallel connections. */ - private final val DFLT_MAX_CONN = 5 - - /** Default connection timeout. */ - private final val DFLT_TIMEOUT = 2000 - - /** - * Catch point for missing arguments case. - */ - def start() { - scold("Missing arguments.") - } - - /** - * ===Command=== - * Starts or restart one or more nodes on remote host. - * Uses SSH protocol to execute commands. - * - * ===Examples=== - * start "-h=uname:passwd@host#3" - * Starts three nodes with default configuration (password authentication). - * - * start "-h=uname@host#3 -k=ssh-key.pem" - * Starts three nodes with default configuration (key authentication). - * - * start "-f=hosts.txt -c=config/spring.xml" - * Reads `hosts.txt` file and starts nodes with provided configuration. - * - * @param args Command arguments. - */ - def start(args: String) = breakable { - assert(args != null) - - if (checkConnected()) { - val argLst = parseArgs(args) - - val fileOpt = argValue("f", argLst) - val hostOpt = argValue("h", argLst) - val portOpt = argValue("p", argLst) - val unameOpt = argValue("u", argLst) - val passwdOpt = argValue("pw", argLst) - val keyOpt = argValue("k", argLst) - val nodesOpt = argValue("n", argLst) - val igniteHomeOpt = argValue("g", argLst) - val cfgOpt = argValue("c", argLst) - val scriptOpt = argValue("s", argLst) - val maxConnOpt = argValue("m", argLst) - val timeoutOpt = argValue("t", argLst) - val restart = hasArgFlag("r", argLst) - - val maxConn = maxConnOpt match { - case None => DFLT_MAX_CONN - case Some(mc) => - try { - mc.toInt - } - catch { - case e: NumberFormatException => - scold("Invalid maximum number of parallel connections: " + maxConnOpt.get).^^ - - 0 // Never happens. - } - } - - if (maxConn <= 0) - scold("Invalid maximum number of parallel connections: " + maxConn).^^ - - val timeout = timeoutOpt match { - case None => DFLT_TIMEOUT - case Some(to) => - try { - to.toInt - } - catch { - case e: NumberFormatException => - scold("Invalid timeout: " + to).^^ - - 0 // Never happens. - } - } - - if (timeout <= 0) - scold("Invalid connection timeout: " + timeout).^^ - - var res = Seq.empty[Result] - - if (fileOpt.isDefined) { - val file = new File(fileOpt.get) - - if (!file.exists()) - scold("File not found: " + file.getAbsolutePath).^^ - - if (file.isDirectory) - scold("File is a directory: " + file.getAbsolutePath).^^ - - try - res = ignite.cluster.startNodes(file, restart, timeout, maxConn).map(t => { - Result(t.getHostName, t.isSuccess, t.getError) - }).toSeq - catch { - case e: IgniteException => scold(e).^^ - case _: RejectedExecutionException => scold("Failed due to system error.").^^ - } - } - else { - if (hostOpt.isEmpty) - scold("Hostname is required.").^^ - - val port: java.lang.Integer = - try { - if (portOpt.isDefined) portOpt.get.toInt else null.asInstanceOf[java.lang.Integer] - } - catch { - case e: NumberFormatException => scold("Invalid port number: " + portOpt.get).^^ - - 0 // Never happens. - } - - if (port != null && port <= 0) - scold("Invalid port number: " + port).^^ - - val keyFile = if (keyOpt.isDefined) new File(keyOpt.get) else null - - if (keyFile != null && (!keyFile.exists || !keyFile.isFile)) - scold("File not found: " + keyFile.getAbsolutePath).^^ - - val nodes: java.lang.Integer = - try { - if (nodesOpt.isDefined) nodesOpt.get.toInt else null.asInstanceOf[java.lang.Integer] - } - catch { - case e: NumberFormatException => scold("Invalid number of nodes: " + nodesOpt.get).^^ - - 0 // Never happens. - } - - if (nodes != null && nodes <= 0) - scold("Invalid number of nodes: " + nodes).^^ - - val params: Map[String, AnyRef] = Map( - "host" -> hostOpt.get, - "port" -> port, - "uname" -> unameOpt.orNull, - "passwd" -> passwdOpt.orNull, - "key" -> keyFile, - "nodes" -> nodes, - "igniteHome" -> igniteHomeOpt.orNull, - "cfg" -> cfgOpt.orNull, - "script" -> scriptOpt.orNull - ) - - try - res = ignite.cluster.startNodes(asJavaCollection(Seq(params)), null, restart, timeout, maxConn). - map(t => Result(t.getHostName, t.isSuccess, t.getError)).toSeq - catch { - case e: IgniteException => scold(e).^^ - case _: RejectedExecutionException => scold("Failed due to system error.").^^ - } - } - - val resT = VisorTextTable() - - resT += ("Successful start attempts", res.count(_.ok)) - resT += ("Failed start attempts", res.count(!_.ok)) - - resT.render() - - if (res.exists(!_.ok)) { - nl() - - println("Errors:") - - val errT = VisorTextTable() - - errT.maxCellWidth = 70 - - errT #= ("Host", "Error") - - val ue = "java.lang.UnsupportedOperationException: " - - res.filter(!_.ok).groupBy(r => r).foreach { - case (r, _) if r.errMsg.linesIterator.next().startsWith(ue) => - errT += (r.host, r.errMsg.linesIterator.next().replace(ue, "")) - - case (r, _) => - errT += (r.host, r.errMsg.replace("\t", " ").split(U.nl()).toSeq) - } - - errT.render() - } - - nl() - - println("Type 'top' to see current topology.") - - nl() - - println("NOTE:") - println(" - Successful start attempt DOES NOT mean that node actually started.") - println(" - Log files are stored in $TMPDIR/ignite-startNodes folder or /tmp/ignite-startNodes if $TMPDIR is not set.") - println(" - For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start.") - println(" - See individual node log for details.") - } - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorStartCommand { - /** Singleton command. */ - private val cmd = new VisorStartCommand - - addHelp( - name = "start", - shortInfo = "Starts or restarts nodes on remote hosts.", - longInfo = List( - "Starts one or more nodes on remote host(s).", - "Uses SSH protocol to execute commands." - ), - spec = List( - "start -f= {-m=} {-r}", - "start -h= {-p=} {-u=} {-pw=} {-k=}", - "{-n=} {-g=} {-c=} {-s=} {-m=} {-r}" - ), - args = List( - "-f=" -> List( - "Path to INI file that contains topology specification.", - "For sample INI file refer to 'bin/include/visorcmd/node_startup_by_ssh.sample.ini'." - ), - "-h=" -> List( - "Hostname where to start nodes.", - " ", - "Can define several hosts if their IPs are sequential.", - "Example of range is 192.168.1.100~150,", - "which means all IPs from 192.168.1.100 to 192.168.1.150 inclusively." - ), - "-p=" -> List( - "Port number (default is 22)." - ), - "-u=" -> List( - "Username (if not defined, current local username will be used)." - ), - "-pw=" -> List( - "Password (if not defined, private key file must be defined)." - ), - "-k=" -> List( - "Path to private key file. Define if key authentication is used." - ), - "-n=" -> List( - "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 '-r' flag is not set, then nothing will happen." - ), - "-g=" -> List( - "Path to Ignite installation folder.", - "If not defined, IGNITE_HOME environment variable must be set on remote hosts." - ), - "-c=" -> List( - "Path to configuration file (relative to Ignite home).", - "If not provided, default Ignite configuration is used." - ), - "-s=" -> List( - "Path to start script (relative to Ignite home).", - "Default is \"bin/ignite.sh\" for Unix or", - "\"bin\\ignite.bat\" for Windows." - ), - "-m=" -> List( - "Defines maximum number of nodes that can be started in parallel on one host.", - "This actually means number of parallel SSH connections to each SSH server.", - "Default is 5." - ), - "-t=" -> List( - "Defines connection timeout in milliseconds.", - "Default is 2000." - ), - "-r" -> List( - "Indicates that existing nodes on the host will be restarted.", - "By default, if flag is not present, existing nodes will be left as is." - ) - ), - examples = List( - "start -h=10.1.1.10 -u=uname -pw=passwd -n=3" -> - "Starts three nodes with default configuration (password authentication).", - "start -h=192.168.1.100~104 -u=uname -k=/home/uname/.ssh/is_rsa -n=5" -> - "Starts 25 nodes on 5 hosts (5 nodes per host) with default configuration (key-based authentication).", - "start -f=start-nodes.ini -r" -> - "Starts topology defined in 'start-nodes.ini' file. Existing nodes are stopped." - ), - emptyArgs = cmd.start, - withArgs = cmd.start - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromStart2Visor(vs: VisorTag): VisorStartCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala deleted file mode 100644 index 91868662781e5..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala +++ /dev/null @@ -1,1445 +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.visor.commands.tasks - -import java.util.UUID - -import org.apache.ignite._ -import org.apache.ignite.events.EventType._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.typedef.X -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.internal.visor.event.{VisorGridEvent, VisorGridJobEvent, VisorGridTaskEvent} -import org.apache.ignite.internal.visor.node.{VisorNodeEventsCollectorTask, VisorNodeEventsCollectorTaskArg} -import org.apache.ignite.internal.visor.util.{VisorTaskUtils => TU} -import org.apache.ignite.lang.IgniteUuid -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import scala.collection.JavaConversions._ -import scala.language.implicitConversions -import scala.util.control.Breaks._ - -/** - * Task execution state. - */ -private object State extends Enumeration { - /** Type shortcut. */ - type State = Value - - val STARTED = Value("Started") - val FINISHED = Value("Finished") - val TIMEDOUT = Value("Timed out") - val FAILED = Value("Failed") - val UNDEFINED = Value("") -} - -import org.apache.ignite.visor.commands.tasks.State._ - -/** - * Task execution data. - */ -private case class VisorExecution( - id: IgniteUuid, - taskName: String, - var evts: List[_ <: VisorGridEvent] = Nil, - var nodeIds: Set[UUID] = Set.empty[UUID], - var failedNodeIds: Set[UUID] = Set.empty[UUID], - var startTs: Long = Long.MaxValue, - var endTs: Long = Long.MinValue, - var state: State = UNDEFINED, - var origNodeId: UUID = null -) { - assert(id != null) - assert(taskName != null) - - /** - * ID8 form of task execution ID. - */ - lazy val id8: String = U.id8(id) - - /** - * ID8 of the task execution + its associated variable. - */ - lazy val id8Var: String = - id8 + "(@" + setVarIfAbsent(id, "e") + ')' - - /** - * Task host + its associated variable host. - */ - lazy val taskNameVar: String = - taskName + "(@" + setVarIfAbsent(taskName, "t") + ')' - - /** - * Gets number of job rejections in this session. - */ - lazy val rejections: Int = - evts.count(_.getTypeId == EVT_JOB_REJECTED) - - /** - * Gets number of job cancellations in this session. - */ - lazy val cancels: Int = - evts.count(_.getTypeId == EVT_JOB_CANCELLED) - - /** - * Gets number of job finished in this session. - */ - lazy val finished: Int = - evts.count(_.getTypeId == EVT_JOB_FINISHED) - - /** - * Gets number of job started in this session. - */ - lazy val started: Int = - evts.count(_.getTypeId == EVT_JOB_STARTED) - - /** - * Gets number of job failures in this session. - */ - lazy val failures: Int = - evts.count(_.getTypeId == EVT_JOB_FAILED) - - /** - * Gets number of job failovers in this session. - */ - lazy val failovers: Int = - evts.count(_.getTypeId == EVT_JOB_FAILED_OVER) - - /** - * Gets duration of the session. - */ - lazy val duration: Long = - endTs - startTs - - override def equals(r: Any) = - if (this eq r.asInstanceOf[AnyRef]) - true - else if (r == null || !r.isInstanceOf[VisorExecution]) - false - else - r.asInstanceOf[VisorExecution].id == id - - override def hashCode() = - id.hashCode() -} - -/** - * Task data. - */ -private case class VisorTask( - taskName: String, - var execs: Set[VisorExecution] = Set.empty[VisorExecution] -) { - /** - * Task host + its associated variable host. - */ - lazy val taskNameVar: String = - taskName + "(@" + setVarIfAbsent(taskName, "t") + ')' - - /** - * Oldest timestamp for this task (oldest event related to this task). - */ - lazy val oldest: Long = - execs.min(Ordering.by[VisorExecution, Long](_.startTs)).startTs - - /** - * Latest timestamp for this task (latest event related to this task). - */ - lazy val latest: Long = - execs.max(Ordering.by[VisorExecution, Long](_.endTs)).endTs - - /** - * Gets timeframe of this task executions. - */ - lazy val timeframe: Long = - latest - oldest - - /** - * Total number of execution for this task. - */ - lazy val totalExecs: Int = - execs.size - - /** - * Gets number of execution with given state. - * - * @param state Execution state to filter by. - */ - def execsFor(state: State): Int = - execs.count(_.state == state) - - /** - * Minimal duration of this task execution. - */ - lazy val minDuration: Long = - execs.min(Ordering.by[VisorExecution, Long](_.duration)).duration - - /** - * Maximum duration of this task execution. - */ - lazy val maxDuration: Long = - execs.max(Ordering.by[VisorExecution, Long](_.duration)).duration - - /** - * Average duration of this task execution. - */ - lazy val avgDuration: Long = - (0L /: execs)((b, a) => a.duration + b) / execs.size - - /** - * Minimal number of nodes this task was executed on. - */ - lazy val minNodes: Int = - execs.min(Ordering.by[VisorExecution, Int](_.nodeIds.size)).nodeIds.size - - /** - * Minimal number of nodes this task was executed on. - */ - lazy val maxNodes: Int = - execs.max(Ordering.by[VisorExecution, Int](_.nodeIds.size)).nodeIds.size - - /** - * Average number of nodes this task was executed on. - */ - lazy val avgNodes: Int = - (0 /: execs)((b, a) => a.nodeIds.size + b) / execs.size - - override def equals(r: Any) = - if (this eq r.asInstanceOf[AnyRef]) - true - else if (r == null || !r.isInstanceOf[VisorTask]) - false - else - r.asInstanceOf[VisorTask].taskName == taskName - - override def hashCode() = - taskName.hashCode() -} - -/** - * ==Overview== - * Visor 'tasks' command implementation. - * - * ==Help== - * {{{ - * +---------------------------------------------------------------------------------------+ - * | tasks | Prints statistics about tasks and executions. | - * | | | - * | | Note that this command depends on Ignite events. | - * | | | - * | | Ignite events can be individually enabled and disabled and disabled events | - * | | can affect the results produced by this command. Note also that configuration | - * | | of Event Storage SPI that is responsible for temporary storage of generated | - * | | events on each node can also affect the functionality of this command. | - * | | | - * | | By default - all events are DISABLED. But if events enabled then Ignite will | - * | | stores last 10,000 local events on each node. | - * | | Both of these defaults can be changed in configuration. | - * +---------------------------------------------------------------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * tasks - * tasks "-l {-t=s|m|h|d} {-r}" - * tasks "-s= {-t=s|m|h|d} {-r}" - * tasks "-g {-t=s|m|h|d} {-r}" - * tasks "-h {-t=s|m|h|d} {-r}" - * tasks "-n= {-r}" - * tasks "-e=" - * }}} - * - * ====Arguments==== - * {{{ - * -l - * List all tasks and executions for a given time period. - * Executions sorted chronologically (see '-r'), and tasks alphabetically - * See '-t=s|m|h|d' on how to specify the time limit. - * Default time period is one hour, i.e '-t=1h' - * - * This is a default mode when command is called without parameters. - * -s= - * List all tasks and executions for a given task name substring. - * Executions sorted chronologically (see '-r'), and tasks alphabetically - * See '-t=s|m|h|d' on how to specify the time limit. - * Default time period is one hour, i.e '-t=1h' - * -g - * List all tasks grouped by nodes for a given time period. - * Tasks sorted alphabetically - * See '-t=s|m|h|d' on how to specify the time limit. - * Default time period is one hour, i.e '-t=1h' - * -h - * List all tasks grouped by hosts for a given time period. - * Tasks sorted alphabetically - * See '-t=s|m|h|d' on how to specify the time limit. - * Default time period is one hour, i.e '-t=1h' - * -t=s|m|h|d - * Defines time frame for '-l' parameter: - * =s Last seconds. - * =m Last minutes. - * =h Last hours. - * =d Last days. - * -r - * Reverse sorting of executions. - * -n= - * Prints aggregated statistic for named task. - * -e= - * Prints aggregated statistic for given task execution. - * }}} - * - * ====Examples==== - * {{{ - * visor tasks "-l" - * Prints list of all tasks and executions for the last hour (default). - * visor tasks - * Prints list of all tasks and executions for the last hour (default). - * visor tasks "-l -t=5m" - * Prints list of tasks and executions that started during last 5 minutes. - * visor tasks "-s=Task" - * Prints list of all tasks and executions that have 'Task' in task name. - * visor tasks "-g" - * Prints list of tasks grouped by nodes. - * visor tasks "-g -t=5m" - * Prints list of tasks that started during last 5 minutes grouped by nodes. - * visor tasks "-h" - * Prints list of tasks grouped by hosts. - * visor tasks "-h -t=5m" - * Prints list of tasks that started during last 5 minutes grouped by hosts. - * visor tasks "-n=GridTask" - * Prints summary for task named 'GridTask'. - * visor tasks "-e=7D5CB773-225C-4165-8162-3BB67337894B" - * Traces task execution with ID '7D5CB773-225C-4165-8162-3BB67337894B'. - * visor tasks "-e=@s1" - * Traces task execution with ID taken from 's1' memory variable. - * }}} - */ -class VisorTasksCommand extends VisorConsoleCommand { - @impl protected val name = "tasks" - - /** Limit for printing tasks and executions. */ - private val SHOW_LIMIT = 100 - - /** - * ===Command=== - * Prints statistics about executed tasks. - * - * ===Examples=== - * tasks - * Prints list of all tasks for the last hour (default). - * - * tasks "-l" - * Prints list of all tasks for the last hour (default). - * - * tasks "-l -a" - * Prints list of all tasks and executions for the last hour (default). - * - * tasks "-l -t=5m" - * Prints list of tasks that started during last 5 minutes. - * - * tasks "-g" - * Prints list of tasks grouped by nodes. - * - * tasks "-g -t=5m" - * Prints list of tasks that started during last 5 minutes grouped by nodes. - * - * tasks "-h" - * Prints list of tasks grouped by hosts. - * - * tasks "-h -t=5m" - * Prints list of tasks that started during last 5 minutes grouped by hosts. - * - * tasks "-n=GridTask" - * Prints summary for task named 'GridTask'. - * - * tasks "-n=GridTask -a" - * Prints summary and executions for task named 'GridTask'. - * - * tasks "-e=7D5CB773-225C-4165-8162-3BB67337894B" - * Traces task execution with ID '7D5CB773-225C-4165-8162-3BB67337894B'. - * - * tasks "-e=@s1" - * Traces task execution with ID taken from 's1' memory variable. - * - * @param args Command arguments. - */ - def tasks(args: String) { - if (checkConnected()) { - val argLst = parseArgs(args) - - if (hasArgFlag("l", argLst)) { - val p = timePeriod(argValue("t", argLst) getOrElse "1h") - - if (p.isDefined) - list(p.get, null, hasArgFlag("r", argLst), hasArgFlag("a", argLst)) - } - else if (hasArgName("s", argLst)) { - val tf = timePeriod(argValue("t", argLst) getOrElse "1h") - - if (tf.isDefined) { - val s = argValue("s", argLst) - - if (s.isDefined) { - list(tf.get, s.get, hasArgFlag("r", argLst), hasArgFlag("a", argLst)) - } - else - scold("Invalid arguments: " + args) - } - } - else if (hasArgFlag("g", argLst)) { - val f = timePeriod(argValue("t", argLst) getOrElse "1h") - - if (f.isDefined) - nodes(f.get) - } - else if (hasArgFlag("h", argLst)) { - val f = timePeriod(argValue("t", argLst) getOrElse "1h") - - if (f.isDefined) - hosts(f.get) - } - else if (hasArgName("n", argLst)) { - val n = argValue("n", argLst) - - if (n.isEmpty) - scold("Invalid arguments: " + args) - else - task(n.get, hasArgFlag("r", argLst), hasArgFlag("a", argLst)) - } - else if (hasArgName("e", argLst)) { - val s = argValue("e", argLst) - - if (s.isEmpty) - scold("Invalid arguments: " + args) - else - exec(s.get, hasArgFlag("r", argLst)) - } - else - scold("Incorrect arguments: " + args) - } - } - - /** - * ===Command=== - * Simply a shortcut for `tasks("-l")` - * - * ===Examples=== - * tasks - * Prints list of all tasks and executions for the last hour (default). - */ - def tasks() { - tasks("-l") - } - - /** - * Creates predicate that filters events by timestamp. - * - * @param arg Command argument. - * @return time period. - */ - private def timePeriod(arg: String): Option[Long] = { - assert(arg != null) - - var n = 0 - - try - n = arg.substring(0, arg.length - 1).toInt - catch { - case e: NumberFormatException => - scold("Time frame size is not numeric in: " + arg) - - return None - } - - if (n <= 0) { - scold("Time frame size is not positive in: " + arg) - - None - } - else { - val m = arg.last match { - case 's' => 1000 - case 'm' => 1000 * 60 - case 'h' => 1000 * 60 * 60 - case 'd' => 1000 * 60 * 60 * 24 - case _ => - scold("Invalid time frame suffix in: " + arg) - - return None - } - - Some(n * m) - } - } - - /** - * Gets collections of tasks and executions for given event filter. - * - * @param evts Collected events. - */ - private def mkData(evts: java.lang.Iterable[_ <: VisorGridEvent]): (List[VisorTask], List[VisorExecution]) = { - var sMap = Map.empty[IgniteUuid, VisorExecution] // Execution map. - var tMap = Map.empty[String, VisorTask] // Task map. - - if (evts == null) - return tMap.values.toList -> sMap.values.toList - - def getSession(id: IgniteUuid, taskName: String): VisorExecution = { - assert(id != null) - assert(taskName != null) - - sMap.getOrElse(id, { - val s = VisorExecution(id, taskName) - - sMap = sMap + (id -> s) - - s - }) - } - - def getTask(taskName: String): VisorTask = { - assert(taskName != null) - - tMap.getOrElse(taskName, { - val t = VisorTask(taskName) - - tMap = tMap + (taskName -> t) - - t - }) - } - - // If task name is task class name, show simple class name. - def taskSimpleName(taskName: String, taskClsName: String) = { - if (taskName == taskClsName || taskName == null) { - val idx = taskClsName.lastIndexOf('.') - - if (idx >= 0) taskClsName.substring(idx + 1) else taskClsName - } - else - taskName - } - - evts.foreach { - case te: VisorGridTaskEvent => - val displayedTaskName = taskSimpleName(te.getTaskName(), te.getTaskClassName()) - - val s = getSession(te.getTaskSessionId(), displayedTaskName) - val t = getTask(displayedTaskName) - - t.execs = t.execs + s - - s.evts = s.evts :+ te - s.nodeIds = s.nodeIds + te.getNid - s.startTs = math.min(s.startTs, te.getTimestamp) - s.endTs = math.max(s.endTs, te.getTimestamp) - - te.getTypeId match { - case EVT_TASK_STARTED => - if (s.state == UNDEFINED) s.state = STARTED - - s.origNodeId = te.getNid - - case EVT_TASK_FINISHED => - if (s.state == UNDEFINED || s.state == STARTED) s.state = FINISHED - - s.origNodeId = te.getNid - - case EVT_TASK_FAILED => if (s.state == UNDEFINED || s.state == STARTED) s.state = FAILED - case EVT_TASK_TIMEDOUT => if (s.state == UNDEFINED || s.state == STARTED) s.state = TIMEDOUT - case _ => - } - - case je: VisorGridJobEvent => - val displayedTaskName = taskSimpleName(je.getTaskName(), je.getTaskClassName()) - val s = getSession(je.getTaskSessionId(), displayedTaskName) - val t = getTask(displayedTaskName) - - t.execs = t.execs + s - - // Collect node IDs where jobs didn't finish ok. - je.getTypeId match { - case EVT_JOB_CANCELLED | EVT_JOB_FAILED | EVT_JOB_REJECTED | EVT_JOB_TIMEDOUT => - s.failedNodeIds = s.failedNodeIds + je.getNid - case _ => - } - - s.evts = s.evts :+ je - s.nodeIds = s.nodeIds + je.getNid - s.startTs = math.min(s.startTs, je.getTimestamp) - s.endTs = math.max(s.endTs, je.getTimestamp) - - case _ => - } - - tMap.values.toList -> sMap.values.toList - } - - /** - * Prints list of tasks and executions. - * - * @param p Event period. - * @param taskName Task name filter. - * @param reverse Reverse session chronological sorting. - * @param all Whether to show full information. - */ - private def list(p: Long, taskName: String, reverse: Boolean, all: Boolean) { - breakable { - try { - val evts = executeMulti(classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createTasksArg(p, taskName, null)) - - val (tLst, eLst) = mkData(evts) - - if (tLst.isEmpty) { - scold("No tasks or executions found.") - - break() - } - - if (all) { - val execsT = VisorTextTable() - - execsT.maxCellWidth = 35 - - execsT #=( - ("ID8(@ID), Start/End,", "State & Duration"), - "Task Name(@)", - "Nodes IP, ID8(@)", - "Jobs") - - var sortedExecs = if (!reverse) eLst.sortBy(_.startTs).reverse else eLst.sortBy(_.startTs) - - if (sortedExecs.size > SHOW_LIMIT) { - warnLimit(sortedExecs.size, "execution") - - sortedExecs = sortedExecs.slice(0, SHOW_LIMIT) - } - - sortedExecs foreach ((e: VisorExecution) => { - execsT +=( - ( - e.id8Var, - " ", - "Start: " + formatDateTime(e.startTs), - "End : " + formatDateTime(e.endTs), - " ", - e.state + ": " + X.timeSpan2HMSM(e.duration) - ), - e.taskNameVar, - (e.nodeIds.map((u: UUID) => { - var s = "" - - if (e.origNodeId != null && e.origNodeId == u) - s = s + "> " - else if (e.failedNodeIds.contains(u)) - s = s + "! " - else - s = s + " " - - s + nodeId8Addr(u) - }).toList :+ ("Nodes: " + e.nodeIds.size)).reverse - , - if (e.started > 0) - ( - "St: " + e.started, - "Fi: " + e.finished + " (" + formatInt(100 * e.finished / e.started) + "%)", - " ", - "Ca: " + e.cancels + " (" + formatInt(100 * e.cancels / e.started) + "%)", - "Re: " + e.rejections + " (" + formatInt(100 * e.rejections / e.started) + "%)", - "Fo: " + e.failovers + " (" + formatInt(100 * e.failovers / e.started) + "%)", - "Fa: " + e.failures + " (" + formatInt(100 * e.failures / e.started) + "%)" - ) - else - ( - "St: " + e.started, - "Fi: " + e.finished, - " ", - "Ca: " + e.cancels, - "Re: " + e.rejections, - "Fo: " + e.failovers, - "Fa: " + e.failures - ) - ) - }) - - println("Executions: " + eLst.size) - - execsT.render() - - nl() - - execFootnote() - - nl() - } - - val tasksT = VisorTextTable() - - tasksT.maxCellWidth = 55 - - tasksT #=( - "Task Name(@ID), Oldest/Latest & Rate", - "Duration", - "Nodes", - "Executions" - ) - - var sortedTasks = tLst.sortBy(_.taskName) - - if (sortedTasks.size > SHOW_LIMIT) { - warnLimit(sortedTasks.size, "task") - - sortedTasks = sortedTasks.slice(0, SHOW_LIMIT) - } - - sortedTasks foreach ((t: VisorTask) => { - val sE = t.execsFor(STARTED) - val fE = t.execsFor(FINISHED) - val eE = t.execsFor(FAILED) - val uE = t.execsFor(UNDEFINED) - val tE = t.execsFor(TIMEDOUT) - - val n = t.execs.size - - tasksT +=( - ( - t.taskNameVar, - " ", - "Oldest: " + formatDateTime(t.oldest), - "Latest: " + formatDateTime(t.latest), - " ", - "Exec. Rate: " + n + " in " + X.timeSpan2HMSM(t.timeframe) - ), - ( - "min: " + X.timeSpan2HMSM(t.minDuration), - "avg: " + X.timeSpan2HMSM(t.avgDuration), - "max: " + X.timeSpan2HMSM(t.maxDuration) - ), - ( - "min: " + t.minNodes, - "avg: " + t.avgNodes, - "max: " + t.maxNodes - ), - ( - "Total: " + n, - " ", - "St: " + sE + " (" + formatInt(100 * sE / n) + "%)", - "Fi: " + fE + " (" + formatInt(100 * fE / n) + "%)", - "Fa: " + eE + " (" + formatInt(100 * eE / n) + "%)", - "Un: " + uE + " (" + formatInt(100 * uE / n) + "%)", - "Ti: " + tE + " (" + formatInt(100 * tE / n) + "%)" - ) - ) - }) - - println("Tasks: " + tLst.size) - - tasksT.render() - - nl() - - taskFootnote() - } - catch { - case e: IgniteException => - scold(e) - - break() - } - } - } - - /** - * Prints task footnote. - */ - private def taskFootnote() { - println("'St' - Started tasks.") - println("'Fi' - Finished tasks.") - println("'Fa' - Failed tasks.") - println("'Un' - Undefined tasks (originating node left topology).") - println("'Ti' - Timed out tasks.") - } - - /** - * Prints execution footnote. - */ - private def execFootnote() { - println("'St' - Started jobs during the task execution.") - println("'Fi' - Finished jobs during the task execution.") - println("'Ca' - Cancelled jobs during the task execution.") - println("'Re' - Rejected jobs during the task execution.") - println("'Fo' - Failed over jobs during the task execution.") - println("'Fa' - Failed jobs during the task execution.") - println("'>' - Originating node (if still in topology).") - println("'!' - Node on which job didn't complete successfully.") - println("\n - Originating node left topology, i.e. execution state is unknown.") - } - - /** - * Prints task summary. - * - * @param taskName Task host. - * @param reverse Reverse session chronological sorting? - * @param all Whether to show full information. - */ - private def task(taskName: String, reverse: Boolean, all: Boolean) { - breakable { - assert(taskName != null) - - try { - val prj = ignite.cluster.forRemotes() - - val evts = executeMulti(classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createTasksArg(null, taskName, null)) - - val (tLst, eLst) = mkData(evts) - - if (tLst.isEmpty) { - scold("Task not found: " + taskName) - - break() - } - - val tasksT = VisorTextTable() - - tasksT.maxCellWidth = 55 - - tasksT #= ("Oldest/Latest & Rate", "Duration", "Nodes", "Executions") - - assert(tLst.size == 1) - - val t = tLst.head - - val sE = t.execsFor(STARTED) - val fE = t.execsFor(FINISHED) - val eE = t.execsFor(FAILED) - val uE = t.execsFor(UNDEFINED) - val tE = t.execsFor(TIMEDOUT) - - val n = t.execs.size - - tasksT += ( - ( - "Oldest: " + formatDateTime(t.oldest), - "Latest: " + formatDateTime(t.latest), - " ", - "Exec. Rate: " + n + " in " + X.timeSpan2HMSM(t.timeframe) - ), - ( - "min: " + X.timeSpan2HMSM(t.minDuration), - "avg: " + X.timeSpan2HMSM(t.avgDuration), - "max: " + X.timeSpan2HMSM(t.maxDuration) - ), - ( - "min: " + t.minNodes, - "avg: " + t.avgNodes, - "max: " + t.maxNodes - ), - ( - "Total: " + n, - " ", - "St: " + sE + " (" + formatInt(100 * sE / n) + "%)", - "Fi: " + fE + " (" + formatInt(100 * fE / n) + "%)", - "Fa: " + eE + " (" + formatInt(100 * eE / n) + "%)", - "Un: " + uE + " (" + formatInt(100 * uE / n) + "%)", - "Ti: " + tE + " (" + formatInt(100 * tE / n) + "%)" - ) - ) - - println("Task: " + t.taskNameVar) - - tasksT.render() - - nl() - - taskFootnote() - - if (all) { - val execsT = VisorTextTable() - - execsT.maxCellWidth = 35 - - execsT #= ( - ("ID8(@ID), Start/End,", "State & Duration"), - "Task Name(@)", - "Nodes IP, ID8(@)", - "Jobs") - - var sorted = if (!reverse) eLst.sortBy(_.startTs).reverse else eLst.sortBy(_.startTs) - - if (sorted.size > SHOW_LIMIT) { - warnLimit(sorted.size, "execution") - - sorted = sorted.slice(0, SHOW_LIMIT) - } - - sorted foreach ((e: VisorExecution) => { - execsT += ( - ( - e.id8Var, - " ", - "Start: " + formatDateTime(e.startTs), - "End : " + formatDateTime(e.endTs), - " ", - e.state + ": " + X.timeSpan2HMSM(e.duration) - ), - e.taskNameVar, - (e.nodeIds.map((u: UUID) => { - var s = "" - - if (e.origNodeId != null && e.origNodeId == u) - s = s + "> " - else if (e.failedNodeIds.contains(u)) - s = s + "! " - else - s = s + " " - - s + nodeId8Addr(u) - }).toList :+ ("Nodes: " + e.nodeIds.size)).reverse - , - if (e.started > 0) - ( - "St: " + e.started, - "Fi: " + e.finished + " (" + formatInt(100 * e.finished / e.started) + "%)", - " ", - "Ca: " + e.cancels + " (" + formatInt(100 * e.cancels / e.started) + "%)", - "Re: " + e.rejections + " (" + formatInt(100 * e.rejections / e.started) + "%)", - "Fo: " + e.failovers + " (" + formatInt(100 * e.failovers / e.started) + "%)", - "Fa: " + e.failures + " (" + formatInt(100 * e.failures / e.started) + "%)" - ) - else - ( - "St: " + e.started, - "Fi: " + e.finished, - " ", - "Ca: " + e.cancels, - "Re: " + e.rejections, - "Fo: " + e.failovers, - "Fa: " + e.failures - ) - ) - }) - - println("\nExecutions: " + eLst.size) - - execsT.render() - - nl() - - execFootnote() - } - } - catch { - case e: IgniteException => - scold(e) - - break() - } - } - } - - /** - * Prints task execution. - * - * @param sesId String representation of session ID. - * @param reverse Reverse session chronological sorting? - */ - private def exec(sesId: String, reverse: Boolean) { - breakable { - assert(sesId != null) - - var uuid: IgniteUuid = null - - try - uuid = IgniteUuid.fromString(sesId) - catch { - case e: Exception => - scold("Invalid execution ID: " + sesId) - - break() - } - - try { - val evts = executeMulti(classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createTasksArg(null, null, uuid)) - - val (tLst, eLst) = mkData(evts) - - if (tLst.isEmpty) { - scold("Task execution not found: " + sesId) - - break() - } - - assert(eLst.size == 1) - assert(tLst.size == 1) - - val execT = VisorTextTable() - - execT.maxCellWidth = 35 - - execT #= ( - ("ID8(@ID), Start/End,", "State & Duration"), - "Task Name(@)", - "Nodes IP, ID8(@)", - "Jobs") - - val e = eLst.head - - execT += ( - ( - e.id8Var, - " ", - "Start: " + formatDateTime(e.startTs), - "End : " + formatDateTime(e.endTs), - " ", - e.state + ": " + X.timeSpan2HMSM(e.duration) - ), - e.taskNameVar, - (e.nodeIds.map((u: UUID) => { - var s = "" - - if (e.origNodeId != null && e.origNodeId == u) - s = s + "> " - else if (e.failedNodeIds.contains(u)) - s = s + "! " - else - s = s + " " - - s + nodeId8Addr(u) - }).toList :+ ("Nodes: " + e.nodeIds.size)).reverse - , - if (e.started > 0) - ( - "St: " + e.started, - "Fi: " + e.finished + " (" + formatInt(100 * e.finished / e.started) + "%)", - " ", - "Ca: " + e.cancels + " (" + formatInt(100 * e.cancels / e.started) + "%)", - "Re: " + e.rejections + " (" + formatInt(100 * e.rejections / e.started) + "%)", - "Fo: " + e.failovers + " (" + formatInt(100 * e.failovers / e.started) + "%)", - "Fa: " + e.failures + " (" + formatInt(100 * e.failures / e.started) + "%)" - ) - else - ( - "St: " + e.started, - "Fi: " + e.finished, - " ", - "Ca: " + e.cancels, - "Re: " + e.rejections, - "Fo: " + e.failovers, - "Fa: " + e.failures - ) - ) - - println("Execution: " + e.id8Var) - - execT.render() - - nl() - - execFootnote() - - val evtsT = VisorTextTable() - - evtsT #= ("Timestamp", "Node ID8(@)", "Event") - - val se = if (!reverse) e.evts.sortBy(_.getTimestamp) else e.evts.sortBy(_.getTimestamp).reverse - - se.foreach(e => evtsT += ( - formatDateTime(e.getTimestamp), - nodeId8Addr(e.getNid), - e.getName)) - - println("\nTrace:") - - evtsT.render() - } - catch { - case e: IgniteException => - scold(e) - - break() - } - } - } - - /** - * Prints list of tasks grouped by nodes. - * - * @param f Event filter. - */ - private def nodes(f: Long) { - breakable { - try { - val evts = executeMulti(classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createTasksArg(f, null, null)) - - val eLst = mkData(evts)._2 - - if (eLst.isEmpty) { - scold("No executions found.") - - break() - } - - var nMap = Map.empty[UUID, Set[VisorExecution]] - - eLst.foreach(e => { - e.nodeIds.foreach(id => { - var eSet = nMap.getOrElse(id, Set.empty[VisorExecution]) - - eSet += e - - nMap += (id -> eSet) - }) - }) - - nMap.foreach(e => { - val id = e._1 - val execs = e._2 - - val execsMap = execs.groupBy(_.taskName) - - val tasksT = VisorTextTable() - - tasksT.maxCellWidth = 55 - - tasksT #=( - "Task Name(@), Oldest/Latest & Rate", - "Duration", - "Executions" - ) - - println("Tasks executed on node " + nodeId8Addr(id) + ":") - - var sortedNames = execsMap.keys.toList.sorted - - if (sortedNames.size > SHOW_LIMIT) { - warnLimit(sortedNames.size, "task") - - sortedNames = sortedNames.slice(0, SHOW_LIMIT) - } - - sortedNames.foreach(taskName => { - val t = VisorTask(taskName, execsMap(taskName)) - - val sE = t.execsFor(STARTED) - val fE = t.execsFor(FINISHED) - val eE = t.execsFor(FAILED) - val uE = t.execsFor(UNDEFINED) - val tE = t.execsFor(TIMEDOUT) - - val n = t.execs.size - - tasksT +=( - ( - t.taskNameVar, - " ", - "Oldest: " + formatDateTime(t.oldest), - "Latest: " + formatDateTime(t.latest), - " ", - "Exec. Rate: " + n + " in " + X.timeSpan2HMSM(t.timeframe) - ), - ( - "min: " + X.timeSpan2HMSM(t.minDuration), - "avg: " + X.timeSpan2HMSM(t.avgDuration), - "max: " + X.timeSpan2HMSM(t.maxDuration) - ), - ( - "Total: " + n, - " ", - "St: " + sE + " (" + formatInt(100 * sE / n) + "%)", - "Fi: " + fE + " (" + formatInt(100 * fE / n) + "%)", - "Fa: " + eE + " (" + formatInt(100 * eE / n) + "%)", - "Un: " + uE + " (" + formatInt(100 * uE / n) + "%)", - "Ti: " + tE + " (" + formatInt(100 * tE / n) + "%)" - ) - ) - }) - - tasksT.render() - - nl() - }) - - taskFootnote() - } - catch { - case e: IgniteException => - scold(e) - - break() - } - } - } - - /** - * Prints list of tasks grouped by hosts. - * - * @param f Event filter. - */ - private def hosts(f: Long) { - breakable { - try { - val evts = executeMulti(classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createTasksArg(f, null, null)) - - val eLst = mkData(evts)._2 - - if (eLst.isEmpty) { - scold("No executions found.") - - break() - } - - var hMap = Map.empty[String, Set[VisorExecution]] - - eLst.foreach(e => { - e.nodeIds.foreach(id => { - TU.sortAddresses(ignite.cluster.node(id).addresses).headOption.foreach(host => { - var eSet = hMap.getOrElse(host, Set.empty[VisorExecution]) - - eSet += e - - hMap += (host -> eSet) - }) - }) - }) - - hMap.foreach(e => { - val host = e._1 - val execs = e._2 - - val execsMap = execs.groupBy(_.taskName) - - val tasksT = VisorTextTable() - - tasksT.maxCellWidth = 55 - - tasksT #= ( - "Task Name(@), Oldest/Latest & Rate", - "Duration", - "Executions" - ) - - println("Tasks executed on host " + host + ":") - - var sortedNames = execsMap.keys.toList.sorted - - if (sortedNames.size > SHOW_LIMIT) { - warnLimit(sortedNames.size, "task") - - sortedNames = sortedNames.slice(0, SHOW_LIMIT) - } - - sortedNames.foreach(taskName => { - val t = VisorTask(taskName, execsMap(taskName)) - - val sE = t.execsFor(STARTED) - val fE = t.execsFor(FINISHED) - val eE = t.execsFor(FAILED) - val uE = t.execsFor(UNDEFINED) - val tE = t.execsFor(TIMEDOUT) - - val n = t.execs.size - - tasksT += ( - ( - t.taskNameVar, - " ", - "Oldest: " + formatDateTime(t.oldest), - "Latest: " + formatDateTime(t.latest), - " ", - "Exec. Rate: " + n + " in " + X.timeSpan2HMSM(t.timeframe) - ), - ( - "min: " + X.timeSpan2HMSM(t.minDuration), - "avg: " + X.timeSpan2HMSM(t.avgDuration), - "max: " + X.timeSpan2HMSM(t.maxDuration) - ), - ( - "Total: " + n, - " ", - "St: " + sE + " (" + formatInt(100 * sE / n) + "%)", - "Fi: " + fE + " (" + formatInt(100 * fE / n) + "%)", - "Fa: " + eE + " (" + formatInt(100 * eE / n) + "%)", - "Un: " + uE + " (" + formatInt(100 * uE / n) + "%)", - "Ti: " + tE + " (" + formatInt(100 * tE / n) + "%)" - ) - ) - }) - - tasksT.render() - - nl() - }) - - taskFootnote() - } - catch { - case e: IgniteException => - scold(e) - - break() - } - } - } - - /** - * Warns about the limit reached. - * - * @param n Actual number of elements - */ - private def warnLimit(n: Int, name: String) { - nl() - - warn(n + name + "s found.", "Only first " + SHOW_LIMIT + " are shown.") - - nl() - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorTasksCommand { - /** Singleton command. */ - private val cmd = new VisorTasksCommand - - addHelp( - name = "tasks", - shortInfo = "Prints tasks execution statistics.", - longInfo = List( - "Prints statistics about tasks and executions.", - " ", - "Note that this command depends on Ignite events.", - " ", - "Ignite events can be individually enabled and disabled and disabled events", - "can affect the results produced by this command. Note also that configuration", - "of Event Storage SPI that is responsible for temporary storage of generated", - "events on each node can also affect the functionality of this command.", - " ", - "By default - all events are disabled. But if events enabled then Ignite will stores last 10,000 local", - "events on each node. Both of these defaults can be changed in configuration." - ), - spec = List( - "tasks", - "tasks -l {-t=s|m|h|d} {-r} {-a}", - "tasks -s= {-t=s|m|h|d} {-r}", - "tasks -g {-t=s|m|h|d} {-r}", - "tasks -h {-t=s|m|h|d} {-r}", - "tasks -n= {-r} {-a}", - "tasks -e=" - ), - args = List( - "-l" -> List( - "List all tasks and executions for a given time period.", - "Executions sorted chronologically (see '-r'), and tasks alphabetically", - "See '-t=s|m|h|d' on how to specify the time limit.", - "Default time period is one hour, i.e '-t=1h'", - " ", - "Execution list will be shown only if '-a' flag is provided.", - " ", - "This is a default mode when command is called without parameters." - ), - "-s=" -> List( - "List all tasks and executions for a given task name substring.", - "Executions sorted chronologically (see '-r'), and tasks alphabetically", - "See '-t=s|m|h|d' on how to specify the time limit.", - "Default time period is one hour, i.e '-t=1h'", - " ", - "Execution list will be shown only if '-a' flag is provided." - ), - "-g" -> List( - "List all tasks grouped by nodes for a given time period.", - "Tasks sorted alphabetically", - "See '-t=s|m|h|d' on how to specify the time limit.", - "Default time period is one hour, i.e '-t=1h'" - ), - "-h" -> List( - "List all tasks grouped by hosts for a given time period.", - "Tasks sorted alphabetically", - "See '-t=s|m|h|d' on how to specify the time limit.", - "Default time period is one hour, i.e '-t=1h'" - ), - "-t=s|m|h|d" -> List( - "Defines time frame for '-l' parameter:", - " =s Last seconds.", - " =m Last minutes.", - " =h Last hours.", - " =d Last days." - ), - "-r" -> List( - "Reverse sorting of executions." - ), - "-n=" -> List( - "Prints aggregated statistic for named task.", - " ", - "Execution list will be shown only if '-a' flag is provided." - ), - "-e=" -> - "Prints aggregated statistic for given task execution.", - "-a" -> List( - "Defines whether to show list of executions.", - "Can be used with '-l', '-s' or '-n'." - ) - ), - examples = List( - "tasks" -> - "Prints list of all tasks for the last hour (default).", - "tasks -l" -> - "Prints list of all tasks for the last hour (default).", - "tasks -l -a" -> - "Prints list of all tasks and executions for the last hour (default).", - "tasks -l -t=5m" -> - "Prints list of tasks that started during last 5 minutes.", - "tasks -s=Task" -> - "Prints list of all tasks that have 'Task' in task name.", - "tasks -g" -> - "Prints list of tasks grouped by nodes.", - "tasks -g -t=5m" -> - "Prints list of tasks that started during last 5 minutes grouped by nodes.", - "tasks -h" -> - "Prints list of tasks grouped by hosts.", - "tasks -h -t=5m" -> - "Prints list of tasks that started during last 5 minutes grouped by hosts.", - "tasks -n=GridTask" -> - "Prints summary for task named 'GridTask'.", - "tasks -n=GridTask -a" -> - "Prints summary and executions for task named 'GridTask'.", - "tasks -e=7D5CB773-225C-4165-8162-3BB67337894B" -> - "Traces task execution with ID '7D5CB773-225C-4165-8162-3BB67337894B'." - ), - emptyArgs = cmd.tasks, - withArgs = cmd.tasks - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromTrace2Visor(vs: VisorTag): VisorTasksCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala deleted file mode 100644 index 094239a5a22cd..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala +++ /dev/null @@ -1,449 +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.visor.commands.top - -import org.apache.ignite._ -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.internal.IgniteNodeAttributes._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.typedef.X -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.lang.IgnitePredicate -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable} -import org.apache.ignite.visor.visor._ - -import java.net.{InetAddress, UnknownHostException} - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * ==Overview== - * Contains Visor command `top` implementation. - * - * ==Help== - * {{{ - * +--------------------------------+ - * | top | Prints current topology. | - * +--------------------------------+ - * }}} - * - * ====Specification==== - * {{{ - * top "{-c1=e1 -c2=e2 ... -ck=ek} {-h= ... -h=} {-a}" - * top -activate - * top -deactivate - * }}} - * - * ====Arguments==== - * {{{ - * -ck=ek - * This defines a mnemonic for node filter: - * -cc Number of available CPUs on the node. - * -cl Average CPU load (in %) on the node. - * -aj Active jobs on the node. - * -cj Cancelled jobs on the node. - * -tc Thread count on the node. - * -it Idle time on the node. - * Note: can have 's', 'm', or 'h' suffix indicating - * seconds, minutes, and hours. By default (no suffix provided) - * value is assumed to be in milliseconds. - * -ut Up time on the node. - * Note: can have 's', 'm', or 'h' suffix indicating - * seconds, minutes, and hours. By default (no suffix provided) - * value is assumed to be in milliseconds. - * -je Job execute time on the node. - * -jw Job wait time on the node. - * -wj Waiting jobs count on the node. - * -rj Rejected jobs count on the node. - * -hu Heap memory used (in MB) on the node. - * -hm Heap memory maximum (in MB) on the node. - * - * Comparison part of the mnemonic predicate: - * =eq Equal '=' to '' number. - * =neq Not equal '!=' to '' number. - * =gt Greater than '>' to '' number. - * =gte Greater than or equal '>=' to '' number. - * =lt Less than '<' to '' number. - * =lte Less than or equal '<=' to '' number. - * -h= - * This defines a host to show nodes from. - * Multiple hosts can be provided. - * -a - * This defines whether to show a separate table of nodes - * with detail per-node information. - * -activate - * Activate cluster. - * -deactivate - * Deactivate cluster. - * }}} - * - * ====Examples==== - * {{{ - * top "-cc=eq2" - * Prints topology for all nodes with two CPUs. - * top "-cc=eq2 -a" - * Prints full information for all nodes with two CPUs. - * top "-h=10.34.2.122 -h=10.65.3.11" - * Prints topology for provided hosts. - * top - * Prints full topology. - * top -activate - * Activate cluster. - * top -deactivate - * Deactivate cluster. - * }}} - */ -class VisorTopologyCommand extends VisorConsoleCommand { - @impl protected val name = "top" - - /** - * ===Command=== - * Prints full topology. - * - * ===Examples=== - * top - * Prints full topology. - */ - def top() { - top("") - } - - /** - * ===Command=== - * Prints topology for provided mnemonic predicate. - * - * ===Examples=== - * top "-cc=eq2" - * Prints topology for all nodes with two CPUs. - * - * top "-cc=eq2 -a" - * Prints full information for all nodes with two CPUs. - * - * top "-h=10.34.2.122 -h=10.65.3.11" - * Prints topology for provided hosts. - * - * @param args Command arguments. - */ - def top(args: String) = breakable { - assert(args != null) - - if (checkConnected()) { - val argLst = parseArgs(args) - - if (hasArgFlag("activate", argLst)) - ignite.cluster().active(true) - else if (hasArgFlag("deactivate", argLst)) - ignite.cluster().active(false) - else { - val hosts = argLst.filter(_._1 == "h").map((a: Arg) => - try - InetAddress.getByName(a._2).getHostAddress - catch { - case e: UnknownHostException => scold("Unknown host: " + a._2).^^ - - "" // Never happens. - } - ).filter(!_.isEmpty).toSet - - val all = hasArgFlag("a", argLst) - - var f: NodeFilter = (ClusterNode) => true - - try { - argLst foreach (arg => { - val (n, v) = arg - - n match { - case "cc" if v != null => f = make(v, f, _.metrics.getTotalCpus) - case "cl" if v != null => f = make(v, f, (n: ClusterNode) => - (n.metrics.getCurrentCpuLoad * 100).toLong) - case "aj" if v != null => f = make(v, f, _.metrics.getCurrentActiveJobs) - case "cj" if v != null => f = make(v, f, _.metrics.getCurrentCancelledJobs) - case "tc" if v != null => f = make(v, f, _.metrics.getCurrentThreadCount) - case "ut" if v != null => f = make(v, f, _.metrics.getUpTime) - case "je" if v != null => f = make(v, f, _.metrics.getCurrentJobExecuteTime) - case "jw" if v != null => f = make(v, f, _.metrics.getCurrentJobWaitTime) - case "wj" if v != null => f = make(v, f, _.metrics.getCurrentWaitingJobs) - case "rj" if v != null => f = make(v, f, _.metrics.getCurrentRejectedJobs) - case "hu" if v != null => f = make(v, f, _.metrics.getHeapMemoryUsed) - case "hm" if v != null => f = make(v, f, _.metrics.getHeapMemoryMaximum) - case _ => () - } - }) - - show(n => f(n), hosts, all) - } - catch { - case e: NumberFormatException => scold(e) - case e: IgniteException => scold(e) - } - } - } - } - - /** - * @param exprStr Expression string. - * @param f Node filter - * @param v Value generator. - */ - private def make(exprStr: String, f: NodeFilter, v: ClusterNode => Long): NodeFilter = { - assert(exprStr != null) - assert(f != null) - assert(v != null) - - val expr = makeExpression(exprStr) - - // Note that if 'f(n)' is false - 'value' won't be evaluated. - if (expr.isDefined) - (n: ClusterNode) => f(n) && expr.get.apply(v(n)) - else - throw new IgniteException("Invalid expression: " + exprStr) - } - - /** - * Prints topology. - * - * @param f Node filtering predicate. - * @param hosts Set of hosts to take nodes from. - * @param all Whether to show full information. - */ - private def show(f: NodeFilter, hosts: Set[String], all: Boolean) = breakable { - assert(f != null) - assert(hosts != null) - - var nodes = ignite.cluster.forPredicate(new IgnitePredicate[ClusterNode] { - override def apply(e: ClusterNode) = f(e) - }).nodes() - - if (hosts.nonEmpty) - nodes = nodes.filter(n => n.addresses.toSet.intersect(hosts).nonEmpty) - - if (nodes.isEmpty) - println("Empty topology.").^^ - - if (all) { - val nodesT = VisorTextTable() - - nodesT #= ("Node ID8(@), IP", "Consistent ID", "Start Time", "Up Time", - //"Idle Time", - "CPUs", "CPU Load", "Free Heap") - - nodes foreach ((n: ClusterNode) => { - val m = n.metrics - - val usdMem = m.getHeapMemoryUsed - val maxMem = m.getHeapMemoryMaximum - - val freeHeapPct = (maxMem - usdMem) * 100 / maxMem - val cpuLoadPct = m.getCurrentCpuLoad * 100 - - // Add row. - nodesT += ( - nodeId8Addr(n.id), - n.consistentId(), - formatDateTime(m.getStartTime), - X.timeSpan2HMS(m.getUpTime), - m.getTotalCpus, - safePercent(cpuLoadPct), - formatDouble(freeHeapPct) + " %" - ) - }) - - println("Nodes: " + nodes.size) - - nodesT.render() - - nl() - } - - val neighborhood = U.neighborhood(nodes) - - val hostsT = VisorTextTable() - - hostsT #= ("Int./Ext. IPs", "Node ID8(@)", "Node consistent ID", "Node Type", "OS", "CPUs", "MACs", "CPU Load") - - neighborhood.foreach { - case (_, neighbors) => - var ips = Set.empty[String] - var id8s = List.empty[String] - var consistentIds = List.empty[String] - var nodeTypes = List.empty[String] - var macs = Set.empty[String] - var cpuLoadSum = 0.0 - - val n1 = neighbors.head - - assert(n1 != null) - - val cpus = n1.metrics.getTotalCpus - val os = "" + - n1.attribute("os.name") + " " + - n1.attribute("os.arch") + " " + - n1.attribute("os.version") - - var i = 1 - - neighbors.foreach(n => { - id8s = id8s :+ (i.toString + ": " + nodeId8(n.id)) - consistentIds = consistentIds :+ n.consistentId().toString - - nodeTypes = nodeTypes :+ (if (n.isClient) "Client" else "Server") - i += 1 - - ips = ips ++ n.addresses() - - cpuLoadSum += n.metrics().getCurrentCpuLoad - - macs = macs ++ n.attribute[String](ATTR_MACS).split(", ").map(_.grouped(2).mkString(":")) - }) - - // Add row. - hostsT += ( - ips.toSeq, - id8s, - consistentIds, - nodeTypes, - os, - cpus, - macs.toSeq, - safePercent(cpuLoadSum / neighbors.size() * 100) - ) - } - - println("Hosts: " + neighborhood.size) - - hostsT.render() - - nl() - - val m = ignite.cluster.forNodes(nodes).metrics() - - val freeHeap = (m.getHeapMemoryTotal - m.getHeapMemoryUsed) * 100 / m.getHeapMemoryTotal - - val sumT = VisorTextTable() - - sumT += ("Active", ignite.cluster().active()) - sumT += ("Total hosts", U.neighborhood(nodes).size) - sumT += ("Total nodes", m.getTotalNodes) - sumT += ("Total CPUs", m.getTotalCpus) - sumT += ("Avg. CPU load", safePercent(m.getAverageCpuLoad * 100)) - sumT += ("Avg. free heap", formatDouble(freeHeap) + " %") - sumT += ("Avg. Up time", X.timeSpan2HMS(m.getUpTime)) - sumT += ("Snapshot time", formatDateTime(System.currentTimeMillis)) - - println("Summary:") - - sumT.render() - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorTopologyCommand { - /** Singleton command. */ - private val cmd = new VisorTopologyCommand - - // Adds command's help to visor. - addHelp( - name = "top", - shortInfo = "Prints current topology.", - spec = List( - "top {-c1=e1 -c2=e2 ... -ck=ek} {-h= ... -h=} {-a}", - "top -activate", - "top -deactivate" - ), - args = List( - "-ck=ek" -> List( - "This defines a mnemonic for node filter:", - " -cc Number of available CPUs on the node.", - " -cl Average CPU load (in %) on the node.", - " -aj Active jobs on the node.", - " -cj Cancelled jobs on the node.", - " -tc Thread count on the node.", -// " -it Idle time on the node.", -// " Note: can have 's', 'm', or 'h' suffix indicating", -// " seconds, minutes, and hours. By default (no suffix provided)", -// " value is assumed to be in milliseconds.", - " -ut Up time on the node.", - " Note: can have 's', 'm', or 'h' suffix indicating", - " seconds, minutes, and hours. By default (no suffix provided)", - " value is assumed to be in milliseconds.", - " -je Job execute time on the node.", - " -jw Job wait time on the node.", - " -wj Waiting jobs count on the node.", - " -rj Rejected jobs count on the node.", - " -hu Heap memory used (in MB) on the node.", - " -hm Heap memory maximum (in MB) on the node.", - "", - "Comparison part of the mnemonic predicate:", - " =eq Equal '=' to '' number.", - " =neq Not equal '!=' to '' number.", - " =gt Greater than '>' to '' number.", - " =gte Greater than or equal '>=' to '' number.", - " =lt Less than '<' to '' number.", - " =lte Less than or equal '<=' to '' number." - ), - "-h=" -> List( - "This defines a host to show nodes from.", - "Multiple hosts can be provided." - ), - "-a" -> List( - "This defines whether to show a separate table of nodes", - "with detail per-node information." - ), - "-activate" -> List( - "Activate cluster." - ), - "-deactivate" -> List( - "Deactivate cluster." - ) - ), - examples = List( - "top -cc=eq2" -> - "Prints topology for all nodes with two CPUs.", - "top -cc=eq2 -a" -> - "Prints full information for all nodes with two CPUs.", - "top -h=10.34.2.122 -h=10.65.3.11" -> - "Prints topology for provided hosts.", - "top" -> - "Prints full topology.", - "top -activate" -> - "Activate cluster.", - "top -deactivate" -> - "Deactivate cluster." - ), - emptyArgs = cmd.top, - withArgs = cmd.top - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromTop2Visor(vs: VisorTag): VisorTopologyCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala deleted file mode 100644 index 350adc3d0f717..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala +++ /dev/null @@ -1,301 +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.visor.commands.vvm - -import org.apache.ignite.IgniteSystemProperties -import org.apache.ignite.cluster.ClusterNode -import org.apache.ignite.internal.IgniteNodeAttributes._ -import org.apache.ignite.internal.util.scala.impl -import org.apache.ignite.internal.util.{IgniteUtils => U} -import org.apache.ignite.visor.VisorTag -import org.apache.ignite.visor.commands.common.VisorConsoleCommand -import org.apache.ignite.visor.visor._ - -import org.jetbrains.annotations.Nullable - -import java.io.File -import java.net._ - -import org.apache.ignite.internal.visor.util.{VisorTaskUtils => TU} - -import scala.collection.JavaConversions._ -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * ==Overview== - * Contains Visor command `vvm` implementation. - * - * ==Help== - * {{{ - * +-----------------------+ - * | vvm | Opens VisualVM. | - * +-----------------------+ - * }}} - * - * ====Specification==== - * {{{ - * vvm "{-home=dir} {-id8=} {-id=}" - * }}} - * - * ====Arguments==== - * {{{ - * -home=dir - * VisualVM home directory. - * If not specified, PATH and JAVA_HOME will be searched. - * -id8= - * ID8 of node. - * Note that either '-id8' or '-id' should be specified. - * You can also use '@n0' ... '@nn' variables as a shortcut for . - * To specify oldest node on the same host as visor use variable '@nl'. - * To specify oldest node on other hosts that are not running visor use variable '@nr'. - * -id= - * Full ID of node. - * Either '-id8' or '-id' can be specified. - * }}} - * - * ====Examples==== - * {{{ - * vvm "-id8=12345678" - * Opens VisualVM connected to JVM for node with '12345678' ID8. - * vvm "-id=5B923966-85ED-4C90-A14C-96068470E94D" - * Opens VisualVM connected to JVM for node with given full node ID. - * vvm "-home=C:\VisualVM -id8=12345678" - * Opens VisualVM installed in 'C:\VisualVM' directory for specified node. - * vvm - * Opens VisualVM connected to all nodes. - * }}} - */ -class VisorVvmCommand extends VisorConsoleCommand { - @impl protected val name = "vvm" - - /** - * ===Command=== - * Opens VisualVM connected to JVM indicated by the node id. - * - * ===Examples=== - * vvm "-id8=12345678" - * Opens VisualVM connected to JVM for node with '12345678' ID8. - * - * vvm "-id=5B923966-85ED-4C90-A14C-96068470E94D" - * Opens VisualVM connected to JVM for node with given full node ID. - * - * vvm "-home=C:\VisualVM -id8=12345678" - * Opens VisualVM installed in 'C:\Visual\VM' directory for specified node. - * - * @param args Command parameters. - */ - def vvm(@Nullable args: String) = breakable { - if (checkConnected()) { - val argLst = parseArgs(args) - - val vvmHome = argValue("home", argLst) getOrElse IgniteSystemProperties.getString("VVM_HOME") - val id8 = argValue("id8", argLst).orNull - val id = argValue("id", argLst).orNull - - var vvmCmd: String = null - - val ext = if (U.isWindows) ".exe" else "" - - val fs = File.separator - - if (vvmHome != null && !vvmHome.isEmpty) { - vvmCmd = vvmHome + fs + "bin" + fs + "visualvm" + ext - - if (!new File(vvmCmd).exists) - vvmCmd = vvmHome + fs + "bin" + fs + "jvisualvm" + ext - } - - if (vvmCmd == null || vvmCmd.isEmpty) { - breakable { - for (p <- System.getenv("PATH").split(System.getProperty("path.separator"))) { - val f1 = p + fs + "visualvm" + ext - val f2 = p + fs + "jvisualvm" + ext - - if (new File(f1).exists) { - vvmCmd = f1 - - break() - } - else if (new File(f2).exists) { - vvmCmd = f2 - - break() - } - } - } - } - - if (vvmCmd == null || vvmCmd.isEmpty) - vvmCmd = IgniteSystemProperties.getString("JAVA_HOME") + fs + "bin" + fs + "jvisualvm" + ext - - if (!new File(vvmCmd).exists) - warn( - "Can't find Visual VM", - "Specify '-home' parameter or VVM_HOME environment property to provide " + - "Visual VM installation folder." - ).^^ - - var nodes: scala.collection.Seq[ClusterNode] = null - - if (id8 != null && id != null) - scold("Only one of '-id8' or '-id' is allowed.").^^ - else if (id8 == null && id == null) - nodes = ignite.cluster.forRemotes().nodes().toSeq - else - if (id8 != null) { - val ns = nodeById8(id8) - - if (ns.isEmpty) - scold("Unknown 'id8' value: " + id8).^^ - else if (ns.size != 1) - scold("'id8' resolves to more than one node (use full 'id' instead): " + id8).^^ - else - nodes = Seq(ns.head) - } - else if (id != null) - try { - val node = ignite.cluster.node(java.util.UUID.fromString(id)) - - if (node == null) - scold("'id' does not match any node: " + id).^^ - - nodes = Seq(node) - } - catch { - case e: IllegalArgumentException => scold("Invalid node 'id': " + id).^^ - } - - var started = false - - val neighbors = ignite.cluster.forHost(ignite.localNode).nodes() - - if (U.isWindows) - vvmCmd = "cmd /c \"%s\"".format(vvmCmd) - - for (node <- nodes if !neighbors.contains(node)) { - val port = node.attribute[java.lang.Integer](ATTR_JMX_PORT) - - if (port == null) - warn("JMX is not enabled for node (skipping): " + nid8(node)) - else { - val addrs = node.addresses.filter(addr => { - try - !InetAddress.getByName(addr).isLoopbackAddress - catch { - case _: Throwable => false - } - }) - - addrs.find(a => TU.reachableByPing(InetAddress.getByName(a), 2000)) match { - case Some(addr) => - // Sequential calls to VisualVM will not start separate processes - // but will add new JMX connection to it. - TU.openInConsole(vvmCmd + " --openjmx " + addr + ":" + port) - - started = true - case None => - scold("Visor failed to get reachable address for node (skipping): " + nid8(node)) - } - } - } - - if (!started) - TU.openInConsole(vvmCmd) - } - } - - /** - * Returns VisualVM command array specific for a particular platform. - * - * @param vvmCmd VisualVM command. - */ - private def vvmCommandArray(vvmCmd: String): Array[String] = { - if (U.isWindows) Array("cmd", "/c", vvmCmd) else Array(vvmCmd) - } - - /** - * ===Command=== - * Opens VisualVM connected to all nodes. - * - * ==Examples== - * vvm - * Opens VisualVM with all nodes. - */ - def vvm() { - vvm(null) - } -} - -/** - * Companion object that does initialization of the command. - */ -object VisorVvmCommand { - /** Singleton command. */ - private val cmd = new VisorVvmCommand - - // Adds command's help to visor. - addHelp( - name = "vvm", - shortInfo = "Opens VisualVM for nodes in topology.", - spec = List("vvm {-home=dir} {-id8=} {-id=}"), - args = List( - "-home=dir" -> List( - "VisualVM home folder.", - "If not specified, PATH and JAVA_HOME will be searched" - ), - "-id8=" -> List( - "ID8 of node.", - "Note that either '-id8' or '-id' should be specified.", - "You can also use '@n0' ... '@nn' variables as a shortcut for .", - "To specify oldest node on the same host as visor use variable '@nl'.", - "To specify oldest node on other hosts that are not running visor use variable '@nr'." - ), - "-id=" -> List( - "Full ID of node.", - "Either '-id8' or '-id' can be specified." - ) - ), - examples = List( - "vvm -id8=12345678" -> - "Opens VisualVM connected to JVM for node with '12345678' ID8.", - "vvm -id8=@n0" -> - "Opens VisualVM connected to JVM for node with given node ID8 taken from 'n0' memory variable.", - "vvm -id=5B923966-85ED-4C90-A14C-96068470E94D" -> - "Opens VisualVM connected to JVM for node with given full node ID.", - "vvm -home=C:\\VisualVM -id8=12345678" -> - "Opens VisualVM installed in 'C:\\VisualVM' folder for specified node.", - "vvm" -> - "Opens VisualVM connected to all nodes." - ), - emptyArgs = cmd.vvm, - withArgs = cmd.vvm - ) - - /** - * Singleton. - */ - def apply() = cmd - - /** - * Implicit converter from visor to commands "pimp". - * - * @param vs Visor tagging trait. - */ - implicit def fromVvm2Visor(vs: VisorTag): VisorVvmCommand = cmd -} diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala deleted file mode 100644 index 9eeea2d211735..0000000000000 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala +++ /dev/null @@ -1,2747 +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.visor - -import java.io._ -import java.lang.{Boolean => JavaBoolean, Byte => JavaByte, Character => JavaCharacter, Double => JavaDouble, Float => JavaFloat, Integer => JavaInteger, Long => JavaLong, Short => JavaShort} -import java.text._ -import java.util.concurrent._ -import java.util.{Collection => JavaCollection, HashSet => JavaHashSet, _} - -import jline.console.ConsoleReader -import org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER -import org.apache.ignite._ -import org.apache.ignite.cluster.{ClusterGroup, ClusterGroupEmptyException, ClusterMetrics, ClusterNode} -import org.apache.ignite.events.EventType._ -import org.apache.ignite.events.{DiscoveryEvent, Event} -import org.apache.ignite.internal.IgniteEx -import org.apache.ignite.internal.IgniteNodeAttributes._ -import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException -import org.apache.ignite.internal.util.lang.{GridFunc => F} -import org.apache.ignite.internal.util.typedef._ -import org.apache.ignite.internal.util.{GridConfigurationFinder, IgniteUtils => U} -import org.apache.ignite.internal.visor.cache._ -import org.apache.ignite.internal.visor.node.{VisorNodeEventsCollectorTaskArg, _} -import org.apache.ignite.internal.visor.util.VisorEventMapper -import org.apache.ignite.internal.visor.util.VisorTaskUtils._ -import org.apache.ignite.internal.visor.{VisorMultiNodeTask, VisorTaskArgument} -import org.apache.ignite.lang._ -import org.apache.ignite.thread.{IgniteThreadFactory, IgniteThreadPoolExecutor} -import org.apache.ignite.visor.commands.common.VisorTextTable -import org.jetbrains.annotations.Nullable - -import scala.collection.JavaConversions._ -import scala.collection.immutable -import scala.language.{implicitConversions, reflectiveCalls} -import scala.util.control.Breaks._ - -/** - * Holder for command help information. - */ -sealed case class VisorCommandHolder( - name: String, - shortInfo: String, - longInfo: Seq[String], - aliases: Seq[String], - spec: Seq[String], - args: Seq[(String, AnyRef)], - examples: Seq[(String, AnyRef)], - emptyArgs: () => Unit, - withArgs: (String) => Unit - ) { - /** Command host with optional aliases. */ - lazy val nameWithAliases: String = - if (aliases != null && aliases.nonEmpty) - name + " (" + ("" /: aliases)((b, a) => if (b.length() == 0) a else b + ", " + a) + ")" - else - name -} - -/** - * ==Overview== - * This is the '''tagging''' trait existing solely to have type associated with - * with `visor` object so that implicit conversions can be done - * on `visor` object itself. Implicit conversions are essential to extensibility - * of the Visor. - * - * ==Example== - * This is an example on how [[VisorTag]] trait is used to - * extend `visor` natively with custom commands: - * - * - * class VisorCustomCommand { - * def foo(@Nullable args: String) = { - * if (visor.hasValue("bar", visor.parse(args))) - * println("foobar") - * else - * println("foo") - * } - * def foo(@Nullable args: Symbol*) = foo(visor.flatSymbols(args: _*)) - * } - * object VisorCustomCommand { - * implicit def fromVisor(vs: VisorTag) = new VisorCustomCommand - * } - * - */ -trait VisorTag - -/** - * {{{ - * ___ _________________________ ________ - * __ | / /____ _/__ ___/__ __ \___ __ \ - * __ | / / __ / _____ \ _ / / /__ /_/ / - * __ |/ / __/ / ____/ / / /_/ / _ _, _/ - * _____/ /___/ /____/ \____/ /_/ |_| - * - * }}} - * - * ==Overview== - * Visor console provides monitoring capabilities for Ignite. - * - * ==Usage== - * Ignite ships with `IGNITE_HOME/bin/ignitevisorcmd.{sh|bat}` script that starts Visor console. - * - * Just type:help in Visor console to get help and get started. - */ -@IgniteNotPeerDeployable -object visor extends VisorTag { - /** Argument type. */ - type Arg = (String, String) - - /** Type alias for command argument list. */ - type ArgList = Seq[Arg] - - /** Type alias for general node filter. */ - type NodeFilter = ClusterNode => Boolean - - /** Type alias for general event filter. */ - type EventFilter = Event => Boolean - - private final val LOC = Locale.US - - /** Date format. */ - private final val dateFmt = new SimpleDateFormat("yyyy-MM-dd", LOC) - - /** Date time format. */ - private final val timeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", LOC) - - final val INPUT_TYPES: Seq[(String, (String => Object), Class[_])] = Seq( - ("java.lang.String", (value: String) => value, classOf[String]), - ("java.lang.Character", (value: String) => JavaCharacter.valueOf(value.head), classOf[JavaCharacter]), - ("java.lang.Integer", (value: String) => JavaInteger.valueOf(value), classOf[JavaInteger]), - ("java.lang.Long", (value: String) => JavaLong.valueOf(value), classOf[JavaLong]), - ("java.lang.Short", (value: String) => JavaShort.valueOf(value), classOf[JavaShort]), - ("java.lang.Byte", (value: String) => JavaByte.valueOf(value), classOf[JavaByte]), - ("java.lang.Float", (value: String) => JavaFloat.valueOf(value), classOf[JavaFloat]), - ("java.lang.Double", (value: String) => JavaDouble.valueOf(value), classOf[JavaDouble]), - ("java.lang.Boolean", (value: String) => JavaBoolean.valueOf(value), classOf[JavaBoolean]), - ("java.util.Date - Value in format yyyy-MM-dd {HH:mm:ss}", - (value: String) => try - timeFmt.parse(value) - catch { - case e: ParseException => dateFmt.parse(value) - }, classOf[Date]), - ("java.util.UUID - Value like this: CC03C3B0-C03D-4B02-82AF-3E0F85414BA6", (value: String) => UUID.fromString(value), classOf[UUID])) - - /** `Nil` is for empty list, `Til` is for empty tuple. */ - val Til: Arg = (null, null) - - /** Node filter that includes any node. */ - final val ALL_NODES_FILTER = (_: ClusterNode) => true - - /** System line separator. */ - final val NL = System getProperty "line.separator" - - /** Display value for `null`. */ - final val NA = "" - - /** */ - private var cmdLst: Seq[VisorCommandHolder] = Nil - - /** Node left listener. */ - private var nodeLeftLsnr: IgnitePredicate[Event] = _ - - /** Node join listener. */ - private var nodeJoinLsnr: IgnitePredicate[Event] = _ - - /** Node segmentation listener. */ - private var nodeSegLsnr: IgnitePredicate[Event] = _ - - /** Node stop listener. */ - private var nodeStopLsnr: IgnitionListener = _ - - /** */ - @volatile private var isCon: Boolean = false - - /** - * Whether or not Visor is the owner of connection - or it - * reused one already opened. - */ - @volatile private var conOwner: Boolean = false - - /** */ - @volatile private var conTs: Long = 0 - - private final val DEC_FMT_SYMS = new DecimalFormatSymbols(LOC) - - /** Number format. */ - private final val nmFmt = new DecimalFormat("#", DEC_FMT_SYMS) - - /** KB format. */ - private final val kbFmt = new DecimalFormat("###,###,###,###,###", DEC_FMT_SYMS) - - /** */ - private val mem = new ConcurrentHashMap[String, String]() - - /** List of close callbacks*/ - @volatile private var cbs = Seq.empty[() => Unit] - - /** List of shutdown callbacks*/ - @volatile private var shutdownCbs = Seq.empty[() => Unit] - - /** Default log file path. */ - /** - * Default log file path. Note that this path is relative to `IGNITE_HOME/work` folder - * if `IGNITE_HOME` system or environment variable specified, otherwise it is relative to - * `work` folder under system `java.io.tmpdir` folder. - */ - private final val DFLT_LOG_PATH = "visor/visor-log" - - /** Log file. */ - private var logFile: File = _ - - /** Log timer. */ - private var logTimer: Timer = _ - - /** Topology log timer. */ - private var topTimer: Timer = _ - - /** Log started flag. */ - @volatile private var logStarted = false - - /** Internal thread pool. */ - @volatile var pool: ExecutorService = new IgniteThreadPoolExecutor( - Runtime.getRuntime.availableProcessors(), - Runtime.getRuntime.availableProcessors(), - 0L, - new LinkedBlockingQueue[Runnable](), - new IgniteThreadFactory("visorInstance", "visor") - ) - - /** Configuration file path, if any. */ - @volatile var cfgPath: String = _ - - /** */ - @volatile var ignite: IgniteEx = _ - - /** */ - @volatile var prevIgnite: Option[IgniteEx] = None - - private var reader: ConsoleReader = _ - - var batchMode: Boolean = false - - /** Quiet mode to disable internal node log and information messages output. */ - var quiet: Boolean = false - - def reader(reader: ConsoleReader) { - assert(reader != null) - - this.reader = reader - } - - /** - * Get grid node for specified ID. - * - * @param nid Node ID. - * @return ClusterNode instance. - * @throws IgniteException if Visor is disconnected or node not found. - */ - def node(nid: UUID): ClusterNode = { - val g = ignite - - if (g == null) - throw new IgniteException("Visor disconnected") - else { - val node = g.cluster.node(nid) - - if (node == null) - throw new IgniteException("Node is gone: " + nid) - - node - } - } - - /** - * @param node Optional node. - * @param cacheName Cache name to take cluster group for. - * @return Cluster group with data nodes for specified cache or cluster group for specified node. - */ - def groupForDataNode(node: Option[ClusterNode], cacheName: String): ClusterGroup = { - val grp = node match { - case Some(n) => ignite.cluster.forNode(n) - case None => ignite.cluster.forNodeIds(executeRandom(classOf[VisorCacheNodesTask], - new VisorCacheNodesTaskArg(cacheName))) - } - - if (grp.nodes().isEmpty) - throw new ClusterGroupEmptyException("Topology is empty.") - - grp - } - - /** - * @param nodeOpt Node. - * @param cacheName Cache name. - * @return Message about why node was not found. - */ - def messageNodeNotFound(nodeOpt: Option[ClusterNode], cacheName: String): String = nodeOpt match { - case Some(node) => "Can't find node with specified id: " + node.id() - case None => "Can't find nodes for cache: " + escapeName(cacheName) - } - - Runtime.getRuntime.addShutdownHook(new Thread() { - override def run() { - try - if (ignite != null && isConnected) { - // Call all shutdown callbacks. - shutdownCbs foreach(_.apply()) - - close() // This will stop the grid too if Visor is connection owner. - } - catch { - case _: Throwable => // ignore - } - } - }) - - // Make sure visor starts without version checker print. - System.setProperty(IGNITE_UPDATE_NOTIFIER, "false") - - addHelp( - name = "mlist", - shortInfo = "Prints Visor console memory variables.", - spec = Seq( - "mlist {arg}" - ), - args = Seq( - "arg" -> - "String that contains start characters of variable names." - ), - examples = Seq( - "mlist" -> - "Prints out all Visor console memory variables.", - "mlist ac" -> - "Lists variables that start with 'a' or 'c' from Visor console memory." - ), - emptyArgs = mlist, - withArgs = mlist - ) - - addHelp( - name = "mget", - shortInfo = "Gets Visor console memory variable.", - longInfo = Seq( - "Gets Visor console memory variable. Variable can be referenced with '@' prefix." - ), - spec = Seq( - "mget <@v>" - ), - args = Seq( - "@v" -> - "Variable name." - ), - examples = Seq( - "mget <@v>" -> - "Gets Visor console variable whose name is referenced by variable 'v'." - ), - emptyArgs = mget, - withArgs = mget - ) - - addHelp( - name = "mcompact", - shortInfo = "Fills gap in Visor console memory variables.", - longInfo = Seq( - "Finds and fills gap in Visor console memory variables." - ), - spec = Seq( - "mcompact" - ), - examples = Seq( - "mcompact" -> - "Fills gap in Visor console memory variables." - ), - emptyArgs = mcompact, - withArgs = _ => wrongArgs("mcompact") - ) - - addHelp( - name = "help", - shortInfo = "Prints Visor console help.", - aliases = Seq("?"), - spec = Seq( - "help {c1 c2 ... ck}" - ), - args = Seq( - "ck" -> - "Command to get help for." - ), - examples = Seq( - "help status" -> - "Prints help for 'status' command.", - "help" -> - "Prints help for all command." - ), - emptyArgs = help, - withArgs = help - ) - - addHelp( - name = "status", - shortInfo = "Prints Visor console status.", - aliases = Seq("!"), - spec = Seq( - "status {-q}" - ), - args = Seq( - "-q" -> - "Quite output without ASCII logo." - ), - examples = Seq( - "status" -> - "Prints Visor console status.", - "status -q" -> - "Prints Visor console status in quiet mode." - ), - emptyArgs = status, - withArgs = status - ) - - /** - * @param name - command name. - */ - private def wrongArgs(name: String) { - warn("Invalid arguments for command without arguments.", - s"Type 'help $name' to see how to use this command.") - } - - addHelp( - name = "close", - shortInfo = "Disconnects Visor console from the grid.", - spec = Seq("close"), - examples = Seq( - "close" -> - "Disconnects Visor console from the grid." - ), - emptyArgs = close, - withArgs = _ => wrongArgs("close") - ) - - addHelp( - name = "quit", - shortInfo = "Quit from Visor console.", - spec = Seq("quit"), - examples = Seq( - "quit" -> - "Quit from Visor console." - ), - aliases = Seq("exit"), - emptyArgs = quit, - withArgs = _ => wrongArgs("quit") - ) - - addHelp( - name = "log", - shortInfo = "Starts or stops grid-wide events logging.", - longInfo = Seq( - "Logging of discovery and failure grid-wide events.", - " ", - "Events are logged to a file. If path is not provided,", - "it will log into '/work/visor/visor-log'.", - " ", - "File is always opened in append mode.", - "If file doesn't exist, it will be created.", - " ", - "It is often convenient to 'tail -f' the log file", - "in a separate console window.", - " ", - "Log command prints periodic topology snapshots in the following format:", - "H/N/C |1 |1 |4 |=^========..........|", - "where:", - " H - Hosts", - " N - Nodes", - " C - CPUs", - " = - 5%-based marker of average CPU load across the topology", - " ^ - 5%-based marker of average heap memory used across the topology" - ), - spec = Seq( - "log", - "log -l {-f=} {-p=} {-t=} {-dl}", - "log -s" - ), - args = Seq( - "-l" -> Seq( - "Starts logging.", - "If logging is already started - it's no-op." - ), - "-f=" -> Seq( - "Provides path to the file.", - "Path to the file can be absolute or relative to Ignite home folder." - ), - "-p=" -> Seq( - "Provides period of querying events (in seconds).", - "Default is 10." - ), - "-t=" -> Seq( - "Provides period of logging topology snapshot (in seconds).", - "Default is 20." - ), - "-s" -> Seq( - "Stops logging.", - "If logging is already stopped - it's no-op." - ), - "-dl" -> Seq( - "Disables collecting of job and task fail events, cache rebalance events from remote nodes." - ) - ), - examples = Seq( - "log" -> - "Prints log status.", - "log -l -f=/home/user/visor-log" -> - "Starts logging to file 'visor-log' located at '/home/user'.", - "log -l -f=log/visor-log" -> - "Starts logging to file 'visor-log' located at '/log'.", - ("log -l -p=20", - "Starts logging to file '/work/visor/visor-log' " + - "with querying events period of 20 seconds."), - ("log -l -t=30", - "Starts logging to file '/work/visor/visor-log' " + - "with topology snapshot logging period of 30 seconds."), - ("log -l -dl", - "Starts logging to file '/work/visor/visor-log' " + - "with disabled collection events from remote nodes."), - "log -s" -> - "Stops logging." - ), - emptyArgs = log, - withArgs = log - ) - - logText("Visor started.") - - // Print out log explanation at the beginning. - logText(": H - Hosts") - logText(": N - Nodes") - logText(": C - CPUs") - logText(": = - 5%-based marker of average CPU load across the topology") - logText(": ^ - 5%-based marker of average heap memory used across the topology") - - /** - * ==Command== - * Lists Visor console memory variables. - * - * ==Examples== - * mlist ac - * Lists variables that start with `a` or `c` from Visor console memory. - * - * mlist - * Lists all variables from Visor console memory. - * - * @param arg String that contains start characters of listed variables. - * If empty - all variables will be listed. - */ - def mlist(arg: String) { - assert(arg != null) - - if (mem.isEmpty) - println("Memory is empty.") - else { - val r = if (arg.trim == "") mem.toMap else mem.filter { case (k, _) => arg.contains(k.charAt(0)) } - - if (r.isEmpty) - println("No matches found.") - else { - val t = new VisorTextTable() - - t.maxCellWidth = 70 - - t #= ("Name", "Value") - - r.toSeq.sortBy(_._1).foreach { case (k, v) => t += (k, v) } - - t.render() - - nl() - - println( - "Variable can be referenced in other commands with '@' prefix." + NL + - "Reference can be either a flag or a parameter value." + NL + - "\nEXAMPLE: " + NL + - " 'help @cmd' - where 'cmd' variable contains command name." + NL + - " 'node -id8=@n11' - where 'n11' variable contains node ID8." - ) - } - } - } - - /** - * Shortcut for `println()`. - */ - def nl() { - println() - } - - /** - * ==Command== - * Lists all Visor console memory. - * - * ==Examples== - * mlist - * Lists all variables in Visor console memory. - */ - def mlist() { - mlist("") - } - - /** - * ==Command== - * Fills gap in Visor console memory variables. - * - * ==Examples== - * mcompact - * Fills gap in Visor console memory variables. - */ - def mcompact() { - val namespaces = Array("a", "c", "e", "n", "s", "t") - - for (namespace <- namespaces) { - val vars = mem.filter { case (k, _) => k.matches(s"$namespace\\d+") } - - if (vars.nonEmpty) { - clearNamespace(namespace) - - vars.toSeq.sortBy(_._1).foreach { case (_, v) => setVar(v, namespace) } - } - } - } - - /** - * Clears given Visor console variable or the whole namespace. - * - * @param arg Variable host or namespace mnemonic. - */ - def mclear(arg: String) { - assert(arg != null) - - arg match { - case "-ev" => clearNamespace("e") - case "-al" => clearNamespace("a") - case "-ca" => clearNamespace("c") - case "-no" => clearNamespace("n") - case "-tn" => clearNamespace("t") - case "-ex" => clearNamespace("s") - case _ => mem.remove(arg) - } - } - - /** - * Clears given variable namespace. - * - * @param namespace Namespace. - */ - private def clearNamespace(namespace: String) { - assert(namespace != null) - - mem.keys().foreach(k => { - if (k.matches(s"$namespace\\d+")) - mem.remove(k) - }) - } - - /** - * Clears all Visor console memory. - */ - def mclear() { - mem.clear() - } - - /** - * Finds variables by its value. - * - * @param v Value to find by. - */ - def mfind(@Nullable v: String): Seq[(String, String)] = mem.filter(t => t._2 == v).toSeq - - /** - * Finds variable by its value. - * - * @param v Value to find by. - */ - def mfindHead(@Nullable v: String): Option[(String, String)] = - mfind(v).filterNot(entry => Seq("nl", "nr").contains(entry._1)).headOption - - /** - * Sets Visor console memory variable. Note that this method '''does not''' - * perform variable substitution on its parameters. - * - * @param n Name of the variable. Can't be `null`. - * @param v Value of the variable. Can't be `null`. - * @return Previous value. - */ - def mset(n: String, v: String): String = { - msetOpt(n, v).orNull - } - - /** - * Sets Visor console memory variable. Note that this method '''does not''' - * perform variable substitution on its parameters. - * - * @param n Name of the variable. Can't be `null`. - * @param v Value of the variable. Can't be `null`. - * @return Previous value as an option. - */ - def msetOpt(n: String, v: String): Option[String] = { - assert(n != null) - assert(v != null) - - val prev = mem.get(n) - - mem.put(n, v) - - Option(prev) - } - - /** - * ==Command== - * Gets Visor console memory variable. Note that this method '''does not''' - * perform variable substitution on its parameters. - * - * ==Examples== - * mget @a - * Gets the value for Visor console variable '@a'. - * - * @param n Name of the variable. - * @return Variable value or `null` if such variable doesn't exist or its value was set as `null`. - */ - def mget(n: String) { - val key = if (n.startsWith("@")) n.substring(1) else n - - if (mem.containsKey(key)) { - val t = new VisorTextTable() - - t.maxCellWidth = 70 - - t #= ("Name", "Value") - - t += (n, mem.get(key)) - - t.render() - - nl() - } - else { - warn("Missing variable with name: \'" + n + "\'.") - } - } - - /** - * Trap for missing arguments. - */ - def mget() { - warn("Missing argument.") - warn("Type 'help mget' to see how to use this command.") - } - - /** - * ==Command== - * Gets Visor console memory variable. Note that this method '''does not''' - * perform variable substitution on its parameters. - * - * ==Examples== - * mgetOpt a - * Gets the value as an option for Visor console variable 'a'. - * - * @param n Name of the variable. - * @return Variable host as an option. - */ - def mgetOpt(n: String): Option[String] = { - assert(n != null) - - Option(mem.get(n)) - } - - /** - * If variable with given value and prefix doesn't exist - creates - * a new variable with given value and returns its host. Otherwise, - * returns an existing variable host. - * - * @param v Value. - * @param prefix Variable host prefix. - * @return Existing variable host or the new variable host. - */ - def setVarIfAbsent(v: AnyRef, prefix: String): String = { - assert(v != null) - assert(prefix != null && prefix.length > 0) - - val s = v.toString - - val t = mem.find((t: (String, String)) => t._1.startsWith(prefix) && t._2 == s) - - if (t.isDefined) - t.get._1 - else { - for (i <- 0 until Int.MaxValue if mem.putIfAbsent(prefix + i, s) == null) - return prefix + i - - throw new IgniteException("No more memory.") - } - } - - /** - * Try get variable value with given name. - * - * @param v variable name. - * @return variable value or `v` if variable with name `v` not exist. - */ - def getVariable(v: String): String = { - v match { - case name if name.startsWith("@") => mgetOpt(name.substring(1)).getOrElse(v) - case _ => v - } - } - - /** - * Creates a new variable with given value and returns its host. - * - * @param v Value. - * @param prefix Variable host prefix. - * @return New variable host. - */ - def setVar(v: AnyRef, prefix: String): String = { - assert(v != null) - assert(prefix != null && prefix.length > 0) - - val s = v.toString - - for (i <- 0 until Int.MaxValue if mem.putIfAbsent(prefix + i, s) == null) - return prefix + i - - throw new IgniteException("No more memory.") - } - - /** - * Adds command help to the Visor console. This will be printed as part of `help` command. - * - * @param name Command name. - * @param shortInfo Short command description. - * @param longInfo Optional multi-line long command description. If not provided - short description - * will be used instead. - * @param aliases List of aliases. Optional. - * @param spec Command specification. - * @param args List of `(host, description)` tuples for command arguments. Optional. - * @param examples List of `(example, description)` tuples for command examples. - * @param emptyArgs - command implementation with empty arguments. - * @param withArgs - command implementation with arguments. - */ - def addHelp( - name: String, - shortInfo: String, - @Nullable longInfo: Seq[String] = null, - @Nullable aliases: Seq[String] = Seq.empty, - spec: Seq[String], - @Nullable args: Seq[(String, AnyRef)] = null, - examples: Seq[(String, AnyRef)], - emptyArgs: () => Unit, - withArgs: (String) => Unit) { - assert(name != null) - assert(shortInfo != null) - assert(spec != null && spec.nonEmpty) - assert(examples != null && examples.nonEmpty) - assert(emptyArgs != null) - assert(withArgs != null) - - // Add and re-sort - cmdLst = (cmdLst ++ Seq(VisorCommandHolder(name, shortInfo, longInfo, aliases, spec, args, examples, emptyArgs, withArgs))). - sortWith((a, b) => a.name.compareTo(b.name) < 0) - } - - /** - * Extract node from command arguments. - * - * @param argLst Command arguments. - * @return Error message or node ref. - */ - def parseNode(argLst: ArgList): Either[String, Option[ClusterNode]] = { - val id8 = argValue("id8", argLst) - val id = argValue("id", argLst) - - if (id8.isDefined && id.isDefined) - Left("Only one of '-id8' or '-id' is allowed.") - else if (id8.isDefined) { - nodeById8(id8.get) match { - case Nil => Left("Unknown 'id8' value: " + id8.get) - case node :: Nil => Right(Option(node)) - case _ => Left("'id8' resolves to more than one node (use full 'id' instead): " + id8.get) - } - } - else if (id.isDefined) { - try { - val node = Option(ignite.cluster.node(java.util.UUID.fromString(id.get))) - - if (node.isDefined) - Right(node) - else - Left("'id' does not match any node: " + id.get) - } - catch { - case _: IllegalArgumentException => Left("Invalid node 'id': " + id.get) - } - } - else - Right(None) - } - - private[this] def parseArg(arg: String): Arg = { - if (arg(0) == '-' || arg(0) == '/') { - val eq = arg.indexOf('=') - - if (eq == -1) - arg.substring(1) -> null - else { - val n = arg.substring(1, eq).trim - var v = arg.substring(eq + 1).trim.replaceAll("['\"`]$", "").replaceAll("^['\"`]", "") - - if (v.startsWith("@")) - v = mgetOpt(v.substring(1)).getOrElse(v) - - n -> v - } - } - else { - val k: String = null - - val v = if (arg.startsWith("@")) - mgetOpt(arg.substring(1)).getOrElse(arg) - else - arg - - k -> v - } - } - - private val quotedArg = "(?:[-/].*=)?(['\"`]).*".r - - /** - * Utility method that parses command arguments. Arguments represented as a string - * into argument list represented as list of tuples (host, value) performing - * variable substitution: - * - * `-p=@n` - A named parameter where `@n` will be considered as a reference to variable named `n`. - * `@ n` - An unnamed parameter where `@n` will be considered as a reference to variable named `n`. - * `-p` - A flag doesn't support variable substitution. - * - * Note that recursive substitution isn't supported. If specified variable isn't set - the value - * starting with `@` will be used as-is. - * - * @param args Command arguments to parse. - */ - def parseArgs(@Nullable args: String): ArgList = { - val buf = collection.mutable.ArrayBuffer.empty[Arg] - - if (args != null && args.trim.nonEmpty) { - val lst = args.trim.split(" ") - - val sb = new StringBuilder() - - for (i <- 0 until lst.size if lst(i).nonEmpty || sb.nonEmpty) { - val arg = sb.toString + lst(i) - - arg match { - case quotedArg(quote) if arg.count(_ == quote(0)) % 2 != 0 && i + 1 < lst.size => - sb.append(lst(i)).append(" ") - - case _ => - sb.clear() - - buf += parseArg(arg) - } - } - } - - buf - } - - /** - * Shortcut method that checks if passed in argument list has an argument with given value. - * - * @param v Argument value to check for existence in this list. - * @param args Command argument list. - */ - def hasArgValue(@Nullable v: String, args: ArgList): Boolean = { - assert(args != null) - - args.exists(_._2 == v) - } - - /** - * Shortcut method that checks if passed in argument list has an argument with given host. - * - * @param n Argument host to check for existence in this list. - * @param args Command argument list. - */ - def hasArgName(@Nullable n: String, args: ArgList): Boolean = { - assert(args != null) - - args.exists(_._1 == n) - } - - /** - * Shortcut method that checks if flag (non-`null` host and `null` value) is set - * in the argument list. - * - * @param n Name of the flag. - * @param args Command argument list. - */ - def hasArgFlag(n: String, args: ArgList): Boolean = { - assert(n != null && args != null) - - args.exists((a) => a._1 == n && a._2 == null) - } - - /** - * Gets the value for a given argument host. - * - * @param n Argument host. - * @param args Argument list. - * @return Argument value. - */ - @Nullable def argValue(n: String, args: ArgList): Option[String] = { - assert(n != null && args != null) - - Option((args find(_._1 == n) getOrElse Til)._2) - } - - /** - * Gets a non-`null` value for given parameter. - * - * @param a Parameter. - * @param dflt Value to return if `a` is `null`. - */ - def safe(@Nullable a: Any, dflt: Any = NA): String = { - assert(dflt != null) - - if (a != null) a.toString else dflt.toString - } - - /** - * Joins array elements to string. - * - * @param arr Array. - * @param dflt Value to return if `arr` is `null` or empty. - * @return String. - */ - def arr2Str[T](arr: Array[T], dflt: Any = NA): String = - if (arr != null && arr.length > 0) U.compact(arr.mkString(", ")) else dflt.toString - - /** - * Converts `Boolean` to 'on'/'off' string. - * - * @param bool Boolean value. - * @return String. - */ - def bool2Str(bool: Boolean): String = if (bool) "on" else "off" - - /** - * Converts `java.lang.Boolean` to 'on'/'off' string. - * - * @param bool Boolean value. - * @param ifNull Default value in case if `bool` is `null`. - * @return String. - */ - def javaBoolToStr(bool: JavaBoolean, ifNull: Boolean = false): String = - bool2Str(if (bool == null) ifNull else bool.booleanValue()) - - /** - * Reconstructs string presentation for given argument. - * - * @param arg Argument to reconstruct. - */ - @Nullable def makeArg(arg: Arg): String = { - assert(arg != null) - - var s = "" - - if (arg._1 != null) { - s = "-" + arg._1 - - if (arg._2 != null) - s = s + '=' + arg._2 - } - else - s = arg._2 - - s - } - - /** - * Reconstructs string presentation for given argument list. - * - * @param args Argument list to reconstruct. - */ - def makeArgs(args: ArgList): String = { - assert(args != null) - - ("" /: args)((b, a) => if (b.length == 0) makeArg(a) else b + ' ' + makeArg(a)) - } - - /** - * Parses string containing mnemonic predicate and returns Scala predicate. - * - * @param s Mnemonic predicate. - * @return Long to Boolean predicate or null if predicate cannot be created. - */ - def makeExpression(s: String): Option[Long => Boolean] = { - assert(s != null) - - def value(v: String): Long = - // Support for seconds, minutes and hours. - // NOTE: all memory sizes are assumed to be in MB. - v.last match { - case 's' => v.substring(0, v.length - 1).toLong * 1000 - case 'm' => v.substring(0, v.length - 1).toLong * 1000 * 60 - case 'h' => v.substring(0, v.length - 1).toLong * 1000 * 60 * 60 - case _ => v.toLong - } - - try - Option( - if (s == null) - null - else if (s.startsWith("lte")) // <= - _ <= value(s.substring(3)) - else if (s.startsWith("lt")) // < - _ < value(s.substring(2)) - else if (s.startsWith("gte")) // >= - _ >= value(s.substring(3)) - else if (s.startsWith("gt")) // > - _ > value(s.substring(2)) - else if (s.startsWith("eq")) // == - _ == value(s.substring(2)) - else if (s.startsWith("neq")) // != - _ != value(s.substring(3)) - else - null - ) - catch { - case _: Throwable => None - } - } - - // Formatters. - private val dblFmt = new DecimalFormat("#0.00", DEC_FMT_SYMS) - private val intFmt = new DecimalFormat("#0", DEC_FMT_SYMS) - - /** - * Formats double value with `#0.00` formatter. - * - * @param d Double value to format. - */ - def formatDouble(d: Double): String = { - dblFmt.format(d) - } - - /** - * Formats double value with `#0` formatter. - * - * @param d Double value to format. - */ - def formatInt(d: Double): String = { - intFmt.format(d.round) - } - - /** - * Returns string representation of the timestamp provided. Result formatted - * using pattern `MM/dd/yy, HH:mm:ss`. - * - * @param ts Timestamp. - */ - def formatDateTime(ts: Long): String = - timeFmt.format(ts) - - /** - * Returns string representation of the date provided. Result formatted using - * pattern `MM/dd/yy, HH:mm:ss`. - * - * @param date Date. - */ - def formatDateTime(date: Date): String = - timeFmt.format(date) - - /** - * Returns string representation of the timestamp provided. Result formatted - * using pattern `MM/dd/yy`. - * - * @param ts Timestamp. - */ - def formatDate(ts: Long): String = - dateFmt.format(ts) - - /** - * Returns string representation of the date provided. Result formatted using - * pattern `MM/dd/yy`. - * - * @param date Date. - */ - def formatDate(date: Date): String = - dateFmt.format(date) - - /** - * Base class for memory units. - * - * @param name Unit name to display on screen. - * @param base Unit base to convert from bytes. - */ - private[this] sealed abstract class VisorMemoryUnit(name: String, val base: Long) { - /** - * Convert memory in bytes to memory in units. - * - * @param m Memory in bytes. - * @return Memory in units. - */ - def toUnits(m: Long): Double = m.toDouble / base - - /** - * Check if memory fits measure units. - * - * @param m Memory in bytes. - * @return `True` if memory is more than `1` after converting bytes to units. - */ - def has(m: Long): Boolean = toUnits(m) >= 1 - - override def toString: String = name - } - - private[this] case object BYTES extends VisorMemoryUnit("b", 1) - private[this] case object KILOBYTES extends VisorMemoryUnit("kb", 1024L) - private[this] case object MEGABYTES extends VisorMemoryUnit("mb", 1024L * 1024L) - private[this] case object GIGABYTES extends VisorMemoryUnit("gb", 1024L * 1024L * 1024L) - private[this] case object TERABYTES extends VisorMemoryUnit("tb", 1024L * 1024L * 1024L * 1024L) - - /** - * Detect memory measure units: from BYTES to TERABYTES. - * - * @param m Memory in bytes. - * @return Memory measure units. - */ - private[this] def memoryUnit(m: Long): VisorMemoryUnit = - if (TERABYTES.has(m)) - TERABYTES - else if (GIGABYTES.has(m)) - GIGABYTES - else if (MEGABYTES.has(m)) - MEGABYTES - else if (KILOBYTES.has(m)) - KILOBYTES - else - BYTES - - /** - * Returns string representation of the memory. - * - * @param n Memory size. - */ - def formatMemory(n: Long): String = { - if (n > 0) { - val u = memoryUnit(n) - - kbFmt.format(u.toUnits(n)) + u.toString - } - else - "0" - } - - /** - * Returns string representation of the memory limit. - * - * @param n Memory size. - */ - def formatMemoryLimit(n: Long): String = { - n match { - case -1 => "Disabled" - case 0 => "Unlimited" - case m => formatMemory(m) - } - } - - /** - * Returns string representation of the number. - * - * @param n Number. - */ - def formatNumber(n: Long): String = - nmFmt.format(n) - - /** - * Tests whether or not Visor console is connected. - * - * @return `True` if Visor console is connected. - */ - def isConnected: Boolean = isCon - - /** - * Check cluster is active. - * - * @return `True` when cluster is active. - */ - def isActive: Boolean = ignite.cluster().active() - - /** - * Gets timestamp of Visor console connection. Returns `0` if Visor console is not connected. - * - * @return Timestamp of Visor console connection. - */ - def connectTimestamp: Long = conTs - - /** - * Prints properly formatted error message like: - * {{{ [WARN]: warning message }}} - * - * @param warnMsgs Warning messages to print - */ - def warn(warnMsgs: Any*) { - if (warnMsgs != null) - warnMsgs.foreach(line => println(s"[WARN ] $line")) - else - println("[ERROR] Warning message is missing") - } - - /** - * Prints properly formatted info message like: - * {{{ [INFO]: info message }}} - * - * @param infoMsgs Info messages to print. - */ - def info(infoMsgs: Any*) { - if (infoMsgs != null) - infoMsgs.foreach(line => println(s"[INFO ] $line")) - else - println("[ERROR] Info message is missing") - } - - /** - * Check connection state and show inform message when Visor console is not connected to cluster. - * - * @return `True` when Visor console is connected to cluster. - */ - def checkConnected(): Boolean = { - isCon || { - warn( - "Visor is disconnected.", - "Type 'open' to connect Visor console or 'help open' to get help." - ) - - false - } - } - - /** - * Gets global projection as an option. - */ - def gridOpt = - Option(ignite) - - def noop() {} - - /** - * ==Command== - * Prints Visor console status. - * - * ==Example== - * status -q - * Prints Visor console status without ASCII logo. - * - * @param args Optional "-q" flag to disable ASCII logo printout. - */ - def status(args: String) { - val t = VisorTextTable() - - t += ("Status", if (isCon) "Connected" else "Disconnected") - t += ("Ignite instance name", - if (ignite == null) - NA - else { - val n = ignite.name - - escapeName(n) - } - ) - t += ("Config path", safe(cfgPath)) - t += ("Uptime", if (isCon) X.timeSpan2HMS(uptime) else NA) - - t.render() - } - - /** - * ==Command== - * Prints Visor console status (with ASCII logo). - * - * ==Example== - * status - * Prints Visor console status. - */ - def status() { - status("") - } - - /** - * ==Command== - * Prints help for specific command(s) or for all commands. - * - * ==Example== - * help - * Prints general help. - * - * help open - * Prints help for 'open' command. - * - * @param args List of commands to print help for. If empty - prints generic help. - */ - def help(args: String = null) { - val argLst = parseArgs(args) - - if (!has(argLst)) { - val t = VisorTextTable() - - t.autoBorder = false - - t.maxCellWidth = 55 - - t #= ("Command", "Description") - - cmdLst foreach (hlp => t += (hlp.nameWithAliases, hlp.shortInfo)) - - t.render() - - println("\nType 'help \"command name\"' to see how to use this command.") - } - else - for (c <- argLst) - if (c._1 != null) - warn("Invalid command name: " + argName(c)) - else if (c._2 == null) - warn("Invalid command name: " + argName(c)) - else { - val n = c._2 - - val opt = cmdLst.find(_.name == n) - - if (opt.isEmpty) - warn("Invalid command name: " + n) - else { - val hlp: VisorCommandHolder = opt.get - - val t = VisorTextTable() - - t += (hlp.nameWithAliases, if (hlp.longInfo == null) hlp.shortInfo else hlp.longInfo) - - t.render() - - println("\nSPECIFICATION:") - - hlp.spec foreach(s => println(blank(4) + s)) - - if (has(hlp.args)) { - println("\nARGUMENTS:") - - hlp.args foreach (a => { - val (arg, desc) = a - - println(blank(4) + arg) - - desc match { - case (lines: Iterable[_]) => lines foreach (line => println(blank(8) + line)) - case s: AnyRef => println(blank(8) + s.toString) - } - }) - } - - if (has(hlp.examples)) { - println("\nEXAMPLES:") - - hlp.examples foreach (a => { - val (ex, desc) = a - - println(blank(4) + ex) - - desc match { - case (lines: Iterable[_]) => lines foreach (line => println(blank(8) + line)) - case s: AnyRef => println(blank(8) + s.toString) - } - }) - } - - nl() - } - } - } - - /** - * Tests whether passed in sequence is not `null` and not empty. - */ - private def has[T](@Nullable s: Seq[T]): Boolean = { - s != null && s.nonEmpty - } - - /** - * ==Command== - * Prints generic help. - * - * ==Example== - * help - * Prints help. - */ - def help() { - help("") - } - - /** - * Helper function that makes up the full argument host from tuple. - * - * @param t Command argument tuple. - */ - def argName(t: (String, String)): String = - if (F.isEmpty(t._1) && F.isEmpty(t._2)) - "" - else if (F.isEmpty(t._1)) - t._2 - else - t._1 - - /** - * Helper method that produces blank string of given length. - * - * @param len Length of the blank string. - */ - private def blank(len: Int) = new String().padTo(len, ' ') - - /** - * Connects Visor console to configuration with path. - * - * @param igniteInstanceName Name of Ignite instance. - * @param cfgPath Configuration path. - */ - def open(igniteInstanceName: String, cfgPath: String) { - this.cfgPath = cfgPath - - ignite = - try - Ignition.ignite(igniteInstanceName).asInstanceOf[IgniteEx] - catch { - case _: IllegalStateException => - this.cfgPath = null - - throw new IgniteException("Named Ignite instance unavailable: " + igniteInstanceName) - } - - assert(cfgPath != null) - - isCon = true - conOwner = true - conTs = System.currentTimeMillis - - ignite.cluster.nodes().foreach(n => { - setVarIfAbsent(nid8(n), "n") - - val ip = sortAddresses(n.addresses()).headOption - - if (ip.isDefined) - setVarIfAbsent(ip.get, "h") - }) - - val onHost = ignite.cluster.forHost(ignite.localNode()) - - Option(onHost.forServers().forOldest().node()).foreach(n => msetOpt("nl", nid8(n))) - Option(ignite.cluster.forOthers(onHost).forServers.forOldest().node()).foreach(n => msetOpt("nr", nid8(n))) - - nodeJoinLsnr = new IgnitePredicate[Event]() { - override def apply(e: Event): Boolean = { - e match { - case de: DiscoveryEvent => - val n = nid8(de.eventNode()) - - setVarIfAbsent(n, "n") - - val node = ignite.cluster.node(de.eventNode().id()) - - if (node != null) { - val alias = if (U.sameMacs(ignite.localNode(), node)) "nl" else "nr" - - if (mgetOpt(alias).isEmpty) - msetOpt(alias, n) - - val ip = sortAddresses(node.addresses).headOption - - if (ip.isDefined) - setVarIfAbsent(ip.get, "h") - } - else { - warn( - "New node not found: " + de.eventNode().id(), - "Visor must have discovery configuration and local " + - "host bindings identical with grid nodes." - ) - } - } - - true - } - } - - ignite.events().localListen(nodeJoinLsnr, EVT_NODE_JOINED) - - val mclear = (node: ClusterNode) => { - mfind(nid8(node)).foreach(nv => mem.remove(nv._1)) - - val onHost = ignite.cluster.forHost(ignite.localNode()) - - if (mgetOpt("nl").isEmpty) - Option(onHost.forServers().forOldest().node()).foreach(n => msetOpt("nl", nid8(n))) - - if (mgetOpt("nr").isEmpty) - Option(ignite.cluster.forOthers(onHost).forServers.forOldest().node()).foreach(n => msetOpt("nr", nid8(n))) - - if (onHost.nodes().isEmpty) - sortAddresses(node.addresses).headOption.foreach((ip) => mfind(ip).foreach(hv => mem.remove(hv._1))) - } - - nodeLeftLsnr = new IgnitePredicate[Event]() { - override def apply(e: Event): Boolean = { - e match { - case (de: DiscoveryEvent) => mclear(de.eventNode()) - } - - true - } - } - - ignite.events().localListen(nodeLeftLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED) - - nodeSegLsnr = new IgnitePredicate[Event] { - override def apply(e: Event): Boolean = { - e match { - case de: DiscoveryEvent => - if (de.eventNode().id() == ignite.localNode.id) { - warn("Closing Visor console due to topology segmentation.") - warn("Contact your system administrator.") - - nl() - - close() - } - else - mclear(de.eventNode()) - } - - true - } - } - - ignite.events().localListen(nodeSegLsnr, EVT_NODE_SEGMENTED) - - nodeStopLsnr = new IgnitionListener { - def onStateChange(name: String, state: IgniteState) { - if (name == ignite.name && state == IgniteState.STOPPED) { - warn("Closing Visor console due to stopping of host grid instance.") - - nl() - - close() - } - } - } - - Ignition.addListener(nodeStopLsnr) - - logText("Visor joined topology: " + cfgPath) - logText("All live nodes, if any, will re-join.") - - nl() - - if (!visor.quiet) { - val t = VisorTextTable() - - // Print advise. - println("Some useful commands:") - - t += ("Type 'top'", "to see full topology.") - t += ("Type 'node'", "to see node statistics.") - t += ("Type 'cache'", "to see cache statistics.") - t += ("Type 'tasks'", "to see tasks statistics.") - t += ("Type 'config'", "to see node configuration.") - - t.render() - - println("\nType 'help' to get help.\n") - } - - status() - } - - /** - * Returns string with node id8, its memory variable, if available, and its - * IP address (first internal address), if node is alive. - * - * @param id Node ID. - * @return String. - */ - def nodeId8Addr(id: UUID): String = { - assert(id != null) - assert(isCon) - - val g = ignite - - if (g != null && g.localNode.id == id) - "" - else { - val n = ignite.cluster.node(id) - - val id8 = nid8(id) - var v = mfindHead(id8) - - if(v.isEmpty){ - v = assignNodeValue(n) - } - - id8 + - (if (v.isDefined) "(@" + v.get._1 + ")" else "" )+ - ", " + - (if (n == null) NA else sortAddresses(n.addresses).headOption.getOrElse(NA)) - } - } - - def assignNodeValue(node: ClusterNode): Option[(String, String)] = { - assert(node != null) - - val id8 = nid8(node.id()) - - setVarIfAbsent(id8, "n") - - val alias = if (U.sameMacs(ignite.localNode(), node)) "nl" else "nr" - - if (mgetOpt(alias).isEmpty) - msetOpt(alias, nid8(node.id())) - - val ip = sortAddresses(node.addresses).headOption - - if (ip.isDefined) - setVarIfAbsent(ip.get, "h") - - mfindHead(id8) - } - - /** - * Returns string with node id8 and its memory variable, if available. - * - * @param id Node ID. - * @return String. - */ - def nodeId8(id: UUID): String = { - assert(id != null) - assert(isCon) - - val id8 = nid8(id) - val v = mfindHead(id8) - - id8 + (if (v.isDefined) "(@" + v.get._1 + ")" else "") - } - - /** - * Guards against invalid percent readings. - * - * @param v Value in '%' to guard. - * @return Percent as string. Any value below `0` and greater than `100` will return `<n/a>` string. - */ - def safePercent(v: Double): String = if (v < 0 || v > 100) NA else formatDouble(v) + " %" - - /** Convert to task argument. */ - def emptyTaskArgument[A](nid: UUID): VisorTaskArgument[Void] = new VisorTaskArgument(nid, false) - - def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void] = - new VisorTaskArgument(new JavaHashSet(nids), false) - - /** Convert to task argument. */ - def toTaskArgument[A](nid: UUID, arg: A): VisorTaskArgument[A] = new VisorTaskArgument(nid, arg, false) - - /** Convert to task argument. */ - def toTaskArgument[A](nids: Iterable[UUID], arg: A): VisorTaskArgument[A] = - new VisorTaskArgument(new JavaHashSet(nids), arg, false) - - @throws[ClusterGroupEmptyException]("In case of empty topology.") - private def execute[A, R, J](grp: ClusterGroup, task: Class[_ <: VisorMultiNodeTask[A, R, J]], arg: A): R = { - if (grp.nodes().isEmpty) - throw new ClusterGroupEmptyException("Topology is empty.") - - ignite.compute(grp).withNoFailover().execute(task, toTaskArgument(grp.nodes().map(_.id()), arg)) - } - - /** - * Execute task on node. - * - * @param nid Node id. - * @param task Task class - * @param arg Task argument. - * @tparam A Task argument type. - * @tparam R Task result type - * @tparam J Job class. - * @return Task result. - */ - @throws[ClusterGroupEmptyException]("In case of empty topology.") - def executeOne[A, R, J](nid: UUID, task: Class[_ <: VisorMultiNodeTask[A, R, J]], arg: A): R = - execute(ignite.cluster.forNodeId(nid), task, arg) - - /** - * Execute task on random node from specified cluster group. - * - * @param grp Cluster group to take rundom node from - * @param task Task class - * @param arg Task argument. - * @tparam A Task argument type. - * @tparam R Task result type - * @tparam J Job class. - * @return Task result. - */ - @throws[ClusterGroupEmptyException]("In case of empty topology.") - def executeRandom[A, R, J](grp: ClusterGroup, task: Class[_ <: VisorMultiNodeTask[A, R, J]], arg: A): R = - execute(grp.forRandom(), task, arg) - - /** - * Execute task on random node. - * - * @param task Task class - * @param arg Task argument. - * @tparam A Task argument type. - * @tparam R Task result type - * @tparam J Job class. - * @return Task result. - */ - @throws[ClusterGroupEmptyException]("In case of empty topology.") - def executeRandom[A, R, J](task: Class[_ <: VisorMultiNodeTask[A, R, J]], arg: A): R = - execute(ignite.cluster.forRandom(), task, arg) - - /** - * Execute task on specified nodes. - * - * @param nids Node ids. - * @param task Task class - * @param arg Task argument. - * @tparam A Task argument type. - * @tparam R Task result type - * @tparam J Job class. - * @return Task result. - */ - @throws[ClusterGroupEmptyException]("In case of empty topology.") - def executeMulti[A, R, J](nids: Iterable[UUID], task: Class[_ <: VisorMultiNodeTask[A, R, J]], arg: A): R = - execute(ignite.cluster.forNodeIds(nids), task, arg) - - /** - * Execute task on all nodes. - * - * @param task Task class - * @param arg Task argument. - * @tparam A Task argument type. - * @tparam R Task result type - * @tparam J Job class. - * @return Task result. - */ - @throws[ClusterGroupEmptyException]("In case of empty topology.") - def executeMulti[A, R, J](task: Class[_ <: VisorMultiNodeTask[A, R, J]], arg: A): R = - execute(ignite.cluster.forRemotes(), task, arg) - - /** - * Gets caches configurations from specified node. - * - * @param nid Node ID to collect configuration from. - * @return Collection of cache configurations. - */ - @throws[ClusterGroupEmptyException]("In case of empty topology.") - def cacheConfigurations(nid: UUID): JavaCollection[VisorCacheConfiguration] = - executeOne(nid, classOf[VisorCacheConfigurationCollectorTask], - new VisorCacheConfigurationCollectorTaskArg(null.asInstanceOf[JavaCollection[String]])).values() - - /** - * Asks user to select a node from the list. - * - * @param title Title displayed before the list of nodes. - * @return `Option` for ID of selected node. - */ - def askForNode(title: String): Option[UUID] = { - assert(title != null) - assert(isCon) - - val t = VisorTextTable() - - t #= ("#", "Node ID8(@), IP", "Consistent ID", "Node Type", "Up Time", "CPUs", "CPU Load", "Free Heap") - - val nodes = ignite.cluster.nodes().toList - - if (nodes.isEmpty) { - warn("Topology is empty.") - - None - } - else if (nodes.size == 1) - Some(nodes.head.id) - else { - nodes.indices foreach (i => { - val n = nodes(i) - - val m = n.metrics - - val usdMem = m.getHeapMemoryUsed - val maxMem = m.getHeapMemoryMaximum - val freeHeapPct = (maxMem - usdMem) * 100 / maxMem - - val cpuLoadPct = m.getCurrentCpuLoad * 100 - - t += ( - i, - nodeId8Addr(n.id), - n.consistentId(), - if (n.isClient) "Client" else "Server", - X.timeSpan2HMS(m.getUpTime), - n.metrics.getTotalCpus, - safePercent(cpuLoadPct), - formatDouble(freeHeapPct) + " %" - ) - }) - - println(title) - - t.render() - - val a = ask("\nChoose node number ('c' to cancel) [0]: ", "0") - - if (a.toLowerCase == "c") - None - else { - try - Some(nodes(a.toInt).id) - catch { - case _: Throwable => - warn("Invalid selection: " + a) - - None - } - } - } - } - - /** - * Asks user to select a host from the list. - * - * @param title Title displayed before the list of hosts. - * @return `Option` for projection of nodes located on selected host. - */ - def askForHost(title: String): Option[ClusterGroup] = { - assert(title != null) - assert(isCon) - - val t = VisorTextTable() - - t #= ("#", "Int./Ext. IPs", "Node ID8(@)", "OS", "CPUs", "MACs", "CPU Load") - - val neighborhood = U.neighborhood(ignite.cluster.nodes()).values().toIndexedSeq - - if (neighborhood.isEmpty) { - warn("Topology is empty.") - - None - } - else { - neighborhood.indices foreach (i => { - val neighbors = neighborhood(i) - - var ips = immutable.Set.empty[String] - var id8s = Seq.empty[String] - var macs = immutable.Set.empty[String] - var cpuLoadSum = 0.0 - - val n1 = neighbors.head - - assert(n1 != null) - - val cpus = n1.metrics.getTotalCpus - - val os = "" + - n1.attribute("os.name") + " " + - n1.attribute("os.arch") + " " + - n1.attribute("os.version") - - neighbors.foreach(n => { - id8s = id8s :+ nodeId8(n.id) - - ips = ips ++ n.addresses - - cpuLoadSum += n.metrics().getCurrentCpuLoad - - macs = macs ++ n.attribute[String](ATTR_MACS).split(", ").map(_.grouped(2).mkString(":")) - }) - - t += ( - i, - ips.toSeq, - id8s, - os, - cpus, - macs.toSeq, - safePercent(cpuLoadSum / neighbors.size() * 100) - ) - }) - - println(title) - - t.render() - - val a = ask("\nChoose host number ('c' to cancel) [0]: ", "0") - - if (a.toLowerCase == "c") - None - else { - try - Some(ignite.cluster.forNodes(neighborhood(a.toInt))) - catch { - case _: Throwable => - warn("Invalid selection: " + a) - - None - } - } - } - } - - /** - * Asks user to choose configuration file. - * - * @return `Option` for file path. - */ - def askConfigFile(): Option[String] = { - val files = GridConfigurationFinder.getConfigFiles - - if (files.isEmpty) { - warn("No configuration files found.") - - None - } - else { - val t = VisorTextTable() - - t #= ("#", "Configuration File") - - (0 until files.size).foreach(i => t += (i, files(i).get1())) - - println("Local configuration files:") - - t.render() - - val a = ask("\nChoose configuration file number ('c' to cancel) [0]: ", "0") - - if (a.toLowerCase == "c") - None - else { - try - Some(files(a.toInt).get3.getPath) - catch { - case _: Throwable => - nl() - - warn("Invalid selection: " + a) - - None - } - } - } - } - - /** - * Asks user input. - * - * @param prompt Prompt string. - * @param dflt Default value for user input. - * @param passwd If `true`, input will be masked with '*' character. `false` by default. - */ - def ask(prompt: String, dflt: String, passwd: Boolean = false): String = { - assert(prompt != null) - assert(dflt != null) - - if (batchMode) - return dflt - - readLineOpt(prompt, if (passwd) Some('*') else None) match { - case None => dflt - case Some(s) if s.length == 0 => dflt - case Some(s) => s - } - } - - def askTypedValue(name: String): Option[Object] = { - val t = VisorTextTable() - - t #= ("#", "Type description") - - INPUT_TYPES.indices.foreach(i => t += (i, INPUT_TYPES(i)._1)) - - println("Available " + name + " types:") - - t.render() - - val a = ask("\nChoose " + name + " type ('c' to cancel) [0]: ", "0") - - if (a.toLowerCase == "c") - None - else { - try { - val parser = INPUT_TYPES(a.toInt)._2 - - try { - val input = readLineOpt("Input " + name + ": ") - - input.map(parser) - } - catch { - case e: Throwable => - nl() - - warn("Failed to parse value to specified type") - - None - } - } - catch { - case e: Throwable => - nl() - - warn("Invalid selection: " + a) - - None - } - } - } - - /** - * Safe `readLine` version. - * - * @param prompt User prompt. - * @param mask Mask character (if `None`, no masking will be applied). - */ - private def readLineOpt(prompt: String, mask: Option[Char] = None): Option[String] = { - assert(reader != null) - - try { - Option(mask.fold(reader.readLine(prompt))(reader.readLine(prompt, _))) - } - catch { - case _: Throwable => None - } - } - - /** - * Adds close callback. Added function will be called every time - * command `close` is called. - * - * @param f Close callback to add. - */ - def addShutdownCallback(f: () => Unit) { - assert(f != null) - - shutdownCbs = shutdownCbs :+ f - } - - /** - * Adds close callback. Added function will be called every time - * command `close` is called. - * - * @param f Close callback to add. - */ - def addCloseCallback(f: () => Unit) { - assert(f != null) - - cbs = cbs :+ f - } - - /** - * Removes close callback. - * - * @param f Close callback to remove. - */ - def removeCloseCallback(f: () => Unit) { - assert(f != null) - - cbs = cbs.filter(_ != f) - } - - /** - * Removes all close callbacks. - */ - def removeCloseCallbacks() { - cbs = Seq.empty[() => Unit] - } - - /** - * Gets visor uptime. - */ - def uptime: Long = if (isCon) System.currentTimeMillis() - conTs else -1L - - /** - * ==Command== - * Disconnects visor. - * - * ==Examples== - * close - * Disconnects from the grid. - */ - def close() { - if (checkConnected()) { - if (pool != null) { - pool.shutdown() - - try - if (!pool.awaitTermination(5, TimeUnit.SECONDS)) - pool.shutdownNow - catch { - case _: InterruptedException => - pool.shutdownNow - - Thread.currentThread.interrupt() - } - - pool = new IgniteThreadPoolExecutor( - Runtime.getRuntime.availableProcessors(), - Runtime.getRuntime.availableProcessors(), - 0L, - new LinkedBlockingQueue[Runnable](), - new IgniteThreadFactory("visorInstance", "visor") - ) - } - - // Call all close callbacks. - cbs foreach(_.apply()) - - if (ignite != null && Ignition.state(ignite.name) == IgniteState.STARTED) { - if (nodeJoinLsnr != null) - ignite.events().stopLocalListen(nodeJoinLsnr) - - if (nodeLeftLsnr != null) - ignite.events().stopLocalListen(nodeLeftLsnr) - - if (nodeSegLsnr != null) - ignite.events().stopLocalListen(nodeSegLsnr) - } - - if (nodeStopLsnr != null) - Ignition.removeListener(nodeStopLsnr) - - if (ignite != null && conOwner) - try - Ignition.stop(ignite.name, true) - catch { - case e: Exception => warn(e.getMessage) - } - - // Fall through and treat Visor console as closed - // even in case when grid didn't stop properly. - - logText("Visor left topology.") - - if (logStarted) { - stopLog() - - nl() - } - - isCon = false - conOwner = false - conTs = 0 - ignite = null - nodeJoinLsnr = null - nodeLeftLsnr = null - nodeSegLsnr = null - nodeStopLsnr = null - cfgPath = null - - // Clear the memory. - mclear() - - nl() - - status() - } - } - - /** - * ==Command== - * quit from Visor console. - * - * ==Examples== - * quit - * Quit from Visor console. - */ - def quit() { - System.exit(0) - } - - /** - * ==Command== - * Prints log status. - * - * ==Examples== - * log - * Prints log status. - */ - def log() { - val t = VisorTextTable() - - t += ("Status", if (logStarted) "Started" else "Stopped") - - if (logStarted) { - t += ("File path", logFile.getAbsolutePath) - t += ("File size", if (logFile.exists) formatMemory(logFile.length())) - } - - t.render() - } - - /** - * ==Command== - * Starts or stops logging. - * - * ==Examples== - * log -l -f=/home/user/visor-log - * Starts logging to file `visor-log` located at `/home/user`. - *
- * log -l -f=log/visor-log - * Starts logging to file `visor-log` located at <`Ignite home folder`>`/log`. - *
- * log -l -p=20 - * Starts logging with querying events period of 20 seconds. - *
- * log -l -t=30 - * Starts logging with topology snapshot logging period of 30 seconds. - *
- * log -s - * Stops logging. - * - * @param args Command arguments. - */ - def log(args: String) { - assert(args != null) - - if (checkConnected()) { - def scold(errMsgs: Any*) { - assert(errMsgs != null) - - warn(errMsgs: _*) - warn("Type 'help log' to see how to use this command.") - } - - val argLst = parseArgs(args) - - if (hasArgFlag("s", argLst)) - if (!logStarted) - scold("Logging was not started.") - else - stopLog() - else if (hasArgFlag("l", argLst)) - if (logStarted) - scold("Logging is already started.") - else - try - startLog(argValue("f", argLst), argValue("p", argLst), argValue("t", argLst), - hasArgFlag("dl", argLst)) - catch { - case e: Exception => scold(e) - } - else - scold("Invalid arguments.") - } - } - - /** - * Stops logging. - */ - private def stopLog() { - assert(logStarted) - - logText("Log stopped.") - - if (logTimer != null) { - logTimer.cancel() - logTimer.purge() - - logTimer = null - } - - if (topTimer != null) { - topTimer.cancel() - topTimer.purge() - - topTimer = null - } - - logStarted = false - - info("Log stopped: " + logFile.getAbsolutePath) - } - - /** Unique Visor key to get events last order. */ - final val EVT_LAST_ORDER_KEY = UUID.randomUUID().toString - - /** Unique Visor key to get events throttle counter. */ - final val EVT_THROTTLE_CNTR_KEY = UUID.randomUUID().toString - - /** - * Starts logging. If logging is already started - no-op. - * - * @param pathOpt `Option` for log file path. If `None` - default is used. - * @param freqOpt `Option` for events fetching frequency If `None` - default is used. - * @param topFreqOpt `Option` for topology refresh frequency. - * @param rmtLogDisabled `True` if no events collected from remote nodes. - */ - private def startLog(pathOpt: Option[String], freqOpt: Option[String], topFreqOpt: Option[String], - rmtLogDisabled: Boolean) { - assert(pathOpt != null) - assert(freqOpt != null) - assert(!logStarted) - - val path = pathOpt.getOrElse(DFLT_LOG_PATH) - - val f = new File(path) - - if (f.exists() && f.isDirectory) - throw new IllegalArgumentException("Specified path is a folder. Please input valid file path.") - - val folder = Option(f.getParent).getOrElse("") - val fileName = f.getName - - logFile = new File(U.resolveWorkDirectory(U.defaultWorkDirectory(), folder, false), fileName) - - logFile.createNewFile() - - if (!logFile.canWrite) - throw new IllegalArgumentException("Not enough permissions to write a log file.") - - var freq = 0L - - try - freq = freqOpt.getOrElse("10").toLong * 1000L - catch { - case _: NumberFormatException => - throw new IllegalArgumentException("Invalid frequency: " + freqOpt.get) - } - - if (freq <= 0) - throw new IllegalArgumentException("Frequency must be positive: " + freq) - - if (freq > 60000) - warn("Frequency greater than a minute is too low (ignoring).") - - var topFreq = 0L - - try - topFreq = topFreqOpt.getOrElse("20").toLong * 1000L - catch { - case _: NumberFormatException => - throw new IllegalArgumentException("Invalid topology frequency: " + topFreqOpt.get) - } - - if (topFreq <= 0) - throw new IllegalArgumentException("Topology frequency must be positive: " + topFreq) - - // Unique key for this JVM. - val key = UUID.randomUUID().toString + System.identityHashCode(classOf[java.lang.Object]).toString - - logTimer = new Timer(true) - - logTimer.schedule(new TimerTask() { - /** Events to be logged by Visor console (additionally to discovery events). */ - private final val LOG_EVTS = Array( - EVT_JOB_TIMEDOUT, - EVT_JOB_FAILED, - EVT_JOB_FAILED_OVER, - EVT_JOB_REJECTED, - EVT_JOB_CANCELLED, - - EVT_TASK_TIMEDOUT, - EVT_TASK_FAILED, - EVT_TASK_DEPLOY_FAILED, - EVT_TASK_DEPLOYED, - EVT_TASK_UNDEPLOYED, - - EVT_CACHE_REBALANCE_STARTED, - EVT_CACHE_REBALANCE_STOPPED, - EVT_CLASS_DEPLOY_FAILED - ) - - override def run() { - if (ignite != null) { - try { - // Discovery events collected only locally. - val loc = collectEvents(ignite, EVT_LAST_ORDER_KEY, EVT_THROTTLE_CNTR_KEY, - LOG_EVTS ++ EVTS_DISCOVERY, new VisorEventMapper).toSeq - - val evts = if (!rmtLogDisabled) - loc ++ executeMulti(classOf[VisorNodeEventsCollectorTask], - VisorNodeEventsCollectorTaskArg.createLogArg(key, LOG_EVTS)).toSeq - else - loc - - if (evts.nonEmpty) { - var out: FileWriter = null - - try { - out = new FileWriter(logFile, true) - - evts.toList.sortBy(_.getTimestamp).foreach(e => { - logImpl( - out, - formatDateTime(e.getTimestamp), - nodeId8Addr(e.getNid), - U.compact(e.getShortDisplay) - ) - - if (EVTS_DISCOVERY.contains(e.getTypeId)) - snapshot() - }) - } - finally { - U.close(out, null) - } - } - } - catch { - case _: ClusterGroupEmptyCheckedException => // Ignore. - case _: Exception => logText("Failed to collect log.") - } - } - } - }, freq, freq) - - topTimer = new Timer(true) - - topTimer.schedule(new TimerTask() { - override def run() { - snapshot() - } - }, topFreq, topFreq) - - logStarted = true - - logText("Log started.") - - info("Log started: " + logFile.getAbsolutePath) - } - - /** - * Does topology snapshot. - */ - private def snapshot() { - val g = ignite - - if (g != null) - try - drawBar(g.cluster.metrics()) - catch { - case _: ClusterGroupEmptyCheckedException => logText("Topology is empty.") - case _: Exception => () - } - } - - /** - * - * @param m Projection metrics. - */ - private def drawBar(m: ClusterMetrics) { - assert(m != null) - - val pipe = "|" - - def bar(cpuLoad: Double, memUsed: Double): String = { - val nCpu = if (cpuLoad < 0 || cpuLoad > 1) 0 else (cpuLoad * 20).toInt - val nMem = if (memUsed < 0 || memUsed > 1) 0 else (memUsed * 20).toInt - - ("" /: (0 until 20))((s: String, i: Int) => { - s + (i match { - case a if a == nMem => "^" - case a if a <= nCpu => "=" - case _ => '.' - }) - }) - } - - logText("H/N/C" + pipe + - U.neighborhood(ignite.cluster.nodes()).size.toString.padTo(4, ' ') + pipe + - m.getTotalNodes.toString.padTo(4, ' ') + pipe + - m.getTotalCpus.toString.padTo(4, ' ') + pipe + - bar(m.getAverageCpuLoad, m.getHeapMemoryUsed / m.getHeapMemoryTotal) + pipe - ) - } - - /** - * Logs text message. - * - * @param msg Message to log. - */ - def logText(msg: String) { - assert(msg != null) - - if (logStarted) { - var out: FileWriter = null - - try { - out = new FileWriter(logFile, true) - - logImpl( - out, - formatDateTime(System.currentTimeMillis), - null, - msg - ) - } - catch { - case _: IOException => () - } - finally { - U.close(out, null) - } - } - } - - /** - * @param out Writer. - * @param tstamp Timestamp of the log. - * @param node Node associated with the event. - * @param msg Message associated with the event. - */ - private def logImpl( - out: java.io.Writer, - tstamp: String, - node: String = null, - msg: String - ) { - assert(out != null) - assert(tstamp != null) - assert(msg != null) - assert(logStarted) - - if (node != null) - out.write(tstamp.padTo(18, ' ') + " | " + node + " => " + msg + "\n") - else - out.write(tstamp.padTo(18, ' ') + " | " + msg + "\n") - } - - /** - * Prints out status and help in case someone calls `visor()`. - * - */ - def apply() { - status() - - nl() - - help() - } - - lazy val commands: Seq[String] = cmdLst.map(_.name) ++ cmdLst.flatMap(_.aliases) - - def searchCmd(cmd: String): Option[VisorCommandHolder] = - cmdLst.find(c => c.name.equals(cmd) || (c.aliases != null && c.aliases.contains(cmd))) - - /** - * Transform node ID to ID8 string. - * - * @param node Node to take ID from. - * @return Node ID in ID8 format. - */ - def nid8(node: ClusterNode): String = { - nid8(node.id()) - } - - /** - * Transform node ID to ID8 string. - * - * @param nid Node ID. - * @return Node ID in ID8 format. - */ - def nid8(nid: UUID): String = { - nid.toString.take(8).toUpperCase - } - - /** - * Get node by ID8 string. - * - * @param id8 Node ID in ID8 format. - * @return Collection of nodes that has specified ID8. - */ - def nodeById8(id8: String): Iterable[ClusterNode] = ignite.cluster.nodes().filter(n => id8.equalsIgnoreCase(nid8(n))) - - /** - * Introduction of `^^` operator for `Any` type that will call `break`. - * - * @param v `Any` value. - */ - implicit def toReturnable(v: Any) = new { - // Ignore the warning below. - def ^^ { - break() - } - } - - /** - * Decode time frame from string. - * - * @param timeArg Optional time frame: <num>s|m|h|d - * @return Time in milliseconds. - */ - def timeFilter(timeArg: Option[String]): Long = { - if (timeArg.nonEmpty) { - val s = timeArg.get - - val n = try - s.substring(0, s.length - 1).toLong - catch { - case (_: NumberFormatException | _: StringIndexOutOfBoundsException) => - throw new IllegalArgumentException("Time frame size is not numeric in: " + s) - } - - if (n <= 0) - throw new IllegalArgumentException("Time frame size is not positive in: " + s) - - val timeUnit = s.last match { - case 's' => 1000L - case 'm' => 1000L * 60L - case 'h' => 1000L * 60L * 60L - case 'd' => 1000L * 60L * 60L * 24L - case _ => throw new IllegalArgumentException("Invalid time frame suffix in: " + s) - } - - n * timeUnit - } - else - Long.MaxValue - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala deleted file mode 100644 index f5d6e561bb236..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala +++ /dev/null @@ -1,82 +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.visor - -import org.apache.ignite.Ignition -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.visor.commands.open.VisorOpenCommand._ -import org.scalatest._ -import VisorRuntimeBaseSpec._ - -/** - * Base abstract class for unit tests requiring Visor runtime. - */ -abstract class VisorRuntimeBaseSpec(private[this] val num: Int) extends FunSpec with Matchers - with BeforeAndAfterAll with BeforeAndAfterEach { - assert(num >= 1) - - /** - * Gets grid configuration. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - protected def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - - cfg - } - - protected def openVisor() { - visor.open(config(VISOR_INSTANCE_NAME), "n/a") - } - - protected def closeVisorQuiet() { - if (visor.isConnected) - visor.close() - } - - /** - * Runs before all tests. - */ - override protected def beforeAll() { - (1 to num).foreach((n: Int) => Ignition.start(config("node-" + n))) - } - - /** - * Runs after all tests. - */ - override def afterAll() { - (1 to num).foreach((n: Int) => Ignition.stop("node-" + n, false)) - } - - override protected def beforeEach() { - openVisor() - } - - override protected def afterEach() { - closeVisorQuiet() - } -} - -/** Singleton companion object. */ -object VisorRuntimeBaseSpec { - val VISOR_INSTANCE_NAME = "visor-demo-node" -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorTextTableSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorTextTableSpec.scala deleted file mode 100644 index eec401936f113..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorTextTableSpec.scala +++ /dev/null @@ -1,45 +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.visor - -import org.apache.ignite.visor.commands.common.VisorTextTable - -import org.scalatest._ - -import scala.collection._ - -/** - * Test for visor text table. - */ -class VisorTextTableSpec extends FlatSpec with ShouldMatchers { - "A table with header" should "render" in { - val t = new VisorTextTable() - - t.margin(5, 5, 5, 5) - - t.maxCellWidth = 10 - - t.headerStyle("leftPad: 10, rightPad: 5") - t #= ("Header 1", mutable.Seq("Header 2.1", "Header 2.2"), "Header 3") - t += ("Row 1", mutable.ListBuffer("Row 2"), immutable.List("Row 3.1", "Row 3.2")) - t += ("1234567890zxcvbnmasdASDFGHJKLQ", mutable.ListBuffer("Row 2"), immutable.List("Row 3.1", "Row 3.2")) - t += (immutable.Seq("Row 31.1", "Row 31.2"), "Row 11", "Row 21") - - t.render() - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala deleted file mode 100644 index a581899c2a84e..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala +++ /dev/null @@ -1,72 +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.visor.commands - -import org.apache.ignite.visor.visor -import org.scalatest._ - -import visor._ - -/** - * Test for visor's argument list parsing. - */ -class VisorArgListSpec extends FunSpec with ShouldMatchers { - describe("A visor argument list") { - it("should properly parse 'null' arguments") { - val v = parseArgs(null) - - assert(v.isEmpty) - } - - it("should properly parse non-empty arguments") { - val v = parseArgs("-a=b c d -minus -d=") - - assert(v.size == 5) - - assert(v(0)._1 == "a") - assert(v(0)._2 == "b") - - assert(v(1)._1 == null) - assert(v(1)._2 == "c") - - assert(v(2)._1 == null) - assert(v(2)._2 == "d") - - assert(v(3)._1 == "minus") - assert(v(3)._2 == null) - - assert(v(4)._1 == "d") - assert(v(4)._2 == "") - } - - it("should properly parse quoted arguments") { - val v = parseArgs("-a='b 'c' d' -minus -d=") - - assert(v.size == 3) - - assert(v(0)._1 == "a") - assert(v(0)._2 == "b 'c' d") - - assert(v(1)._1 == "minus") - assert(v(1)._2 == null) - - assert(v(2)._1 == "d") - assert(v(2)._2 == "") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala deleted file mode 100644 index e7333c67ef6ea..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala +++ /dev/null @@ -1,58 +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.visor.commands - -import org.scalatest._ - -import java.io.File -import java.util - -/** - * Test for visor's file name completer. - */ -class VisorFileNameCompleterSpec extends FunSpec with ShouldMatchers { - describe("A visor file name completer") { - it("should properly parse empty path") { - val c = new VisorFileNameCompleter() - - val res = new util.ArrayList[CharSequence]() - - c.complete("", 0, res) - - assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size) - - res.clear() - - c.complete(null, 0, res) - - assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size) - - res.clear() - - c.complete(" ", 2, res) - - assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size) - - res.clear() - - c.complete("help ", 5, res) - - assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size) - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala deleted file mode 100644 index b6a9608633eed..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala +++ /dev/null @@ -1,40 +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.visor.commands.ack - -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.apache.ignite.visor.commands.ack.VisorAckCommand._ - -/** - * Unit test for 'ack' command. - */ -class VisorAckCommandSpec extends VisorRuntimeBaseSpec(2) { - describe("A 'ack' visor command") { - it("should properly execute w/o arguments"){ - visor ack() - } - - it("should properly execute with arguments") { - visor ack "Broadcasting!" - } - - it("should print error message when not connected") { - visor ack() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala deleted file mode 100644 index 2fce3d3d638f7..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala +++ /dev/null @@ -1,153 +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.visor.commands.alert - -import org.apache.ignite.Ignition -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.spi.discovery.DiscoverySpi -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder - -import java.util.regex.Pattern - -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.apache.ignite.visor.commands.alert.VisorAlertCommand._ - -/** - * Unit test for alert commands. - */ -class VisorAlertCommandSpec extends VisorRuntimeBaseSpec(1) { - /** */ - val ipFinder = new TcpDiscoveryVmIpFinder(true) - - /** */ - val out = new java.io.ByteArrayOutputStream - - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - cfg.setLocalHost("127.0.0.1") - - val discoSpi: TcpDiscoverySpi = new TcpDiscoverySpi() - - discoSpi.setIpFinder(ipFinder) - - cfg.setDiscoverySpi(discoSpi.asInstanceOf[DiscoverySpi]) - - cfg - } - - override def afterAll() { - super.afterAll() - - out.close() - } - - /** - * Redirect stdout and compare output with specified text. - * - * @param block Function to execute. - * @param text Text to compare with. - * @param exp If `true` then stdout must contain `text` otherwise must not. - */ - private[this] def checkOut(block: => Unit, text: String, exp: Boolean = true) { - try { - Console.withOut(out)(block) - - assertResult(exp)(out.toString.contains(text)) - } - finally { - out.reset() - } - } - - /** - * Redirect stdout and compare output with specified regexp. - * - * @param block Function to execute. - * @param regex Regexp to match with. - */ - private[this] def matchOut(block: => Unit, regex: String) { - try { - Console.withOut(out)(block) - - assertResult(true)(Pattern.compile(regex, Pattern.MULTILINE).matcher(out.toString).find()) - } - finally { - out.reset() - } - } - - describe("An 'alert' visor command") { - it("should print not connected error message") { - visor.close() - - checkOut(visor.alert("-r -t=5 -cc=gte4"), "Visor is disconnected.") - - checkOut(visor.alert(), "No alerts are registered.") - } - - it("should register new alert") { - try { - checkOut(visor.alert(), "No alerts are registered.") - - matchOut(visor.alert("-r -t=5 -cc=gte4"), "Alert.+registered.") - - checkOut(visor.alert(), "No alerts are registered.", false) - } - finally { - visor.alert("-u -a") - } - } - - it("should print error messages on incorrect alerts") { - try { - checkOut(visor.alert("-r -t=5"), "No predicates have been provided in args") - - checkOut(visor.alert("-r -UNKNOWN_KEY=lt20"), "Invalid argument") - - checkOut(visor.alert("-r -cc=UNKNOWN_OPERATION20"), "Invalid expression") - } - finally { - visor.alert("-u -a") - } - } - - it("should write alert to log") { - try { - matchOut(visor.alert("-r -nc=gte1"), "Alert.+registered.") - - Ignition.start(config("node-2")) - - Ignition.stop("node-2", false) - - checkOut(visor.alert(), "No alerts are registered.", false) - } - finally { - visor.alert("-u -a") - } - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala deleted file mode 100644 index 59e6b3973557a..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala +++ /dev/null @@ -1,101 +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.visor.commands.cache - -import org.apache.ignite.cache.{CacheAtomicityMode, CacheMode} -import CacheAtomicityMode._ -import CacheMode._ -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.apache.ignite.Ignition -import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration} -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder -import org.jetbrains.annotations.{NotNull, Nullable} -import org.apache.ignite.visor.commands.cache.VisorCacheCommand._ - -import scala.collection.JavaConversions._ - -/** - * - */ -class VisorCacheClearCommandSpec extends VisorRuntimeBaseSpec(2) { - /** IP finder. */ - val ipFinder = new TcpDiscoveryVmIpFinder(true) - - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - cfg.setLocalHost("127.0.0.1") - cfg.setCacheConfiguration(cacheConfig("cache")) - - val discoSpi = new TcpDiscoverySpi() - - discoSpi.setIpFinder(ipFinder) - - cfg.setDiscoverySpi(discoSpi) - - cfg - } - - /** - * @param name Cache name. - * @return Cache Configuration. - */ - def cacheConfig(@NotNull name: String): CacheConfiguration[Object, Object] = { - val cfg = new CacheConfiguration[Object, Object] - - cfg.setCacheMode(REPLICATED) - cfg.setAtomicityMode(TRANSACTIONAL) - cfg.setName(name) - - cfg - } - - describe("An 'cclear' visor command") { - it("should show correct result for named cache") { - Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3)) - - val lock = Ignition.ignite("node-1").cache[Int, Int]("cache").lock(1) - - lock.lock() - - visor.cache("-clear -c=cache") - - lock.unlock() - - visor.cache("-clear -c=cache") - } - - it("should show correct help") { - VisorCacheCommand - - visor.help("cache") - } - - it("should show empty projection error message") { - visor.cache("-clear -c=wrong") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala deleted file mode 100644 index d2c3711d6ef70..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala +++ /dev/null @@ -1,164 +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.visor.commands.cache - -import java.lang.{Integer => JavaInt} -import java.util.{Collections, List => JavaList} - -import org.apache.ignite.Ignition -import org.apache.ignite.cache.CacheAtomicityMode._ -import org.apache.ignite.cache.CacheMode._ -import org.apache.ignite.cache.query.SqlQuery -import org.apache.ignite.cache.query.annotations.QuerySqlField -import org.apache.ignite.configuration._ -import org.apache.ignite.internal.visor.cache._ -import org.apache.ignite.spi.discovery.tcp._ -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm._ -import org.apache.ignite.util.AttributeNodeFilter -import org.apache.ignite.visor._ -import org.apache.ignite.visor.commands.cache.VisorCacheCommand._ -import org.apache.ignite.visor.visor.executeMulti -import org.jetbrains.annotations._ - -import scala.collection.JavaConversions._ - -/** - * Unit test for 'events' command. - */ -class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(2) { - /** */ - val CACHE_NAME = "replicated" - - /** */ - val FILTER_ATTRIBUTE_NAME = "NAME" - - /** IP finder. */ - val ipFinder = new TcpDiscoveryVmIpFinder(true) - - /** - * @param name Cache name. - * @return Cache Configuration. - */ - def cacheConfig(@NotNull name: String): CacheConfiguration[Object, Object] = { - val cfg = new CacheConfiguration[Object, Object] - - cfg.setName(name) - cfg.setCacheMode(REPLICATED) - cfg.setAtomicityMode(TRANSACTIONAL) - - cfg.setNodeFilter(new AttributeNodeFilter(FILTER_ATTRIBUTE_NAME, "node-1")) - - val arr = Seq(classOf[JavaInt], classOf[Foo]).toArray - - cfg.setIndexedTypes(arr: _*) - - cfg - } - - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = super.config(name) - - cfg.setLocalHost("127.0.0.1") - cfg.setCacheConfiguration(cacheConfig(CACHE_NAME)) - - val discoSpi = new TcpDiscoverySpi() - - discoSpi.setIpFinder(ipFinder) - - cfg.setDiscoverySpi(discoSpi) - cfg.setUserAttributes(Collections.singletonMap(FILTER_ATTRIBUTE_NAME, name)) - - cfg - } - - describe("A 'cache' visor command") { - it("should put/get some values to/from cache and display information about caches") { - val c = Ignition.ignite("node-1").cache[String, String]("replicated") - - for (i <- 0 to 3) { - val kv = "" + i - - c.put(kv, kv) - - c.get(kv) - } - - visor.cache() - } - - it("should run query and display information about caches") { - val g = Ignition.ignite("node-1") - - val c = g.cache[JavaInt, Foo]("replicated") - - c.put(0, Foo(20)) - c.put(1, Foo(100)) - c.put(2, Foo(101)) - c.put(3, Foo(150)) - - // Create and execute query that mast return 2 rows. - val q1 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(JavaInt.valueOf(1))).getAll - - assert(q1.size() == 2) - - // Create and execute query that mast return 0 rows. - val q2 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(JavaInt.valueOf(100))).getAll - - assert(q2.size() == 0) - - visor cache "-a" - } - - it("should display correct information for 'replicated' cache only") { - visor cache "-n=replicated -a" - } - - it("should display correct information for all caches") { - visor cache "-a" - } - - it("should scan cache") { - visor cache "-c=replicated -scan" - } - - it("should get metrics for nodes available by cache node filter") { - val caches: JavaList[String] = Collections.singletonList(CACHE_NAME) - - val arg = new VisorCacheMetricsCollectorTaskArg(false, caches) - - val metrics = executeMulti(classOf[VisorCacheMetricsCollectorTask], arg).toList - - assert(metrics.size == 1) - assert(metrics.head.getNodes.size() == 1) - } - } -} - -/** - * Object for queries. - */ -private case class Foo( - @QuerySqlField - value: Int -) diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala deleted file mode 100644 index 4b960351925ab..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala +++ /dev/null @@ -1,114 +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.visor.commands.cache - -import org.apache.ignite.Ignition -import org.apache.ignite.cache.CacheAtomicityMode._ -import org.apache.ignite.cache.CacheMode._ -import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration} -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder -import org.apache.ignite.visor.commands.cache.VisorCacheCommand._ -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.jetbrains.annotations.NotNull - -import scala.collection.JavaConversions._ - -/** - * Unit test for 'reset' command. - */ -class VisorCacheResetCommandSpec extends VisorRuntimeBaseSpec(2) { - /** IP finder. */ - val ipFinder = new TcpDiscoveryVmIpFinder(true) - - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - cfg.setLocalHost("127.0.0.1") - cfg.setCacheConfiguration(cacheConfig("default"), cacheConfig("cache")) - - val discoSpi = new TcpDiscoverySpi() - - discoSpi.setIpFinder(ipFinder) - - cfg.setDiscoverySpi(discoSpi) - - cfg - } - - /** - * @param name Cache name. - * @return Cache Configuration. - */ - def cacheConfig(@NotNull name: String): CacheConfiguration[Object, Object] = { - val cfg = new CacheConfiguration[Object, Object] - - cfg.setCacheMode(REPLICATED) - cfg.setAtomicityMode(TRANSACTIONAL) - cfg.setName(name) - - cfg - } - - describe("A 'reset' visor command") { - it("should show correct result for default cache") { - Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3)) - - val lock = Ignition.ignite("node-1").cache[Int, Int]("default").lock(1) - - lock.lock() - - VisorCacheResetCommand().reset(Nil, None) - - lock.unlock() - - VisorCacheResetCommand().reset(Nil, None) - } - - it("should show correct result for named cache") { - Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3)) - - val lock = Ignition.ignite("node-1").cache[Int, Int]("cache").lock(1) - - lock.lock() - - visor.cache("-reset -c=cache") - - lock.unlock() - - visor.cache("-reset -c=cache") - } - - it("should show correct help") { - VisorCacheCommand - - visor.help("cache") - } - - it("should show empty projection error message") { - visor.cache("-reset -c=wrong") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala deleted file mode 100644 index 6aadf1afc13cc..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala +++ /dev/null @@ -1,50 +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.visor.commands.config - -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.events.EventType._ -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} - -import org.apache.ignite.visor.commands.config.VisorConfigurationCommand._ - -/** - * Unit test for 'config' command. - */ -class VisorConfigurationCommandSpec extends VisorRuntimeBaseSpec(1) { - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - cfg.setIncludeEventTypes(EVTS_ALL: _*) - - cfg - } - - describe("A 'config' visor command") { - it("should print configuration for first node") { - visor.config("-id8=@n0") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala deleted file mode 100644 index b80ff1d5c44f8..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala +++ /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. - */ - -package org.apache.ignite.visor.commands.deploy - -import org.apache.ignite.visor.visor -import org.scalatest._ - -import org.apache.ignite.visor.commands.deploy.VisorDeployCommand._ - -/** - * Unit test for 'deploy' command. - */ -class VisorDeployCommandSpec extends FunSpec with Matchers { - describe("A 'deploy' visor command") { - it("should copy folder") { - visor.deploy("-h=uname:passwd@localhost -s=/home/uname/test -d=dir") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala deleted file mode 100644 index cb4bf3d5c2903..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala +++ /dev/null @@ -1,85 +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.visor.commands.disco - -import org.apache.ignite.Ignition -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} - -import org.apache.ignite.visor.commands.disco.VisorDiscoveryCommand._ - -/** - * Unit test for 'disco' command. - */ -class VisorDiscoveryCommandSpec extends VisorRuntimeBaseSpec(4) { - /** - * Open visor and execute several tasks before all tests. - */ - override protected def beforeAll() { - super.beforeAll() - - Ignition.stop("node-1", false) - Ignition.stop("node-2", false) - } - - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - - cfg - } - - describe("A 'disco' visor command") { - it("should advise to connect") { - closeVisorQuiet() - - visor.disco() - } - - it("should show all discovery events") { - visor.disco() - } - - it("should show all discovery events in reversed order") { - visor.disco("-r") - } - - it("should show discovery events from last two minutes") { - visor.disco("-t=2m") - } - - it("should show discovery events from last two minutes in reversed order ") { - visor.disco("-t=2m -r") - } - - it("should show top 3 discovery events") { - visor.disco("-c=3") - } - - it("should print error message with invalid count") { - visor.disco("-c=x") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala deleted file mode 100644 index 7be35400eed02..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala +++ /dev/null @@ -1,62 +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.visor.commands.events - -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} - -import org.apache.ignite.visor.commands.events.VisorEventsCommand._ - -/** - * Unit test for 'events' command. - */ -class VisorEventsCommandSpec extends VisorRuntimeBaseSpec(1) { - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - - cfg - } - - describe("A 'events' visor command") { - it("should print error message when not connected") { - closeVisorQuiet() - - visor.events() - } - - it("should display all events from remote node") { - visor.events("-id8=@n0") - } - - it("should display top 3 events from remote node") { - visor.events("-id8=@n0 -c=3") - } - - it("should print error message with invalid count") { - visor.events("-id8=@n0 -c=x") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala deleted file mode 100644 index 1893cdca7bee5..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala +++ /dev/null @@ -1,61 +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.visor.commands.gc - -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.visor.commands.gc.VisorGcCommand._ -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} - -/** - * Unit test for 'gc' command. - */ -class VisorGcCommandSpec extends VisorRuntimeBaseSpec(1) { - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - override def config(name: String): IgniteConfiguration = - { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - - cfg - } - - describe("'gc' visor command") { - it("should run GC on all nodes") { - visor.gc() - } - - it("should run GC on first node") { - visor.gc("-id8=@n0") - } - - it("should run GC and DGC on all nodes") { - visor.gc("-c") - } - - it("should run GC and DGC on first node") { - visor.gc("-id8=@n0 -c") - } - - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala deleted file mode 100644 index 43c6f520006e8..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala +++ /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.visor.commands.help - -import org.apache.ignite.visor._ -import org.scalatest._ - -/** - * Unit test for 'help' command. - */ -class VisorHelpCommandSpec extends FunSpec with Matchers { - // Pre-initialize command so that help can be registered. - commands.ack.VisorAckCommand - commands.ping.VisorPingCommand - commands.alert.VisorAlertCommand - commands.config.VisorConfigurationCommand - commands.top.VisorTopologyCommand - commands.kill.VisorKillCommand - commands.vvm.VisorVvmCommand - commands.node.VisorNodeCommand - commands.events.VisorEventsCommand - commands.disco.VisorDiscoveryCommand - commands.cache.VisorCacheCommand - commands.start.VisorStartCommand - commands.deploy.VisorDeployCommand - commands.start.VisorStartCommand - - - describe("General help") { - it ("should properly execute via alias") { visor.searchCmd("?").get.emptyArgs } - it ("should properly execute w/o alias") { visor.searchCmd("help").get.emptyArgs } - } - - describe("Help for command") { - it ("should properly execute for 'start' command") { visor.help("start") } - it ("should properly execute for 'deploy' command") { visor.help("deploy") } - it ("should properly execute for 'events' command") { visor.help("events") } - it ("should properly execute for 'mclear' command") { visor.help("mclear") } - it ("should properly execute for 'cache' command") { visor.help("cache") } - it ("should properly execute for 'disco' command") { visor.help("disco") } - it ("should properly execute for 'alert' command") { visor.help("alert") } - it ("should properly execute for 'node' command") { visor.help("node") } - it ("should properly execute for 'vvm' command") { visor.help("vvm") } - it ("should properly execute for 'kill' command") { visor.help("kill") } - it ("should properly execute for 'top' command") { visor.help("top") } - it ("should properly execute for 'config' command") { visor.help("config") } - it ("should properly execute for 'ack' command") { visor.help("ack") } - it ("should properly execute for 'ping' command") { visor.help("ping") } - it ("should properly execute for 'close' command") { visor.help("close") } - it ("should properly execute for 'open' command") { visor.help("open") } - it ("should properly execute for 'start' status") { visor.help("status") } - it ("should properly execute for 'start' mset") { visor.help("mset") } - it ("should properly execute for 'start' mget") { visor.help("mget") } - it ("should properly execute for 'start' mlist") { visor.help("mlist") } - it ("should properly execute for 'start' log") { visor.help("log") } - it ("should properly execute for 'start' dash") { visor.help("dash") } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala deleted file mode 100644 index 47196062e3f82..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala +++ /dev/null @@ -1,59 +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.visor.commands.kill - -import org.apache.ignite.visor.visor -import org.scalatest._ - -import org.apache.ignite.visor.commands.open.VisorOpenCommand._ -import org.apache.ignite.visor.commands.kill.VisorKillCommand._ - -/** - * Unit test for 'kill' command. - */ -class VisorKillCommandSpec extends FunSpec with Matchers { - describe("A 'kill' visor command") { - it("should print error message with null argument") { - visor.open("-d") - visor.kill(null) - visor.close() - } - - it("should print error message if both kill and restart specified") { - visor.open("-d") - visor.kill("-k -r") - visor.close() - } - - it("should print error message if not connected") { - visor.kill("-k") - } - - it("should restart node") { - visor.open("-d") - visor.kill("-r -id8=@n1") - visor.close() - } - - it("should print error message") { - visor.open("-d") - visor.kill("-r -id=xxx") - visor.close() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala deleted file mode 100644 index ddb84ea0aae99..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala +++ /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. - */ - -package org.apache.ignite.visor.commands.log - -import org.apache.ignite.visor.visor -import org.scalatest._ - -/** -* Unit test for 'log' command. -*/ -class VisorLogCommandSpec extends FunSpec with Matchers { - describe("A 'log' visor command") { - it("should print log status") { - visor.log() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala deleted file mode 100644 index 278bace6d6d75..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala +++ /dev/null @@ -1,115 +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.visor.commands.mem - -import org.apache.ignite.visor.visor -import org.scalatest._ - -/** - * Unit test for memory commands. - */ -class VisorMemoryCommandSpec extends FunSpec with Matchers { - describe("A 'mget' visor command") { - it("should get correct value") { - visor.mset("key", "value") - - assertResult(Option("value"))(visor.mgetOpt("key")) - - visor.mclear() - } - } - - describe("A 'mlist' visor command") { - it("should list all variables") { - visor.mset("key1", "value1") - visor.mset("key2", "value2") - visor.mset("key3", "value3") - - visor.mlist() - visor.mclear() - } - - it("should list ax and cx variables") { - visor.mset("a1", "1") - visor.mset("a2", "2") - visor.mset("b1", "3") - visor.mset("b2", "4") - visor.mset("c1", "5") - visor.mset("c2", "6") - - visor.mlist("ac") - visor.mclear() - } - } - - describe("A 'mclear' visor command") { - it("should remove first two variables") { - visor.mset("key1", "value1") - visor.mset("key2", "value2") - visor.mset("key3", "value3") - - visor mclear "key1 key2" - - visor.mlist() - visor.mclear() - - } - - it("should remove all variables") { - visor.mset("key1", "value1") - visor.mset("key2", "value2") - visor.mset("key3", "value3") - - visor.mclear() - visor.mlist() - } - } - - describe("A 'mcompact' visor command") { - it("should compact variable") { - visor.mset("key1", "value1") - visor.mset("key3", "value3") - - visor.mset("n0", "value0") - visor.mset("n1", "value1") - visor.mset("n2", "value2") - visor.mset("n3", "value3") - - visor.mset("c1", "value1") - visor.mset("c3", "value3") - - visor.mcompact() - - assertResult(None)(visor.mgetOpt("key0")) - assertResult(Some("value1"))(visor.mgetOpt("key1")) - assertResult(None)(visor.mgetOpt("key2")) - assertResult(Some("value3"))(visor.mgetOpt("key3")) - - assertResult(Some("value0"))(visor.mgetOpt("n0")) - assertResult(Some("value1"))(visor.mgetOpt("n1")) - assertResult(Some("value2"))(visor.mgetOpt("n2")) - assertResult(Some("value3"))(visor.mgetOpt("n3")) - - assertResult(Some("value1"))(visor.mgetOpt("c0")) - assertResult(Some("value3"))(visor.mgetOpt("c1")) - assertResult(None)(visor.mgetOpt("c3")) - - visor.mlist() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala deleted file mode 100644 index c0983c0f5f858..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala +++ /dev/null @@ -1,42 +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.visor.commands.node - -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.apache.ignite.visor.commands.node.VisorNodeCommand._ - -/** - * Unit test for 'node' command. - */ -class VisorNodeCommandSpec extends VisorRuntimeBaseSpec(1) { - describe("A 'node' visor command") { - it("should properly execute with valid node ID") { - visor.node("-id8=@n1") - } - - it("should print the error message for invalid node ID") { - visor.node("-id8=zeee") - } - - it("should print error message when not connected") { - closeVisorQuiet() - - visor.node("") // Arguments are ignored. - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala deleted file mode 100644 index f00ff55d5105b..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala +++ /dev/null @@ -1,36 +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.visor.commands.open - -import org.apache.ignite.IgniteException -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} - -/** - * Unit test for 'open' command. - */ -class VisorOpenCommandSpec extends VisorRuntimeBaseSpec(3) { - describe("A 'open' visor command") { - it("should properly connect using default configuration") { - visor.mlist() - } - - it("should reopen when already connected") { - openVisor() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala deleted file mode 100644 index 06e3a22eb7101..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala +++ /dev/null @@ -1,38 +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.visor.commands.ping - -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.apache.ignite.visor.commands.ping.VisorPingCommand._ - -/** - * Unit test for 'ping' command. - */ -class VisorPingCommandSpec extends VisorRuntimeBaseSpec(2) { - describe("A 'ping' visor command") { - it("should properly execute") { - visor.ping() - } - - it("should print error message when not connected") { - closeVisorQuiet() - - visor.ping() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala deleted file mode 100644 index 49a861ceb6215..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala +++ /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.visor.commands.start - -import org.apache.ignite.visor.visor -import org.scalatest._ - -import org.apache.ignite.visor.commands.open.VisorOpenCommand._ -import org.apache.ignite.visor.commands.start.VisorStartCommand._ -import org.apache.ignite.visor.commands.top.VisorTopologyCommand._ - -/** - * Unit test for 'start' command. - */ -class VisorStartCommandSpec extends FunSpec with Matchers with BeforeAndAfterAll { - override def beforeAll() { - visor.open("-d") - } - - override def afterAll() { - visor.close() - } - - describe("A 'start' visor command") { - it("should should start one new node") { - visor.start("-h=192.168.1.103 -r -p=password") - } - - it("should should start two nodes") { - visor.start("-h=uname:passwd@localhost -n=2") - } - - it("should print error message with invalid port number") { - visor.start("-h=localhost:x -p=passwd") - } - - it("should print error message with zero port number") { - visor.start("-h=localhost:0 -p=passwd") - } - - it("should print error message with negative port number") { - visor.start("-h=localhost:-1 -p=passwd") - } - - it("should print error message with invalid nodes count") { - visor.start("-h=localhost#x -p=passwd") - } - - it("should print error message with zero nodes count") { - visor.start("-h=localhost#0 -p=passwd") - } - - it("should print error message with negative nodes count") { - visor.start("-h=localhost#-1 -p=passwd") - } - - it("should print error message with incorrect host") { - visor.start("-h=incorrect -p=passwd") - } - - it("should print error message with incorrect username") { - visor.start("-h=incorrect@localhost -p=passwd") - } - - it("should print error message with incorrect password") { - visor.start("-h=uname:incorrect@localhost") - } - - it("should print error message with nonexistent script path") { - visor.start("-h=uname:passwd@localhost -s=incorrect") - } - - it("should print error message with incorrect script path") { - visor.start("-h=uname:passwd@localhost -s=bin/readme.txt") - } - - it("should print error message with nonexistent config path") { - visor.start("-h=uname:passwd@localhost -c=incorrect") - } - - it("should print error message with incorrect config path") { - visor.start("-h=uname:passwd@localhost -c=bin/readme.txt") - } - - it("should start one node") { - visor.start("-h=uname:passwd@localhost") - - visor.top() - } - - it("should start one node on host identified by IP") { - visor.start("-h=uname:passwd@127.0.0.1") - - visor.top() - } - - it("should start two nodes") { - visor.start("-h=uname:passwd@localhost#2") - - visor.top() - } - - it("should restart 4 nodes") { - visor.start("-h=uname:passwd@localhost#4 -r") - - visor.top() - } - } -} 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 deleted file mode 100644 index 4291103e00bf9..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala +++ /dev/null @@ -1,221 +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.visor.commands.tasks - -import org.apache.ignite.Ignition -import org.apache.ignite.compute.{ComputeJob, ComputeJobAdapter, ComputeJobResult, ComputeTaskSplitAdapter} -import org.apache.ignite.configuration.IgniteConfiguration -import org.apache.ignite.events.EventType._ -import org.apache.ignite.visor.visor -import org.scalatest._ - -import java.util - -import org.apache.ignite.visor.commands.open.VisorOpenCommand._ -import org.apache.ignite.visor.commands.tasks.VisorTasksCommand._ - -import scala.collection.JavaConversions._ -import scala.collection._ - -/** - * Unit test for 'tasks' command. - */ -class VisorTasksCommandSpec extends FunSpec with Matchers with BeforeAndAfterAll { - /** - * Open visor and execute several tasks before all tests. - */ - override def beforeAll() { - val ignite = Ignition.start(config("grid-1")) - - Ignition.start(config("grid-2")) - - visor.open(config("visor-demo-node"), "n/a") - - try { - val compute = ignite.compute() - - val fut1 = compute.withName("TestTask1").executeAsync(new TestTask1(), null) - - val fut2 = compute.withName("TestTask1").executeAsync(new TestTask1(), null) - - val fut3 = compute.withName("TestTask1").executeAsync(new TestTask1(), null) - - val fut4 = compute.withName("TestTask2").executeAsync(new TestTask2(), null) - - val fut5 = compute.withName("Test3").executeAsync(new Test3(), null) - - fut1.get - fut2.get - fut3.get - fut4.get - fut5.get - } - catch { - case _: Exception => - } - } - - /** - * Creates grid configuration for provided grid host. - * - * @param name Ignite instance name. - * @return Grid configuration. - */ - private def config(name: String): IgniteConfiguration = { - val cfg = new IgniteConfiguration - - cfg.setIgniteInstanceName(name) - cfg.setIncludeEventTypes(EVTS_ALL: _*) - - cfg - } - - /** - * Close visor after all tests. - */ - override def afterAll() { - visor.close() - - Ignition.stopAll(false) - } - - describe("A 'tasks' visor command") { - it("should print tasks when called w/o arguments") { - visor.tasks() - } - - it("should print error message with incorrect argument") { - visor.tasks("-xx") - } - - it("should print task summary when called for specific task") { - visor.tasks("-n=@t1") - } - - it("should print execution when called for specific execution") { - visor.tasks("-e=@e1") - } - - it("should print all tasks") { - visor.tasks("-l") - } - - it("should print all tasks and executions") { - visor.tasks("-l -a") - } - - it("should print tasks that started during last 5 seconds") { - visor.tasks("-l -t=5s") - } - - it("should print error message about invalid time period") { - visor.tasks("-l -t=x2s") - } - - it("should print error message about negative time period") { - visor.tasks("-l -t=-10s") - } - - it("should print error message about invalid time period specification") { - visor.tasks("-l -t=10x") - } - - it("should print task summary for the first task") { - visor.tasks("-n=TestTask1") - } - - it("should print task summary and executions for the first task") { - visor.tasks("-n=TestTask1 -a") - } - - it("should print list of tasks grouped by nodes") { - visor.tasks("-g") - } - - it("should print list of tasks that started during last 5 minutes grouped by nodes") { - visor.tasks("-g -t=5m") - } - - it("should print list of tasks grouped by hosts") { - visor.tasks("-h") - } - - it("should print list of tasks that started during last 5 minutes grouped by hosts") { - visor.tasks("-h -t=5m") - } - - it("should print list of tasks filtered by substring") { - visor.tasks("-s=TestTask") - } - - it("should print list of tasks and executions filtered by substring") { - visor.tasks("-s=TestTask -a") - } - } -} - -/** - * Test task 1. - */ -private class TestTask1 extends ComputeTaskSplitAdapter[String, Void] { - def split(gridSize: Int, arg: String): java.util.Collection[_ <: ComputeJob] = { - Iterable.fill(gridSize)(new ComputeJobAdapter() { - def execute() = { - println("Task 1") - - null - } - }) - } - - def reduce(results: util.List[ComputeJobResult]) = null -} - -/** - * Test task 2. - */ -private class TestTask2 extends ComputeTaskSplitAdapter[String, Void] { - def split(gridSize: Int, arg: String): java.util.Collection[_ <: ComputeJob] = { - Iterable.fill(gridSize)(new ComputeJobAdapter() { - def execute() = { - println("Task 2") - - null - } - }) - } - - def reduce(results: util.List[ComputeJobResult]) = null -} - -/** - * Test task 3 (w/o 'Task' in host for testing '-s' option). - */ -private class Test3 extends ComputeTaskSplitAdapter[String, Void] { - def split(gridSize: Int, arg: String): java.util.Collection[_ <: ComputeJob] = { - Iterable.fill(gridSize)(new ComputeJobAdapter() { - def execute() = { - println("Task 3") - - null - } - }) - } - - def reduce(results: util.List[ComputeJobResult]) = null -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala deleted file mode 100644 index a77249220577c..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala +++ /dev/null @@ -1,70 +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.visor.commands.top - -import org.apache.ignite.Ignition -import org.apache.ignite.configuration._ -import org.apache.ignite.visor.commands.top.VisorTopologyCommand._ -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import VisorRuntimeBaseSpec._ - -/** - * Unit test for cluster activation commands. - */ -class VisorActivationCommandSpec extends VisorRuntimeBaseSpec(2) { - override protected def config(name: String): IgniteConfiguration = { - val cfg = super.config(name) - - val dfltReg = new DataRegionConfiguration - val dataRegCfg = new DataStorageConfiguration - - dfltReg.setMaxSize(10 * 1024 * 1024) - dfltReg.setPersistenceEnabled(true) - dataRegCfg.setDefaultDataRegionConfiguration(dfltReg) - - cfg.setDataStorageConfiguration(dataRegCfg) - - cfg - } - - describe("A 'top' visor command for cluster activation") { - it("should activate cluster") { - assert(!Ignition.ignite(VISOR_INSTANCE_NAME).active()) - - visor.top() - - visor.top("-activate") - - visor.top() - - assert(Ignition.ignite(VISOR_INSTANCE_NAME).active()) - } - - it("should deactivate cluster") { - assert(Ignition.ignite(VISOR_INSTANCE_NAME).active()) - - visor.top() - - visor.top("-deactivate") - - visor.top() - - assert(!Ignition.ignite(VISOR_INSTANCE_NAME).active()) - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala deleted file mode 100644 index 515cf6717336c..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala +++ /dev/null @@ -1,62 +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.visor.commands.top - -import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor} -import org.apache.ignite.visor.commands.top.VisorTopologyCommand._ - -/** - * Unit test for topology commands. - */ -class VisorTopologyCommandSpec extends VisorRuntimeBaseSpec(2) { - describe("A 'top' visor command") { - it("should advise to connect") { - closeVisorQuiet() - - visor.top() - } - - it("should print error message") { - visor.top("-cc=eq1x") - } - - it("should print full topology") { - visor.top() - } - - it("should print nodes with idle time greater than 12000ms") { - visor.top("-it=gt12000") - } - - it("should print nodes with idle time greater than 12sec") { - visor.top("-it=gt12s") - } - - it("should print full information about all nodes") { - visor.top("-a") - } - - it("should print information about nodes on localhost") { - visor.top("-h=192.168.1.100") - } - - it("should print full information about nodes on localhost") { - visor.top("-h=localhost") - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala deleted file mode 100644 index 022f6d6917cac..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala +++ /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.visor.commands.vvm - -import org.apache.ignite.visor.visor -import org.scalatest._ - -import org.apache.ignite.visor.commands.open.VisorOpenCommand._ -import org.apache.ignite.visor.commands.vvm.VisorVvmCommand._ - -/** - * Unit test for 'vvm' command. - */ -class VisorVvmCommandSpec extends FunSpec with Matchers { - describe("A 'vvm' visor command") { - it("should print error message when not connected") { - visor.vvm() - } - - it("should open VisualVM connected to all nodes skipping ones with disabled JMX") { - visor.open("-d") - visor.vvm() - visor.close() - } - - it("should open VisualVM connected to first node if it has JMX enabled") { - visor.open("-d") - visor.vvm("-id8=@n1") - visor.close() - } - } -} diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/testsuites/VisorConsoleSelfTestSuite.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/testsuites/VisorConsoleSelfTestSuite.scala deleted file mode 100644 index 5fbc8a09719e7..0000000000000 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/testsuites/VisorConsoleSelfTestSuite.scala +++ /dev/null @@ -1,93 +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.visor.testsuites - -import java.net.{InetAddress, UnknownHostException} - -import org.apache.ignite.IgniteSystemProperties._ -import org.apache.ignite.visor.VisorTextTableSpec -import org.apache.ignite.visor.commands.VisorArgListSpec -import org.apache.ignite.visor.commands.ack.VisorAckCommandSpec -import org.apache.ignite.visor.commands.alert.VisorAlertCommandSpec -import org.apache.ignite.visor.commands.cache.{VisorCacheClearCommandSpec, VisorCacheCommandSpec} -import org.apache.ignite.visor.commands.config.VisorConfigurationCommandSpec -import org.apache.ignite.visor.commands.deploy.VisorDeployCommandSpec -import org.apache.ignite.visor.commands.disco.VisorDiscoveryCommandSpec -import org.apache.ignite.visor.commands.events.VisorEventsCommandSpec -import org.apache.ignite.visor.commands.gc.VisorGcCommandSpec -import org.apache.ignite.visor.commands.help.VisorHelpCommandSpec -import org.apache.ignite.visor.commands.kill.VisorKillCommandSpec -import org.apache.ignite.visor.commands.log.VisorLogCommandSpec -import org.apache.ignite.visor.commands.mem.VisorMemoryCommandSpec -import org.apache.ignite.visor.commands.node.VisorNodeCommandSpec -import org.apache.ignite.visor.commands.open.VisorOpenCommandSpec -import org.apache.ignite.visor.commands.ping.VisorPingCommandSpec -import org.apache.ignite.visor.commands.start.VisorStartCommandSpec -import org.apache.ignite.visor.commands.tasks.VisorTasksCommandSpec -import org.apache.ignite.visor.commands.top.{VisorActivationCommandSpec, VisorTopologyCommandSpec} -import org.junit.runner.RunWith -import org.scalatest.Suites -import org.scalatest.junit.JUnitRunner - -/** - * - */ -@RunWith(classOf[JUnitRunner]) -class VisorConsoleSelfTestSuite extends Suites ( - new VisorTextTableSpec, - new VisorAckCommandSpec, - new VisorAlertCommandSpec, - new VisorCacheCommandSpec, - new VisorCacheClearCommandSpec, - new VisorConfigurationCommandSpec, - new VisorDeployCommandSpec, - new VisorDiscoveryCommandSpec, - new VisorEventsCommandSpec, - new VisorGcCommandSpec, - new VisorHelpCommandSpec, - new VisorKillCommandSpec, - new VisorLogCommandSpec, - new VisorMemoryCommandSpec, - new VisorNodeCommandSpec, - new VisorOpenCommandSpec, - new VisorPingCommandSpec, - new VisorStartCommandSpec, - new VisorTasksCommandSpec, - new VisorTopologyCommandSpec, - new VisorActivationCommandSpec, - new VisorArgListSpec -) { - // Mimic GridTestUtils.getNextMulticastGroup behavior because it can't be imported here - // as it will create a circular module dependency. Use the highest address. - try { - val locHost = InetAddress.getLocalHost - - if (locHost != null) { - var thirdByte: Int = locHost.getAddress()(3) - - if (thirdByte < 0) - thirdByte += 256 - - System.setProperty(IGNITE_OVERRIDE_MCAST_GRP, "229." + thirdByte + ".255.255") - } - } - catch { - case e: UnknownHostException => - assert(false, "Unable to get local address.") - } -} diff --git a/modules/visor-plugins/licenses/apache-2.0.txt b/modules/visor-plugins/licenses/apache-2.0.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/modules/visor-plugins/licenses/apache-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml deleted file mode 100644 index 59bb3a9002d59..0000000000000 --- a/modules/visor-plugins/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - 4.0.0 - - - org.apache.ignite - ignite-parent-internal - ${revision} - ../../parent-internal/pom.xml - - - ignite-visor-plugins - - http://ignite.apache.org - - - - - ${project.groupId} - ignite-core - - - - - - ro.fortsoft.pf4j - pf4j - 0.9.0 - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - - org.apache.logging.log4j - log4j-slf4j-impl - - - - - - - - src/main/java - - **/*.java - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - false - - - - - diff --git a/modules/visor-plugins/src/main/java/log4j2.properties b/modules/visor-plugins/src/main/java/log4j2.properties deleted file mode 100644 index cfc2382906c28..0000000000000 --- a/modules/visor-plugins/src/main/java/log4j2.properties +++ /dev/null @@ -1,31 +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. -# - -# Configure console appender. -appender.stdout.type=Console -appender.stdout.name=stdout -appender.stdout.target=SYSTEM_ERR -appender.stdout.layout.type=PatternLayout -appender.stdout.layout.pattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n - -# Configure pf4j loggers. -logger.pf4j.name=ro.fortsoft.pf4j -logger.pf4j.level=ERROR -logger.pf4j.appenderRef.$1.ref=stdout - -rootLogger.level=info -rootLogger.appenderRef.$1.ref=stdout diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorExtensionPoint.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorExtensionPoint.java deleted file mode 100644 index 6f9569932ff2f..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorExtensionPoint.java +++ /dev/null @@ -1,75 +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.visor.plugin; - -import ro.fortsoft.pf4j.ExtensionPoint; - -/** - * Abstract base class for Visor plugin extension point. - */ -public abstract class VisorExtensionPoint implements ExtensionPoint { - /** */ - private final VisorPluginModel model; - - /** - * @param model Visor model. - */ - protected VisorExtensionPoint(VisorPluginModel model) { - this.model = model; - } - - /** - * @return Visor model. - */ - public VisorPluginModel model() { - return model; - } - - /** - * @return Plugin name. - */ - public abstract String name(); - - /** - * Will be executed on Visor model changed. - */ - public void onModelChanged() { - // No-op. - } - - /** - * Will be executed on Visor events changed. - */ - public void onEventsChanged() { - // No-op. - } - - /** - * Will be executed on Visor connect to grid. - */ - public void onConnected() { - // No-op. - } - - /** - * Will be executed on Visor disconnect from grid. - */ - public void onDisconnected() { - // No-op. - } -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluggableTab.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluggableTab.java deleted file mode 100644 index 4488f917ea9d8..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluggableTab.java +++ /dev/null @@ -1,64 +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.visor.plugin; - -import javax.swing.ImageIcon; -import javax.swing.JPanel; - -/** - * Abstract base class for Visor pluggable tabs. - */ -public abstract class VisorPluggableTab extends VisorExtensionPoint { - /** - * @param model Visor model. - */ - protected VisorPluggableTab(VisorPluginModel model) { - super(model); - } - - /** - * Tab and menu icon 16x16 px. - * - * @return Plugin icon. - */ - public abstract ImageIcon icon(); - - /** - * Tab tooltip. - * - * @return Tooltip. - */ - public abstract String tooltip(); - - /** - * Construct content of pluggable tab. - * - * @param componentsFactory Factory for creating ready UI blocks, like nodes panel and charts. - * @param dfltTabBtn Panel with standart tab buttons. - * - * @return Pluggable tab content. - */ - public abstract JPanel createPanel(VisorPluginComponentsFactory componentsFactory, JPanel dfltTabBtn); - - /** - * Will be executed on tab close. - */ - public void onClosed() { - // No-op. - } -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPlugin.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPlugin.java deleted file mode 100644 index 1d1366c49e0a3..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPlugin.java +++ /dev/null @@ -1,53 +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.visor.plugin; - -import ro.fortsoft.pf4j.Plugin; -import ro.fortsoft.pf4j.PluginException; -import ro.fortsoft.pf4j.PluginWrapper; - -/** - * Base class for Visor plugins. - */ -public abstract class VisorPlugin extends Plugin { - /** - * Constructor to be used by plugin manager for plugin instantiation. - * Your plugins have to provide constructor with this exact signature to - * be successfully loaded by manager. - * - * @param wrapper A wrapper over plugin instance. - */ - protected VisorPlugin(PluginWrapper wrapper) { - super(wrapper); - } - - /** - * @return Plugin name. - */ - public abstract String name(); - - /** {@inheritDoc} */ - @Override public void start() throws PluginException { - log.info("Plugin Started: " + name()); - } - - /** {@inheritDoc} */ - @Override public void stop() throws PluginException { - log.info("Plugin stopped: " + name()); - } -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponent.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponent.java deleted file mode 100644 index 7e9a143ae6190..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponent.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.visor.plugin; - -import javax.swing.JComponent; - -/** - * Base interface for Visor components. - */ -public interface VisorPluginComponent { - /** - * @return Component container. - */ - public JComponent container(); -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponentsFactory.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponentsFactory.java deleted file mode 100644 index 681edb78883c9..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginComponentsFactory.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.visor.plugin; - -import java.util.List; -import javax.swing.JPanel; - -/** - * Factory for creating ready Visor UI blocks like nodes panel, log panel, etc. - * Plugins will receive factory instance from - * {@link VisorPluggableTab#createPanel(VisorPluginComponentsFactory, JPanel)} method. - */ -public interface VisorPluginComponentsFactory { - /** - * Create panel with nodes. - * - * @param pluginName Plugin name. - * @param title Panel title. - * @param ovrMsg Overlay message text. - * @param showHostBtn Whether or not host button should be displayed. - * @return Nodes panel. - */ - public VisorPluginNodesPanel nodesPanel(String pluginName, String title, List ovrMsg, boolean showHostBtn); - - /** - * Create panel with list of log events. - * - * @param pluginName Plugin name. - * @param title Panel title. - * @param ovrMsg Overlay message text. - * @return Log panel. - */ - public VisorPluginLogPanel logPanel(String pluginName, String title, List ovrMsg); -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginLogPanel.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginLogPanel.java deleted file mode 100644 index 7257b5556af1d..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginLogPanel.java +++ /dev/null @@ -1,26 +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.visor.plugin; - -/** - * Standard Visor panel with log entries. - * - * This panel will be created by {@link VisorPluginComponentsFactory}. - */ -public interface VisorPluginLogPanel extends VisorPluginComponent { -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginModel.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginModel.java deleted file mode 100644 index 67b1475cad2c8..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginModel.java +++ /dev/null @@ -1,97 +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.visor.plugin; - -import java.util.Collection; -import java.util.UUID; -import org.apache.ignite.IgniteLogger; -import org.apache.ignite.compute.ComputeTask; -import org.jetbrains.annotations.Nullable; - -/** - * Gateway to Visor functionality from plugins. - * Plugins will receive model instance from Visor, usually passed - * into constructor, e.g. {@link VisorExtensionPoint#VisorExtensionPoint(VisorPluginModel)}. - */ -public interface VisorPluginModel { - /** - * Whether Visor connected to the grid. - * - * @return {@code true} if Visor connected to the grid. - */ - public boolean connected(); - - /** - * Get logger. - * - * @return Logger. - */ - public IgniteLogger logger(); - - /** - * Install topology listener. - * - * @param lsnr Listener to add. - * @throws IllegalStateException If Visor not connected to the grid. - */ - public void addTopologyListener(VisorTopologyListener lsnr) throws IllegalStateException; - - /** - * Uninstall topology listener. - * - * @param lsnr Listener to remove. - * @throws IllegalStateException If Visor not connected to the grid. - */ - public void removeTopologyListener(VisorTopologyListener lsnr) throws IllegalStateException; - - /** - * @return Collection of all nodes IDs. - */ - public Collection nodeIds(); - - /** - * Executes given task on this grid projection. For step-by-step explanation of task execution process - * refer to {@link org.apache.ignite.compute.ComputeTask} documentation. - * - * @param taskCls Class of the task to execute. If class has {@link org.apache.ignite.compute.ComputeTaskName} annotation, - * then task is deployed under a name specified within annotation. Otherwise, full - * class name is used as task name. - * @param nodeIds Node IDs on with execute task. - * @param arg Optional argument of task execution, can be {@code null}. - * @param Argument type. - * @param Result type. - * @return Task result. - * @throws IllegalStateException If Visor not connected to the grid. - */ - public R execute(Class> taskCls, Collection nodeIds, @Nullable A arg) - throws IllegalStateException; - - /** - * Executes given task on this grid projection. For step-by-step explanation of task execution process - * refer to {@link org.apache.ignite.compute.ComputeTask} documentation. - * - * @param taskName Name of the task to execute. - * @param nodeIds Node IDs on with execute task. - * @param arg Optional argument of task execution, can be {@code null}. - * @param Argument type. - * @param Result type. - * @return Task result. - * @throws IllegalStateException If Visor not connected to the grid. - */ - public R execute(String taskName, Collection nodeIds, @Nullable A arg) throws IllegalStateException; -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginNodesPanel.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginNodesPanel.java deleted file mode 100644 index 71046c589072c..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorPluginNodesPanel.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.visor.plugin; - -import java.util.Collection; -import java.util.UUID; - -/** - * Standart Visor panel with nodes. - * - * This panel will be created by {@link VisorPluginComponentsFactory}. - */ -public interface VisorPluginNodesPanel extends VisorPluginComponent { - /** - * Add selection listener. - * - * @param listener Table selection listener. - */ - public void addSelectionListener(VisorSelectionListener listener); - - /** - * Remove selection listener. - * - * @param listener Table selection listener. - */ - public void removeSelectionListener(VisorSelectionListener listener); - - /** - * Get selected elements. - * - * @return selected elements. - */ - public Collection selected(); -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorSelectionListener.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorSelectionListener.java deleted file mode 100644 index 8b7553336be38..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorSelectionListener.java +++ /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. - */ - -package org.apache.ignite.visor.plugin; - -import java.util.Collection; - -/** - * The listener interface for receiving "selection" events from standard Visor panels. - */ -public interface VisorSelectionListener { - /** - * On selection changed. - * - * @param selected Selected elements. If nothing selected return all. - */ - public void onChange(Collection selected); -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorTopologyListener.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorTopologyListener.java deleted file mode 100644 index 242119fdf7782..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/VisorTopologyListener.java +++ /dev/null @@ -1,53 +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.visor.plugin; - -import java.util.UUID; - -/** - * Listener for grid node topology changes. - */ -public interface VisorTopologyListener { - /** - * Action that should be done on node join. - * - * @param nid ID of node that join topology. - */ - public void onNodeJoin(UUID nid); - - /** - * Action that should be done on node left. - * - * @param nid ID of node that left topology. - */ - public void onNodeLeft(UUID nid); - - /** - * Action that should be done on node failed. - * - * @param nid ID of failed node. - */ - public void onNodeFailed(UUID nid); - - /** - * Action that should be done on node segmented. - * - * @param nid ID of segmented node. - */ - public void onNodeSegmented(UUID nid); -} diff --git a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/package-info.java b/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/package-info.java deleted file mode 100644 index da048d041a0f4..0000000000000 --- a/modules/visor-plugins/src/main/java/org/apache/ignite/visor/plugin/package-info.java +++ /dev/null @@ -1,23 +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. - */ - -/** - * - * Contains Visor Plugin extension functionality. - */ - -package org.apache.ignite.visor.plugin; diff --git a/packaging/rpm/apache-ignite.spec b/packaging/rpm/apache-ignite.spec index 9b5f91b57178a..d3b980625e95e 100644 --- a/packaging/rpm/apache-ignite.spec +++ b/packaging/rpm/apache-ignite.spec @@ -84,9 +84,6 @@ case $1 in # Install alternatives # Commented out until ignitevisorcmd / ignitesqlline is ready to work from any user - #update-alternatives --install %{_bindir}/ignitevisorcmd ignitevisorcmd %{_datadir}/%{name}/bin/ignitevisorcmd.sh 0 - #update-alternatives --auto ignitevisorcmd - #update-alternatives --display ignitevisorcmd #update-alternatives --install %{_bindir}/ignitesqlline ignitesqlline %{_datadir}/%{name}/bin/sqlline.sh 0 #update-alternatives --auto ignitesqlline #update-alternatives --display ignitesqlline @@ -135,8 +132,6 @@ case $1 in # Remove alternatives # Commented out until ignitevisorcmd / ignitesqlline is ready to work from any user - #update-alternatives --remove ignitevisorcmd /usr/share/%{name}/bin/ignitevisorcmd.sh - #update-alternatives --display ignitevisorcmd || true #update-alternatives --remove ignitesqlline /usr/share/%{name}/bin/sqlline.sh #update-alternatives --display ignitesqlline || true ;; diff --git a/pom.xml b/pom.xml index 1460b082262d9..7b1c60baec657 100644 --- a/pom.xml +++ b/pom.xml @@ -89,15 +89,6 @@ - - all-scala - - modules/visor-console-2.10 - modules/visor-console - modules/visor-plugins - - - all-other @@ -434,22 +425,6 @@ - - dependencies-visor-console - validate - - single - - - - assembly/dependencies-visor-console.xml - - target/release-package-${ignite.edition}/bin - include - false - - - dependencies-sqlline validate @@ -465,22 +440,6 @@ false - - - scala-scripts - validate - - single - - - - assembly/release-scala.xml - - target/release-package-${ignite.edition} - bin - false - - @@ -509,32 +468,6 @@ - - scala - - - !scala-2.10 - - - - modules/visor-console - modules/visor-plugins - - - - - scala-2.10 - - - scala-2.10 - - - - modules/visor-console-2.10 - modules/visor-plugins - - - examples