You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2017/04/06 08:01:21 UTC
[1/8] ignite git commit: GG-11732 Merged with master.
Repository: ignite
Updated Branches:
refs/heads/ignite-gg-11732 [created] fb9112e6a
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 2a83c4a..815267b 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -288,7 +288,7 @@ class VisorCacheCommand {
if (hasArgFlag("scan", argLst))
VisorCacheScanCommand().scan(argLst, node)
else {
- if (aggrData.nonEmpty && !aggrData.exists(cache => F.eq(cache.name(), name) && cache.system())) {
+ if (aggrData.nonEmpty && !aggrData.exists(cache => F.eq(cache.getName, name) && cache.isSystem)) {
if (hasArgFlag("clear", argLst))
VisorCacheClearCommand().clear(argLst, node)
else if (hasArgFlag("swap", argLst))
@@ -345,39 +345,39 @@ class VisorCacheCommand {
sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
ad => {
// Add cache host as visor variable.
- registerCacheName(ad.name())
+ registerCacheName(ad.getName)
sumT += (
- mkCacheName(ad.name()),
- ad.mode(),
- ad.nodes.size(),
+ mkCacheName(ad.getName),
+ ad.getMode,
+ ad.getNodes.size(),
(
- "min: " + (ad.minimumHeapSize() + ad.minimumOffHeapSize()) +
- " (" + ad.minimumHeapSize() + " / " + ad.minimumOffHeapSize() + ")",
- "avg: " + formatDouble(ad.averageHeapSize() + ad.averageOffHeapSize()) +
- " (" + formatDouble(ad.averageHeapSize()) + " / " + formatDouble(ad.averageOffHeapSize()) + ")",
- "max: " + (ad.maximumHeapSize() + ad.maximumOffHeapSize()) +
- " (" + ad.maximumHeapSize() + " / " + ad.maximumOffHeapSize() + ")"
+ "min: " + (ad.getMinimumHeapSize + ad.getMinimumOffHeapSize) +
+ " (" + ad.getMinimumHeapSize + " / " + ad.getMinimumOffHeapSize + ")",
+ "avg: " + formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapSize) +
+ " (" + formatDouble(ad.getAverageHeapSize) + " / " + formatDouble(ad.getAverageOffHeapSize) + ")",
+ "max: " + (ad.getMaximumHeapSize + ad.getMaximumOffHeapSize) +
+ " (" + ad.getMaximumHeapSize + " / " + ad.getMaximumOffHeapSize + ")"
),
(
- "min: " + ad.minimumHits,
- "avg: " + formatDouble(ad.averageHits),
- "max: " + ad.maximumHits
+ "min: " + ad.getMinimumHits,
+ "avg: " + formatDouble(ad.getAverageHits),
+ "max: " + ad.getMaximumHits
),
(
- "min: " + ad.minimumMisses,
- "avg: " + formatDouble(ad.averageMisses),
- "max: " + ad.maximumMisses
+ "min: " + ad.getMinimumMisses,
+ "avg: " + formatDouble(ad.getAverageMisses),
+ "max: " + ad.getMaximumMisses
),
(
- "min: " + ad.minimumReads,
- "avg: " + formatDouble(ad.averageReads),
- "max: " + ad.maximumReads
+ "min: " + ad.getMinimumReads,
+ "avg: " + formatDouble(ad.getAverageReads),
+ "max: " + ad.getMaximumReads
),
(
- "min: " + ad.minimumWrites,
- "avg: " + formatDouble(ad.averageWrites),
- "max: " + ad.maximumWrites
+ "min: " + ad.getMinimumWrites,
+ "avg: " + formatDouble(ad.getAverageWrites),
+ "max: " + ad.getMaximumWrites
)
)
}
@@ -387,11 +387,11 @@ class VisorCacheCommand {
if (all) {
val sorted = aggrData.sortWith((k1, k2) => {
- if (k1.name() == null)
+ if (k1.getName == null)
true
- else if (k2.name() == null)
+ else if (k2.getName == null)
false
- else k1.name().compareTo(k2.name()) < 0
+ else k1.getName.compareTo(k2.getName) < 0
})
val gCfg = node.map(config).collect {
@@ -399,23 +399,23 @@ class VisorCacheCommand {
}
sorted.foreach(ad => {
- val cacheNameVar = mkCacheName(ad.name())
+ val cacheNameVar = mkCacheName(ad.getName)
println("\nCache '" + cacheNameVar + "':")
- val m = ad.metrics()
+ val m = ad.getMetrics
val csT = VisorTextTable()
csT += ("Name(@)", cacheNameVar)
csT += ("Nodes", m.size())
- csT += ("Total size Min/Avg/Max", (ad.minimumHeapSize() + ad.minimumOffHeapSize()) + " / " +
- formatDouble(ad.averageHeapSize() + ad.averageOffHeapSize()) + " / " +
- (ad.maximumHeapSize() + ad.maximumOffHeapSize()))
- csT += (" Heap size Min/Avg/Max", ad.minimumHeapSize() + " / " +
- formatDouble(ad.averageHeapSize()) + " / " + ad.maximumHeapSize())
- csT += (" Off-heap size Min/Avg/Max", ad.minimumOffHeapSize() + " / " +
- formatDouble(ad.averageOffHeapSize()) + " / " + ad.maximumOffHeapSize())
+ csT += ("Total size Min/Avg/Max", (ad.getMinimumHeapSize + ad.getMinimumOffHeapSize) + " / " +
+ formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapSize) + " / " +
+ (ad.getMaximumHeapSize + ad.getMaximumOffHeapSize))
+ csT += (" Heap size Min/Avg/Max", ad.getMinimumHeapSize + " / " +
+ formatDouble(ad.getAverageHeapSize) + " / " + ad.getMaximumHeapSize)
+ csT += (" Off-heap size Min/Avg/Max", ad.getMinimumOffHeapSize + " / " +
+ formatDouble(ad.getAverageOffHeapSize) + " / " + ad.getMaximumOffHeapSize)
val ciT = VisorTextTable()
@@ -432,16 +432,16 @@ class VisorCacheCommand {
formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
X.timeSpan2HMSM(nm.getUpTime),
(
- "Total: " + (cm.keySize() + cm.offHeapEntriesCount()),
- " Heap: " + cm.keySize(),
+ "Total: " + (cm.getKeySize + cm.offHeapEntriesCount()),
+ " Heap: " + cm.getKeySize,
" Off-Heap: " + cm.offHeapEntriesCount(),
- " Off-Heap Memory: " + formatMemory(cm.offHeapAllocatedSize())
+ " Off-Heap Memory: " + formatMemory(cm.getOffHeapAllocatedSize)
),
(
- "Hi: " + cm.hits(),
- "Mi: " + cm.misses(),
- "Rd: " + cm.reads(),
- "Wr: " + cm.writes()
+ "Hi: " + cm.getHits,
+ "Mi: " + cm.getMisses,
+ "Rd: " + cm.getReads,
+ "Wr: " + cm.getWrites
)
)
}
@@ -456,19 +456,19 @@ class VisorCacheCommand {
// Print footnote.
println("'Hi' - Number of cache hits.")
println("'Mi' - Number of cache misses.")
- println("'Rd' - Number of cache reads.")
+ 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.minimumQueryTime()))
- println(" Maximum execution time: " + X.timeSpan2HMSM(ad.maximumQueryTime))
- println(" Average execution time: " + X.timeSpan2HMSM(ad.averageQueryTime.toLong))
- println(" Total number of executions: " + ad.execsQuery)
- println(" Total number of failures: " + ad.failsQuery)
+ 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.name(), ad.name()))
+ gCfg.foreach(ccfgs => ccfgs.find(ccfg => F.eq(ccfg.getName, ad.getName))
.foreach(ccfg => {
nl()
@@ -533,7 +533,7 @@ class VisorCacheCommand {
try {
val caches: JavaCollection[String] = name.fold(Collections.emptyList[String]())(Collections.singletonList)
- val arg = new IgniteBiTuple(JavaBoolean.valueOf(systemCaches), caches)
+ val arg = new VisorCacheMetricsCollectorTaskArg(systemCaches, caches)
node match {
case Some(n) => executeOne(n.id(), classOf[VisorCacheMetricsCollectorTask], arg).toList
@@ -587,10 +587,10 @@ class VisorCacheCommand {
assert(arg != null)
val sorted = arg.trim match {
- case "hi" => data.toSeq.sortBy(_._2.hits)
- case "mi" => data.toSeq.sortBy(_._2.misses)
- case "rd" => data.toSeq.sortBy(_._2.reads)
- case "wr" => data.toSeq.sortBy(_._2.writes)
+ 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 _ =>
@@ -614,12 +614,12 @@ class VisorCacheCommand {
List[VisorCacheAggregatedMetrics] = {
val sorted = arg.trim match {
- case "hi" => data.toList.sortBy(_.averageHits)
- case "mi" => data.toList.sortBy(_.averageMisses)
- case "rd" => data.toList.sortBy(_.averageReads)
- case "wr" => data.toList.sortBy(_.averageWrites)
+ 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.name() == null || (y.name() != null && x.name().toLowerCase < y.name().toLowerCase))
+ x.getName == null || (y.getName != null && x.getName.toLowerCase < y.getName.toLowerCase))
case _ =>
assert(false, "Unknown sorting type: " + arg)
@@ -661,19 +661,19 @@ class VisorCacheCommand {
val ad = sortedAggrData(i)
// Add cache host as visor variable.
- registerCacheName(ad.name())
+ registerCacheName(ad.getName)
sumT += (
i,
- mkCacheName(ad.name()),
- ad.mode(),
+ mkCacheName(ad.getName),
+ ad.getMode,
(
- "min: " + (ad.minimumHeapSize() + ad.minimumOffHeapSize()) +
- " (" + ad.minimumHeapSize() + " / " + ad.minimumOffHeapSize() + ")",
- "avg: " + formatDouble(ad.averageHeapSize() + ad.averageOffHeapSize()) +
- " (" + formatDouble(ad.averageHeapSize()) + " / " + formatDouble(ad.averageOffHeapSize()) + ")",
- "max: " + (ad.maximumHeapSize() + ad.maximumOffHeapSize()) +
- " (" + ad.maximumHeapSize() + " / " + ad.maximumOffHeapSize() + ")"
+ "min: " + (ad.getMinimumHeapSize + ad.getMinimumOffHeapSize) +
+ " (" + ad.getMinimumHeapSize + " / " + ad.getMinimumOffHeapSize + ")",
+ "avg: " + formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapSize) +
+ " (" + formatDouble(ad.getAverageHeapSize) + " / " + formatDouble(ad.getAverageOffHeapSize) + ")",
+ "max: " + (ad.getMaximumHeapSize + ad.getMaximumOffHeapSize) +
+ " (" + ad.getMaximumHeapSize + " / " + ad.getMaximumOffHeapSize + ")"
))
})
@@ -685,7 +685,7 @@ class VisorCacheCommand {
None
else {
try
- Some(sortedAggrData(a.toInt).name())
+ Some(sortedAggrData(a.toInt).getName)
catch {
case e: Throwable =>
warn("Invalid selection: " + a)
@@ -859,107 +859,98 @@ object VisorCacheCommand {
* @param cfg Config to show information.
*/
private[commands] def printCacheConfiguration(title: String, cfg: VisorCacheConfiguration) {
- val affinityCfg = cfg.affinityConfiguration()
- val nearCfg = cfg.nearConfiguration()
- val rebalanceCfg = cfg.rebalanceConfiguration()
- val evictCfg = cfg.evictConfiguration()
- val defaultCfg = cfg.defaultConfiguration()
- val storeCfg = cfg.storeConfiguration()
- val queryCfg = cfg.queryConfiguration()
+ val affinityCfg = cfg.getAffinityConfiguration
+ val nearCfg = cfg.getNearConfiguration
+ val rebalanceCfg = cfg.getRebalanceConfiguration
+ val evictCfg = cfg.getEvictConfiguration
+ val storeCfg = cfg.getStoreConfiguration
+ val queryCfg = cfg.getQueryConfiguration
val cacheT = VisorTextTable()
cacheT #= ("Name", "Value")
- cacheT += ("Mode", cfg.mode)
- cacheT += ("Atomicity Mode", safe(cfg.atomicityMode))
- cacheT += ("Atomic Write Ordering Mode", safe(cfg.atomicWriteOrderMode))
- cacheT += ("Statistic Enabled", bool2Str(cfg.statisticsEnabled()))
- cacheT += ("Management Enabled", bool2Str(cfg.managementEnabled()))
-
- cacheT += ("Time To Live Eager Flag", cfg.eagerTtl)
-
- cacheT += ("Write Synchronization Mode", safe(cfg.writeSynchronizationMode))
- cacheT += ("Swap Enabled", bool2Str(cfg.swapEnabled()))
- cacheT += ("Invalidate", bool2Str(cfg.invalidate()))
- cacheT += ("Start Size", cfg.startSize())
-
- cacheT += ("Affinity Function", safe(affinityCfg.function()))
- cacheT += ("Affinity Backups", affinityCfg.partitionedBackups())
- cacheT += ("Affinity Partitions", safe(affinityCfg.partitions()))
- cacheT += ("Affinity Exclude Neighbors", safe(affinityCfg.excludeNeighbors()))
- cacheT += ("Affinity Mapper", safe(affinityCfg.mapper()))
-
- cacheT += ("Rebalance Mode", rebalanceCfg.mode())
- cacheT += ("Rebalance Batch Size", rebalanceCfg.batchSize())
- cacheT += ("Rebalance Thread Pool size", rebalanceCfg.threadPoolSize())
- cacheT += ("Rebalance Timeout", rebalanceCfg.timeout())
- cacheT += ("Rebalance Delay", rebalanceCfg.partitionedDelay())
- cacheT += ("Time Between Rebalance Messages", rebalanceCfg.throttle())
-
- cacheT += ("Eviction Policy Enabled", bool2Str(evictCfg.policy() != null))
- cacheT += ("Eviction Policy", safe(evictCfg.policy()))
- cacheT += ("Eviction Policy Max Size", safe(evictCfg.policyMaxSize()))
- cacheT += ("Eviction Filter", safe(evictCfg.filter()))
- cacheT += ("Eviction Key Buffer Size", evictCfg.synchronizedKeyBufferSize())
- cacheT += ("Eviction Synchronized", bool2Str(evictCfg.evictSynchronized()))
- cacheT += ("Eviction Overflow Ratio", evictCfg.maxOverflowRatio())
- cacheT += ("Synchronous Eviction Timeout", evictCfg.synchronizedTimeout())
- cacheT += ("Synchronous Eviction Concurrency Level", evictCfg.synchronizedConcurrencyLevel())
-
- cacheT += ("Near Cache Enabled", bool2Str(nearCfg.nearEnabled()))
- cacheT += ("Near Start Size", nearCfg.nearStartSize())
- cacheT += ("Near Eviction Policy", safe(nearCfg.nearEvictPolicy()))
- cacheT += ("Near Eviction Policy Max Size", safe(nearCfg.nearEvictMaxSize()))
-
- cacheT += ("Default Lock Timeout", defaultCfg.txLockTimeout())
- cacheT += ("Metadata type count", cfg.typeMeta().size())
- cacheT += ("Cache Interceptor", safe(cfg.interceptor()))
-
- cacheT += ("Store Enabled", bool2Str(storeCfg.enabled()))
- cacheT += ("Store Class", safe(storeCfg.store()))
- cacheT += ("Store Factory Class", storeCfg.storeFactory())
- cacheT += ("Store Keep Binary", storeCfg match {
- case cfg: VisorCacheStoreConfiguration => cfg.storeKeepBinary()
- case _ => false
- })
- cacheT += ("Store Read Through", bool2Str(storeCfg.readThrough()))
- cacheT += ("Store Write Through", bool2Str(storeCfg.writeThrough()))
-
- cacheT += ("Write-Behind Enabled", bool2Str(storeCfg.enabled()))
- cacheT += ("Write-Behind Flush Size", storeCfg.flushSize())
- cacheT += ("Write-Behind Frequency", storeCfg.flushFrequency())
- cacheT += ("Write-Behind Flush Threads Count", storeCfg.flushThreadCount())
- cacheT += ("Write-Behind Batch Size", storeCfg.batchSize())
-
- cacheT += ("Concurrent Asynchronous Operations Number", cfg.maxConcurrentAsyncOperations())
- cacheT += ("Memory Mode", cfg.memoryMode())
- cacheT += ("Off-Heap Size", cfg.offsetHeapMaxMemory() match {
+ cacheT += ("Mode", cfg.getMode)
+ cacheT += ("Atomicity Mode", safe(cfg.getAtomicityMode))
+ cacheT += ("Atomic Write Ordering Mode", safe(cfg.getAtomicWriteOrderMode))
+ cacheT += ("Statistic Enabled", bool2Str(cfg.isStatisticsEnabled))
+ cacheT += ("Management Enabled", bool2Str(cfg.isManagementEnabled))
+
+ cacheT += ("Time To Live Eager Flag", cfg.getEagerTtl)
+
+ cacheT += ("Write Synchronization Mode", safe(cfg.getWriteSynchronizationMode))
+ // TODO GG-11732 cacheT += ("Swap Enabled", bool2Str(cfg.swapEnabled()))
+ cacheT += ("Invalidate", bool2Str(cfg.isInvalidate))
+ cacheT += ("Start Size", cfg.getStartSize)
+
+ 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 += ("Eviction Policy Enabled", bool2Str(evictCfg.getPolicy != null))
+ cacheT += ("Eviction Policy", safe(evictCfg.getPolicy))
+ cacheT += ("Eviction Policy Max Size", safe(evictCfg.getPolicyMaxSize))
+ cacheT += ("Eviction Filter", safe(evictCfg.getFilter))
+ cacheT += ("Eviction Key Buffer Size", evictCfg.getSynchronizedKeyBufferSize)
+ cacheT += ("Eviction Synchronized", bool2Str(evictCfg.isEvictSynchronized))
+ cacheT += ("Eviction Overflow Ratio", evictCfg.getMaxOverflowRatio)
+ cacheT += ("Synchronous Eviction Timeout", evictCfg.getSynchronizedTimeout)
+ cacheT += ("Synchronous Eviction Concurrency Level", evictCfg.getSynchronizedConcurrencyLevel)
+
+ cacheT += ("Near Cache Enabled", bool2Str(nearCfg.isNearEnabled))
+ cacheT += ("Near Start Size", nearCfg.getNearStartSize)
+ cacheT += ("Near Eviction Policy", safe(nearCfg.getNearEvictPolicy))
+ cacheT += ("Near Eviction Policy Max Size", safe(nearCfg.getNearEvictMaxSize))
+
+ cacheT += ("Default Lock Timeout", cfg.getDefaultLockTimeout)
+ cacheT += ("Metadata type count", cfg.getTypeMeta.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 += ("Write-Behind Enabled", bool2Str(storeCfg.isEnabled))
+ 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 += ("Off-Heap Size", cfg.getOffsetHeapMaxMemory match {
case 0 => "UNLIMITED"
case size if size < 0 => NA
case size => size
})
- cacheT += ("Loader Factory Class Name", safe(cfg.loaderFactory()))
- cacheT += ("Writer Factory Class Name", safe(cfg.writerFactory()))
- cacheT += ("Expiry Policy Factory Class Name", safe(cfg.expiryPolicyFactory()))
+ 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.longQueryWarningTimeout())
- cacheT +=("Query Schema Name", queryCfg match {
- case cfg: VisorCacheQueryConfiguration => cfg.sqlSchema()
- case _ => null
- })
- cacheT +=("Query Escaped Names", bool2Str(queryCfg.sqlEscapeAll()))
- cacheT +=("Query Onheap Cache Size", queryCfg.sqlOnheapRowCacheSize())
+ cacheT +=("Query Execution Time Threshold", queryCfg.getLongQueryWarningTimeout)
+ cacheT +=("Query Schema Name", queryCfg.getSqlSchema)
+ cacheT +=("Query Escaped Names", bool2Str(queryCfg.isSqlEscapeAll))
+ cacheT +=("Query Onheap Cache Size", queryCfg.getSqlOnheapRowCacheSize)
- val sqlFxs = queryCfg.sqlFunctionClasses()
+ val sqlFxs = queryCfg.getSqlFunctionClasses
val hasSqlFxs = sqlFxs != null && sqlFxs.nonEmpty
if (!hasSqlFxs)
cacheT +=("Query SQL functions", NA)
- val indexedTypes = queryCfg.indexedTypes()
+ val indexedTypes = queryCfg.getIndexedTypes
val hasIndexedTypes = indexedTypes != null && indexedTypes.nonEmpty
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
index 9668072..a6bec15 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
@@ -140,11 +140,11 @@ class VisorCacheScanCommand {
try
executeRandom(groupForDataNode(node, cacheName),
classOf[VisorQueryTask], new VisorQueryArg(cacheName, null, false, false, false, pageSize)) match {
- case x if x.get1() != null =>
- error(x.get1())
+ case x if x.getError != null =>
+ error(x.getError)
return
- case x => x.get2()
+ case x => x.getResult
}
catch {
case e: ClusterGroupEmptyException =>
@@ -157,7 +157,7 @@ class VisorCacheScanCommand {
return
}
- if (firstPage.rows.isEmpty) {
+ if (firstPage.getRows.isEmpty) {
println(s"Cache: ${escapeName(cacheName)} is empty")
return
@@ -172,19 +172,19 @@ class VisorCacheScanCommand {
t #= ("Key Class", "Key", "Value Class", "Value")
- nextPage.rows.foreach(r => t += (r(0), r(1), r(2), r(3)))
+ nextPage.getRows.foreach(r => t += (r(0), r(1), r(2), r(3)))
t.render()
}
render()
- while (nextPage.hasMore) {
+ while (nextPage.isHasMore) {
ask("\nFetch more objects (y/n) [y]:", "y") match {
case "y" | "Y" =>
try {
- nextPage = executeOne(firstPage.responseNodeId(), classOf[VisorQueryNextPageTask],
- new IgniteBiTuple[String, Integer](firstPage.queryId(), pageSize))
+ nextPage = executeOne(firstPage.getResponseNodeId, classOf[VisorQueryNextPageTask],
+ new VisorQueryNextPageTaskArg(firstPage.getQueryId, pageSize))
render()
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
----------------------------------------------------------------------
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
index e69aa99..49f71fd 100644
--- 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
@@ -29,7 +29,7 @@ import org.apache.ignite.visor.visor._
import java.lang.System._
import java.util.UUID
-import org.apache.ignite.internal.visor.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
+import org.apache.ignite.internal.visor.node.{VisorSpiDescription, VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
import scala.collection.JavaConversions._
@@ -139,7 +139,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
cacheConfigurations(nid).foreach(ccfg => {
println()
- printCacheConfiguration(s"Cache '${escapeName(ccfg.name())}':", ccfg)
+ printCacheConfiguration(s"Cache '${escapeName(ccfg.getName)}':", ccfg)
})
}
catch {
@@ -157,45 +157,46 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val cmnT = VisorTextTable()
- val basic = cfg.basic()
-
- cmnT += ("Ignite instance name", escapeName(basic.igniteInstanceName()))
- cmnT += ("Ignite home", safe(basic.ggHome()))
- cmnT += ("Localhost", safe(basic.localHost()))
- cmnT += ("Node ID", safe(basic.nodeId()))
- cmnT += ("Marshaller", basic.marshaller())
- cmnT += ("Deployment mode", safe(basic.deploymentMode()))
- cmnT += ("ClientMode", javaBoolToStr(basic.clientMode()))
- cmnT += ("Daemon", bool2Str(basic.daemon()))
- cmnT += ("Remote JMX", bool2Str(basic.jmxRemote()))
- cmnT += ("Restart", bool2Str(basic.restart()))
- cmnT += ("Network timeout", basic.networkTimeout() + "ms")
- cmnT += ("Grid logger", safe(basic.logger()))
- cmnT += ("Discovery startup delay", basic.discoStartupDelay() + "ms")
- cmnT += ("MBean server", safe(basic.mBeanServer()))
- cmnT += ("ASCII logo disabled", bool2Str(basic.noAscii()))
- cmnT += ("Discovery order not required", bool2Str(basic.noDiscoOrder()))
- cmnT += ("Shutdown hook disabled", bool2Str(basic.noShutdownHook()))
- cmnT += ("Program name", safe(basic. programName()))
- cmnT += ("Quiet mode", bool2Str(basic.quiet()))
- cmnT += ("Success filename", safe(basic.successFile()))
- cmnT += ("Update notification", bool2Str(basic.updateNotifier()))
- cmnT += ("Include properties", safe(cfg.includeProperties()))
-
- val atomic = cfg.atomic()
-
- cmnT += ("Atomic Cache Mode", atomic.cacheMode())
- cmnT += ("Atomic Sequence Reservation Size", atomic.atomicSequenceReserveSize())
- cmnT += ("Atomic Number Of Backup Nodes", atomic.backups())
-
- val trn = cfg.transaction()
-
- cmnT += ("Transaction Concurrency", trn.defaultTxConcurrency())
- cmnT += ("Transaction Isolation", trn.defaultTxIsolation())
- cmnT += ("Transaction Timeout", trn.defaultTxTimeout() + "ms")
- cmnT += ("Transaction Log Cleanup Delay", trn.pessimisticTxLogLinger() + "ms")
+ val basic = cfg.getBasic
+
+ cmnT += ("Grid name", escapeName(basic.getGridName))
+ cmnT += ("Ignite home", safe(basic.getGgHome))
+ cmnT += ("Localhost", safe(basic.getLocalHost))
+ cmnT += ("Node ID", safe(basic.getNodeId))
+ 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 Serializable Enabled", bool2Str(trn.txSerializableEnabled()))
+ cmnT += ("Transaction Manager Factory", trn.getTxManagerFactory)
+ cmnT += ("Transaction Use JTA", bool2Str(trn.isUseJtaSync))
cmnT.render()
@@ -203,11 +204,13 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val metricsT = VisorTextTable()
- val expTime = cfg.metrics().expireTime()
+ val metricsCfg = cfg.getMetrics
+
+ val expTime = metricsCfg.getExpireTime
metricsT += ("Metrics expire time", if (expTime != Long.MaxValue) expTime + "ms" else "<never>")
- metricsT += ("Metrics history size", cfg.metrics().historySize())
- metricsT += ("Metrics log frequency", cfg.metrics().loggerFrequency())
+ metricsT += ("Metrics history size", metricsCfg.getHistorySize)
+ metricsT += ("Metrics log frequency", metricsCfg.getLoggerFrequency)
metricsT.render()
@@ -215,24 +218,25 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val spisT = VisorTextTable()
- def spiClass(spi: IgniteBiTuple[String, java.util.Map[String, AnyRef]]) = {
- if (spi != null) spi.get2().getOrElse("Class Name", NA) else NA
+ def spiClass(spi: VisorSpiDescription) = {
+ if (spi != null) spi.getFieldDescriptions.getOrElse("Class Name", NA) else NA
}
- def spisClass(spis: Array[IgniteBiTuple[String, java.util.Map[String, AnyRef]]]) = {
+ def spisClass(spis: Array[VisorSpiDescription]) = {
spis.map(spiClass).mkString("[", ", ", "]")
}
- spisT += ("Discovery", spiClass(cfg.spis().discoverySpi()))
- spisT += ("Communication", spiClass(cfg.spis().communicationSpi()))
- spisT += ("Event storage", spiClass(cfg.spis().eventStorageSpi()))
- spisT += ("Collision", spiClass(cfg.spis().collisionSpi()))
- spisT += ("Deployment", spiClass(cfg.spis().deploymentSpi()))
- spisT += ("Checkpoints", spisClass(cfg.spis().checkpointSpis()))
- spisT += ("Failovers", spisClass(cfg.spis().failoverSpis()))
- spisT += ("Load balancings", spisClass(cfg.spis().loadBalancingSpis()))
- spisT += ("Swap spaces", spiClass(cfg.spis().swapSpaceSpi()))
- spisT += ("Indexing", spisClass(cfg.spis().indexingSpis()))
+ 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()
@@ -240,9 +244,11 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val p2pT = VisorTextTable()
- p2pT += ("Peer class loading enabled", bool2Str(cfg.p2p().p2pEnabled()))
- p2pT += ("Missed resources cache size", cfg.p2p().p2pMissedResponseCacheSize())
- p2pT += ("Peer-to-Peer loaded packages", safe(cfg.p2p().p2pLocalClassPathExclude()))
+ 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()
@@ -250,7 +256,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val lifecycleT = VisorTextTable()
- lifecycleT += ("Beans", safe(cfg.lifecycle().beans()))
+ lifecycleT += ("Beans", safe(cfg.getLifecycle.getBeans))
lifecycleT.render()
@@ -258,14 +264,15 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val execSvcT = VisorTextTable()
- val execCfg = cfg.executeService()
+ val execCfg = cfg.getExecutorService
- execSvcT += ("Public thread pool size", safe(execCfg.publicThreadPoolSize()))
- execSvcT += ("System thread pool size", safe(execCfg.systemThreadPoolSize()))
- execSvcT += ("Management thread pool size", safe(execCfg.managementThreadPoolSize()))
- execSvcT += ("IGFS thread pool size", safe(execCfg.igfsThreadPoolSize()))
- execSvcT += ("Peer-to-Peer thread pool size", safe(execCfg.peerClassLoadingThreadPoolSize()))
- execSvcT += ("REST thread pool size", safe(execCfg.restThreadPoolSize()))
+ 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 += ("IGFS thread pool size", safe(execCfg.getIgfsThreadPoolSize))
+ 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.render()
@@ -273,11 +280,13 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val segT = VisorTextTable()
- segT += ("Segmentation policy", safe(cfg.segmentation().policy()))
- segT += ("Segmentation resolvers", safe(cfg.segmentation().resolvers()))
- segT += ("Segmentation check frequency", cfg.segmentation().checkFrequency())
- segT += ("Wait for segmentation on start", bool2Str(cfg.segmentation().waitOnStart()))
- segT += ("All resolvers pass required", bool2Str(cfg.segmentation().passRequired()))
+ 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()
@@ -285,7 +294,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val evtsT = VisorTextTable()
- val inclEvtTypes = Option(cfg.includeEventTypes()).fold(NA)(et => arr2Str(et.map(U.gridEventName)))
+ val inclEvtTypes = Option(cfg.getIncludeEventTypes).fold(NA)(et => arr2Str(et.map(U.gridEventName)))
evtsT += ("Included event types", inclEvtTypes)
@@ -295,32 +304,33 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
val restT = VisorTextTable()
- restT += ("REST enabled", bool2Str(cfg.rest().restEnabled()))
- restT += ("Rest accessible folders", safe(cfg.rest().accessibleFolders()))
- restT += ("Jetty path", safe(cfg.rest().jettyPath()))
- restT += ("Jetty host", safe(cfg.rest().jettyHost()))
- restT += ("Jetty port", safe(cfg.rest().jettyPort()))
- restT += ("Tcp ssl enabled", bool2Str(cfg.rest().tcpSslEnabled()))
- restT += ("Tcp ssl context factory", safe(cfg.rest().tcpSslContextFactory()))
- restT += ("Tcp host", safe(cfg.rest().tcpHost()))
- restT += ("Tcp port", safe(cfg.rest().tcpPort()))
+ 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.userAttributes().nonEmpty) {
+ if (cfg.getUserAttributes.nonEmpty) {
println("\nUser attributes:")
val uaT = VisorTextTable()
uaT #= ("Name", "Value")
- cfg.userAttributes().foreach(a => uaT += (a._1, a._2))
+ cfg.getUserAttributes.foreach(a => uaT += (a._1, a._2))
uaT.render()
} else
println("\nNo user attributes defined.")
- if (cfg.env().nonEmpty) {
+ if (cfg.getEnv.nonEmpty) {
println("\nEnvironment variables:")
val envT = VisorTextTable()
@@ -329,13 +339,13 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
envT #= ("Name", "Value")
- cfg.env().foreach(v => envT += (v._1, compactProperty(v._1, v._2)))
+ cfg.getEnv.foreach(v => envT += (v._1, compactProperty(v._1, v._2)))
envT.render()
} else
println("\nNo environment variables defined.")
- val sysProps = cfg.systemProperties().toMap
+ val sysProps = cfg.getSystemProperties.toMap
if (sysProps.nonEmpty) {
println("\nSystem properties:")
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
index b0f2c82..c45ce37 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
@@ -28,7 +28,7 @@ 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.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
import scala.collection.JavaConversions._
import scala.collection.immutable._
@@ -184,9 +184,9 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
evts.take(cnt).foreach {
case de: VisorGridDiscoveryEvent =>
- t +=(formatDateTime(de.timestamp()), de.name(),
+ t +=(formatDateTime(de.getTimestamp), de.getName,
nodeId8(de.evtNodeId()) + (if (de.isDaemon) "(daemon)" else ""),
- if (F.isEmpty(de.address())) NA else de.address())
+ if (F.isEmpty(de.getAddress())) NA else de.getAddress())
case _ =>
}
@@ -216,12 +216,12 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
if (nodeStartTime > System.currentTimeMillis() - tmFrame) {
val root = new VisorGridDiscoveryEvent(EVT_NODE_JOINED, null, U.gridEventName(EVT_NODE_JOINED),
- node.id(), nodeStartTime, "", "", node.id, node.addresses().head, node.isDaemon, 0)
+ node.id(), nodeStartTime, "", "", node.id, node.addresses().head, node.isDaemon, 0L) // TODO GG-11732
evts = Seq(root) ++ evts
}
- evts = evts.sortBy(_.timestamp())
+ evts = evts.sortBy(_.getTimestamp)
if (reverse) evts.reverse else evts
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
----------------------------------------------------------------------
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
index e3e73c7..c41eca1 100644
--- 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
@@ -28,7 +28,7 @@ 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.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
import scala.collection.JavaConversions._
import scala.collection.immutable._
@@ -86,7 +86,6 @@ import scala.language.implicitConversions
* cl Cloud events.
* ca Cache events.
* cr Cache rebalance events.
- * sw Swapspace events.
* -t=<num>s|m|h|d
* Defines time frame for querying events:
* =<num>s Queries events fired during last <num> seconds.
@@ -168,7 +167,6 @@ class VisorEventsCommand extends VisorConsoleCommand {
case "ta" => EVTS_TASK_EXECUTION
case "ca" => EVTS_CACHE
case "cr" => EVTS_CACHE_REBALANCE
- case "sw" => EVTS_SWAPSPACE
case t => throw new IllegalArgumentException("Unknown event mnemonic: " + t)
}
}
@@ -184,7 +182,7 @@ class VisorEventsCommand extends VisorConsoleCommand {
protected def mnemonic(e: VisorGridEvent) = {
assert(e != null)
- e.typeId() match {
+ 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"
@@ -192,7 +190,6 @@ class VisorEventsCommand extends VisorConsoleCommand {
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 if EVTS_SWAPSPACE.contains(t) => "sw"
case t => throw new IllegalArgumentException("Unknown event type: " + t)
}
}
@@ -242,7 +239,7 @@ class VisorEventsCommand extends VisorConsoleCommand {
val sortedOpt = sort(evts.toList, argValue("s", argLst), hasArgName("r", argLst))
- if (!sortedOpt.isDefined)
+ if (sortedOpt.isEmpty)
return
val sorted = sortedOpt.get
@@ -267,8 +264,8 @@ class VisorEventsCommand extends VisorConsoleCommand {
st += ("Node ID8(@ID)", nodeId8Addr(nid))
st += ("Total", sorted.size)
- st += ("Earliest timestamp", formatDateTime(evts.maxBy(_.timestamp).timestamp))
- st += ("Oldest timestamp", formatDateTime(evts.minBy(_.timestamp).timestamp))
+ st += ("Earliest timestamp", formatDateTime(evts.maxBy(_.getTimestamp).getTimestamp))
+ st += ("Oldest timestamp", formatDateTime(evts.minBy(_.getTimestamp).getTimestamp))
st.render()
@@ -279,13 +276,13 @@ class VisorEventsCommand extends VisorConsoleCommand {
var sum = Map[Int, (String, Int, Long, Long)]()
evts.foreach(evt => {
- val info = sum.getOrElse(evt.typeId(), (null, 0, Long.MinValue, Long.MaxValue))
+ val info = sum.getOrElse(evt.getTypeId, (null, 0, Long.MinValue, Long.MaxValue))
- sum += (evt.typeId -> (
- "(" + mnemonic(evt) + ") " + evt.name(),
+ sum += (evt.getTypeId -> (
+ "(" + mnemonic(evt) + ") " + evt.getName,
info._2 + 1,
- if (evt.timestamp() > info._3) evt.timestamp() else info._3,
- if (evt.timestamp() < info._4) evt.timestamp() else info._4)
+ if (evt.getTimestamp > info._3) evt.getTimestamp else info._3,
+ if (evt.getTimestamp < info._4) evt.getTimestamp else info._4)
)
})
@@ -325,7 +322,7 @@ class VisorEventsCommand extends VisorConsoleCommand {
all #= ("Timestamp", "Description")
sorted.take(cnt).foreach(evt =>
- all += (formatDateTime(evt.timestamp()), U.compact(evt.shortDisplay))
+ all += (formatDateTime(evt.getTimestamp), U.compact(evt.getShortDisplay))
)
all.render()
@@ -368,8 +365,8 @@ class VisorEventsCommand extends VisorConsoleCommand {
Some(evts)
else
arg.get.trim match {
- case "e" => Some(if (reverse) evts.sortBy(_.name).reverse else evts.sortBy(_.name))
- case "t" => Some(if (reverse) evts.sortBy(_.timestamp).reverse else evts.sortBy(_.timestamp))
+ 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)
@@ -403,7 +400,7 @@ object VisorEventsCommand {
),
spec = List(
"events",
- "events {-id=<node-id>|-id8=<node-id8>} {-e=<ch,de,di,jo,ta,ca,cr,sw>}",
+ "events {-id=<node-id>|-id8=<node-id8>} {-e=<ch,de,di,jo,ta,ca,cr>}",
" {-t=<num>s|m|h|d} {-s=e|t} {-r} {-c=<n>}"
),
args = List(
@@ -420,7 +417,7 @@ object VisorEventsCommand {
"Either '-id' or '-id8' can be specified.",
"If called without the arguments - starts in interactive mode."
),
- "-e=<ch,de,di,jo,ta,ca,cr,sw>" -> List(
+ "-e=<ch,de,di,jo,ta,ca,cr>" -> List(
"Comma separated list of event types that should be queried:",
" ch Checkpoint events.",
" de Deployment events.",
@@ -428,11 +425,10 @@ object VisorEventsCommand {
" jo Job execution events.",
" ta Task execution events.",
" ca Cache events.",
- " cr Cache rebalance events.",
- " sw Swapspace events."
+ " cr Cache rebalance events."
),
"-t=<num>s|m|h|d" -> List(
- "Defines time frame for quering events:",
+ "Defines time frame for querying events:",
" =<num>s Queries events fired during last <num> seconds.",
" =<num>m Queries events fired during last <num> minutes.",
" =<num>h Queries events fired during last <num> hours.",
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
----------------------------------------------------------------------
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
index 990fd00..5f642d7 100644
--- 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
@@ -104,8 +104,8 @@ class VisorGcCommand extends VisorConsoleCommand {
res.foreach {
case (nid, stat) =>
- val roundHb = stat.get1() / (1024L * 1024L)
- val roundHa = stat.get2() / (1024L * 1024L)
+ val roundHb = stat.getSizeBefore / (1024L * 1024L)
+ val roundHa = stat.getSizeAfter / (1024L * 1024L)
val sign = if (roundHa > roundHb) "+" else ""
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
----------------------------------------------------------------------
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
index 0468e80..4d9b795 100644
--- 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
@@ -31,7 +31,7 @@ import java.util.UUID
import org.apache.ignite.internal.visor.event.{VisorGridEvent, VisorGridJobEvent, VisorGridTaskEvent}
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
import scala.collection.JavaConversions._
import scala.language.implicitConversions
@@ -91,37 +91,37 @@ private case class VisorExecution(
* Gets number of job rejections in this session.
*/
lazy val rejections: Int =
- evts.count(_.typeId() == EVT_JOB_REJECTED)
+ evts.count(_.getTypeId == EVT_JOB_REJECTED)
/**
* Gets number of job cancellations in this session.
*/
lazy val cancels: Int =
- evts.count(_.typeId() == EVT_JOB_CANCELLED)
+ evts.count(_.getTypeId == EVT_JOB_CANCELLED)
/**
* Gets number of job finished in this session.
*/
lazy val finished: Int =
- evts.count(_.typeId() == EVT_JOB_FINISHED)
+ evts.count(_.getTypeId == EVT_JOB_FINISHED)
/**
* Gets number of job started in this session.
*/
lazy val started: Int =
- evts.count(_.typeId() == EVT_JOB_STARTED)
+ evts.count(_.getTypeId == EVT_JOB_STARTED)
/**
* Gets number of job failures in this session.
*/
lazy val failures: Int =
- evts.count(_.typeId() == EVT_JOB_FAILED)
+ evts.count(_.getTypeId == EVT_JOB_FAILED)
/**
* Gets number of job failovers in this session.
*/
lazy val failovers: Int =
- evts.count(_.typeId() == EVT_JOB_FAILED_OVER)
+ evts.count(_.getTypeId == EVT_JOB_FAILED_OVER)
/**
* Gets duration of the session.
@@ -420,7 +420,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
else if (hasArgName("n", argLst)) {
val n = argValue("n", argLst)
- if (!n.isDefined)
+ if (n.isEmpty)
scold("Invalid arguments: " + args)
else
task(n.get, hasArgFlag("r", argLst), hasArgFlag("a", argLst))
@@ -428,7 +428,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
else if (hasArgName("e", argLst)) {
val s = argValue("e", argLst)
- if (!s.isDefined)
+ if (s.isEmpty)
scold("Invalid arguments: " + args)
else
exec(s.get, hasArgFlag("r", argLst))
@@ -541,28 +541,28 @@ class VisorTasksCommand extends VisorConsoleCommand {
evts.foreach {
case te: VisorGridTaskEvent =>
- val displayedTaskName = taskSimpleName(te.taskName(), te.taskClassName())
+ val displayedTaskName = taskSimpleName(te.getTaskName(), te.getTaskClassName())
- val s = getSession(te.taskSessionId(), displayedTaskName)
+ 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.nid()
- s.startTs = math.min(s.startTs, te.timestamp())
- s.endTs = math.max(s.endTs, te.timestamp())
+ s.nodeIds = s.nodeIds + te.getNid
+ s.startTs = math.min(s.startTs, te.getTimestamp)
+ s.endTs = math.max(s.endTs, te.getTimestamp)
- te.typeId() match {
+ te.getTypeId match {
case EVT_TASK_STARTED =>
if (s.state == UNDEFINED) s.state = STARTED
- s.origNodeId = te.nid()
+ s.origNodeId = te.getNid
case EVT_TASK_FINISHED =>
if (s.state == UNDEFINED || s.state == STARTED) s.state = FINISHED
- s.origNodeId = te.nid()
+ 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
@@ -570,23 +570,23 @@ class VisorTasksCommand extends VisorConsoleCommand {
}
case je: VisorGridJobEvent =>
- val displayedTaskName = taskSimpleName(je.taskName(), je.taskClassName())
- val s = getSession(je.taskSessionId(), displayedTaskName)
+ 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.typeId() match {
+ je.getTypeId match {
case EVT_JOB_CANCELLED | EVT_JOB_FAILED | EVT_JOB_REJECTED | EVT_JOB_TIMEDOUT =>
- s.failedNodeIds = s.failedNodeIds + je.nid()
+ s.failedNodeIds = s.failedNodeIds + je.getNid
case _ =>
}
s.evts = s.evts :+ je
- s.nodeIds = s.nodeIds + je.nid()
- s.startTs = math.min(s.startTs, je.timestamp())
- s.endTs = math.max(s.endTs, je.timestamp())
+ s.nodeIds = s.nodeIds + je.getNid
+ s.startTs = math.min(s.startTs, je.getTimestamp)
+ s.endTs = math.max(s.endTs, je.getTimestamp)
case _ =>
}
@@ -1063,13 +1063,12 @@ class VisorTasksCommand extends VisorConsoleCommand {
evtsT #= ("Timestamp", "Node ID8(@)", "Event")
- val se = if (!reverse) e.evts.sortBy(_.timestamp()) else e.evts.sortBy(_.timestamp()).reverse
+ val se = if (!reverse) e.evts.sortBy(_.getTimestamp) else e.evts.sortBy(_.getTimestamp).reverse
se.foreach(e => evtsT += (
- formatDateTime(e.timestamp()),
- nodeId8Addr(e.nid()),
- e.name()
- ))
+ formatDateTime(e.getTimestamp),
+ nodeId8Addr(e.getNid),
+ e.getName))
println("\nTrace:")
@@ -1142,7 +1141,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
}
sortedNames.foreach(taskName => {
- val t = VisorTask(taskName, execsMap.get(taskName).get)
+ val t = VisorTask(taskName, execsMap(taskName))
val sE = t.execsFor(STARTED)
val fE = t.execsFor(FINISHED)
@@ -1256,7 +1255,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
}
sortedNames.foreach(taskName => {
- val t = VisorTask(taskName, execsMap.get(taskName).get)
+ val t = VisorTask(taskName, execsMap(taskName))
val sE = t.execsFor(STARTED)
val fE = t.execsFor(FINISHED)
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
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
index ea60c87..1963530 100644
--- 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
@@ -43,7 +43,7 @@ import java.util.concurrent._
import java.util.{Collection => JavaCollection, HashSet => JavaHashSet, _}
import org.apache.ignite.internal.visor.cache._
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
import org.apache.ignite.internal.visor.node._
import org.apache.ignite.internal.visor.util.VisorEventMapper
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
@@ -152,16 +152,16 @@ object visor extends VisorTag {
private var cmdLst: Seq[VisorCommandHolder] = Nil
/** Node left listener. */
- private var nodeLeftLsnr: IgnitePredicate[Event] = null
+ private var nodeLeftLsnr: IgnitePredicate[Event] = _
/** Node join listener. */
- private var nodeJoinLsnr: IgnitePredicate[Event] = null
+ private var nodeJoinLsnr: IgnitePredicate[Event] = _
/** Node segmentation listener. */
- private var nodeSegLsnr: IgnitePredicate[Event] = null
+ private var nodeSegLsnr: IgnitePredicate[Event] = _
/** Node stop listener. */
- private var nodeStopLsnr: IgnitionListener = null
+ private var nodeStopLsnr: IgnitionListener = _
/** */
@volatile private var isCon: Boolean = false
@@ -209,13 +209,13 @@ object visor extends VisorTag {
private final val DFLT_LOG_PATH = "visor/visor-log"
/** Log file. */
- private var logFile: File = null
+ private var logFile: File = _
/** Log timer. */
- private var logTimer: Timer = null
+ private var logTimer: Timer = _
/** Topology log timer. */
- private var topTimer: Timer = null
+ private var topTimer: Timer = _
/** Log started flag. */
@volatile private var logStarted = false
@@ -224,15 +224,15 @@ object visor extends VisorTag {
@volatile var pool: ExecutorService = new IgniteThreadPoolExecutor()
/** Configuration file path, if any. */
- @volatile var cfgPath: String = null
+ @volatile var cfgPath: String = _
/** */
- @volatile var ignite: IgniteEx = null
+ @volatile var ignite: IgniteEx = _
/** */
@volatile var prevIgnite: Option[IgniteEx] = None
- private var reader: ConsoleReader = null
+ private var reader: ConsoleReader = _
var batchMode: Boolean = false
@@ -2454,15 +2454,15 @@ object visor extends VisorTag {
try {
out = new FileWriter(logFile, true)
- evts.toList.sortBy(_.timestamp).foreach(e => {
+ evts.toList.sortBy(_.getTimestamp).foreach(e => {
logImpl(
out,
- formatDateTime(e.timestamp),
- nodeId8Addr(e.nid()),
- U.compact(e.shortDisplay())
+ formatDateTime(e.getTimestamp),
+ nodeId8Addr(e.getNid),
+ U.compact(e.getShortDisplay)
)
- if (EVTS_DISCOVERY.contains(e.typeId()))
+ if (EVTS_DISCOVERY.contains(e.getTypeId))
snapshot()
})
}
[8/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
GG-11732 Merged with master.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fb9112e6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fb9112e6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fb9112e6
Branch: refs/heads/ignite-gg-11732
Commit: fb9112e6a0e193bcb798f17f7771e301e8c905ba
Parents: 740621a
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Apr 6 15:01:21 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Apr 6 15:01:22 2017 +0700
----------------------------------------------------------------------
.../JettyRestProcessorAbstractSelfTest.java | 12 +-
.../internal/visor/VisorDataTransferObject.java | 84 +++++
.../internal/visor/VisorMultiNodeTask.java | 6 +-
.../ignite/internal/visor/VisorOneNodeTask.java | 5 +-
.../internal/visor/VisorTaskArgument.java | 48 ++-
.../internal/visor/VisorTaskResultWrapper.java | 34 +++
.../visor/binary/VisorBinaryMetadata.java | 139 +++++++++
.../VisorBinaryMetadataCollectorTask.java | 70 +++++
.../VisorBinaryMetadataCollectorTaskResult.java | 88 ++++++
.../visor/binary/VisorBinaryMetadataField.java | 101 ++++++
.../ignite/internal/visor/cache/VisorCache.java | 306 ++++++++-----------
.../cache/VisorCacheAffinityConfiguration.java | 91 ++++--
.../visor/cache/VisorCacheAffinityNodeTask.java | 12 +-
.../cache/VisorCacheAffinityNodeTaskArg.java | 87 ++++++
.../cache/VisorCacheAggregatedMetrics.java | 205 ++++++++-----
.../visor/cache/VisorCacheClearTask.java | 68 ++---
.../visor/cache/VisorCacheClearTaskResult.java | 85 ++++++
.../visor/cache/VisorCacheConfiguration.java | 182 ++++++-----
.../VisorCacheConfigurationCollectorJob.java | 4 +-
.../cache/VisorCacheDefaultConfiguration.java | 58 ----
.../cache/VisorCacheEvictionConfiguration.java | 84 +++--
.../visor/cache/VisorCacheLoadTask.java | 19 +-
.../visor/cache/VisorCacheLoadTaskArg.java | 101 ++++++
.../visor/cache/VisorCacheMetadataTask.java | 18 +-
.../internal/visor/cache/VisorCacheMetrics.java | 211 +++++++++----
.../cache/VisorCacheMetricsCollectorTask.java | 28 +-
.../VisorCacheMetricsCollectorTaskArg.java | 88 ++++++
.../cache/VisorCacheNearConfiguration.java | 59 ++--
.../visor/cache/VisorCachePartition.java | 65 ++--
.../visor/cache/VisorCachePartitions.java | 45 +--
.../visor/cache/VisorCachePartitionsTask.java | 28 +-
.../cache/VisorCacheQueryConfiguration.java | 89 +++---
.../cache/VisorCacheQueryDetailMetrics.java | 50 ++-
...sorCacheQueryDetailMetricsCollectorTask.java | 4 +-
.../visor/cache/VisorCacheQueryMetrics.java | 61 ++--
.../cache/VisorCacheRebalanceConfiguration.java | 71 +++--
.../visor/cache/VisorCacheSqlIndexMetadata.java | 115 +++++++
.../visor/cache/VisorCacheSqlMetadata.java | 161 ++++++++++
.../visor/cache/VisorCacheStartArg.java | 101 ++++++
.../visor/cache/VisorCacheStartTask.java | 60 +---
.../cache/VisorCacheStoreConfiguration.java | 77 +++--
.../cache/VisorCacheTypeFieldMetadata.java | 39 ++-
.../visor/cache/VisorCacheTypeMetadata.java | 111 ++++---
.../internal/visor/cache/VisorPartitionMap.java | 90 ++++++
.../VisorComputeToggleMonitoringTask.java | 17 +-
.../VisorComputeToggleMonitoringTaskArg.java | 87 ++++++
.../visor/compute/VisorGatewayTask.java | 14 +-
.../visor/debug/VisorThreadDumpTask.java | 13 +-
.../visor/debug/VisorThreadDumpTaskResult.java | 88 ++++++
.../internal/visor/debug/VisorThreadInfo.java | 228 +++++++-------
.../visor/debug/VisorThreadLockInfo.java | 51 +++-
.../visor/debug/VisorThreadMonitorInfo.java | 64 ++--
.../visor/event/VisorGridDeploymentEvent.java | 31 +-
.../visor/event/VisorGridDiscoveryEvent.java | 43 ++-
.../internal/visor/event/VisorGridEvent.java | 66 ++--
.../visor/event/VisorGridEventsLost.java | 15 +-
.../internal/visor/event/VisorGridJobEvent.java | 49 ++-
.../visor/event/VisorGridTaskEvent.java | 49 ++-
.../internal/visor/file/VisorFileBlock.java | 60 +++-
.../internal/visor/file/VisorFileBlockArg.java | 115 +++++++
.../internal/visor/file/VisorFileBlockTask.java | 64 +---
.../visor/file/VisorFileBlockTaskResult.java | 87 ++++++
.../visor/file/VisorLatestTextFilesTask.java | 16 +-
.../visor/file/VisorLatestTextFilesTaskArg.java | 87 ++++++
.../ignite/internal/visor/igfs/VisorIgfs.java | 78 +++--
.../internal/visor/igfs/VisorIgfsEndpoint.java | 72 +++--
.../internal/visor/igfs/VisorIgfsMetrics.java | 118 ++++---
.../internal/visor/igfs/VisorIgfsProfiler.java | 24 +-
.../visor/igfs/VisorIgfsProfilerClearTask.java | 11 +-
.../igfs/VisorIgfsProfilerClearTaskResult.java | 85 ++++++
.../visor/igfs/VisorIgfsProfilerEntry.java | 106 +++++--
.../visor/igfs/VisorIgfsProfilerTask.java | 10 +-
.../VisorIgfsProfilerUniformityCounters.java | 38 ++-
.../visor/igfs/VisorIgfsSamplingStateTask.java | 16 +-
.../igfs/VisorIgfsSamplingStateTaskArg.java | 86 ++++++
.../ignite/internal/visor/log/VisorLogFile.java | 43 ++-
.../internal/visor/log/VisorLogSearchArg.java | 115 +++++++
.../visor/log/VisorLogSearchResult.java | 80 +++--
.../internal/visor/log/VisorLogSearchTask.java | 72 +----
.../visor/log/VisorLogSearchTaskResult.java | 92 ++++++
.../visor/node/VisorAtomicConfiguration.java | 49 ++-
.../visor/node/VisorBasicConfiguration.java | 171 +++++++----
.../node/VisorExecutorServiceConfiguration.java | 81 +++--
.../visor/node/VisorGridConfiguration.java | 118 ++++---
.../visor/node/VisorIgfsConfiguration.java | 218 +++++++------
.../visor/node/VisorLifecycleConfiguration.java | 39 ++-
.../visor/node/VisorMetricsConfiguration.java | 50 ++-
.../VisorNodeConfigurationCollectorJob.java | 4 +-
.../visor/node/VisorNodeDataCollectorJob.java | 63 ++--
.../node/VisorNodeDataCollectorJobResult.java | 113 +++++--
.../visor/node/VisorNodeDataCollectorTask.java | 40 +--
.../node/VisorNodeDataCollectorTaskArg.java | 54 +++-
.../node/VisorNodeDataCollectorTaskResult.java | 127 ++++++--
.../node/VisorNodeEventsCollectorTask.java | 133 +-------
.../node/VisorNodeEventsCollectorTaskArg.java | 164 ++++++++++
.../internal/visor/node/VisorNodeGcTask.java | 17 +-
.../visor/node/VisorNodeGcTaskResult.java | 85 ++++++
.../internal/visor/node/VisorNodePingTask.java | 15 +-
.../visor/node/VisorNodePingTaskResult.java | 99 ++++++
.../visor/node/VisorNodeSuppressedErrors.java | 89 ++++++
.../node/VisorNodeSuppressedErrorsTask.java | 22 +-
.../node/VisorPeerToPeerConfiguration.java | 57 ++--
.../visor/node/VisorRestConfiguration.java | 93 +++---
.../node/VisorSegmentationConfiguration.java | 67 ++--
.../visor/node/VisorSpiDescription.java | 89 ++++++
.../visor/node/VisorSpisConfiguration.java | 125 ++++----
.../visor/node/VisorSuppressedError.java | 147 +++++++++
.../node/VisorTransactionConfiguration.java | 104 +++++--
.../internal/visor/query/VisorQueryArg.java | 65 +++-
.../internal/visor/query/VisorQueryField.java | 42 ++-
.../internal/visor/query/VisorQueryJob.java | 40 +--
.../visor/query/VisorQueryNextPageTask.java | 27 +-
.../visor/query/VisorQueryNextPageTaskArg.java | 86 ++++++
.../internal/visor/query/VisorQueryResult.java | 42 ++-
.../visor/query/VisorQueryResultEx.java | 43 ++-
.../internal/visor/query/VisorQueryTask.java | 6 +-
.../visor/query/VisorQueryTaskResult.java | 83 +++++
.../internal/visor/util/VisorMimeTypes.java | 12 +-
.../internal/visor/util/VisorTaskUtils.java | 35 ++-
.../plugin/segmentation/SegmentationPolicy.java | 18 +-
.../resources/META-INF/classnames.properties | 95 +++---
.../ignite/visor/commands/VisorConsole.scala | 1 -
.../commands/cache/VisorCacheClearCommand.scala | 2 +-
.../commands/cache/VisorCacheCommand.scala | 295 +++++++++---------
.../commands/cache/VisorCacheScanCommand.scala | 16 +-
.../config/VisorConfigurationCommand.scala | 184 +++++------
.../commands/disco/VisorDiscoveryCommand.scala | 10 +-
.../commands/events/VisorEventsCommand.scala | 38 ++-
.../visor/commands/gc/VisorGcCommand.scala | 4 +-
.../commands/tasks/VisorTasksCommand.scala | 61 ++--
.../scala/org/apache/ignite/visor/visor.scala | 32 +-
131 files changed, 6881 insertions(+), 2539 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 5e3d896..3201c6f 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
@@ -71,6 +71,7 @@ import org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask;
import org.apache.ignite.internal.visor.cache.VisorCacheNodesTask;
import org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask;
import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask;
+import org.apache.ignite.internal.visor.cache.VisorCacheStartArg;
import org.apache.ignite.internal.visor.cache.VisorCacheStartTask;
import org.apache.ignite.internal.visor.cache.VisorCacheStopTask;
import org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask;
@@ -79,6 +80,7 @@ import org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask;
import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask;
import org.apache.ignite.internal.visor.compute.VisorGatewayTask;
import org.apache.ignite.internal.visor.debug.VisorThreadDumpTask;
+import org.apache.ignite.internal.visor.file.VisorFileBlockArg;
import org.apache.ignite.internal.visor.file.VisorFileBlockTask;
import org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask;
@@ -86,6 +88,7 @@ import org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask;
import org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask;
+import org.apache.ignite.internal.visor.log.VisorLogSearchArg;
import org.apache.ignite.internal.visor.log.VisorLogSearchTask;
import org.apache.ignite.internal.visor.misc.VisorAckTask;
import org.apache.ignite.internal.visor.misc.VisorLatestVersionTask;
@@ -94,6 +97,7 @@ import org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask
import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTask;
import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskArg;
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask;
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg;
import org.apache.ignite.internal.visor.node.VisorNodeGcTask;
import org.apache.ignite.internal.visor.node.VisorNodePingTask;
import org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask;
@@ -1383,7 +1387,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
ret = content(new VisorGatewayArgument(VisorFileBlockTask.class)
.forNode(locNode)
- .argument(VisorFileBlockTask.VisorFileBlockArg.class, "", 0L, 1, 0L));
+ .argument(VisorFileBlockArg.class, "", 0L, 1, 0L));
info("VisorFileBlockTask result: " + ret);
@@ -1466,7 +1470,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jsonTaskResult(ret);
ret = content(new VisorGatewayArgument(VisorLogSearchTask.class)
- .argument(VisorLogSearchTask.VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
+ .argument(VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
info("VisorLogSearchTask result: " + ret);
@@ -1486,7 +1490,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jsonTaskResult(ret);
ret = content(new VisorGatewayArgument(VisorNodeEventsCollectorTask.class)
- .argument(VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg.class,
+ .argument(VisorNodeEventsCollectorTaskArg.class,
"null", "null", "null", "taskName", "null"));
info("VisorNodeEventsCollectorTask result: " + ret);
@@ -1536,7 +1540,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
"</beans>";
ret = content(new VisorGatewayArgument(VisorCacheStartTask.class)
- .argument(VisorCacheStartTask.VisorCacheStartArg.class, false, "person2",
+ .argument(VisorCacheStartArg.class, false, "person2",
URLEncoder.encode(START_CACHE, CHARSET)));
info("VisorCacheStartTask result: " + ret);
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
new file mode 100644
index 0000000..d38c74f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayInputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Base class for data transfer objects.
+ */
+abstract public class VisorDataTransferObject implements Externalizable {
+ /** */
+ public static int FIRST_VER = 1;
+
+ /** Object version */
+ protected int ver = FIRST_VER;
+
+ /**
+ * Save object's specific data content.
+ *
+ * @param out Output object to write data content.
+ * @throws IOException
+ */
+ protected abstract void writeExternalData(ObjectOutput out) throws IOException;
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(ver);
+
+ GridByteArrayOutputStream bos = new GridByteArrayOutputStream();
+
+ try(ObjectOutputStream oos = new ObjectOutputStream(bos)) {
+ writeExternalData(oos);
+
+ oos.flush();
+
+ U.writeByteArray(out, bos.internalArray(), bos.size());
+ }
+ }
+
+ /**
+ * Load object's specific data content.
+ *
+ * @param in Input object to load data content.
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ protected abstract void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException;
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ ver = in.readInt();
+
+ byte[] buf = U.readByteArray(in);
+
+ GridByteArrayInputStream bis = new GridByteArrayInputStream(buf);
+
+ try(ObjectInputStream ois = new ObjectInputStream(bis)) {
+ readExternalData(ois);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
index ece1a17..563a236 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
@@ -69,9 +69,9 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
start = U.currentTimeMillis();
- debug = arg.debug();
+ debug = arg.isDebug();
- taskArg = arg.argument();
+ taskArg = arg.getArgument();
if (debug)
logStart(ignite.log(), getClass(), start);
@@ -88,7 +88,7 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
* @throws IgniteException If mapping could not complete successfully.
*/
protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode> subgrid, VisorTaskArgument<A> arg) {
- Collection<UUID> nodeIds = arg.nodes();
+ Collection<UUID> nodeIds = arg.getNodes();
Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
index e4880a8..e992875 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor;
import java.util.List;
import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.util.typedef.F;
import org.jetbrains.annotations.Nullable;
/**
@@ -30,11 +29,11 @@ public abstract class VisorOneNodeTask<A, R> extends VisorMultiNodeTask<A, R, R>
@Nullable @Override protected R reduce0(List<ComputeJobResult> results) {
assert results.size() == 1;
- ComputeJobResult res = F.first(results);
+ ComputeJobResult res = results.get(0);
if (res.getException() == null)
return res.getData();
throw res.getException();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
index 255bd75..f7b3314 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
@@ -17,26 +17,37 @@
package org.apache.ignite.internal.visor;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Visor tasks argument.
*/
-public class VisorTaskArgument<A> implements Serializable {
+public class VisorTaskArgument<A> extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Node IDs task should be mapped to. */
- private final Collection<UUID> nodes;
+ private Collection<UUID> nodes;
/** Task argument. */
- private final A arg;
+ private A arg;
/** Debug flag. */
- private final boolean debug;
+ private boolean debug;
+
+ /**
+ * Default constructor.
+ */
+ public VisorTaskArgument() {
+ // No-op.
+ }
/**
* Create Visor task argument.
@@ -88,21 +99,40 @@ public class VisorTaskArgument<A> implements Serializable {
/**
* @return Node IDs task should be mapped to.
*/
- public Collection<UUID> nodes() {
+ public Collection<UUID> getNodes() {
return nodes;
}
/**
* @return Task argument.
*/
- public A argument() {
+ public A getArgument() {
return arg;
}
/**
* @return Debug flag.
*/
- public boolean debug() {
+ public boolean isDebug() {
return debug;
}
-}
\ No newline at end of file
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, nodes);
+ out.writeObject(arg);
+ out.writeBoolean(debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ nodes = U.readCollection(in);
+ arg = (A)in.readObject();
+ debug = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorTaskArgument.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskResultWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskResultWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskResultWrapper.java
new file mode 100644
index 0000000..ec1e865
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskResultWrapper.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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 org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+
+/**
+ * Task result wrapper that could return result or error.
+ */
+public interface VisorTaskResultWrapper<T> {
+ /**
+ * @return Exception on query execution.
+ */
+ public Throwable getError();
+
+ /**
+ * @return Task result.
+ */
+ public T getResult();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
new file mode 100644
index 0000000..b8cacea
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary object metadata to show in Visor.
+ */
+public class VisorBinaryMetadata extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Type name */
+ private String typeName;
+
+ /** Type Id */
+ private Integer typeId;
+
+ /** Affinity key field name. */
+ private String affinityKeyFieldName;
+
+ /** Filed list */
+ private Collection<VisorBinaryMetadataField> fields;
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadata() {
+ // No-op.
+ }
+
+ /**
+ * @param binary Binary objects.
+ * @return List of data transfer objects for binary objects metadata.
+ */
+ public static Collection<VisorBinaryMetadata> list(IgniteBinary binary) {
+ if (binary == null)
+ return new ArrayList<>(0);
+
+ Collection<BinaryType> metas = binary.types();
+
+ Collection<VisorBinaryMetadata> res = new ArrayList<>(metas.size());
+
+ for (BinaryType meta : metas) {
+ VisorBinaryMetadata m = new VisorBinaryMetadata();
+
+ m.typeName = meta.typeName();
+ m.typeId = binary.typeId(meta.typeName());
+ m.affinityKeyFieldName = meta.affinityKeyFieldName();
+
+ Collection<String> metaFields = meta.fieldNames();
+
+ m.fields = new ArrayList<>(metaFields.size());
+
+ for (String metaField : metaFields)
+ m.fields.add(new VisorBinaryMetadataField(metaField, meta.fieldTypeName(metaField), null));
+
+ res.add(m);
+ }
+
+ return res;
+ }
+
+ /**
+ * @return Type name.
+ */
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
+ * @return Type Id.
+ */
+ public Integer getTypeId() {
+ return typeId;
+ }
+
+ /**
+ * @return Fields list.
+ */
+ public Collection<VisorBinaryMetadataField> getFields() {
+ return fields;
+ }
+
+ /**
+ * @return Affinity key field name.
+ */
+ @Nullable public String getAffinityKeyFieldName() {
+ return affinityKeyFieldName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, typeName);
+ out.writeObject(typeId);
+ U.writeString(out, affinityKeyFieldName);
+ U.writeCollection(out, fields);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ typeName = U.readString(in);
+ typeId = (Integer)in.readObject();
+ affinityKeyFieldName = U.readString(in);
+ fields = U.readCollection(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryMetadata.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
new file mode 100644
index 0000000..06732ff
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.binary;
+
+import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.marshaller.Marshaller;
+
+/**
+ * Task that collects binary metadata.
+ */
+@GridInternal
+public class VisorBinaryMetadataCollectorTask extends VisorOneNodeTask<Long, VisorBinaryMetadataCollectorTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorPortableCollectMetadataJob job(Long lastUpdate) {
+ return new VisorPortableCollectMetadataJob(lastUpdate, debug);
+ }
+
+ /** Job that collect portables metadata on node. */
+ private static class VisorPortableCollectMetadataJob extends VisorJob<Long, VisorBinaryMetadataCollectorTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with given argument.
+ *
+ * @param lastUpdate Time data was collected last time.
+ * @param debug Debug flag.
+ */
+ private VisorPortableCollectMetadataJob(Long lastUpdate, boolean debug) {
+ super(lastUpdate, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorBinaryMetadataCollectorTaskResult run(Long lastUpdate) {
+ Marshaller marsh = ignite.configuration().getMarshaller();
+
+ IgniteBinary binary = marsh == null || marsh instanceof BinaryMarshaller ? ignite.binary() : null;
+
+ return new VisorBinaryMetadataCollectorTaskResult(0L, VisorBinaryMetadata.list(binary));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorPortableCollectMetadataJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
new file mode 100644
index 0000000..5092987
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.Collection;
+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}
+ */
+@SuppressWarnings("PublicInnerClass")
+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 Collection<VisorBinaryMetadata> binary;
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadataCollectorTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param lastUpdate Last binary metadata update date.
+ * @param binary Remote data center IDs for which full state transfer was requested.
+ */
+ public VisorBinaryMetadataCollectorTaskResult(Long lastUpdate, Collection<VisorBinaryMetadata> binary) {
+ this.lastUpdate = lastUpdate;
+ this.binary = binary;
+ }
+
+ /**
+ * @return Last binary metadata update date.
+ */
+ public Long getLastUpdate() {
+ return lastUpdate;
+ }
+
+ /**
+ * @return Remote data center IDs for which full state transfer was requested.
+ */
+ public Collection<VisorBinaryMetadata> getBinary() {
+ return binary;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(lastUpdate);
+ U.writeCollection(out, binary);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ lastUpdate = in.readLong();
+ binary = U.readCollection(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryMetadataCollectorTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
new file mode 100644
index 0000000..2d0e4dc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary object metadata field information.
+ */
+public class VisorBinaryMetadataField extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Field name. */
+ private String fieldName;
+
+ /** Field type name. */
+ private String fieldTypeName;
+
+ /** Field id. */
+ private Integer fieldId;
+
+ /**
+ * Default constructor.
+ */
+ public VisorBinaryMetadataField() {
+ // No-op.
+ }
+
+ /**
+ * @param fieldName Field name.
+ * @param fieldTypeName Field type name.
+ * @param fieldId Field id.
+ */
+ public VisorBinaryMetadataField(String fieldName, String fieldTypeName, Integer fieldId) {
+ this.fieldName = fieldName;
+ this.fieldTypeName = fieldTypeName;
+ this.fieldId = fieldId;
+ }
+
+ /**
+ * @return Field name.
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * @return Field type name.
+ */
+ @Nullable public String getFieldTypeName() {
+ return fieldTypeName;
+ }
+
+ /**
+ * @return Field id.
+ */
+ public Integer getFieldId() {
+ return fieldId;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, fieldName);
+ U.writeString(out, fieldTypeName);
+ out.writeObject(fieldId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ fieldName = U.readString(in);
+ fieldTypeName = U.readString(in);
+ fieldId = (Integer)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorBinaryMetadataField.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index ec6a350..4d8820c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -17,30 +17,34 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
-import java.util.Iterator;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.cache.GridCacheSwapManager;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
/**
* Data transfer object for {@link IgniteCache}.
*/
-public class VisorCache implements Serializable, LessNamingBean {
+public class VisorCache extends VisorDataTransferObject {
+ /** */
+ private static final CachePeekMode[] PEEK_NO_NEAR =
+ new CachePeekMode[] {CachePeekMode.PRIMARY, CachePeekMode.BACKUP};
+
/** */
private static final long serialVersionUID = 0L;
@@ -63,88 +67,61 @@ public class VisorCache implements Serializable, LessNamingBean {
private long indexesSize;
/** Number of all entries in cache. */
- private int size;
+ private long size;
/** Number of all entries in near cache. */
private int nearSize;
- /** Number of all entries in DHT cache. */
- private int dhtSize;
-
/** Number of primary entries in cache. */
- private int primarySize;
-
- /** Memory size allocated in off-heap. */
- private long offHeapAllocatedSize;
-
- /** Number of cache entries stored in off-heap memory. */
- private long offHeapEntriesCnt;
+ private long primarySize;
- /** Size in bytes for swap space. */
- private long swapSize;
+ /** Number of backup entries in cache. */
+ private long backupSize;
- /** Number of cache entries stored in swap space. */
- private long swapKeys;
+ /** Number of cache entries stored in heap memory. */
+ private long onHeapEntriesCnt;
/** Number of partitions. */
private int partitions;
- /**
- * Flag indicating that cache has near cache.
- */
- private boolean near;
-
- /** Number of primary entries in offheap. */
- private int offHeapPrimaryEntriesCnt;
-
- /** Number of backup entries in offheap. */
- private int offHeapBackupEntriesCnt;
-
- /** Number of primary entries in swap. */
- private int swapPrimaryEntriesCnt;
-
- /** Number of backup entries in swap. */
- private int swapBackupEntriesCnt;
-
/** Cache metrics. */
private VisorCacheMetrics metrics;
/** Cache partitions states. */
- private GridDhtPartitionMap partitionsMap;
+ private VisorPartitionMap parts;
+
+ /** Flag indicating that cache has near cache. */
+ private boolean near;
+
+ /**
+ * Create data transfer object for given cache.
+ */
+ public VisorCache() {
+ // No-op.
+ }
/**
- * @param ignite Grid.
- * @param cacheName Cache name.
+ * Create data transfer object for given cache.
+ *
+ * @param ca Internal cache.
* @param sample Sample size.
- * @return Data transfer object for given cache.
* @throws IgniteCheckedException If failed to create data transfer object.
*/
- public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
- assert ignite != null;
-
- GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
+ public VisorCache(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
+ assert ca != null;
- // Cache was not started.
- if (ca == null || !ca.context().started())
- return null;
+ name = ca.name();
- name = cacheName;
- try {
- swapSize = ca.swapSize();
- swapKeys = ca.swapKeys();
- }
- catch (IgniteCheckedException ignored) {
- swapSize = -1;
- swapKeys = -1;
- }
+ // Cache was not started.
+ GridCacheContext cctx = ca.context();
CacheConfiguration cfg = ca.configuration();
mode = cfg.getCacheMode();
boolean partitioned = (mode == CacheMode.PARTITIONED || mode == CacheMode.REPLICATED)
- && ca.context().affinityNode();
+ && cctx.affinityNode();
if (partitioned) {
GridDhtCacheAdapter dca = null;
@@ -158,43 +135,32 @@ public class VisorCache implements Serializable, LessNamingBean {
GridDhtPartitionTopology top = dca.topology();
if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0)
- partitionsMap = top.localPartitionMap();
+ parts = new VisorPartitionMap(top.localPartitionMap());
}
}
- size = ca.size();
+ dynamicDeploymentId = cctx.dynamicDeploymentId();
+ size = ca.localSizeLong(PEEK_NO_NEAR);
+ primarySize = ca.primarySizeLong();
+ backupSize = size - primarySize; // This is backup size.
nearSize = ca.nearSize();
- dynamicDeploymentId = ca.context().dynamicDeploymentId();
- dhtSize = size - nearSize;
- primarySize = ca.primarySize();
- offHeapAllocatedSize = ca.offHeapAllocatedSize();
- offHeapEntriesCnt = ca.offHeapEntriesCount();
+ onHeapEntriesCnt = 0; // TODO GG-11148 Need to rename on ON-heap entries count, see
partitions = ca.affinity().partitions();
- metrics = new VisorCacheMetrics().from(ignite, cacheName);
- near = ca.context().isNear();
-
- GridCacheSwapManager swap = ca.context().swap();
-
- offHeapPrimaryEntriesCnt = swap.offheapEntriesCount(true, false, AffinityTopologyVersion.NONE);
- offHeapBackupEntriesCnt = swap.offheapEntriesCount(false, true, AffinityTopologyVersion.NONE);
-
- swapPrimaryEntriesCnt = swap.swapEntriesCount(true, false, AffinityTopologyVersion.NONE);
- swapBackupEntriesCnt = swap.swapEntriesCount(false, true, AffinityTopologyVersion.NONE);
+ metrics = new VisorCacheMetrics(ignite, ca.name()); // TODO: GG-11683 Move to separate thing
+ near = cctx.isNear();
estimateMemorySize(ignite, ca, sample);
-
- return this;
}
/**
* Estimate memory size used by cache.
*
- * @param ignite Ignite.
* @param ca Cache adapter.
* @param sample Sample size.
* @throws IgniteCheckedException If estimation failed.
*/
protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
+ /* TODO Fix after GG-11739 implemented.
int size = ca.size();
Iterable<GridCacheEntryEx> set = ca.context().isNear()
@@ -219,51 +185,36 @@ public class VisorCache implements Serializable, LessNamingBean {
memSz = (long)((double)memSz / cnt * size);
memorySize = memSz;
- }
-
- /**
- * Fill values that should be stored in history;
- *
- * @param c Source cache.
- * @return Cache.
- */
- protected VisorCache initHistory(VisorCache c) {
- if (c != null) {
- c.name = name;
- c.mode = mode;
- c.memorySize = memorySize;
- c.indexesSize = indexesSize;
- c.size = size;
- c.nearSize = nearSize;
- c.dhtSize = dhtSize;
- c.primarySize = primarySize;
- c.offHeapAllocatedSize = offHeapAllocatedSize;
- c.offHeapEntriesCnt = offHeapEntriesCnt;
- c.swapSize = swapSize;
- c.swapKeys = swapKeys;
- c.partitions = partitions;
- c.metrics = metrics;
- c.near = near;
- c.offHeapPrimaryEntriesCnt = offHeapPrimaryEntriesCnt;
- c.offHeapBackupEntriesCnt = offHeapBackupEntriesCnt;
- c.swapPrimaryEntriesCnt = swapPrimaryEntriesCnt;
- c.swapBackupEntriesCnt = swapBackupEntriesCnt;
- }
-
- return c;
+ */
+ memorySize = 0;
}
/**
* @return New instance suitable to store in history.
*/
public VisorCache history() {
- return initHistory(new VisorCache());
+ VisorCache c = new VisorCache();
+
+ c.name = name;
+ c.mode = mode;
+ c.memorySize = memorySize;
+ c.indexesSize = indexesSize;
+ c.size = size;
+ c.nearSize = nearSize;
+ c.backupSize = backupSize;
+ c.primarySize = primarySize;
+ c.onHeapEntriesCnt = onHeapEntriesCnt;
+ c.partitions = partitions;
+ c.metrics = metrics;
+ c.near = near;
+
+ return c;
}
/**
* @return Cache name.
*/
- public String name() {
+ public String getName() {
return name;
}
@@ -272,148 +223,135 @@ public class VisorCache implements Serializable, LessNamingBean {
*
* @param name New cache name.
*/
- public void name(String name) {
+ public void setName(String name) {
this.name = name;
}
/**
* @return Dynamic deployment ID.
*/
- public IgniteUuid dynamicDeploymentId() {
+ public IgniteUuid getDynamicDeploymentId() {
return dynamicDeploymentId;
}
/**
* @return Cache mode.
*/
- public CacheMode mode() {
+ public CacheMode getMode() {
return mode;
}
/**
* @return Cache size in bytes.
*/
- public long memorySize() {
+ public long getMemorySize() {
return memorySize;
}
/**
* @return Indexes size in bytes.
*/
- public long indexesSize() {
+ public long getIndexesSize() {
return indexesSize;
}
/**
* @return Number of all entries in cache.
*/
- public int size() {
+ public long getSize() {
return size;
}
/**
* @return Number of all entries in near cache.
*/
- public int nearSize() {
+ public int getNearSize() {
return nearSize;
}
/**
- * @return Number of all entries in DHT cache.
+ * @return Number of backup entries in cache.
*/
- public int dhtSize() {
- return dhtSize;
+ public long getBackupSize() {
+ return backupSize;
}
/**
* @return Number of primary entries in cache.
*/
- public int primarySize() {
+ public long getPrimarySize() {
return primarySize;
}
/**
- * @return Memory size allocated in off-heap.
- */
- public long offHeapAllocatedSize() {
- return offHeapAllocatedSize;
- }
-
- /**
- * @return Number of cache entries stored in off-heap memory.
+ * @return Number of cache entries stored in heap memory.
*/
- public long offHeapEntriesCount() {
- return offHeapEntriesCnt;
- }
-
- /**
- * @return Size in bytes for swap space.
- */
- public long swapSize() {
- return swapSize;
- }
-
- /**
- * @return Number of cache entries stored in swap space.
- */
- public long swapKeys() {
- return swapKeys;
+ public long getOnHeapEntriesCount() {
+ return onHeapEntriesCnt;
}
/**
* @return Number of partitions.
*/
- public int partitions() {
+ public int getPartitions() {
return partitions;
}
/**
- * @return {@code true} if cache has near cache.
- */
- public boolean near() {
- return near;
- }
-
- /**
- * @return Off-heap heap primary entries count.
- */
- public int offHeapPrimaryEntriesCount() {
- return offHeapPrimaryEntriesCnt;
- }
-
- /**
- * @return Off-heap heap backup entries count.
+ * @return Cache metrics.
*/
- public int offHeapBackupEntriesCount() {
- return offHeapBackupEntriesCnt;
+ public VisorCacheMetrics getMetrics() {
+ return metrics;
}
/**
- * @return Swap primary entries count.
+ * @return Cache partitions states.
*/
- public int swapPrimaryEntriesCount() {
- return swapPrimaryEntriesCnt;
+ @Nullable public VisorPartitionMap getPartitionMap() {
+ return parts;
}
/**
- * @return Swap backup entries count.
+ * @return {@code true} if cache has near cache.
*/
- public int swapBackupEntriesCount() {
- return swapBackupEntriesCnt;
+ public boolean isNear() {
+ return near;
}
- /**
- * @return Cache metrics.
- */
- public VisorCacheMetrics metrics() {
- return metrics;
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ U.writeGridUuid(out, dynamicDeploymentId);
+ U.writeEnum(out, mode);
+ out.writeLong(memorySize);
+ out.writeLong(indexesSize);
+ out.writeLong(size);
+ out.writeInt(nearSize);
+ out.writeLong(primarySize);
+ out.writeLong(backupSize);
+ out.writeLong(onHeapEntriesCnt);
+ out.writeInt(partitions);
+ out.writeBoolean(near);
+ out.writeObject(metrics);
+ out.writeObject(parts);
}
- /**
- * @return Cache partitions states.
- */
- @Nullable public GridDhtPartitionMap partitionMap() {
- return partitionsMap;
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ dynamicDeploymentId = U.readGridUuid(in);
+ mode = CacheMode.fromOrdinal(in.readByte());
+ memorySize = in.readLong();
+ indexesSize = in.readLong();
+ size = in.readLong();
+ nearSize = in.readInt();
+ primarySize = in.readLong();
+ backupSize = in.readLong();
+ onHeapEntriesCnt = in.readLong();
+ partitions = in.readInt();
+ near = in.readBoolean();
+ metrics = (VisorCacheMetrics)in.readObject();
+ parts = (VisorPartitionMap)in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
index 371a514..8fca272 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
@@ -17,20 +17,25 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import org.apache.ignite.cache.affinity.AffinityFunction;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.internal.util.IgniteUtils.findNonPublicMethod;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
/**
* Data transfer object for affinity configuration properties.
*/
-public class VisorCacheAffinityConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheAffinityConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -40,74 +45,98 @@ public class VisorCacheAffinityConfiguration implements Serializable, LessNaming
/** Cache affinity mapper. */
private String mapper;
- /** Count of key backups. */
+ /** Number of backup nodes for one partition. */
private int partitionedBackups;
- /** Cache affinity partitions. */
+ /** Total partition count. */
private Integer partitions;
/** Cache partitioned affinity exclude neighbors. */
- private Boolean excludeNeighbors;
+ private Boolean exclNeighbors;
/**
+ * Default constructor
+ */
+ public VisorCacheAffinityConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for affinity configuration properties.
+ *
* @param ccfg Cache configuration.
- * @return Data transfer object for affinity configuration properties.
*/
- public static VisorCacheAffinityConfiguration from(CacheConfiguration ccfg) {
+ public VisorCacheAffinityConfiguration(CacheConfiguration ccfg) {
AffinityFunction aff = ccfg.getAffinity();
- Boolean excludeNeighbors = null;
+ function = compactClass(aff);
+ mapper = compactClass(ccfg.getAffinityMapper());
+ partitions = aff.partitions();
+ partitionedBackups = ccfg.getBackups();
- if (aff instanceof RendezvousAffinityFunction) {
- RendezvousAffinityFunction hashAffFunc = (RendezvousAffinityFunction)aff;
+ Method mthd = findNonPublicMethod(aff.getClass(), "isExcludeNeighbors");
- excludeNeighbors = hashAffFunc.isExcludeNeighbors();
+ if (mthd != null) {
+ try {
+ exclNeighbors = (Boolean)mthd.invoke(aff);
+ }
+ catch (InvocationTargetException | IllegalAccessException ignored) {
+ // No-op.
+ }
}
-
- VisorCacheAffinityConfiguration cfg = new VisorCacheAffinityConfiguration();
-
- cfg.function = compactClass(aff);
- cfg.mapper = compactClass(ccfg.getAffinityMapper());
- cfg.partitions = aff.partitions();
- cfg.partitionedBackups = ccfg.getBackups();
- cfg.excludeNeighbors = excludeNeighbors;
-
- return cfg;
}
/**
* @return Cache affinity.
*/
- public String function() {
+ public String getFunction() {
return function;
}
/**
* @return Cache affinity mapper.
*/
- public String mapper() {
+ public String getMapper() {
return mapper;
}
/**
- * @return Count of key backups.
+ * @return Number of backup nodes for one partition.
*/
- public int partitionedBackups() {
+ public int getPartitionedBackups() {
return partitionedBackups;
}
/**
- * @return Cache affinity partitions.
+ * @return Total partition count.
*/
- public Integer partitions() {
+ public Integer getPartitions() {
return partitions;
}
/**
* @return Cache partitioned affinity exclude neighbors.
*/
- @Nullable public Boolean excludeNeighbors() {
- return excludeNeighbors;
+ @Nullable public Boolean isExcludeNeighbors() {
+ return exclNeighbors;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, function);
+ U.writeString(out, mapper);
+ out.writeInt(partitionedBackups);
+ out.writeObject(partitions);
+ out.writeObject(exclNeighbors);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ function = U.readString(in);
+ mapper = U.readString(in);
+ partitionedBackups = in.readInt();
+ partitions = (Integer)in.readObject();
+ exclNeighbors = (Boolean)in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
index 83d421a..4bf4f61 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
@@ -31,17 +31,17 @@ import org.jetbrains.annotations.Nullable;
* Task that will find affinity node for key.
*/
@GridInternal
-public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<IgniteBiTuple<String, Object>, UUID> {
+public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<VisorCacheAffinityNodeTaskArg, UUID> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorCacheAffinityNodeJob job(IgniteBiTuple<String, Object> arg) {
+ @Override protected VisorCacheAffinityNodeJob job(VisorCacheAffinityNodeTaskArg arg) {
return new VisorCacheAffinityNodeJob(arg, debug);
}
/** Job that will find affinity node for key. */
- private static class VisorCacheAffinityNodeJob extends VisorJob<IgniteBiTuple<String, Object>, UUID> {
+ private static class VisorCacheAffinityNodeJob extends VisorJob<VisorCacheAffinityNodeTaskArg, UUID> {
/** */
private static final long serialVersionUID = 0L;
@@ -49,15 +49,15 @@ public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<IgniteBiTuple<S
* @param arg Cache name and key to find affinity node.
* @param debug Debug flag.
*/
- private VisorCacheAffinityNodeJob(IgniteBiTuple<String, Object> arg, boolean debug) {
+ private VisorCacheAffinityNodeJob(VisorCacheAffinityNodeTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected UUID run(@Nullable IgniteBiTuple<String, Object> arg) throws IgniteException {
+ @Override protected UUID run(@Nullable VisorCacheAffinityNodeTaskArg arg) throws IgniteException {
assert arg != null;
- ClusterNode node = ignite.affinity(arg.getKey()).mapKeyToNode(arg.getValue());
+ ClusterNode node = ignite.affinity(arg.getCacheName()).mapKeyToNode(arg.getKey());
return node != null ? node.id() : null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..83bfe1e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.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 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ cacheName = U.readString(in);
+ key = in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheAffinityNodeTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index 586fa87..1a6f73b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -17,19 +17,22 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.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.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for aggregated cache metrics.
*/
-public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean {
+public class VisorCacheAggregatedMetrics extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -43,7 +46,7 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
private boolean sys;
/** Node IDs with cache metrics. */
- private final Map<UUID, VisorCacheMetrics> metrics = new HashMap<>();
+ private Map<UUID, VisorCacheMetrics> metrics = new HashMap<>();
/** Minimum number of elements in heap. */
private transient Long minHeapSize;
@@ -118,54 +121,56 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
private transient Integer failsQry;
/**
+ * Default constructor.
+ */
+ public VisorCacheAggregatedMetrics() {
+ // No-op.
+ }
+
+ /**
* Create data transfer object for aggregated cache metrics.
*
* @param cm Source cache metrics.
- * @return Data transfer object for aggregated cache metrics.
*/
- public static VisorCacheAggregatedMetrics from(VisorCacheMetrics cm) {
- VisorCacheAggregatedMetrics acm = new VisorCacheAggregatedMetrics();
-
- acm.name = cm.name();
- acm.mode = cm.mode();
- acm.sys = cm.system();
-
- return acm;
+ public VisorCacheAggregatedMetrics(VisorCacheMetrics cm) {
+ name = cm.getName();
+ mode = cm.getMode();
+ sys = cm.isSystem();
}
/**
* @return Cache name.
*/
- public String name() {
+ public String getName() {
return name;
}
/** @return Cache mode. */
- public CacheMode mode() {
+ public CacheMode getMode() {
return mode;
}
/** @return Cache system state. */
- public boolean system() {
+ public boolean isSystem() {
return sys;
}
/**
* @return Nodes.
*/
- public Collection<UUID> nodes() {
+ public Collection<UUID> getNodes() {
return metrics.keySet();
}
/**
* @return Minimum number of elements in heap.
*/
- public long minimumHeapSize() {
+ public long getMinimumHeapSize() {
if (minHeapSize == null) {
minHeapSize = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minHeapSize = Math.min(minHeapSize, metric.keySize());
+ minHeapSize = Math.min(minHeapSize, metric.getKeySize());
}
return minHeapSize;
@@ -174,12 +179,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average number of elements in heap.
*/
- public double averageHeapSize() {
+ public double getAverageHeapSize() {
if (avgHeapSize == null) {
avgHeapSize = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgHeapSize += metric.keySize();
+ avgHeapSize += metric.getKeySize();
avgHeapSize /= metrics.size();
}
@@ -190,12 +195,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum number of elements in heap.
*/
- public long maximumHeapSize() {
+ public long getMaximumHeapSize() {
if (maxHeapSize == null) {
maxHeapSize = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxHeapSize = Math.max(maxHeapSize, metric.keySize());
+ maxHeapSize = Math.max(maxHeapSize, metric.getKeySize());
}
return maxHeapSize;
@@ -205,19 +210,19 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
* @param metric Metrics to process.
* @return Off heap entries count.
*/
- private long offHeapEntriesCount(VisorCacheMetrics metric) {
+ private long getOffHeapEntriesCount(VisorCacheMetrics metric) {
return metric.offHeapEntriesCount();
}
/**
* @return Minimum number of elements in off heap.
*/
- public long minimumOffHeapSize() {
+ public long getMinimumOffHeapSize() {
if (minOffHeapSize == null) {
minOffHeapSize = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minOffHeapSize = Math.min(minOffHeapSize, offHeapEntriesCount(metric));
+ minOffHeapSize = Math.min(minOffHeapSize, getOffHeapEntriesCount(metric));
}
return minOffHeapSize;
@@ -226,12 +231,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average number of elements in off heap.
*/
- public double averageOffHeapSize() {
+ public double getAverageOffHeapSize() {
if (avgOffHeapSize == null) {
avgOffHeapSize = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgOffHeapSize += offHeapEntriesCount(metric);
+ avgOffHeapSize += getOffHeapEntriesCount(metric);
avgOffHeapSize /= metrics.size();
}
@@ -242,12 +247,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum number of elements in off heap in the cache.
*/
- public long maximumOffHeapSize() {
+ public long getMaximumOffHeapSize() {
if (maxOffHeapSize == null) {
maxOffHeapSize = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxOffHeapSize = Math.max(maxOffHeapSize, offHeapEntriesCount(metric));
+ maxOffHeapSize = Math.max(maxOffHeapSize, getOffHeapEntriesCount(metric));
}
return maxOffHeapSize;
@@ -256,12 +261,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Minimum hits of the owning cache.
*/
- public long minimumHits() {
+ public long getMinimumHits() {
if (minHits == null) {
minHits = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minHits = Math.min(minHits, metric.hits());
+ minHits = Math.min(minHits, metric.getHits());
}
return minHits;
@@ -270,12 +275,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average hits of the owning cache.
*/
- public double averageHits() {
+ public double getAverageHits() {
if (avgHits == null) {
avgHits = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgHits += metric.hits();
+ avgHits += metric.getHits();
avgHits /= metrics.size();
}
@@ -286,12 +291,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum hits of the owning cache.
*/
- public long maximumHits() {
+ public long getMaximumHits() {
if (maxHits == null) {
maxHits = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxHits = Math.max(maxHits, metric.hits());
+ maxHits = Math.max(maxHits, metric.getHits());
}
return maxHits;
@@ -300,12 +305,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Minimum misses of the owning cache.
*/
- public long minimumMisses() {
+ public long getMinimumMisses() {
if (minMisses == null) {
minMisses = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minMisses = Math.min(minMisses, metric.misses());
+ minMisses = Math.min(minMisses, metric.getMisses());
}
return minMisses;
@@ -314,12 +319,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average misses of the owning cache.
*/
- public double averageMisses() {
+ public double getAverageMisses() {
if (avgMisses == null) {
avgMisses = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgMisses += metric.misses();
+ avgMisses += metric.getMisses();
avgMisses /= metrics.size();
}
@@ -330,12 +335,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum misses of the owning cache.
*/
- public long maximumMisses() {
+ public long getMaximumMisses() {
if (maxMisses == null) {
maxMisses = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxMisses = Math.max(maxMisses, metric.misses());
+ maxMisses = Math.max(maxMisses, metric.getMisses());
}
return maxMisses;
@@ -344,12 +349,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Minimum total number of reads of the owning cache.
*/
- public long minimumReads() {
+ public long getMinimumReads() {
if (minReads == null) {
minReads = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minReads = Math.min(minReads, metric.reads());
+ minReads = Math.min(minReads, metric.getReads());
}
return minReads;
@@ -358,12 +363,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average total number of reads of the owning cache.
*/
- public double averageReads() {
+ public double getAverageReads() {
if (avgReads == null) {
avgReads = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgReads += metric.reads();
+ avgReads += metric.getReads();
avgReads /= metrics.size();
}
@@ -374,12 +379,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum total number of reads of the owning cache.
*/
- public long maximumReads() {
+ public long getMaximumReads() {
if (maxReads == null) {
maxReads = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxReads = Math.max(maxReads, metric.reads());
+ maxReads = Math.max(maxReads, metric.getReads());
}
return maxReads;
@@ -388,12 +393,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Minimum total number of writes of the owning cache.
*/
- public long minimumWrites() {
+ public long getMinimumWrites() {
if (minWrites == null) {
minWrites = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minWrites = Math.min(minWrites, metric.writes());
+ minWrites = Math.min(minWrites, metric.getWrites());
}
return minWrites;
@@ -402,12 +407,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average total number of writes of the owning cache.
*/
- public double averageWrites() {
+ public double getAverageWrites() {
if (avgWrites == null) {
avgWrites = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgWrites += metric.writes();
+ avgWrites += metric.getWrites();
avgWrites /= metrics.size();
}
@@ -418,12 +423,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum total number of writes of the owning cache.
*/
- public long maximumWrites() {
+ public long getMaximumWrites() {
if (maxWrites == null) {
maxWrites = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxWrites = Math.max(maxWrites, metric.writes());
+ maxWrites = Math.max(maxWrites, metric.getWrites());
}
return maxWrites;
@@ -432,12 +437,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Minimum execution time of query.
*/
- public long minimumQueryTime() {
+ public long getMinimumQueryTime() {
if (minQryTime == null) {
minQryTime = Long.MAX_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- minQryTime = Math.min(minQryTime, metric.queryMetrics().minimumTime());
+ minQryTime = Math.min(minQryTime, metric.getQueryMetrics().getMinimumTime());
}
return minQryTime;
@@ -446,12 +451,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Average execution time of query.
*/
- public double averageQueryTime() {
+ public double getAverageQueryTime() {
if (avgQryTime == null) {
avgQryTime = 0.0d;
for (VisorCacheMetrics metric : metrics.values())
- avgQryTime += metric.queryMetrics().averageTime();
+ avgQryTime += metric.getQueryMetrics().getAverageTime();
avgQryTime /= metrics.size();
}
@@ -462,12 +467,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Maximum execution time of query.
*/
- public long maximumQueryTime() {
+ public long getMaximumQueryTime() {
if (maxQryTime == null) {
maxQryTime = Long.MIN_VALUE;
for (VisorCacheMetrics metric : metrics.values())
- maxQryTime = Math.max(maxQryTime, metric.queryMetrics().maximumTime());
+ maxQryTime = Math.max(maxQryTime, metric.getQueryMetrics().getMaximumTime());
}
return maxQryTime;
@@ -476,9 +481,9 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Total execution time of query.
*/
- public long totalQueryTime() {
+ public long getTotalQueryTime() {
if (totalQryTime == null)
- totalQryTime = (long)(averageQueryTime() * execsQuery());
+ totalQryTime = (long)(getAverageQueryTime() * getQueryExecutions());
return totalQryTime;
}
@@ -486,12 +491,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Number of executions.
*/
- public int execsQuery() {
+ public int getQueryExecutions() {
if (execsQry == null) {
execsQry = 0;
for (VisorCacheMetrics metric : metrics.values())
- execsQry += metric.queryMetrics().executions();
+ execsQry += metric.getQueryMetrics().getExecutions();
}
return execsQry;
@@ -500,25 +505,89 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
/**
* @return Total number of times a query execution failed.
*/
- public int failsQuery() {
+ public int getQueryFailures() {
if (failsQry == null) {
failsQry = 0;
for (VisorCacheMetrics metric : metrics.values())
- failsQry += metric.queryMetrics().fails();
+ failsQry += metric.getQueryMetrics().getFailures();
}
return failsQry;
}
/**
- * @return Node IDs with cache metrics.
+ * @return Map of Node IDs to cache metrics.
*/
- public Map<UUID, VisorCacheMetrics> metrics() {
+ public Map<UUID, VisorCacheMetrics> getMetrics() {
return metrics;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ U.writeEnum(out, 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ mode = CacheMode.fromOrdinal(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);
}
[6/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
index d1a0cdf..12b7870 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
@@ -17,20 +17,27 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collection;
+import java.util.List;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClasses;
/**
* Data transfer object for cache query configuration data.
*/
-public class VisorCacheQueryConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheQueryConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** */
- private String[] sqlFuncClss;
+ private Collection<String> sqlFuncClss;
/** */
private long longQryWarnTimeout;
@@ -39,7 +46,7 @@ public class VisorCacheQueryConfiguration implements Serializable, LessNamingBea
private boolean sqlEscapeAll;
/** */
- private String[] indexedTypes;
+ private List<String> indexedTypes;
/** */
private int sqlOnheapRowCacheSize;
@@ -48,76 +55,90 @@ public class VisorCacheQueryConfiguration implements Serializable, LessNamingBea
private String sqlSchema;
/**
- * @return Schema name, which is used by SQL engine for SQL statements generation.
- */
- public String sqlSchema() {
- return sqlSchema;
- }
-
- /**
- * @param clss Classes to compact.
+ * Default constructor.
*/
- private static String[] compactClasses(Class<?>[] clss) {
- if (clss == null)
- return null;
-
- int len = clss.length;
-
- String[] res = new String[len];
-
- for (int i = 0; i < len; i++)
- res[i] = U.compact(clss[i].getName());
-
- return res;
+ public VisorCacheQueryConfiguration() {
+ // No-op.
}
/**
+ * Create data transfer object with cache query configuration data.
+ *
* @param ccfg Cache configuration.
- * @return Fill data transfer object with cache query configuration data.
*/
- public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) {
+ public VisorCacheQueryConfiguration(CacheConfiguration ccfg) {
sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses());
longQryWarnTimeout = ccfg.getLongQueryWarningTimeout();
sqlEscapeAll = ccfg.isSqlEscapeAll();
indexedTypes = compactClasses(ccfg.getIndexedTypes());
sqlOnheapRowCacheSize = ccfg.getSqlOnheapRowCacheSize();
sqlSchema = ccfg.getSqlSchema();
-
- return this;
}
/**
* @return Classes names with SQL functions.
*/
- public String[] sqlFunctionClasses() {
+ public Collection<String> getSqlFunctionClasses() {
return sqlFuncClss;
}
/**
* @return Timeout in milliseconds after which long query warning will be printed.
*/
- public long longQueryWarningTimeout() {
+ public long getLongQueryWarningTimeout() {
return longQryWarnTimeout;
}
/**
* @return {@code true} if SQL engine generate SQL statements with escaped names.
*/
- public boolean sqlEscapeAll() {
+ public boolean isSqlEscapeAll() {
return sqlEscapeAll;
}
/**
* @return Array of key and value classes names to be indexed.
*/
- public String[] indexedTypes() {
+ public List<String> getIndexedTypes() {
return indexedTypes;
}
/**
* @return Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
*/
- public int sqlOnheapRowCacheSize() {
+ public int getSqlOnheapRowCacheSize() {
return sqlOnheapRowCacheSize;
}
+
+ /**
+ * @return Schema name, which is used by SQL engine for SQL statements generation.
+ */
+ public String getSqlSchema() {
+ return sqlSchema;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, sqlFuncClss);
+ out.writeLong(longQryWarnTimeout);
+ out.writeBoolean(sqlEscapeAll);
+ U.writeCollection(out, indexedTypes);
+ out.writeInt(sqlOnheapRowCacheSize);
+ U.writeString(out, sqlSchema);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ sqlFuncClss = U.readCollection(in);
+ longQryWarnTimeout = in.readLong();
+ sqlEscapeAll = in.readBoolean();
+ indexedTypes = U.readList(in);
+ sqlOnheapRowCacheSize = in.readInt();
+ sqlSchema = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheQueryConfiguration.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
index dc46906..edcb13d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
@@ -17,14 +17,18 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+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 VisorCacheQueryDetailMetrics implements Serializable {
+public class VisorCacheQueryDetailMetrics extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -62,10 +66,16 @@ public class VisorCacheQueryDetailMetrics implements Serializable {
private long lastStartTime;
/**
+ * Default constructor
+ */
+ public VisorCacheQueryDetailMetrics() {
+ // No-op.
+ }
+
+ /**
* @param m Cache query metrics.
- * @return Data transfer object for given cache metrics.
*/
- public VisorCacheQueryDetailMetrics from(QueryDetailMetrics m) {
+ public VisorCacheQueryDetailMetrics(QueryDetailMetrics m) {
qryType = m.queryType();
qry = m.query();
cache = m.cache();
@@ -79,8 +89,6 @@ public class VisorCacheQueryDetailMetrics implements Serializable {
avgTime = m.averageTime();
totalTime = m.totalTime();
lastStartTime = m.lastStartTime();
-
- return this;
}
/**
@@ -161,6 +169,36 @@ public class VisorCacheQueryDetailMetrics implements Serializable {
}
/** {@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(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(VisorCacheQueryDetailMetrics.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
index aee5063..3326e0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
@@ -71,8 +71,8 @@ public class VisorCacheQueryDetailMetricsCollectorTask extends VisorMultiNodeTas
Collection<VisorCacheQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
- for (GridCacheQueryDetailMetricsAdapter m : aggMetrics)
- res.add(new VisorCacheQueryDetailMetrics().from(m));
+ for (GridCacheQueryDetailMetricsAdapter m: aggMetrics)
+ res.add(new VisorCacheQueryDetailMetrics(m));
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
index a3d77e5..eab8419 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
@@ -17,15 +17,17 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.cache.query.QueryMetrics;
-import org.apache.ignite.internal.LessNamingBean;
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 VisorCacheQueryMetrics implements Serializable, LessNamingBean {
+public class VisorCacheQueryMetrics extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -45,57 +47,78 @@ public class VisorCacheQueryMetrics implements Serializable, LessNamingBean {
private int fails;
/**
- * @param m Cache query metrics.
- * @return Data transfer object for given cache metrics.
+ * Default constructor.
*/
- public static VisorCacheQueryMetrics from(QueryMetrics m) {
- VisorCacheQueryMetrics qm = new VisorCacheQueryMetrics();
-
- qm.minTime = m.minimumTime();
- qm.maxTime = m.maximumTime();
- qm.avgTime = m.averageTime();
- qm.execs = m.executions();
- qm.fails = m.fails();
+ public VisorCacheQueryMetrics() {
+ // No-op.
+ }
- return qm;
+ /**
+ * Create data transfer object for given cache metrics.
+ * @param m Cache query metrics.
+ */
+ public VisorCacheQueryMetrics(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 minimumTime() {
+ public long getMinimumTime() {
return minTime;
}
/**
* @return Maximum execution time of query.
*/
- public long maximumTime() {
+ public long getMaximumTime() {
return maxTime;
}
/**
* @return Average execution time of query.
*/
- public double averageTime() {
+ public double getAverageTime() {
return avgTime;
}
/**
* @return Number of executions.
*/
- public int executions() {
+ public int getExecutions() {
return execs;
}
/**
* @return Total number of times a query execution failed.
*/
- public int fails() {
+ 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(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(VisorCacheQueryMetrics.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
index 4c28d00..9fd0e13 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
@@ -17,25 +17,25 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for cache rebalance configuration properties.
*/
-public class VisorCacheRebalanceConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheRebalanceConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Cache rebalance mode. */
private CacheRebalanceMode mode;
- /** Rebalance thread pool size. */
- private int threadPoolSize;
-
/** Cache rebalance batch size. */
private int batchSize;
@@ -49,65 +49,78 @@ public class VisorCacheRebalanceConfiguration implements Serializable, LessNamin
private long timeout;
/**
- * @param ccfg Cache configuration.
- * @return Data transfer object for rebalance configuration properties.
+ * Default constructor.
*/
- public static VisorCacheRebalanceConfiguration from(CacheConfiguration ccfg) {
- VisorCacheRebalanceConfiguration cfg = new VisorCacheRebalanceConfiguration();
-
- cfg.mode = ccfg.getRebalanceMode();
- cfg.batchSize = ccfg.getRebalanceBatchSize();
- cfg.threadPoolSize = ccfg.getRebalanceThreadPoolSize();
- cfg.partitionedDelay = ccfg.getRebalanceDelay();
- cfg.throttle = ccfg.getRebalanceThrottle();
- cfg.timeout = ccfg.getRebalanceTimeout();
-
- return cfg;
+ public VisorCacheRebalanceConfiguration() {
+ // No-op.
}
/**
- * @return Cache rebalance mode.
+ * Create data transfer object for rebalance configuration properties.
+ * @param ccfg Cache configuration.
*/
- public CacheRebalanceMode mode() {
- return mode;
+ public VisorCacheRebalanceConfiguration(CacheConfiguration ccfg) {
+ mode = ccfg.getRebalanceMode();
+ batchSize = ccfg.getRebalanceBatchSize();
+ partitionedDelay = ccfg.getRebalanceDelay();
+ throttle = ccfg.getRebalanceThrottle();
+ timeout = ccfg.getRebalanceTimeout();
}
/**
- * @return Rebalance thread pool size.
+ * @return Cache rebalance mode.
*/
- public int threadPoolSize() {
- return threadPoolSize;
+ public CacheRebalanceMode getMode() {
+ return mode;
}
/**
* @return Cache rebalance batch size.
*/
- public int batchSize() {
+ public int getBatchSize() {
return batchSize;
}
/**
* @return Rebalance partitioned delay.
*/
- public long partitionedDelay() {
+ public long getPartitionedDelay() {
return partitionedDelay;
}
/**
* @return Time in milliseconds to wait between rebalance messages.
*/
- public long throttle() {
+ public long getThrottle() {
return throttle;
}
/**
* @return Rebalance timeout.
*/
- public long timeout() {
+ public long getTimeout() {
return timeout;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeEnum(out, mode);
+ out.writeInt(batchSize);
+ out.writeLong(partitionedDelay);
+ out.writeLong(throttle);
+ out.writeLong(timeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ mode = CacheRebalanceMode.fromOrdinal(in.readByte());
+ batchSize = in.readInt();
+ partitionedDelay = in.readLong();
+ throttle = in.readLong();
+ timeout = in.readLong();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheRebalanceConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..e1a7fb1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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 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 Collection<String> fields;
+
+ /** */
+ private Collection<String> 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 = meta.fields();
+ descendings = meta.descendings();
+ unique = meta.unique();
+ }
+
+ /**
+ * @return Index name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Indexed fields names.
+ */
+ public Collection<String> getFields() {
+ return fields;
+ }
+
+ /**
+ * @return Descendings.
+ */
+ public Collection<String> 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ fields = U.readCollection(in);
+ descendings = U.readCollection(in);
+ unique = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheSqlIndexMetadata.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..6089b51
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.Map;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+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 Collection<String> types;
+
+ /** */
+ private Map<String, String> keyClasses;
+
+ /** */
+ private Map<String, String> valClasses;
+
+ /** */
+ private Map<String, Map<String, String>> fields;
+
+ /** */
+ private Map<String, Collection<VisorCacheSqlIndexMetadata>> indexes;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheSqlMetadata() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object.
+ *
+ * @param meta Cache SQL metadata.
+ */
+ public VisorCacheSqlMetadata(GridCacheSqlMetadata meta) {
+ cacheName = meta.cacheName();
+ types = meta.types();
+ keyClasses = meta.keyClasses();
+ valClasses = meta.valClasses();
+ fields = meta.fields();
+ indexes = new HashMap<>();
+
+ Map<String, Collection<GridCacheSqlIndexMetadata>> src = meta.indexes();
+
+ if (src != null) {
+ for (Map.Entry<String, Collection<GridCacheSqlIndexMetadata>> entry: src.entrySet()) {
+ Collection<GridCacheSqlIndexMetadata> idxs = entry.getValue();
+
+ Collection<VisorCacheSqlIndexMetadata> 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 Collection<String> getTypes() {
+ return types;
+ }
+
+ /**
+ * @return Key classes.
+ */
+ public Map<String, String> getKeyClasses() {
+ return keyClasses;
+ }
+
+ /**
+ * @return Value classes.
+ */
+ public Map<String, String> getValueClasses() {
+ return valClasses;
+ }
+
+ /**
+ * @return Fields.
+ */
+ public Map<String, Map<String, String>> getFields() {
+ return fields;
+ }
+
+ /**
+ * @return Indexes.
+ */
+ public Map<String, Collection<VisorCacheSqlIndexMetadata>> getIndexes() {
+ return indexes;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, cacheName);
+ U.writeCollection(out, types);
+ IgfsUtils.writeStringMap(out, keyClasses);
+ IgfsUtils.writeStringMap(out, valClasses);
+ U.writeMap(out, fields);
+ U.writeMap(out, indexes);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ cacheName = U.readString(in);
+ types = U.readCollection(in);
+ keyClasses = IgfsUtils.readStringMap(in);
+ valClasses = IgfsUtils.readStringMap(in);
+ fields = U.readMap(in);
+ indexes = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheSqlMetadata.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
new file mode 100644
index 0000000..9690264
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.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.
+ */
+@SuppressWarnings("PublicInnerClass")
+public class VisorCacheStartArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private boolean near;
+
+ /** */
+ private String name;
+
+ /** */
+ private String cfg;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheStartArg() {
+ // No-op.
+ }
+
+ /**
+ * @param near {@code true} if near cache should be started.
+ * @param name Name for near cache.
+ * @param cfg Cache XML configuration.
+ */
+ public VisorCacheStartArg(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(ObjectInput in) throws IOException, ClassNotFoundException {
+ near = in.readBoolean();
+ name = U.readString(in);
+ cfg = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheStartArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
----------------------------------------------------------------------
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
index 758f39a..af51a38 100644
--- 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
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor.cache;
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -41,8 +40,7 @@ import org.jetbrains.annotations.Nullable;
* Task that start cache or near cache with specified configuration.
*/
@GridInternal
-public class VisorCacheStartTask extends
- VisorMultiNodeTask<VisorCacheStartTask.VisorCacheStartArg, Map<UUID, IgniteException>, Void> {
+public class VisorCacheStartTask extends VisorMultiNodeTask<VisorCacheStartArg, Map<UUID, IgniteException>, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -63,56 +61,6 @@ public class VisorCacheStartTask extends
}
/**
- * Cache start arguments.
- */
- @SuppressWarnings("PublicInnerClass")
- public static class VisorCacheStartArg implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private final boolean near;
-
- /** */
- private final String name;
-
- /** */
- private final String cfg;
-
- /**
- * @param near {@code true} if near cache should be started.
- * @param name Name for near cache.
- * @param cfg Cache XML configuration.
- */
- public VisorCacheStartArg(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 near() {
- return near;
- }
-
- /**
- * @return Name for near cache.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Cache XML configuration.
- */
- public String configuration() {
- return cfg;
- }
- }
-
- /**
* Job that start cache or near cache with specified configuration.
*/
private static class VisorCacheStartJob extends VisorJob<VisorCacheStartArg, Void> {
@@ -131,15 +79,15 @@ public class VisorCacheStartTask extends
/** {@inheritDoc} */
@Override protected Void run(VisorCacheStartArg arg) throws IgniteException {
- String cfg = arg.configuration();
+ String cfg = arg.getConfiguration();
assert !F.isEmpty(cfg);
try (ByteArrayInputStream bais = new ByteArrayInputStream(cfg.getBytes())) {
- if (arg.near) {
+ if (arg.isNear()) {
NearCacheConfiguration nearCfg = Ignition.loadSpringBean(bais, "nearCacheConfiguration");
- ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.name()), nearCfg);
+ ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.getName()), nearCfg);
}
else {
CacheConfiguration cacheCfg = Ignition.loadSpringBean(bais, "cacheConfiguration");
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
index fd3d980..520fcb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
@@ -17,14 +17,17 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
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;
@@ -32,7 +35,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
/**
* Data transfer object for cache store configuration properties.
*/
-public class VisorCacheStoreConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -70,11 +73,19 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
private boolean storeKeepBinary;
/**
+ * Default constructor.
+ */
+ public VisorCacheStoreConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for cache store configuration properties.
+ *
* @param ignite Ignite instance.
* @param ccfg Cache configuration.
- * @return Data transfer object for cache store configuration properties.
*/
- public VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
+ public VisorCacheStoreConfiguration(IgniteEx ignite, CacheConfiguration ccfg) {
IgniteCacheProxy<Object, Object> c = ignite.context().cache().jcache(ccfg.getName());
CacheStore cstore = c != null && c.context().started() ? c.context().store().configuredStore() : null;
@@ -94,95 +105,123 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();
storeKeepBinary = ccfg.isStoreKeepBinary();
-
- return this;
}
/**
* @return {@code true} if cache has store.
*/
- public boolean enabled() {
+ public boolean isEnabled() {
return store != null;
}
/**
* @return {@code true} if cache has JDBC store.
*/
- public boolean jdbcStore() {
+ public boolean isJdbcStore() {
return jdbcStore;
}
/**
* @return Cache store class name.
*/
- @Nullable public String store() {
+ @Nullable public String getStore() {
return store;
}
/**
* @return Cache store factory class name..
*/
- public String storeFactory() {
+ public String getStoreFactory() {
return storeFactory;
}
/**
* @return Whether cache should operate in read-through mode.
*/
- public boolean readThrough() {
+ public boolean isReadThrough() {
return readThrough;
}
/**
* @return Whether cache should operate in write-through mode.
*/
- public boolean writeThrough() {
+ public boolean isWriteThrough() {
return writeThrough;
}
/**
* @return Flag indicating whether write-behind behaviour should be used for the cache store.
*/
- public boolean writeBehindEnabled() {
+ public boolean isWriteBehindEnabled() {
return writeBehindEnabled;
}
/**
* @return Maximum batch size for write-behind cache store operations.
*/
- public int batchSize() {
+ public int getBatchSize() {
return batchSz;
}
/**
* @return Frequency with which write-behind cache is flushed to the cache store in milliseconds.
*/
- public long flushFrequency() {
+ public long getFlushFrequency() {
return flushFreq;
}
/**
* @return Maximum object count in write-behind cache.
*/
- public int flushSize() {
+ public int getFlushSize() {
return flushSz;
}
/**
* @return Number of threads that will perform cache flushing.
*/
- public int flushThreadCount() {
+ public int getFlushThreadCount() {
return flushThreadCnt;
}
/**
* @return Keep binary in store flag.
*/
- public boolean storeKeepBinary() {
+ public boolean isStoreKeepBinary() {
return storeKeepBinary;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(jdbcStore);
+ U.writeString(out, store);
+ U.writeString(out, storeFactory);
+ out.writeBoolean(readThrough);
+ out.writeBoolean(writeThrough);
+ out.writeBoolean(writeBehindEnabled);
+ out.writeInt(batchSz);
+ out.writeLong(flushFreq);
+ out.writeInt(flushSz);
+ out.writeInt(flushThreadCnt);
+ out.writeBoolean(storeKeepBinary);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ jdbcStore = in.readBoolean();
+ store = U.readString(in);
+ storeFactory = U.readString(in);
+ readThrough = in.readBoolean();
+ writeThrough = in.readBoolean();
+ writeBehindEnabled = in.readBoolean();
+ batchSz = in.readInt();
+ flushFreq = in.readLong();
+ flushSz = in.readInt();
+ flushThreadCnt = in.readInt();
+ storeKeepBinary = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheStoreConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
index c9bf960..65a59e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
@@ -17,14 +17,18 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
-import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for {@link JdbcTypeField}.
*/
-public class VisorCacheTypeFieldMetadata implements Serializable, LessNamingBean {
+public class VisorCacheTypeFieldMetadata extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -65,28 +69,49 @@ public class VisorCacheTypeFieldMetadata implements Serializable, LessNamingBean
/**
* @return Column name in database.
*/
- public String dbName() {
+ public String getDatabaseName() {
return dbName;
}
/**
* @return Column JDBC type in database.
*/
- public int dbType() {
+ public int getDatabaseType() {
return dbType;
}
/**
* @return Field name in java object.
*/
- public String javaName() {
+ public String getJavaName() {
return javaName;
}
/**
* @return Corresponding java type.
*/
- public String javaType() {
+ public String getJavaType() {
return javaType;
}
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, dbName);
+ out.writeInt(dbType);
+ U.writeString(out, javaName);
+ U.writeString(out, javaType);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ dbName = U.readString(in);
+ dbType = in.readInt();
+ javaName = U.readString(in);
+ javaType = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheTypeFieldMetadata.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
index 7463887..52e94c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
@@ -17,7 +17,9 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -28,10 +30,10 @@ import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
import org.apache.ignite.cache.store.jdbc.JdbcType;
import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
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.IgniteBiTuple;
import javax.cache.configuration.Factory;
@@ -39,7 +41,7 @@ import javax.cache.configuration.Factory;
/**
* Data transfer object for {@link JdbcType}.
*/
-public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
+public class VisorCacheTypeMetadata extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -56,31 +58,24 @@ public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
private String valType;
/** Key fields. */
- @GridToStringInclude
private Collection<VisorCacheTypeFieldMetadata> keyFields;
/** Value fields. */
- @GridToStringInclude
private Collection<VisorCacheTypeFieldMetadata> valFields;
/** Fields to be queried, in addition to indexed fields. */
- @GridToStringInclude
private Map<String, String> qryFlds;
/** Fields to index in ascending order. */
- @GridToStringInclude
private Map<String, String> ascFlds;
/** Fields to index in descending order. */
- @GridToStringInclude
private Map<String, String> descFlds;
/** Fields to index as text. */
- @GridToStringInclude
private Collection<String> txtFlds;
/** Fields to create group indexes for. */
- @GridToStringInclude
private Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps;
/**
@@ -97,7 +92,7 @@ public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
// Add query entries.
if (qryEntities != null)
for (QueryEntity qryEntity : qryEntities) {
- VisorCacheTypeMetadata meta = from(qryEntity);
+ VisorCacheTypeMetadata meta = new VisorCacheTypeMetadata(qryEntity);
metas.add(meta);
@@ -164,34 +159,40 @@ public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
}
/**
+ * Create data transfer object for given cache type metadata.
+ */
+ public VisorCacheTypeMetadata() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for given cache type metadata.
+ *
* @param q Actual cache query entities.
- * @return Data transfer object for given cache type metadata.
*/
- public static VisorCacheTypeMetadata from(QueryEntity q) {
+ public VisorCacheTypeMetadata(QueryEntity q) {
assert q != null;
- VisorCacheTypeMetadata metadata = new VisorCacheTypeMetadata();
-
- metadata.keyType = q.getKeyType();
- metadata.valType = q.getValueType();
+ keyType = q.getKeyType();
+ valType = q.getValueType();
- metadata.dbSchema = "";
- metadata.dbTbl = "";
+ dbSchema = "";
+ dbTbl = "";
- metadata.keyFields = Collections.emptyList();
- metadata.valFields = Collections.emptyList();
+ keyFields = Collections.emptyList();
+ valFields = Collections.emptyList();
LinkedHashMap<String, String> qryFields = q.getFields();
- metadata.qryFlds = new LinkedHashMap<>(qryFields);
+ qryFlds = new LinkedHashMap<>(qryFields);
- metadata.ascFlds = Collections.emptyMap();
- metadata.descFlds = Collections.emptyMap();
- metadata.txtFlds = Collections.emptyList();
+ ascFlds = Collections.emptyMap();
+ descFlds = Collections.emptyMap();
+ txtFlds = Collections.emptyList();
Collection<QueryIndex> qryIdxs = q.getIndexes();
- metadata.grps = new LinkedHashMap<>(qryIdxs.size());
+ grps = new LinkedHashMap<>(qryIdxs.size());
for (QueryIndex qryIdx : qryIdxs) {
LinkedHashMap<String, Boolean> qryIdxFlds = qryIdx.getFields();
@@ -204,90 +205,118 @@ public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
grpFlds.put(fldName, new IgniteBiTuple<>(qryFields.get(fldName), !qryIdxFld.getValue()));
}
- metadata.grps.put(qryIdx.getName(), grpFlds);
+ grps.put(qryIdx.getName(), grpFlds);
}
-
- return metadata;
}
/**
* @return Schema name in database.
*/
- public String dbSchema() {
+ public String getDatabaseSchema() {
return dbSchema;
}
/**
* @return Table name in database.
*/
- public String dbTbl() {
+ public String getDatabaseTable() {
return dbTbl;
}
/**
* @return Key class used to store key in cache.
*/
- public String keyType() {
+ public String getKeyType() {
return keyType;
}
/**
* @return Value class used to store value in cache.
*/
- public String valType() {
+ public String getValueType() {
return valType;
}
/**
* @return Key fields.
*/
- public Collection<VisorCacheTypeFieldMetadata> keyFields() {
+ public Collection<VisorCacheTypeFieldMetadata> getKeyFields() {
return keyFields;
}
/**
* @return Value fields.
*/
- public Collection<VisorCacheTypeFieldMetadata> valFields() {
+ public Collection<VisorCacheTypeFieldMetadata> getValueFields() {
return valFields;
}
/**
* @return Fields to be queried, in addition to indexed fields.
*/
- public Map<String, String> qryFlds() {
+ public Map<String, String> getQueryFields() {
return qryFlds;
}
/**
* @return Fields to index in ascending order.
*/
- public Map<String, String> ascFlds() {
+ public Map<String, String> getAscFields() {
return ascFlds;
}
/**
* @return Fields to index in descending order.
*/
- public Map<String, String> descFlds() {
+ public Map<String, String> getDescFields() {
return descFlds;
}
/**
* @return Fields to index as text.
*/
- public Collection<String> txtFlds() {
+ public Collection<String> getTextFields() {
return txtFlds;
}
/**
* @return Fields to create group indexes for.
*/
- public Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps() {
+ public Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> getGroups() {
return grps;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, dbSchema);
+ U.writeString(out, dbTbl);
+ U.writeString(out, keyType);
+ U.writeString(out, valType);
+ U.writeCollection(out, keyFields);
+ U.writeCollection(out, valFields);
+ IgfsUtils.writeStringMap(out, qryFlds);
+ IgfsUtils.writeStringMap(out, ascFlds);
+ IgfsUtils.writeStringMap(out, descFlds);
+ U.writeCollection(out, txtFlds);
+ U.writeMap(out, grps);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ dbSchema = U.readString(in);
+ dbTbl = U.readString(in);
+ keyType = U.readString(in);
+ valType = U.readString(in);
+ keyFields = U.readCollection(in);
+ valFields = U.readCollection(in);
+ qryFlds = IgfsUtils.readStringMap(in);
+ ascFlds = IgfsUtils.readStringMap(in);
+ descFlds = IgfsUtils.readStringMap(in);
+ txtFlds = U.readCollection(in);
+ grps = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheTypeMetadata.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..6264c21
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+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<Integer, GridDhtPartitionState> parts;
+
+ /**
+ * Default constructor.
+ */
+ public VisorPartitionMap() {
+ // No-op.
+ }
+
+ /**
+ * @param map Partitions map.
+ */
+ public VisorPartitionMap(GridDhtPartitionMap map) {
+ parts = map.map();
+ }
+
+ /**
+ * @return Partitions map.
+ */
+ public Map<Integer, GridDhtPartitionState> 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 {
+ U.writeIntKeyMap(out, parts);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ parts = U.readIntKeyMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorPartitionMap.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java
----------------------------------------------------------------------
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
index ae66d4b..1604143 100644
--- 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
@@ -26,7 +26,6 @@ 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.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder.COMPUTE_MONITORING_HOLDER_KEY;
@@ -38,7 +37,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.checkExplicit
*/
@GridInternal
public class VisorComputeToggleMonitoringTask extends
- VisorMultiNodeTask<IgniteBiTuple<String, Boolean>, Boolean, Boolean> {
+ VisorMultiNodeTask<VisorComputeToggleMonitoringTaskArg, Boolean, Boolean> {
/** */
private static final long serialVersionUID = 0L;
@@ -54,14 +53,14 @@ public class VisorComputeToggleMonitoringTask extends
}
/** {@inheritDoc} */
- @Override protected VisorComputeToggleMonitoringJob job(IgniteBiTuple<String, Boolean> arg) {
+ @Override protected VisorComputeToggleMonitoringJob job(VisorComputeToggleMonitoringTaskArg arg) {
return new VisorComputeToggleMonitoringJob(arg, debug);
}
/**
* Job to toggle task monitoring on node.
*/
- private static class VisorComputeToggleMonitoringJob extends VisorJob<IgniteBiTuple<String, Boolean>, Boolean> {
+ private static class VisorComputeToggleMonitoringJob extends VisorJob<VisorComputeToggleMonitoringTaskArg, Boolean> {
/** */
private static final long serialVersionUID = 0L;
@@ -69,12 +68,12 @@ public class VisorComputeToggleMonitoringTask extends
* @param arg Visor ID key and monitoring state flag.
* @param debug Debug flag.
*/
- private VisorComputeToggleMonitoringJob(IgniteBiTuple<String, Boolean> arg, boolean debug) {
+ private VisorComputeToggleMonitoringJob(VisorComputeToggleMonitoringTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Boolean run(IgniteBiTuple<String, Boolean> arg) {
+ @Override protected Boolean run(VisorComputeToggleMonitoringTaskArg arg) {
if (checkExplicitTaskMonitoring(ignite))
return true;
else {
@@ -91,9 +90,9 @@ public class VisorComputeToggleMonitoringTask extends
holder = holderOld == null ? holderNew : holderOld;
}
- String visorKey = arg.get1();
+ String visorKey = arg.getVisorKey();
- boolean state = arg.get2();
+ boolean state = arg.isEnabled();
// Set task monitoring state.
if (state)
@@ -111,4 +110,4 @@ public class VisorComputeToggleMonitoringTask extends
return S.toString(VisorComputeToggleMonitoringJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..ecc63be
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.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.
+ */
+@SuppressWarnings("PublicInnerClass")
+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(ObjectInput in) throws IOException, ClassNotFoundException {
+ visorKey = U.readString(in);
+ enabled = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorComputeToggleMonitoringTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
index 8f42eb2..1113ca1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
@@ -102,6 +102,9 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
/** */
private static final long serialVersionUID = 0L;
+ /** */
+ private static final byte[] ZERO_BYTES = new byte[0];
+
/** Auto-injected grid instance. */
@IgniteInstanceResource
protected transient IgniteEx ignite;
@@ -181,7 +184,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
if (entries != null) {
for (String entry : entries.split(";")) {
- if (entry.length() > 0) {
+ if (!entry.isEmpty()) {
String[] values = entry.split("=");
assert values.length >= 1;
@@ -220,7 +223,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
* @return Object constructed from string.
*/
@Nullable private Object toSimpleObject(Class cls, String val) {
- if (val == null || val.equals("null"))
+ if (val == null || "null".equals(val))
return null;
if (String.class == cls)
@@ -268,8 +271,8 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
if (byte[].class == cls) {
String[] els = val.split(";");
- if (els.length == 0 || (els.length == 1 && els[0].length() == 0))
- return new byte[0];
+ if (els.length == 0 || (els.length == 1 && els[0].isEmpty()))
+ return ZERO_BYTES;
byte[] res = new byte[els.length];
@@ -294,7 +297,6 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
}
/** {@inheritDoc} */
- @SuppressWarnings("unchecked")
@Override public Object execute() throws IgniteException {
if (fut != null)
return fut.get();
@@ -348,7 +350,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
final Collection<UUID> nids;
- if (nidsArg == null || nidsArg.equals("null") || nidsArg.equals("")) {
+ if (nidsArg == null || "null".equals(nidsArg) || nidsArg.isEmpty()) {
Collection<ClusterNode> nodes = ignite.cluster().nodes();
nids = new ArrayList<>(nodes.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java
----------------------------------------------------------------------
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
index 68cfdb3..9c6aa60 100644
--- 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
@@ -24,13 +24,12 @@ 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 org.apache.ignite.lang.IgniteBiTuple;
/**
* Creates thread dump.
*/
@GridInternal
-public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<VisorThreadInfo[], long[]>> {
+public class VisorThreadDumpTask extends VisorOneNodeTask<Void, VisorThreadDumpTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -42,7 +41,7 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
/**
* Job that take thread dump on node.
*/
- private static class VisorDumpThreadJob extends VisorJob<Void, IgniteBiTuple<VisorThreadInfo[], long[]>> {
+ private static class VisorDumpThreadJob extends VisorJob<Void, VisorThreadDumpTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -55,7 +54,7 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<VisorThreadInfo[], long[]> run(Void arg) {
+ @Override protected VisorThreadDumpTaskResult run(Void arg) {
ThreadMXBean mx = U.getThreadMx();
ThreadInfo[] info = mx.dumpAllThreads(true, true);
@@ -63,9 +62,9 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
VisorThreadInfo[] visorInfo = new VisorThreadInfo[info.length];
for (int i = 0; i < info.length; i++)
- visorInfo[i] = VisorThreadInfo.from(info[i]);
+ visorInfo[i] = new VisorThreadInfo(info[i]);
- return new IgniteBiTuple<>(visorInfo, mx.findDeadlockedThreads());
+ return new VisorThreadDumpTaskResult(visorInfo, mx.findDeadlockedThreads());
}
/** {@inheritDoc} */
@@ -73,4 +72,4 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
return S.toString(VisorDumpThreadJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..8b0276a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ threadInfo = (VisorThreadInfo[])in.readObject();
+ deadlockedThreads = (long[])in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorThreadDumpTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
----------------------------------------------------------------------
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
index d656ad1..c2fffdb 100644
--- 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
@@ -17,14 +17,21 @@
package org.apache.ignite.internal.visor.debug;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.lang.management.ThreadInfo;
-import org.apache.ignite.internal.LessNamingBean;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+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 implements Serializable, LessNamingBean {
+public class VisorThreadInfo extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -32,239 +39,256 @@ public class VisorThreadInfo implements Serializable, LessNamingBean {
private static final int MAX_FRAMES = 8;
/** Thread name. */
- private final String name;
+ private String name;
/** Thread ID. */
- private final Long id;
+ private Long id;
/** Thread state. */
- private final Thread.State state;
+ private Thread.State state;
/** Lock information. */
- private final VisorThreadLockInfo lock;
+ private VisorThreadLockInfo lock;
/** Lock name. */
- private final String lockName;
+ private String lockName;
/** Lock owner thread ID. */
- private final Long lockOwnerId;
+ private Long lockOwnerId;
/** Lock owner name. */
- private final String lockOwnerName;
+ private String lockOwnerName;
/** Thread executing native code. */
- private final Boolean inNative;
+ private Boolean inNative;
/** Thread is suspended. */
- private final Boolean suspended;
+ private Boolean suspended;
/** Waited count. */
- private final Long waitedCnt;
+ private Long waitedCnt;
/** Waited time. */
- private final Long waitedTime;
+ private Long waitedTime;
/** Blocked count. */
- private final Long blockedCnt;
+ private Long blockedCnt;
/** Blocked time. */
- private final Long blockedTime;
+ private Long blockedTime;
/** Stack trace. */
- private final StackTraceElement[] stackTrace;
+ private List<StackTraceElement> stackTrace;
/** Locks info. */
- private final VisorThreadLockInfo[] locks;
+ private Collection<VisorThreadLockInfo> locks;
/** Locked monitors. */
- private final VisorThreadMonitorInfo[] lockedMonitors;
-
- /** Create thread info with given parameters. */
- public VisorThreadInfo(String name,
- Long id,
- Thread.State state,
- VisorThreadLockInfo lock,
- String lockName,
- Long lockOwnerId,
- String lockOwnerName,
- Boolean inNative,
- Boolean suspended,
- Long waitedCnt,
- Long waitedTime,
- Long blockedCnt,
- Long blockedTime,
- StackTraceElement[] stackTrace,
- VisorThreadLockInfo[] locks,
- VisorThreadMonitorInfo[] lockedMonitors
- ) {
- this.name = name;
- this.id = id;
- this.state = state;
- this.lock = lock;
- this.lockName = lockName;
- this.lockOwnerId = lockOwnerId;
- this.lockOwnerName = lockOwnerName;
- this.inNative = inNative;
- this.suspended = suspended;
- this.waitedCnt = waitedCnt;
- this.waitedTime = waitedTime;
- this.blockedCnt = blockedCnt;
- this.blockedTime = blockedTime;
- this.stackTrace = stackTrace;
- this.locks = locks;
- this.lockedMonitors = lockedMonitors;
+ private Collection<VisorThreadMonitorInfo> lockedMonitors;
+
+ /**
+ * Default constructor.
+ */
+ public VisorThreadInfo() {
+ // No-op.
}
- /** Create data transfer object for given thread info. */
- public static VisorThreadInfo from(ThreadInfo ti) {
+ /**
+ * Create data transfer object for given thread info.
+ *
+ * @param ti Thread info.
+ */
+ public VisorThreadInfo(ThreadInfo ti) {
assert ti != null;
- VisorThreadLockInfo[] linfos = ti.getLockedSynchronizers() != null ?
- new VisorThreadLockInfo[ti.getLockedSynchronizers().length] : 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<VisorThreadLockInfo>(ti.getLockedSynchronizers().length) : null;
if (ti.getLockedSynchronizers() != null)
for (int i = 0; i < ti.getLockedSynchronizers().length; i++)
- linfos[i] = VisorThreadLockInfo.from(ti.getLockedSynchronizers()[i]);
+ locks.add(new VisorThreadLockInfo(ti.getLockedSynchronizers()[i]));
- VisorThreadMonitorInfo[] minfos = ti.getLockedMonitors() != null ?
- new VisorThreadMonitorInfo[ti.getLockedMonitors().length] : null;
+ lockedMonitors = ti.getLockedMonitors() != null ?
+ new ArrayList<VisorThreadMonitorInfo>(ti.getLockedMonitors().length) : null;
if (ti.getLockedMonitors() != null)
for (int i = 0; i < ti.getLockedMonitors().length; i++)
- minfos[i] = VisorThreadMonitorInfo.from(ti.getLockedMonitors()[i]);
-
- return new VisorThreadInfo(ti.getThreadName(),
- ti.getThreadId(),
- ti.getThreadState(),
- ti.getLockInfo() != null ? VisorThreadLockInfo.from(ti.getLockInfo()) : null,
- ti.getLockName(),
- ti.getLockOwnerId(),
- ti.getLockOwnerName(),
- ti.isInNative(),
- ti.isSuspended(),
- ti.getWaitedCount(),
- ti.getWaitedTime(),
- ti.getBlockedCount(),
- ti.getBlockedTime(),
- ti.getStackTrace(),
- linfos,
- minfos
- );
+ lockedMonitors.add(new VisorThreadMonitorInfo(ti.getLockedMonitors()[i]));
}
/**
* @return Thread name.
*/
- public String name() {
+ public String getName() {
return name;
}
/**
* @return Thread ID.
*/
- public Long id() {
+ public Long getId() {
return id;
}
/**
* @return Thread state.
*/
- public Thread.State state() {
+ public Thread.State getState() {
return state;
}
/**
* @return Lock information.
*/
- public VisorThreadLockInfo lock() {
+ public VisorThreadLockInfo getLock() {
return lock;
}
/**
* @return Lock name.
*/
- public String lockName() {
+ public String getLockName() {
return lockName;
}
/**
* @return Lock owner thread ID.
*/
- public Long lockOwnerId() {
+ public Long getLockOwnerId() {
return lockOwnerId;
}
/**
* @return Lock owner name.
*/
- public String lockOwnerName() {
+ public String getLockOwnerName() {
return lockOwnerName;
}
/**
* @return Thread executing native code.
*/
- public Boolean inNative() {
+ public Boolean isInNative() {
return inNative;
}
/**
* @return Thread is suspended.
*/
- public Boolean suspended() {
+ public Boolean isSuspended() {
return suspended;
}
/**
* @return Waited count.
*/
- public Long waitedCount() {
+ public Long getWaitedCount() {
return waitedCnt;
}
/**
* @return Waited time.
*/
- public Long waitedTime() {
+ public Long getWaitedTime() {
return waitedTime;
}
/**
* @return Blocked count.
*/
- public Long blockedCount() {
+ public Long getBlockedCount() {
return blockedCnt;
}
/**
* @return Blocked time.
*/
- public Long blockedTime() {
+ public Long getBlockedTime() {
return blockedTime;
}
/**
* @return Stack trace.
*/
- public StackTraceElement[] stackTrace() {
+ public List<StackTraceElement> getStackTrace() {
return stackTrace;
}
/**
* @return Locks info.
*/
- public VisorThreadLockInfo[] locks() {
+ public Collection<VisorThreadLockInfo> getLocks() {
return locks;
}
/**
* @return Locked monitors.
*/
- public VisorThreadMonitorInfo[] lockedMonitors() {
+ public Collection<VisorThreadMonitorInfo> getLockedMonitors() {
return lockedMonitors;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ out.writeObject(id);
+ U.writeString(out, state.toString());
+ out.writeObject(lock);
+ U.writeString(out, lockName);
+ out.writeObject(lockOwnerId);
+ U.writeString(out, lockOwnerName);
+ out.writeObject(inNative);
+ out.writeObject(suspended);
+ out.writeObject(waitedCnt);
+ out.writeObject(waitedTime);
+ out.writeObject(blockedCnt);
+ out.writeObject(blockedTime);
+ U.writeCollection(out, stackTrace);
+ U.writeCollection(out, locks);
+ U.writeCollection(out, lockedMonitors);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ id = (Long)in.readObject();
+
+ String statePresentation = U.readString(in);
+
+ if (statePresentation != null)
+ state = Enum.valueOf(Thread.State.class, statePresentation);
+
+ lock = (VisorThreadLockInfo)in.readObject();
+ lockName = U.readString(in);
+ lockOwnerId = (Long)in.readObject();
+ lockOwnerName = U.readString(in);
+ inNative = (Boolean)in.readObject();
+ suspended = (Boolean)in.readObject();
+ waitedCnt = (Long)in.readObject();
+ waitedTime = (Long)in.readObject();
+ blockedCnt = (Long)in.readObject();
+ blockedTime = (Long)in.readObject();
+ stackTrace = U.readList(in);
+ locks = U.readCollection(in);
+ lockedMonitors = U.readCollection(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
StringBuilder sb = new StringBuilder("\"" + name + "\"" + " Id=" + id + " " + state);
@@ -282,10 +306,10 @@ public class VisorThreadInfo implements Serializable, LessNamingBean {
sb.append('\n');
- int maxFrames = Math.min(stackTrace.length, MAX_FRAMES);
+ int maxFrames = Math.min(stackTrace.size(), MAX_FRAMES);
for (int i = 0; i < maxFrames; i++) {
- StackTraceElement ste = stackTrace[i];
+ StackTraceElement ste = stackTrace.get(i);
sb.append("\tat ").append(ste.toString()).append('\n');
@@ -308,16 +332,16 @@ public class VisorThreadInfo implements Serializable, LessNamingBean {
}
for (VisorThreadMonitorInfo mi : lockedMonitors) {
- if (mi.stackDepth() == i)
+ if (mi.getStackDepth() == i)
sb.append("\t- locked ").append(mi).append('\n');
}
}
- if (maxFrames < stackTrace.length)
+ if (maxFrames < stackTrace.size())
sb.append("\t...").append('\n');
- if (locks.length > 0) {
- sb.append("\n\tNumber of locked synchronizers = ").append(locks.length).append('\n');
+ if (locks.size() > 0) {
+ sb.append("\n\tNumber of locked synchronizers = ").append(locks.size()).append('\n');
for (VisorThreadLockInfo li : locks)
sb.append("\t- ").append(li).append('\n');
[4/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..3953b5f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.
+ */
+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(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ enabled = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsSamplingStateTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java
----------------------------------------------------------------------
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
index 211a171..2f4a139 100644
--- 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
@@ -18,24 +18,35 @@
package org.apache.ignite.internal.visor.log;
import java.io.File;
-import java.io.Serializable;
+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 implements Serializable {
+public class VisorLogFile extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** File path. */
- private final String path;
+ private String path;
/** File size. */
- private final long size;
+ private long size;
/** File last modified timestamp. */
- private final long lastModified;
+ private long lastModified;
+
+ /**
+ * Default constructor.
+ */
+ public VisorLogFile() {
+ // No-op.
+ }
/**
* Create log file for given file.
@@ -62,26 +73,40 @@ public class VisorLogFile implements Serializable {
/**
* @return File path.
*/
- public String path() {
+ public String getPath() {
return path;
}
/**
* @return File size.
*/
- public long size() {
+ public long getSize() {
return size;
}
/**
* @return File last modified timestamp.
*/
- public long lastModified() {
+ 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(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);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
new file mode 100644
index 0000000..e1b1193
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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}.
+ */
+@SuppressWarnings("PublicInnerClass")
+public class VisorLogSearchArg 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 VisorLogSearchArg() {
+ // No-op.
+ }
+
+ /**
+ * @param searchStr Searched string.
+ * @param folder Folder.
+ * @param filePtrn File name search pattern.
+ * @param limit Max number of results.
+ */
+ public VisorLogSearchArg(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(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(VisorLogSearchArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
----------------------------------------------------------------------
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
index 35ace13..bb1a8fe 100644
--- 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
@@ -17,42 +17,54 @@
package org.apache.ignite.internal.visor.log;
-import java.io.Serializable;
+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.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Result for log search operation.
* Contains found line and several lines before and after, plus other info.
*/
-public class VisorLogSearchResult implements Serializable, LessNamingBean {
+public class VisorLogSearchResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Node ID. */
- private final UUID nid;
+ private UUID nid;
/** File path relative to the search folder. */
- private final String filePath;
+ private String filePath;
/** File size. */
- private final long fileSize;
+ private long fileSize;
/** Timestamp of last modification of the file. */
- private final long lastModified;
+ private long lastModified;
/** Lines of text including found line and several lines before and after. */
- private final String[] lines;
+ private List<String> lines;
/** Line number in the file, 1 based. */
- private final int lineNum;
+ private int lineNum;
/** Lines count in the file. */
- private final int lineCnt;
+ private int lineCnt;
/** File content encoding. */
- private final String encoding;
+ private String encoding;
+
+ /**
+ * Default constructor.
+ */
+ public VisorLogSearchResult() {
+ // No-op.
+ }
/**
* Create log search result with given parameters.
@@ -80,7 +92,7 @@ public class VisorLogSearchResult implements Serializable, LessNamingBean {
this.filePath = filePath;
this.fileSize = fileSize;
this.lastModified = lastModified;
- this.lines = lines;
+ this.lines = Arrays.asList(lines);
this.lineNum = lineNum;
this.lineCnt = lineCnt;
this.encoding = encoding;
@@ -89,64 +101,88 @@ public class VisorLogSearchResult implements Serializable, LessNamingBean {
/**
* @return Node ID.
*/
- public UUID nid() {
+ public UUID getNid() {
return nid;
}
/**
* @return File path relative to the search folder.
*/
- public String filePath() {
+ public String getFilePath() {
return filePath;
}
/**
* @return File size.
*/
- public long fileSize() {
+ public long getFileSize() {
return fileSize;
}
/**
* @return Timestamp of last modification of the file.
*/
- public long lastModified() {
+ public long getLastModified() {
return lastModified;
}
/**
* @return Lines of text including found line and several lines before and after.
*/
- public String[] lines() {
+ public List<String> getLines() {
return lines;
}
/**
* @return Line number in the file, 1 based.
*/
- public int lineNumber() {
+ public int getLineNumber() {
return lineNum;
}
/**
* @return Lines count in the file.
*/
- public int lineCount() {
+ public int getLineCount() {
return lineCnt;
}
/**
* @return File content encoding.
*/
- public String encoding() {
+ public String getEncoding() {
return encoding;
}
/**
* @return Found line.
*/
- public String line() {
- return lines[lines.length / 2];
+ 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(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} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
----------------------------------------------------------------------
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
index b6552b2..b8a7184 100644
--- 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
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.visor.log;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.Serializable;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
@@ -28,6 +27,7 @@ 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;
@@ -38,7 +38,6 @@ 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.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.decode;
@@ -49,8 +48,8 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.textFile;
* Search text matching in logs
*/
@GridInternal
-public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.VisorLogSearchArg,
- IgniteBiTuple<Iterable<IgniteBiTuple<Exception, UUID>>, Iterable<VisorLogSearchResult>>,
+public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchArg,
+ VisorLogSearchTaskResult,
Collection<VisorLogSearchResult>> {
/** */
private static final long serialVersionUID = 0L;
@@ -67,15 +66,14 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
}
/** {@inheritDoc} */
- @Nullable @Override protected IgniteBiTuple<Iterable<IgniteBiTuple<Exception, UUID>>,
- Iterable<VisorLogSearchResult>> reduce0(List<ComputeJobResult> results) {
+ @Nullable @Override protected VisorLogSearchTaskResult reduce0(List<ComputeJobResult> results) {
Collection<VisorLogSearchResult> searchRes = new ArrayList<>();
- Collection<IgniteBiTuple<Exception, UUID>> exRes = new ArrayList<>();
+ Map<Exception, UUID> exRes = U.newHashMap(0);
// Separate successfully executed results and exceptions.
for (ComputeJobResult result : results) {
if (result.getException() != null)
- exRes.add(new IgniteBiTuple<Exception, UUID>(result.getException(), result.getNode().id()));
+ exRes.put(result.getException(), result.getNode().id());
else if (result.getData() != null) {
Collection<VisorLogSearchResult> data = result.getData();
@@ -83,47 +81,7 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
}
}
- return new IgniteBiTuple<Iterable<IgniteBiTuple<Exception, UUID>>, Iterable<VisorLogSearchResult>>
- (exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes);
- }
-
- /**
- * Arguments for {@link VisorLogSearchTask}.
- */
- @SuppressWarnings("PublicInnerClass")
- public static class VisorLogSearchArg implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Searched string. */
- private final String searchStr;
-
- /** Folder. */
- private final String folder;
-
- /** File name search pattern. */
- private final String filePtrn;
-
- /** Max number of results. */
- private final int limit;
-
- /**
- * @param searchStr Searched string.
- * @param folder Folder.
- * @param filePtrn File name search pattern.
- * @param limit Max number of results.
- */
- public VisorLogSearchArg(String searchStr, String folder, String filePtrn, int limit) {
- this.searchStr = searchStr;
- this.folder = folder;
- this.filePtrn = filePtrn;
- this.limit = limit;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorLogSearchArg.class, this);
- }
+ return new VisorLogSearchTaskResult(exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes);
}
/**
@@ -216,15 +174,15 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
/** {@inheritDoc} */
@Override protected Collection<VisorLogSearchResult> run(VisorLogSearchArg arg) {
- URL url = U.resolveIgniteUrl(arg.folder);
+ URL url = U.resolveIgniteUrl(arg.getFolder());
if (url == null)
- throw new IgniteException(new FileNotFoundException("Log folder not found: " + arg.folder));
+ throw new IgniteException(new FileNotFoundException("Log folder not found: " + arg.getFolder()));
UUID uuid = ignite.localNode().id();
String nid = uuid.toString().toLowerCase();
- String filePtrn = arg.filePtrn.replace("@nid8", nid.substring(0, 8)).replace("@nid", nid);
+ String filePtrn = arg.getFilePattern().replace("@nid8", nid.substring(0, 8)).replace("@nid", nid);
try {
File fld = new File(url.toURI());
@@ -232,22 +190,22 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
List<VisorLogFile> matchingFiles = matchedFiles(fld, filePtrn);
- Collection<VisorLogSearchResult> results = new ArrayList<>(arg.limit);
+ Collection<VisorLogSearchResult> results = new ArrayList<>(arg.getLimit());
int resCnt = 0;
for (VisorLogFile logFile : matchingFiles) {
try {
- File f = new File(logFile.path());
+ File f = new File(logFile.getPath());
if (textFile(f, false)) {
Charset charset = decode(f);
- if (resCnt == arg.limit)
+ if (resCnt == arg.getLimit())
break;
List<GridTuple3<String[], Integer, Integer>> searched =
- searchInFile(f, charset, arg.searchStr, arg.limit - resCnt);
+ searchInFile(f, charset, arg.getSearchString(), arg.getLimit() - resCnt);
resCnt += searched.size();
@@ -276,4 +234,4 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
return S.toString(VisorLogSearchJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..65f0f62
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.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;
+
+/**
+ * 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<Exception, UUID> exceptions;
+
+ /** List of log search results. */
+ private Collection<VisorLogSearchResult> 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<Exception, UUID> exceptions, Collection<VisorLogSearchResult> results) {
+ this.exceptions = exceptions;
+ this.results = results;
+ }
+
+ /**
+ * @return List of exceptions by node ID.
+ */
+ public Map<Exception, UUID> getExceptions() {
+ return exceptions;
+ }
+
+ /**
+ * @return List of log search results.
+ */
+ public Collection<VisorLogSearchResult> 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ exceptions = U.readMap(in);
+ results = U.readCollection(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorLogSearchTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
----------------------------------------------------------------------
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
index a6d8c4c..c233b67 100644
--- 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
@@ -17,16 +17,19 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+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.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for configuration of atomic data structures.
*/
-public class VisorAtomicConfiguration implements Serializable, LessNamingBean {
+public class VisorAtomicConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -40,43 +43,59 @@ public class VisorAtomicConfiguration implements Serializable, LessNamingBean {
private int backups;
/**
+ * Default constructor.
+ */
+ public VisorAtomicConfiguration() {
+ // No-op.
+ }
+
+ /**
* Create data transfer object for atomic configuration.
*
* @param src Atomic configuration.
- * @return Data transfer object.
*/
- public static VisorAtomicConfiguration from(AtomicConfiguration src) {
- VisorAtomicConfiguration cfg = new VisorAtomicConfiguration();
-
- cfg.seqReserveSize = src.getAtomicSequenceReserveSize();
- cfg.cacheMode = src.getCacheMode();
- cfg.backups = src.getBackups();
-
- return cfg;
+ public VisorAtomicConfiguration(AtomicConfiguration src) {
+ seqReserveSize = src.getAtomicSequenceReserveSize();
+ cacheMode = src.getCacheMode();
+ backups = src.getBackups();
}
/**
* @return Atomic sequence reservation size.
*/
- public int atomicSequenceReserveSize() {
+ public int getAtomicSequenceReserveSize() {
return seqReserveSize;
}
/**
* @return Cache mode.
*/
- public CacheMode cacheMode() {
+ public CacheMode getCacheMode() {
return cacheMode;
}
/**
* @return Number of backup nodes.
*/
- public int backups() {
+ public int getBackups() {
return backups;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeInt(seqReserveSize);
+ U.writeEnum(out, cacheMode);
+ out.writeInt(backups);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ seqReserveSize = in.readInt();
+ cacheMode = CacheMode.fromOrdinal(in.readByte());
+ backups = in.readInt();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorAtomicConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
----------------------------------------------------------------------
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
index 0dae4da..3fde833 100644
--- 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
@@ -17,12 +17,16 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.UUID;
+import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
import static java.lang.System.getProperty;
@@ -38,17 +42,16 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_SUCCESS_FILE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.boolValue;
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 basic configuration properties.
*/
-public class VisorBasicConfiguration implements Serializable, LessNamingBean {
+public class VisorBasicConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
- /** Ignite instance name. */
- private String igniteInstanceName;
+ /** Grid name. */
+ private String gridName;
/** IGNITE_HOME determined at startup. */
private String ggHome;
@@ -63,7 +66,7 @@ public class VisorBasicConfiguration implements Serializable, LessNamingBean {
private String marsh;
/** Deployment Mode. */
- private Object deployMode;
+ private DeploymentMode deployMode;
/** Client mode flag. */
private Boolean clientMode;
@@ -111,186 +114,240 @@ public class VisorBasicConfiguration implements Serializable, LessNamingBean {
private boolean updateNtf;
/**
+ * Default constructor.
+ */
+ public VisorBasicConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for node basic configuration properties.
+ *
* @param ignite Grid.
* @param c Grid configuration.
- * @return Data transfer object for node basic configuration properties.
*/
- public static VisorBasicConfiguration from(IgniteEx ignite, IgniteConfiguration c) {
- VisorBasicConfiguration cfg = new VisorBasicConfiguration();
-
- cfg.igniteInstanceName = c.getIgniteInstanceName();
- cfg.ggHome = getProperty(IGNITE_HOME, c.getIgniteHome());
- cfg.locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost());
- cfg.nodeId = ignite.localNode().id();
- cfg.marsh = compactClass(c.getMarshaller());
- cfg.deployMode = compactObject(c.getDeploymentMode());
- cfg.clientMode = c.isClientMode();
- cfg.daemon = boolValue(IGNITE_DAEMON, c.isDaemon());
- cfg.jmxRemote = ignite.isJmxRemoteEnabled();
- cfg.restart = ignite.isRestartEnabled();
- cfg.netTimeout = c.getNetworkTimeout();
- cfg.log = compactClass(c.getGridLogger());
- cfg.discoStartupDelay = c.getDiscoveryStartupDelay();
- cfg.mBeanSrv = compactClass(c.getMBeanServer());
- cfg.noAscii = boolValue(IGNITE_NO_ASCII, false);
- cfg.noDiscoOrder = boolValue(IGNITE_NO_DISCO_ORDER, false);
- cfg.noShutdownHook = boolValue(IGNITE_NO_SHUTDOWN_HOOK, false);
- cfg.progName = getProperty(IGNITE_PROG_NAME);
- cfg.quiet = boolValue(IGNITE_QUIET, true);
- cfg.successFile = getProperty(IGNITE_SUCCESS_FILE);
- cfg.updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true);
-
- return cfg;
+ public VisorBasicConfiguration(IgniteEx ignite, IgniteConfiguration c) {
+ gridName = c.getGridName();
+ ggHome = getProperty(IGNITE_HOME, c.getIgniteHome());
+ locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost());
+ nodeId = ignite.localNode().id();
+ 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, true);
}
/**
- * @return Ignite instance name.
+ * @return Grid name.
*/
- @Nullable public String igniteInstanceName() {
- return igniteInstanceName;
+ @Nullable public String getGridName() {
+ return gridName;
}
/**
* @return IGNITE_HOME determined at startup.
*/
- @Nullable public String ggHome() {
+ @Nullable public String getGgHome() {
return ggHome;
}
/**
* @return Local host value used.
*/
- @Nullable public String localHost() {
+ @Nullable public String getLocalHost() {
return locHost;
}
/**
* @return Node id.
*/
- public UUID nodeId() {
+ public UUID getNodeId() {
return nodeId;
}
/**
* @return Marshaller used.
*/
- public String marshaller() {
+ public String getMarshaller() {
return marsh;
}
/**
* @return Deployment Mode.
*/
- public Object deploymentMode() {
+ public Object getDeploymentMode() {
return deployMode;
}
/**
* @return Client mode flag.
*/
- public Boolean clientMode() {
+ public Boolean isClientMode() {
return clientMode;
}
/**
* @return Whether this node daemon or not.
*/
- public boolean daemon() {
+ public boolean isDaemon() {
return daemon;
}
/**
* @return Whether remote JMX is enabled.
*/
- public boolean jmxRemote() {
+ public boolean isJmxRemote() {
return jmxRemote;
}
/**
* @return Is node restart enabled.
*/
- public boolean restart() {
+ public boolean isRestart() {
return restart;
}
/**
* @return Network timeout.
*/
- public long networkTimeout() {
+ public long getNetworkTimeout() {
return netTimeout;
}
/**
* @return Logger used on node.
*/
- public String logger() {
+ public String getLogger() {
return log;
}
/**
* @return Discovery startup delay.
*/
- public long discoStartupDelay() {
+ public long getDiscoStartupDelay() {
return discoStartupDelay;
}
/**
* @return MBean server name
*/
- @Nullable public String mBeanServer() {
+ @Nullable public String getMBeanServer() {
return mBeanSrv;
}
/**
* @return Whether ASCII logo is disabled.
*/
- public boolean noAscii() {
+ public boolean isNoAscii() {
return noAscii;
}
/**
* @return Whether no discovery order is allowed.
*/
- public boolean noDiscoOrder() {
+ public boolean isNoDiscoOrder() {
return noDiscoOrder;
}
/**
* @return Whether shutdown hook is disabled.
*/
- public boolean noShutdownHook() {
+ public boolean isNoShutdownHook() {
return noShutdownHook;
}
/**
* @return Name of command line program.
*/
- public String programName() {
+ public String getProgramName() {
return progName;
}
/**
* @return Whether node is in quiet mode.
*/
- public boolean quiet() {
+ public boolean isQuiet() {
return quiet;
}
/**
* @return Success file name.
*/
- public String successFile() {
+ public String getSuccessFile() {
return successFile;
}
/**
* @return Whether update checker is enabled.
*/
- public boolean updateNotifier() {
+ public boolean isUpdateNotifier() {
return updateNtf;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, gridName);
+ U.writeString(out, ggHome);
+ U.writeString(out, locHost);
+ U.writeUuid(out, nodeId);
+ 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);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ gridName = U.readString(in);
+ ggHome = U.readString(in);
+ locHost = U.readString(in);
+ nodeId = U.readUuid(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();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorBasicConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
----------------------------------------------------------------------
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
index df083f5..69a950b 100644
--- 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
@@ -17,16 +17,18 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+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.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for node executors configuration properties.
*/
-public class VisorExecutorServiceConfiguration implements Serializable, LessNamingBean {
+public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -45,73 +47,110 @@ public class VisorExecutorServiceConfiguration implements Serializable, LessNami
/** Peer-to-peer pool size. */
private int p2pPoolSz;
+ /** Rebalance thread pool size. */
+ private int rebalanceThreadPoolSize;
+
/** REST requests pool size. */
private int restPoolSz;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node executors configuration properties.
+ * Default constructor.
*/
- public static VisorExecutorServiceConfiguration from(IgniteConfiguration c) {
- VisorExecutorServiceConfiguration cfg = new VisorExecutorServiceConfiguration();
+ public VisorExecutorServiceConfiguration() {
+ // No-op.
+ }
- cfg.pubPoolSize = c.getPublicThreadPoolSize();
- cfg.sysPoolSz = c.getSystemThreadPoolSize();
- cfg.mgmtPoolSize = c.getManagementThreadPoolSize();
- cfg.p2pPoolSz = c.getPeerClassLoadingThreadPoolSize();
- cfg.igfsPoolSize = c.getIgfsThreadPoolSize();
+ /**
+ * 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();
+ igfsPoolSize = c.getIgfsThreadPoolSize();
+ rebalanceThreadPoolSize = c.getRebalanceThreadPoolSize();
ConnectorConfiguration cc = c.getConnectorConfiguration();
if (cc != null)
- cfg.restPoolSz = cc.getThreadPoolSize();
-
- return cfg;
+ restPoolSz = cc.getThreadPoolSize();
}
/**
* @return Public pool size.
*/
- public int publicThreadPoolSize() {
+ public int getPublicThreadPoolSize() {
return pubPoolSize;
}
/**
* @return System pool size.
*/
- public int systemThreadPoolSize() {
+ public int getSystemThreadPoolSize() {
return sysPoolSz;
}
/**
* @return Management pool size.
*/
- public int managementThreadPoolSize() {
+ public int getManagementThreadPoolSize() {
return mgmtPoolSize;
}
/**
* @return IGFS pool size.
*/
- public int igfsThreadPoolSize() {
+ public int getIgfsThreadPoolSize() {
return igfsPoolSize;
}
/**
* @return Peer-to-peer pool size.
*/
- public int peerClassLoadingThreadPoolSize() {
+ public int getPeerClassLoadingThreadPoolSize() {
return p2pPoolSz;
}
/**
+ * @return Rebalance thread pool size.
+ */
+ public int getRebalanceThreadPoolSize() {
+ return rebalanceThreadPoolSize;
+ }
+
+ /**
* @return REST requests pool size.
*/
- public int restThreadPoolSize() {
+ public int getRestThreadPoolSize() {
return restPoolSz;
}
/** {@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);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(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();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorExecutorServiceConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
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
index 913c450..b61fc3f 100644
--- 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
@@ -17,22 +17,26 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+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.Properties;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
/**
* Data transfer object for node configuration data.
*/
-public class VisorGridConfiguration implements Serializable, LessNamingBean {
+public class VisorGridConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -70,7 +74,7 @@ public class VisorGridConfiguration implements Serializable, LessNamingBean {
private Map<String, ?> userAttrs;
/** Igfss. */
- private Iterable<VisorIgfsConfiguration> igfss;
+ private Collection<VisorIgfsConfiguration> igfss;
/** Environment. */
private Map<String, String> env;
@@ -85,147 +89,193 @@ public class VisorGridConfiguration implements Serializable, LessNamingBean {
private VisorTransactionConfiguration txCfg;
/**
+ * Default constructor.
+ */
+ public VisorGridConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object with node configuration data.
+ *
* @param ignite Grid.
- * @return Fill data transfer object with node configuration data.
*/
- public VisorGridConfiguration from(IgniteEx ignite) {
+ public VisorGridConfiguration(IgniteEx ignite) {
assert ignite != null;
IgniteConfiguration c = ignite.configuration();
- basic = VisorBasicConfiguration.from(ignite, c);
- metrics = VisorMetricsConfiguration.from(c);
- spis = VisorSpisConfiguration.from(c);
- p2p = VisorPeerToPeerConfiguration.from(c);
- lifecycle = VisorLifecycleConfiguration.from(c);
- execSvc = VisorExecutorServiceConfiguration.from(c);
- seg = VisorSegmentationConfiguration.from(c);
+ 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 = VisorRestConfiguration.from(c);
+ rest = new VisorRestConfiguration(c);
userAttrs = c.getUserAttributes();
igfss = VisorIgfsConfiguration.list(c.getFileSystemConfiguration());
env = new HashMap<>(System.getenv());
sysProps = IgniteSystemProperties.snapshot();
- atomic = VisorAtomicConfiguration.from(c.getAtomicConfiguration());
- txCfg = VisorTransactionConfiguration.from(c.getTransactionConfiguration());
-
- return this;
+ atomic = new VisorAtomicConfiguration(c.getAtomicConfiguration());
+ txCfg = new VisorTransactionConfiguration(c.getTransactionConfiguration());
}
/**
* @return Basic.
*/
- public VisorBasicConfiguration basic() {
+ public VisorBasicConfiguration getBasic() {
return basic;
}
/**
* @return Metrics.
*/
- public VisorMetricsConfiguration metrics() {
+ public VisorMetricsConfiguration getMetrics() {
return metrics;
}
/**
* @return SPIs.
*/
- public VisorSpisConfiguration spis() {
+ public VisorSpisConfiguration getSpis() {
return spis;
}
/**
* @return P2P.
*/
- public VisorPeerToPeerConfiguration p2p() {
+ public VisorPeerToPeerConfiguration getP2p() {
return p2p;
}
/**
* @return Lifecycle.
*/
- public VisorLifecycleConfiguration lifecycle() {
+ public VisorLifecycleConfiguration getLifecycle() {
return lifecycle;
}
/**
* @return Executors service configuration.
*/
- public VisorExecutorServiceConfiguration executeService() {
+ public VisorExecutorServiceConfiguration getExecutorService() {
return execSvc;
}
/**
* @return Segmentation.
*/
- public VisorSegmentationConfiguration segmentation() {
+ public VisorSegmentationConfiguration getSegmentation() {
return seg;
}
/**
* @return Include properties.
*/
- public String includeProperties() {
+ public String getIncludeProperties() {
return inclProps;
}
/**
* @return Include events types.
*/
- public int[] includeEventTypes() {
+ public int[] getIncludeEventTypes() {
return inclEvtTypes;
}
/**
* @return Rest.
*/
- public VisorRestConfiguration rest() {
+ public VisorRestConfiguration getRest() {
return rest;
}
/**
* @return User attributes.
*/
- public Map<String, ?> userAttributes() {
+ public Map<String, ?> getUserAttributes() {
return userAttrs;
}
/**
* @return Igfss.
*/
- public Iterable<VisorIgfsConfiguration> igfss() {
+ public Collection<VisorIgfsConfiguration> getIgfss() {
return igfss;
}
/**
* @return Environment.
*/
- public Map<String, String> env() {
+ public Map<String, String> getEnv() {
return env;
}
/**
* @return System properties.
*/
- public Properties systemProperties() {
+ public Properties getSystemProperties() {
return sysProps;
}
/**
* @return Configuration of atomic data structures.
*/
- public VisorAtomicConfiguration atomic() {
+ public VisorAtomicConfiguration getAtomic() {
return atomic;
}
/**
* @return Transactions configuration.
*/
- public VisorTransactionConfiguration transaction() {
+ public VisorTransactionConfiguration getTransaction() {
return txCfg;
}
/** {@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, igfss);
+ U.writeMap(out, env);
+ out.writeObject(sysProps);
+ out.writeObject(atomic);
+ out.writeObject(txCfg);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(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.readCollection(in);
+ env = U.readMap(in);
+ sysProps = (Properties)in.readObject();
+ atomic = (VisorAtomicConfiguration)in.readObject();
+ txCfg = (VisorTransactionConfiguration)in.readObject();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorGridConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
----------------------------------------------------------------------
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
index 7f8e3b0..1d4b388 100644
--- 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
@@ -17,7 +17,9 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -25,8 +27,9 @@ import java.util.Map;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
import org.apache.ignite.igfs.IgfsMode;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -34,7 +37,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
/**
* Data transfer object for IGFS configuration properties.
*/
-public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
+public class VisorIgfsConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -62,15 +65,6 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
/** Number of batches that can be concurrently sent to remote node. */
private int perNodeParallelBatchCnt;
- /** @deprecated Needed only for backward compatibility. */
- private String secondaryHadoopFileSysUri;
-
- /** @deprecated Needed only for backward compatibility. */
- private String secondaryHadoopFileSysCfgPath;
-
- /** @deprecated Needed only for backward compatibility. */
- private String secondaryHadoopFileSysUserName;
-
/** IGFS instance mode. */
private IgfsMode dfltMode;
@@ -123,44 +117,47 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
private long trashPurgeTimeout;
/**
+ * Default constructor.
+ */
+ public VisorIgfsConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for IGFS configuration properties.
* @param igfs IGFS configuration.
- * @return Data transfer object for IGFS configuration properties.
*/
- public static VisorIgfsConfiguration from(FileSystemConfiguration igfs) {
- VisorIgfsConfiguration cfg = new VisorIgfsConfiguration();
-
- cfg.name = igfs.getName();
- cfg.metaCacheName = igfs.getMetaCacheConfiguration().getName();
- cfg.dataCacheName = igfs.getDataCacheConfiguration().getName();
- cfg.blockSize = igfs.getBlockSize();
- cfg.prefetchBlocks = igfs.getPrefetchBlocks();
- cfg.streamBufSize = igfs.getStreamBufferSize();
- cfg.perNodeBatchSize = igfs.getPerNodeBatchSize();
- cfg.perNodeParallelBatchCnt = igfs.getPerNodeParallelBatchCount();
-
- cfg.dfltMode = igfs.getDefaultMode();
- cfg.pathModes = igfs.getPathModes();
- cfg.dualModePutExecutorSrvc = compactClass(igfs.getDualModePutExecutorService());
- cfg.dualModePutExecutorSrvcShutdown = igfs.getDualModePutExecutorServiceShutdown();
- cfg.dualModeMaxPendingPutsSize = igfs.getDualModeMaxPendingPutsSize();
- cfg.maxTaskRangeLen = igfs.getMaximumTaskRangeLength();
- cfg.fragmentizerConcurrentFiles = igfs.getFragmentizerConcurrentFiles();
- cfg.fragmentizerLocWritesRatio = igfs.getFragmentizerLocalWritesRatio();
- cfg.fragmentizerEnabled = igfs.isFragmentizerEnabled();
- cfg.fragmentizerThrottlingBlockLen = igfs.getFragmentizerThrottlingBlockLength();
- cfg.fragmentizerThrottlingDelay = igfs.getFragmentizerThrottlingDelay();
+ public VisorIgfsConfiguration(FileSystemConfiguration igfs) {
+ name = igfs.getName();
+ metaCacheName = igfs.getMetaCacheConfiguration().getName();
+ dataCacheName = igfs.getDataCacheConfiguration().getName();
+ blockSize = igfs.getBlockSize();
+ prefetchBlocks = igfs.getPrefetchBlocks();
+ streamBufSize = igfs.getStreamBufferSize();
+ perNodeBatchSize = igfs.getPerNodeBatchSize();
+ perNodeParallelBatchCnt = igfs.getPerNodeParallelBatchCount();
+
+ dfltMode = igfs.getDefaultMode();
+ pathModes = igfs.getPathModes();
+ dualModePutExecutorSrvc = compactClass(igfs.getDualModePutExecutorService());
+ dualModePutExecutorSrvcShutdown = igfs.getDualModePutExecutorServiceShutdown();
+ dualModeMaxPendingPutsSize = igfs.getDualModeMaxPendingPutsSize();
+ maxTaskRangeLen = igfs.getMaximumTaskRangeLength();
+ fragmentizerConcurrentFiles = igfs.getFragmentizerConcurrentFiles();
+ fragmentizerLocWritesRatio = igfs.getFragmentizerLocalWritesRatio();
+ fragmentizerEnabled = igfs.isFragmentizerEnabled();
+ fragmentizerThrottlingBlockLen = igfs.getFragmentizerThrottlingBlockLength();
+ fragmentizerThrottlingDelay = igfs.getFragmentizerThrottlingDelay();
IgfsIpcEndpointConfiguration endpointCfg = igfs.getIpcEndpointConfiguration();
- cfg.ipcEndpointCfg = endpointCfg != null ? endpointCfg.toString() : null;
+ ipcEndpointCfg = endpointCfg != null ? endpointCfg.toString() : null;
- cfg.ipcEndpointEnabled = igfs.isIpcEndpointEnabled();
- cfg.maxSpace = igfs.getMaxSpaceSize();
- cfg.mgmtPort = igfs.getManagementPort();
- cfg.seqReadsBeforePrefetch = igfs.getSequentialReadsBeforePrefetch();
- cfg.trashPurgeTimeout = igfs.getTrashPurgeTimeout();
-
- return cfg;
+ ipcEndpointEnabled = igfs.isIpcEndpointEnabled();
+ maxSpace = igfs.getMaxSpaceSize();
+ mgmtPort = igfs.getManagementPort();
+ seqReadsBeforePrefetch = igfs.getSequentialReadsBeforePrefetch();
+ trashPurgeTimeout = igfs.getTrashPurgeTimeout();
}
/**
@@ -169,14 +166,14 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
* @param igfss Igfs configurations.
* @return igfs configurations properties.
*/
- public static Iterable<VisorIgfsConfiguration> list(FileSystemConfiguration[] igfss) {
+ public static Collection<VisorIgfsConfiguration> list(FileSystemConfiguration[] igfss) {
if (igfss == null)
return Collections.emptyList();
final Collection<VisorIgfsConfiguration> cfgs = new ArrayList<>(igfss.length);
for (FileSystemConfiguration igfs : igfss)
- cfgs.add(from(igfs));
+ cfgs.add(new VisorIgfsConfiguration(igfs));
return cfgs;
}
@@ -184,200 +181,237 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
/**
* @return IGFS instance name.
*/
- @Nullable public String name() {
+ @Nullable public String getName() {
return name;
}
/**
* @return Cache name to store IGFS meta information.
*/
- @Nullable public String metaCacheName() {
+ @Nullable public String getMetaCacheName() {
return metaCacheName;
}
/**
* @return Cache name to store IGFS data.
*/
- @Nullable public String dataCacheName() {
+ @Nullable public String getDataCacheName() {
return dataCacheName;
}
/**
* @return File's data block size.
*/
- public int blockSize() {
+ public int getBlockSize() {
return blockSize;
}
/**
* @return Number of pre-fetched blocks if specific file's chunk is requested.
*/
- public int prefetchBlocks() {
+ public int getPrefetchBlocks() {
return prefetchBlocks;
}
/**
* @return Read/write buffer size for IGFS stream operations in bytes.
*/
- public int streamBufferSize() {
+ public int getStreamBufferSize() {
return streamBufSize;
}
/**
* @return Number of file blocks buffered on local node before sending batch to remote node.
*/
- public int perNodeBatchSize() {
+ public int getPerNodeBatchSize() {
return perNodeBatchSize;
}
/**
* @return Number of batches that can be concurrently sent to remote node.
*/
- public int perNodeParallelBatchCount() {
+ public int getPerNodeParallelBatchCount() {
return perNodeParallelBatchCnt;
}
/**
- * @deprecated Needed only for backward compatibility.
- */
- @Nullable public String secondaryHadoopFileSystemUri() {
- return secondaryHadoopFileSysUri;
- }
-
- /**
- * @deprecated Needed only for backward compatibility.
- */
- @Nullable public String secondaryHadoopFileSystemUserName() {
- return secondaryHadoopFileSysUserName;
- }
-
- /**
- * @deprecated Needed only for backward compatibility.
- */
- @Nullable public String secondaryHadoopFileSystemConfigPath() {
- return secondaryHadoopFileSysCfgPath;
- }
-
- /**
* @return IGFS instance mode.
*/
- public IgfsMode defaultMode() {
+ public IgfsMode getDefaultMode() {
return dfltMode;
}
/**
* @return Map of paths to IGFS modes.
*/
- @Nullable public Map<String, IgfsMode> pathModes() {
+ @Nullable public Map<String, IgfsMode> getPathModes() {
return pathModes;
}
/**
* @return Dual mode PUT operations executor service.
*/
- public String dualModePutExecutorService() {
+ public String getDualModePutExecutorService() {
return dualModePutExecutorSrvc;
}
/**
* @return Dual mode PUT operations executor service shutdown flag.
*/
- public boolean dualModePutExecutorServiceShutdown() {
+ public boolean getDualModePutExecutorServiceShutdown() {
return dualModePutExecutorSrvcShutdown;
}
/**
* @return Maximum amount of data in pending puts.
*/
- public long dualModeMaxPendingPutsSize() {
+ public long getDualModeMaxPendingPutsSize() {
return dualModeMaxPendingPutsSize;
}
/**
* @return Maximum range length.
*/
- public long maxTaskRangeLength() {
+ public long getMaxTaskRangeLength() {
return maxTaskRangeLen;
}
/**
* @return Fragmentizer concurrent files.
*/
- public int fragmentizerConcurrentFiles() {
+ public int getFragmentizerConcurrentFiles() {
return fragmentizerConcurrentFiles;
}
/**
* @return Fragmentizer local writes ratio.
*/
- public float fragmentizerLocalWritesRatio() {
+ public float getFragmentizerLocalWritesRatio() {
return fragmentizerLocWritesRatio;
}
/**
* @return Fragmentizer enabled flag.
*/
- public boolean fragmentizerEnabled() {
+ public boolean isFragmentizerEnabled() {
return fragmentizerEnabled;
}
/**
* @return Fragmentizer throttling block length.
*/
- public long fragmentizerThrottlingBlockLength() {
+ public long getFragmentizerThrottlingBlockLength() {
return fragmentizerThrottlingBlockLen;
}
/**
* @return Fragmentizer throttling delay.
*/
- public long fragmentizerThrottlingDelay() {
+ public long getFragmentizerThrottlingDelay() {
return fragmentizerThrottlingDelay;
}
/**
* @return IPC endpoint config to publish IGFS over.
*/
- @Nullable public String ipcEndpointConfiguration() {
+ @Nullable public String getIpcEndpointConfiguration() {
return ipcEndpointCfg;
}
/**
* @return IPC endpoint enabled flag.
*/
- public boolean ipcEndpointEnabled() {
+ public boolean isIpcEndpointEnabled() {
return ipcEndpointEnabled;
}
/**
* @return Maximum space.
*/
- public long maxSpace() {
+ public long getMaxSpace() {
return maxSpace;
}
/**
* @return Management port.
*/
- public int managementPort() {
+ public int getManagementPort() {
return mgmtPort;
}
/**
* @return Amount of sequential block reads before prefetch is triggered.
*/
- public int sequenceReadsBeforePrefetch() {
+ public int getSequenceReadsBeforePrefetch() {
return seqReadsBeforePrefetch;
}
/**
* @return Trash purge await timeout.
*/
- public long trashPurgeTimeout() {
+ public long getTrashPurgeTimeout() {
return trashPurgeTimeout;
}
/** {@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);
+ U.writeString(out, dualModePutExecutorSrvc);
+ out.writeBoolean(dualModePutExecutorSrvcShutdown);
+ out.writeLong(dualModeMaxPendingPutsSize);
+ out.writeLong(maxTaskRangeLen);
+ out.writeInt(fragmentizerConcurrentFiles);
+ out.writeFloat(fragmentizerLocWritesRatio);
+ out.writeBoolean(fragmentizerEnabled);
+ out.writeLong(fragmentizerThrottlingBlockLen);
+ out.writeLong(fragmentizerThrottlingDelay);
+ U.writeString(out, ipcEndpointCfg);
+ out.writeBoolean(ipcEndpointEnabled);
+ out.writeLong(maxSpace);
+ out.writeInt(mgmtPort);
+ out.writeInt(seqReadsBeforePrefetch);
+ out.writeLong(trashPurgeTimeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(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 = IgfsMode.fromOrdinal(in.readByte());
+ pathModes = U.readMap(in);
+ dualModePutExecutorSrvc = U.readString(in);
+ dualModePutExecutorSrvcShutdown = in.readBoolean();
+ dualModeMaxPendingPutsSize = in.readLong();
+ maxTaskRangeLen = in.readLong();
+ fragmentizerConcurrentFiles = in.readInt();
+ fragmentizerLocWritesRatio = in.readFloat();
+ fragmentizerEnabled = in.readBoolean();
+ fragmentizerThrottlingBlockLen = in.readLong();
+ fragmentizerThrottlingDelay = in.readLong();
+ ipcEndpointCfg = U.readString(in);
+ ipcEndpointEnabled = in.readBoolean();
+ maxSpace = in.readLong();
+ mgmtPort = in.readInt();
+ seqReadsBeforePrefetch = in.readInt();
+ trashPurgeTimeout = in.readLong();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorIgfsConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
----------------------------------------------------------------------
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
index 838a6cc..7eb4ad3 100644
--- 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
@@ -17,10 +17,13 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
@@ -28,7 +31,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
/**
* Data transfer object for node lifecycle configuration properties.
*/
-public class VisorLifecycleConfiguration implements Serializable, LessNamingBean {
+public class VisorLifecycleConfiguration extends VisorDataTransferObject{
/** */
private static final long serialVersionUID = 0L;
@@ -36,25 +39,39 @@ public class VisorLifecycleConfiguration implements Serializable, LessNamingBean
private String beans;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node lifecycle configuration properties.
+ * Default constructor.
*/
- public static VisorLifecycleConfiguration from(IgniteConfiguration c) {
- VisorLifecycleConfiguration cfg = new VisorLifecycleConfiguration();
-
- cfg.beans = compactArray(c.getLifecycleBeans());
+ public VisorLifecycleConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * 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 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ beans = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorLifecycleConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
----------------------------------------------------------------------
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
index 4e812b7..18575aa 100644
--- 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
@@ -17,15 +17,17 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
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 implements Serializable, LessNamingBean {
+public class VisorMetricsConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -39,41 +41,59 @@ public class VisorMetricsConfiguration implements Serializable, LessNamingBean {
private long logFreq;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node metrics configuration properties.
+ * Default constructor.
*/
- public static VisorMetricsConfiguration from(IgniteConfiguration c) {
- VisorMetricsConfiguration cfg = new VisorMetricsConfiguration();
-
- cfg.expTime = c.getMetricsExpireTime();
- cfg.histSize = c.getMetricsHistorySize();
- cfg.logFreq = c.getMetricsLogFrequency();
+ public VisorMetricsConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * 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 expireTime() {
+ public long getExpireTime() {
return expTime;
}
/**
* @return Number of node metrics stored in memory.
*/
- public int historySize() {
+ public int getHistorySize() {
return histSize;
}
/**
* @return Frequency of metrics log printout.
*/
- public long loggerFrequency() {
+ 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(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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java
----------------------------------------------------------------------
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
index 109b1d8..35b7ad3 100644
--- 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
@@ -37,11 +37,11 @@ public class VisorNodeConfigurationCollectorJob extends VisorJob<Void, VisorGrid
/** {@inheritDoc} */
@Override protected VisorGridConfiguration run(Void arg) {
- return new VisorGridConfiguration().from(ignite);
+ return new VisorGridConfiguration(ignite);
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorNodeConfigurationCollectorJob.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 0617e70..125e219 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -24,6 +24,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.igfs.IgfsProcessorAdapter;
import org.apache.ignite.internal.util.ipc.IpcServerEndpoint;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -33,6 +35,7 @@ import org.apache.ignite.internal.visor.cache.VisorCache;
import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
+import org.apache.ignite.lang.IgniteProductVersion;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
@@ -70,7 +73,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
*/
protected void events0(VisorNodeDataCollectorJobResult res, String evtOrderKey, String evtThrottleCntrKey,
final boolean all) {
- res.events().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all, EVT_MAPPER));
+ res.getEvents().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all, EVT_MAPPER));
}
/**
@@ -83,12 +86,12 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
try {
// Visor events explicitly enabled in configuration.
if (checkExplicitTaskMonitoring(ignite))
- res.taskMonitoringEnabled(true);
+ res.setTaskMonitoringEnabled(true);
else {
// Get current task monitoring state.
- res.taskMonitoringEnabled(arg.taskMonitoringEnabled());
+ res.setTaskMonitoringEnabled(arg.isTaskMonitoringEnabled());
- if (arg.taskMonitoringEnabled()) {
+ if (arg.isTaskMonitoringEnabled()) {
ConcurrentMap<String, VisorComputeMonitoringHolder> storage = ignite.cluster().nodeLocalMap();
VisorComputeMonitoringHolder holder = storage.get(COMPUTE_MONITORING_HOLDER_KEY);
@@ -102,21 +105,33 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
// Enable task monitoring for new node in grid.
- holder.startCollect(ignite, arg.eventsOrderKey());
+ holder.startCollect(ignite, arg.getEventsOrderKey());
// Update current state after change (it may not changed in some cases).
- res.taskMonitoringEnabled(ignite.allEventsUserRecordable(VISOR_TASK_EVTS));
+ res.setTaskMonitoringEnabled(ignite.allEventsUserRecordable(VISOR_TASK_EVTS));
}
}
- events0(res, arg.eventsOrderKey(), arg.eventsThrottleCounterKey(), arg.taskMonitoringEnabled());
+ events0(res, arg.getEventsOrderKey(), arg.getEventsThrottleCounterKey(), arg.isTaskMonitoringEnabled());
}
catch (Exception eventsEx) {
- res.eventsEx(eventsEx);
+ res.setEventsEx(eventsEx);
}
}
/**
+ * @param ver Version to check.
+ * @return {@code true} if found at least one compatible node with specified version.
+ */
+ protected boolean compatibleWith(IgniteProductVersion ver) {
+ for (ClusterNode node : ignite.cluster().nodes())
+ if (node.version().compareToIgnoreTimestamp(ver) <= 0)
+ return true;
+
+ return false;
+ }
+
+ /**
* @param cacheName Cache name to check.
* @return {@code true} if cache on local node is not a data cache or near cache disabled.
*/
@@ -138,19 +153,22 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
try {
IgniteConfiguration cfg = ignite.configuration();
- for (String cacheName : ignite.context().cache().cacheNames()) {
+ GridCacheProcessor cacheProc = ignite.context().cache();
+
+ for (String cacheName : cacheProc.cacheNames()) {
if (proxyCache(cacheName))
continue;
- if (arg.systemCaches() ||
- !(isSystemCache(cacheName) || isIgfsCache(cfg, cacheName))) {
+ if (arg.getSystemCaches() || !(isSystemCache(cacheName) || isIgfsCache(cfg, cacheName))) {
long start0 = U.currentTimeMillis();
try {
- VisorCache cache = new VisorCache().from(ignite, cacheName, arg.sample());
+ GridCacheAdapter ca = cacheProc.internalCache(cacheName);
+
+ if (ca == null || !ca.context().started())
+ continue;
- if (cache != null)
- res.caches().add(cache);
+ res.getCaches().add(new VisorCache(ignite, ca, arg.getSample()));
}
catch(IllegalStateException | IllegalArgumentException e) {
if (debug && ignite.log() != null)
@@ -164,7 +182,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
}
catch (Exception cachesEx) {
- res.cachesEx(cachesEx);
+ res.setCachesEx(cachesEx);
}
}
@@ -182,8 +200,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
FileSystemConfiguration igfsCfg = igfs.configuration();
- if (proxyCache(igfsCfg.getDataCacheConfiguration().getName())
- || proxyCache(igfsCfg.getMetaCacheConfiguration().getName()))
+ if (proxyCache(igfsCfg.getDataCacheConfiguration().getName()) || proxyCache(igfsCfg.getMetaCacheConfiguration().getName()))
continue;
try {
@@ -192,11 +209,11 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
if (endPoints != null) {
for (IpcServerEndpoint ep : endPoints)
if (ep.isManagement())
- res.igfsEndpoints().add(new VisorIgfsEndpoint(igfs.name(), ignite.name(),
+ res.getIgfsEndpoints().add(new VisorIgfsEndpoint(igfs.name(), ignite.name(),
ep.getHost(), ep.getPort()));
}
- res.igfss().add(VisorIgfs.from(igfs));
+ res.getIgfss().add(new VisorIgfs(igfs));
}
finally {
if (debug)
@@ -205,7 +222,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
}
catch (Exception igfssEx) {
- res.igfssEx(igfssEx);
+ res.setIgfssEx(igfssEx);
}
}
@@ -223,9 +240,9 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
*/
protected VisorNodeDataCollectorJobResult run(VisorNodeDataCollectorJobResult res,
VisorNodeDataCollectorTaskArg arg) {
- res.igniteInstanceName(ignite.name());
+ res.setGridName(ignite.name());
- res.topologyVersion(ignite.cluster().topologyVersion());
+ res.setTopologyVersion(ignite.cluster().topologyVersion());
long start0 = U.currentTimeMillis();
@@ -244,7 +261,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
if (debug)
log(ignite.log(), "Collected igfs", getClass(), start0);
- res.errorCount(ignite.context().exceptionRegistry().errorCount());
+ res.setErrorCount(ignite.context().exceptionRegistry().errorCount());
return res;
}
[5/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
----------------------------------------------------------------------
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
index 0fdd95f..1e22610 100644
--- 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
@@ -17,57 +17,76 @@
package org.apache.ignite.internal.visor.debug;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.lang.management.LockInfo;
-import org.apache.ignite.internal.LessNamingBean;
+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 implements Serializable, LessNamingBean {
+public class VisorThreadLockInfo extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/**
* Fully qualified name of the class of the lock object.
*/
- protected final String clsName;
+ protected String clsName;
/**
* Identity hash code of the lock object.
*/
- protected final Integer identityHashCode;
+ protected Integer identityHashCode;
- /** Create thread lock info with given parameters. */
- public VisorThreadLockInfo(String clsName, Integer identityHashCode) {
- assert clsName != null;
-
- this.clsName = clsName;
- this.identityHashCode = identityHashCode;
+ /**
+ * Default constructor.
+ */
+ public VisorThreadLockInfo() {
+ // No-op.
}
- /** Create data transfer object for given lock info. */
- public static VisorThreadLockInfo from(LockInfo li) {
+ /**
+ * Create data transfer object for given lock info.
+ *
+ * @param li Lock info.
+ */
+ public VisorThreadLockInfo(LockInfo li) {
assert li != null;
- return new VisorThreadLockInfo(li.getClassName(), li.getIdentityHashCode());
+ clsName = li.getClassName();
+ identityHashCode = li.getIdentityHashCode();
}
/**
* @return Fully qualified name of the class of the lock object.
*/
- public String className() {
+ public String getClassName() {
return clsName;
}
/**
* @return Identity hash code of the lock object.
*/
- public Integer identityHashCode() {
+ 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ clsName = U.readString(in);
+ identityHashCode = (Integer)in.readObject();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return clsName + '@' + Integer.toHexString(identityHashCode);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
----------------------------------------------------------------------
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
index cc68665..e358eee 100644
--- 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
@@ -17,7 +17,11 @@
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;
/**
* Data transfer object for {@link MonitorInfo}.
@@ -27,46 +31,62 @@ public class VisorThreadMonitorInfo extends VisorThreadLockInfo {
private static final long serialVersionUID = 0L;
/** Stack depth. */
- private final Integer stackDepth;
+ private Integer stackDepth;
/** Stack frame. */
- private final StackTraceElement stackFrame;
+ private StackTraceElement stackFrame;
/**
- * Create thread monitor info with given parameters.
- *
- * @param clsName Fully qualified name of the class of the lock object.
- * @param identityHashCode Identity hash code of the lock object.
- * @param stackDepth Depth in the stack trace where the object monitor was locked.
- * @param stackFrame Stack frame that locked the object monitor.
+ * Default constructor.
*/
- public VisorThreadMonitorInfo(String clsName, Integer identityHashCode, Integer stackDepth,
- StackTraceElement stackFrame) {
- super(clsName, identityHashCode);
-
- this.stackDepth = stackDepth;
- this.stackFrame = stackFrame;
+ public VisorThreadMonitorInfo() {
+ // No-op.
}
- /** Create data transfer object for given monitor info. */
- public static VisorThreadMonitorInfo from(MonitorInfo mi) {
- assert mi != null;
+ /**
+ * Create data transfer object for given monitor info.
+ *
+ * @param mi Monitoring info.
+ */
+ public VisorThreadMonitorInfo(MonitorInfo mi) {
+ super(mi);
- return new VisorThreadMonitorInfo(mi.getClassName(), mi.getIdentityHashCode(), mi.getLockedStackDepth(),
- mi.getLockedStackFrame());
+ stackDepth = mi.getLockedStackDepth();
+ stackFrame = mi.getLockedStackFrame();
}
/**
* @return Stack depth.
*/
- public Integer stackDepth() {
+ public Integer getStackDepth() {
return stackDepth;
}
/**
* @return Stack frame.
*/
- public StackTraceElement stackFrame() {
+ public StackTraceElement getStackFrame() {
return stackFrame;
}
-}
\ No newline at end of file
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ super.writeExternalData(out);
+
+ out.writeObject(stackDepth);
+ out.writeObject(stackFrame);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternalData(in);
+
+ stackDepth = (Integer)in.readObject();
+ stackFrame = (StackTraceElement)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorThreadMonitorInfo.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java
----------------------------------------------------------------------
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
index 0eefa6b..6144012 100644
--- 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
@@ -17,8 +17,12 @@
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.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -30,7 +34,14 @@ public class VisorGridDeploymentEvent extends VisorGridEvent {
private static final long serialVersionUID = 0L;
/** Deployment alias. */
- private final String alias;
+ private String alias;
+
+ /**
+ * Default constructor.
+ */
+ public VisorGridDeploymentEvent() {
+ // No-op.
+ }
/**
* Create event with given parameters.
@@ -62,12 +73,26 @@ public class VisorGridDeploymentEvent extends VisorGridEvent {
/**
* @return Deployment alias.
*/
- public String alias() {
+ public String getAlias() {
return alias;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ super.writeExternalData(out);
+
+ U.writeString(out, alias);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternalData(in);
+
+ alias = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorGridDeploymentEvent.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
index bad6966..ecafb8a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
@@ -17,8 +17,12 @@
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.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -30,16 +34,23 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
private static final long serialVersionUID = 0L;
/** Node that caused this event to be generated. */
- private final UUID evtNodeId;
+ private UUID evtNodeId;
/** Node address that caused this event to be generated. */
- private final String addr;
+ private String addr;
/** If node that caused this event is daemon. */
- private final boolean isDaemon;
+ private boolean isDaemon;
/** Topology version. */
- private final long topVer;
+ private long topVer;
+
+ /**
+ * Default constructor.
+ */
+ public VisorGridDiscoveryEvent() {
+ // No-op.
+ }
/**
* Create event with given parameters.
@@ -87,7 +98,7 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
/**
* @return Node address that caused this event to be generated.
*/
- public String address() {
+ public String getAddress() {
return addr;
}
@@ -102,11 +113,31 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
* @return Topology version or {@code 0} if configured discovery SPI implementation
* does not support versioning.
**/
- public long topologyVersion() {
+ public long getTopologyVersion() {
return topVer;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ super.writeExternalData(out);
+
+ U.writeUuid(out, evtNodeId);
+ U.writeString(out, addr);
+ out.writeBoolean(isDaemon);
+ out.writeLong(topVer);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternalData(in);
+
+ 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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
----------------------------------------------------------------------
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
index b24e860..c0e4162 100644
--- 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
@@ -17,40 +17,50 @@
package org.apache.ignite.internal.visor.event;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.UUID;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.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 implements Serializable, LessNamingBean {
+public class VisorGridEvent extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Event type. */
- private final int typeId;
+ private int typeId;
/** Globally unique ID of this event. */
- private final IgniteUuid id;
+ private IgniteUuid id;
/** Name of this event. */
- private final String name;
+ private String name;
/** Node Id where event occurred and was recorded. */
- private final UUID nid;
+ private UUID nid;
/** Event timestamp. */
- private final long ts;
+ private long ts;
/** Event message. */
- private final String msg;
+ private String msg;
/** Shortened version of {@code toString()} result. Suitable for humans to read. */
- private final String shortDisplay;
+ private String shortDisplay;
+
+ /**
+ * Default constructor.
+ */
+ public VisorGridEvent() {
+ // No-op.
+ }
/**
* Create event with given parameters.
@@ -77,53 +87,75 @@ public class VisorGridEvent implements Serializable, LessNamingBean {
/**
* @return Event type.
*/
- public int typeId() {
+ public int getTypeId() {
return typeId;
}
/**
* @return Globally unique ID of this event.
*/
- public IgniteUuid id() {
+ public IgniteUuid getId() {
return id;
}
/**
* @return Name of this event.
*/
- public String name() {
+ public String getName() {
return name;
}
/**
* @return Node Id where event occurred and was recorded.
*/
- public UUID nid() {
+ public UUID getNid() {
return nid;
}
/**
* @return Event timestamp.
*/
- public long timestamp() {
+ public long getTimestamp() {
return ts;
}
/**
* @return Event message.
*/
- @Nullable public String message() {
+ @Nullable public String getMessage() {
return msg;
}
/**
* @return Shortened version of result. Suitable for humans to read.
*/
- public String shortDisplay() {
+ public String getShortDisplay() {
return shortDisplay;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeInt(typeId);
+ U.writeGridUuid(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(ObjectInput in) throws IOException, ClassNotFoundException {
+ typeId = in.readInt();
+ id = U.readGridUuid(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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java
----------------------------------------------------------------------
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
index 92f149a..e07a3a1 100644
--- 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
@@ -18,6 +18,7 @@
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;
@@ -29,6 +30,13 @@ 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.
@@ -38,4 +46,9 @@ public class VisorGridEventsLost extends VisorGridEvent {
"Some Visor events were lost and Visor may show inconsistent results. " +
"Configure your grid to disable not important events.", "");
}
-}
\ No newline at end of file
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorGridEventsLost.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java
----------------------------------------------------------------------
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
index a1a0c04..47b5002 100644
--- 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
@@ -17,8 +17,12 @@
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.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -30,16 +34,23 @@ public class VisorGridJobEvent extends VisorGridEvent {
private static final long serialVersionUID = 0L;
/** Name of the task that triggered the event. */
- private final String taskName;
+ private String taskName;
/** Name of task class that triggered the event. */
- private final String taskClsName;
+ private String taskClsName;
/** Task session ID of the task that triggered the event. */
- private final IgniteUuid taskSesId;
+ private IgniteUuid taskSesId;
/** Job ID. */
- private final IgniteUuid jobId;
+ private IgniteUuid jobId;
+
+ /**
+ * Default constructor.
+ */
+ public VisorGridJobEvent() {
+ // No-op.
+ }
/**
* Create event with given parameters.
@@ -80,33 +91,53 @@ public class VisorGridJobEvent extends VisorGridEvent {
/**
* @return Name of the task that triggered the event.
*/
- public String taskName() {
+ public String getTaskName() {
return taskName;
}
/**
* @return Name of task class that triggered the event.
*/
- public String taskClassName() {
+ public String getTaskClassName() {
return taskClsName;
}
/**
* @return Task session ID of the task that triggered the event.
*/
- public IgniteUuid taskSessionId() {
+ public IgniteUuid getTaskSessionId() {
return taskSesId;
}
/**
* @return Job ID.
*/
- public IgniteUuid jobId() {
+ public IgniteUuid getJobId() {
return jobId;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ super.writeExternalData(out);
+
+ U.writeString(out, taskName);
+ U.writeString(out, taskClsName);
+ U.writeGridUuid(out, taskSesId);
+ U.writeGridUuid(out, jobId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternalData(in);
+
+ taskName = U.readString(in);
+ taskClsName = U.readString(in);
+ taskSesId = U.readGridUuid(in);
+ jobId = U.readGridUuid(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorGridJobEvent.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java
----------------------------------------------------------------------
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
index 255d559..530ae41 100644
--- 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
@@ -17,8 +17,12 @@
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.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -30,16 +34,23 @@ public class VisorGridTaskEvent extends VisorGridEvent {
private static final long serialVersionUID = 0L;
/** Name of the task that triggered the event. */
- private final String taskName;
+ private String taskName;
/** Name of task class that triggered the event. */
- private final String taskClsName;
+ private String taskClsName;
/** Task session ID. */
- private final IgniteUuid taskSesId;
+ private IgniteUuid taskSesId;
/** Whether task was created for system needs. */
- private final boolean internal;
+ private boolean internal;
+
+ /**
+ * Default constructor.
+ */
+ public VisorGridTaskEvent() {
+ // No-op.
+ }
/**
* Create event with given parameters.
@@ -80,33 +91,53 @@ public class VisorGridTaskEvent extends VisorGridEvent {
/**
* @return Name of the task that triggered the event.
*/
- public String taskName() {
+ public String getTaskName() {
return taskName;
}
/**
* @return Name of task class that triggered the event.
*/
- public String taskClassName() {
+ public String getTaskClassName() {
return taskClsName;
}
/**
* @return Task session ID.
*/
- public IgniteUuid taskSessionId() {
+ public IgniteUuid getTaskSessionId() {
return taskSesId;
}
/**
* @return Whether task was created for system needs.
*/
- public boolean internal() {
+ public boolean isInternal() {
return internal;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ super.writeExternalData(out);
+
+ U.writeString(out, taskName);
+ U.writeString(out, taskClsName);
+ U.writeGridUuid(out, taskSesId);
+ out.writeBoolean(internal);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternalData(in);
+
+ taskName = U.readString(in);
+ taskClsName = U.readString(in);
+ taskSesId = U.readGridUuid(in);
+ internal = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorGridTaskEvent.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
----------------------------------------------------------------------
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
index dba7037..4746a8d 100644
--- 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
@@ -17,34 +17,44 @@
package org.apache.ignite.internal.visor.file;
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+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 implements Serializable, LessNamingBean {
+public class VisorFileBlock extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** File path. */
- private final String path;
+ private String path;
/** Marker position. */
- private final long off;
+ private long off;
/** File size. */
- private final long size;
+ private long size;
/** Timestamp of last modification of the file. */
- private final long lastModified;
+ private long lastModified;
/** Whether data was zipped. */
- private final boolean zipped;
+ private boolean zipped;
/** Data bytes. */
- private final byte[] data;
+ private byte[] data;
+
+ /**
+ * Default constructor.
+ */
+ public VisorFileBlock() {
+
+ }
/**
* Create file block with given parameters.
@@ -68,46 +78,66 @@ public class VisorFileBlock implements Serializable, LessNamingBean {
/**
* @return File path.
*/
- public String path() {
+ public String getPath() {
return path;
}
/**
* @return Marker position.
*/
- public long offset() {
+ public long getOffset() {
return off;
}
/**
* @return File size.
*/
- public long size() {
+ public long getSize() {
return size;
}
/**
* @return Timestamp of last modification of the file.
*/
- public long lastModified() {
+ public long getLastModified() {
return lastModified;
}
/**
* @return Whether data was zipped.
*/
- public boolean zipped() {
+ public boolean isZipped() {
return zipped;
}
/**
* @return Data bytes.
*/
- public byte[] data() {
+ 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(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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
new file mode 100644
index 0000000..0a5175f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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}
+ */
+@SuppressWarnings("PublicInnerClass")
+public class VisorFileBlockArg 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 VisorFileBlockArg() {
+ // No-op.
+ }
+
+ /**
+ * @param path Log file path.
+ * @param off Offset in file.
+ * @param blockSz Block size.
+ * @param lastModified Log file last modified timestamp.
+ */
+ public VisorFileBlockArg(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(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(VisorFileBlockArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java
----------------------------------------------------------------------
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
index 58a25ee..298c14e 100644
--- 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
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor.file;
import java.io.File;
import java.io.IOException;
-import java.io.Serializable;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.NoSuchFileException;
@@ -36,8 +35,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.readBlock;
* Task to read file block.
*/
@GridInternal
-public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.VisorFileBlockArg,
- IgniteBiTuple<? extends IOException, VisorFileBlock>> {
+public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockArg, VisorFileBlockTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -47,49 +45,10 @@ public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.Viso
}
/**
- * Arguments for {@link VisorFileBlockTask}
- */
- @SuppressWarnings("PublicInnerClass")
- public static class VisorFileBlockArg implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Log file path. */
- private final String path;
-
- /** Log file offset. */
- private final long off;
-
- /** Block size. */
- private final int blockSz;
-
- /** Log file last modified timestamp. */
- private final long lastModified;
-
- /**
- * @param path Log file path.
- * @param off Offset in file.
- * @param blockSz Block size.
- * @param lastModified Log file last modified timestamp.
- */
- public VisorFileBlockArg(String path, long off, int blockSz, long lastModified) {
- this.path = path;
- this.off = off;
- this.blockSz = blockSz;
- this.lastModified = lastModified;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorFileBlockArg.class, this);
- }
- }
-
- /**
* Job that read file block on node.
*/
private static class VisorFileBlockJob
- extends VisorJob<VisorFileBlockArg, IgniteBiTuple<? extends IOException, VisorFileBlock>> {
+ extends VisorJob<VisorFileBlockArg, VisorFileBlockTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -102,22 +61,25 @@ public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.Viso
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<? extends IOException, VisorFileBlock> run(VisorFileBlockArg arg) {
+ @Override protected VisorFileBlockTaskResult run(VisorFileBlockArg arg) {
try {
- URL url = U.resolveIgniteUrl(arg.path);
+ URL url = U.resolveIgniteUrl(arg.getPath());
if (url == null)
- return new IgniteBiTuple<>(new NoSuchFileException("File path not found: " + arg.path), null);
+ return new VisorFileBlockTaskResult(
+ new NoSuchFileException("File path not found: " + arg.getPath()), null);
- VisorFileBlock block = readBlock(new File(url.toURI()), arg.off, arg.blockSz, arg.lastModified);
+ VisorFileBlock block = readBlock(
+ new File(url.toURI()), arg.getOffset(), arg.getBlockSize(), arg.getLastModified());
- return new IgniteBiTuple<>(null, block);
+ return new VisorFileBlockTaskResult(null, block);
}
catch (IOException e) {
- return new IgniteBiTuple<>(e, null);
+ return new VisorFileBlockTaskResult(e, null);
}
catch (URISyntaxException ignored) {
- return new IgniteBiTuple<>(new NoSuchFileException("File path not found: " + arg.path), null);
+ return new VisorFileBlockTaskResult(
+ new NoSuchFileException("File path not found: " + arg.getPath()), null);
}
}
@@ -126,4 +88,4 @@ public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.Viso
return S.toString(VisorFileBlockJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..049a4f4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTaskResult.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.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(ObjectInput in) throws IOException, ClassNotFoundException {
+ ex = (IOException)in.readObject();
+ block = (VisorFileBlock)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorFileBlockTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
----------------------------------------------------------------------
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
index 55d358c..6563ad7 100644
--- 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
@@ -38,19 +38,19 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.matchedFiles;
* Get list files matching filter.
*/
@GridInternal
-public class VisorLatestTextFilesTask extends VisorOneNodeTask<IgniteBiTuple<String, String>, Collection<VisorLogFile>> {
+public class VisorLatestTextFilesTask extends VisorOneNodeTask<VisorLatestTextFilesTaskArg, Collection<VisorLogFile>> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorLatestTextFilesJob job(IgniteBiTuple<String, String> arg) {
+ @Override protected VisorLatestTextFilesJob job(VisorLatestTextFilesTaskArg arg) {
return new VisorLatestTextFilesJob(arg, debug);
}
/**
* Job that gets list of files.
*/
- private static class VisorLatestTextFilesJob extends VisorJob<IgniteBiTuple<String, String>, Collection<VisorLogFile>> {
+ private static class VisorLatestTextFilesJob extends VisorJob<VisorLatestTextFilesTaskArg, Collection<VisorLogFile>> {
/** */
private static final long serialVersionUID = 0L;
@@ -58,14 +58,14 @@ public class VisorLatestTextFilesTask extends VisorOneNodeTask<IgniteBiTuple<Str
* @param arg Folder and regexp.
* @param debug Debug flag.
*/
- private VisorLatestTextFilesJob(IgniteBiTuple<String, String> arg, boolean debug) {
+ private VisorLatestTextFilesJob(VisorLatestTextFilesTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Nullable @Override protected Collection<VisorLogFile> run(final IgniteBiTuple<String, String> arg) {
- String path = arg.get1();
- String regexp = arg.get2();
+ @Nullable @Override protected Collection<VisorLogFile> run(final VisorLatestTextFilesTaskArg arg) {
+ String path = arg.getPath();
+ String regexp = arg.getRegexp();
assert path != null;
assert regexp != null;
@@ -98,4 +98,4 @@ public class VisorLatestTextFilesTask extends VisorOneNodeTask<IgniteBiTuple<Str
return S.toString(VisorLatestTextFilesJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..1667fb2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.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}
+ */
+@SuppressWarnings("PublicInnerClass")
+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(ObjectInput in) throws IOException, ClassNotFoundException {
+ path = U.readString(in);
+ regexp = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorLatestTextFilesTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
----------------------------------------------------------------------
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
index 114d92d..3957881 100644
--- 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
@@ -17,45 +17,50 @@
package org.apache.ignite.internal.visor.igfs;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.igfs.IgfsMode;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * Data transfer object for {@link org.apache.ignite.IgniteFileSystem}.
+ * Data transfer object for {@link IgniteFileSystem}.
*/
-public class VisorIgfs implements Serializable, LessNamingBean {
+public class VisorIgfs extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** IGFS instance name. */
- private final String name;
+ private String name;
/** IGFS instance working mode. */
- private final IgfsMode mode;
+ private IgfsMode mode;
/** IGFS metrics. */
- private final VisorIgfsMetrics metrics;
+ private VisorIgfsMetrics metrics;
/** Whether IGFS has configured secondary file system. */
- private final boolean secondaryFsConfigured;
+ private boolean secondaryFsConfigured;
/**
- * Create data transfer object.
+ * Default constructor.
+ */
+ public VisorIgfs() {
+ // No-op.
+ }
+
+ /**
+ * Create IGFS configuration transfer object.
*
- * @param name IGFS name.
- * @param mode IGFS mode.
+ * @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,
- IgfsMode mode,
- VisorIgfsMetrics metrics,
- boolean secondaryFsConfigured
- ) {
+ public VisorIgfs(String name, IgfsMode mode, VisorIgfsMetrics metrics, boolean secondaryFsConfigured) {
this.name = name;
this.mode = mode;
this.metrics = metrics;
@@ -63,49 +68,64 @@ public class VisorIgfs implements Serializable, LessNamingBean {
}
/**
+ * Create data transfer object.
+ *
* @param igfs Source IGFS.
- * @return Data transfer object for given IGFS.
*/
- public static VisorIgfs from(IgniteFileSystem igfs) {
+ public VisorIgfs(IgniteFileSystem igfs) {
assert igfs != null;
- return new VisorIgfs(
- igfs.name(),
- igfs.configuration().getDefaultMode(),
- VisorIgfsMetrics.from(igfs),
- igfs.configuration().getSecondaryFileSystem() != null
- );
+ name = igfs.name();
+ mode = igfs.configuration().getDefaultMode();
+ metrics = new VisorIgfsMetrics(igfs);
+ secondaryFsConfigured = igfs.configuration().getSecondaryFileSystem() != null;
}
/**
* @return IGFS instance name.
*/
- public String name() {
+ public String getName() {
return name;
}
/**
* @return IGFS instance working mode.
*/
- public IgfsMode mode() {
+ public IgfsMode getMode() {
return mode;
}
/**
* @return IGFS metrics.
*/
- public VisorIgfsMetrics metrics() {
+ public VisorIgfsMetrics getMetrics() {
return metrics;
}
/**
* @return Whether IGFS has configured secondary file system.
*/
- public boolean secondaryFileSystemConfigured() {
+ 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ mode = IgfsMode.fromOrdinal(in.readByte());
+ metrics = (VisorIgfsMetrics)in.readObject();
+ secondaryFsConfigured = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorIgfs.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
----------------------------------------------------------------------
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
index 8ddd883..d068abf 100644
--- 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
@@ -17,43 +17,51 @@
package org.apache.ignite.internal.visor.igfs;
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+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.
*/
-public class VisorIgfsEndpoint implements Serializable, LessNamingBean {
+public class VisorIgfsEndpoint extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** IGFS name. */
- private final String igfsName;
+ private String igfsName;
- /** Ignite instance name. */
- private final String igniteInstanceName;
+ /** Grid name. */
+ private String gridName;
/** Host address / name. */
- private final String hostName;
+ private String hostName;
/** Port number. */
- private final int port;
+ private int port;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsEndpoint() {
+ // No-op.
+ }
/**
* Create IGFS endpoint descriptor with given parameters.
*
* @param igfsName IGFS name.
- * @param igniteInstanceName Ignite instance name.
+ * @param gridName Grid name.
* @param hostName Host address / name.
* @param port Port number.
*/
- public VisorIgfsEndpoint(
- @Nullable String igfsName, String igniteInstanceName, @Nullable String hostName, int port
- ) {
+ public VisorIgfsEndpoint(@Nullable String igfsName, String gridName, @Nullable String hostName, int port) {
this.igfsName = igfsName;
- this.igniteInstanceName = igniteInstanceName;
+ this.gridName = gridName;
this.hostName = hostName;
this.port = port;
}
@@ -61,45 +69,61 @@ public class VisorIgfsEndpoint implements Serializable, LessNamingBean {
/**
* @return IGFS name.
*/
- @Nullable public String igfsName() {
+ @Nullable public String getIgfsName() {
return igfsName;
}
/**
- * @return Ignite instance name.
+ * @return Grid name.
*/
- public String igniteInstanceName() {
- return igniteInstanceName;
+ public String getGridName() {
+ return gridName;
}
/**
* @return Host address / name.
*/
- @Nullable public String hostName() {
+ @Nullable public String getHostName() {
return hostName;
}
/**
* @return Port number.
*/
- public int port() {
+ public int getPort() {
return port;
}
/**
* @return URI Authority
*/
- public String authority() {
+ public String getAuthority() {
String addr = hostName + ":" + port;
- if (igfsName == null && igniteInstanceName == null)
+ if (igfsName == null && gridName == null)
return addr;
else if (igfsName == null)
- return igniteInstanceName + "@" + addr;
- else if (igniteInstanceName == null)
+ return gridName + "@" + addr;
+ else if (gridName == null)
return igfsName + "@" + addr;
else
- return igfsName + ":" + igniteInstanceName + "@" + addr;
+ 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ igfsName = U.readString(in);
+ gridName = U.readString(in);
+ hostName = U.readString(in);
+ port = in.readInt();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
----------------------------------------------------------------------
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
index 58acee1..49a6bdd 100644
--- 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
@@ -17,16 +17,18 @@
package org.apache.ignite.internal.visor.igfs;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.igfs.IgfsMetrics;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for {@link IgfsMetrics}.
*/
-public class VisorIgfsMetrics implements Serializable, LessNamingBean {
+public class VisorIgfsMetrics extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -73,32 +75,36 @@ public class VisorIgfsMetrics implements Serializable, LessNamingBean {
private long bytesWrtTm;
/**
+ * Create data transfer object for given IGFS metrics.
+ */
+ public VisorIgfsMetrics() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for given IGFS metrics.
+ *
* @param igfs Source IGFS.
- * @return Data transfer object for given IGFS metrics.
*/
- public static VisorIgfsMetrics from(IgniteFileSystem igfs) {
+ public VisorIgfsMetrics(IgniteFileSystem igfs) {
assert igfs != null;
IgfsMetrics m = igfs.metrics();
- VisorIgfsMetrics metrics = new VisorIgfsMetrics();
-
- metrics.totalSpaceSz = igfs.configuration().getMaxSpaceSize();
- metrics.usedSpaceSz = m.localSpaceSize();
- metrics.foldersCnt = m.directoriesCount();
- metrics.filesCnt = m.filesCount();
- metrics.filesOpenedForRd = m.filesOpenedForRead();
- metrics.filesOpenedForWrt = m.filesOpenedForWrite();
- metrics.blocksRd = m.blocksReadTotal();
- metrics.blocksRdRmt = m.blocksReadRemote();
- metrics.blocksWrt = m.blocksWrittenTotal();
- metrics.blocksWrtRmt = m.blocksWrittenRemote();
- metrics.bytesRd = m.bytesRead();
- metrics.bytesRdTm = m.bytesReadTime();
- metrics.bytesWrt = m.bytesWritten();
- metrics.bytesWrtTm = m.bytesWriteTime();
-
- return metrics;
+ totalSpaceSz = igfs.configuration().getMaxSpaceSize();
+ usedSpaceSz = m.localSpaceSize();
+ foldersCnt = m.directoriesCount();
+ filesCnt = m.filesCount();
+ filesOpenedForRd = m.filesOpenedForRead();
+ filesOpenedForWrt = m.filesOpenedForWrite();
+ blocksRd = m.blocksReadTotal();
+ blocksRdRmt = m.blocksReadRemote();
+ blocksWrt = m.blocksWrittenTotal();
+ blocksWrtRmt = m.blocksWrittenRemote();
+ bytesRd = m.bytesRead();
+ bytesRdTm = m.bytesReadTime();
+ bytesWrt = m.bytesWritten();
+ bytesWrtTm = m.bytesWriteTime();
}
/**
@@ -146,109 +152,145 @@ public class VisorIgfsMetrics implements Serializable, LessNamingBean {
/**
* @return Maximum amount of data that can be stored on local node.
*/
- public long totalSpaceSize() {
+ public long getTotalSpaceSize() {
return totalSpaceSz;
}
/**
* @return Local used space in bytes on local node.
*/
- public long usedSpaceSize() {
+ public long getUsedSpaceSize() {
return usedSpaceSz;
}
/**
* @return Local free space in bytes on local node.
*/
- public long freeSpaceSize() {
+ public long getFreeSpaceSize() {
return totalSpaceSz - usedSpaceSz;
}
/**
* @return Number of directories created in file system.
*/
- public int foldersCount() {
+ public int getFoldersCount() {
return foldersCnt;
}
/**
* @return Number of files stored in file system.
*/
- public int filesCount() {
+ public int getFilesCount() {
return filesCnt;
}
/**
* @return Number of files that are currently opened for reading on local node.
*/
- public int filesOpenedForRead() {
+ public int getFilesOpenedForRead() {
return filesOpenedForRd;
}
/**
* @return Number of files that are currently opened for writing on local node.
*/
- public int filesOpenedForWrite() {
+ public int getFilesOpenedForWrite() {
return filesOpenedForWrt;
}
/**
* @return Total blocks read, local and remote.
*/
- public long blocksRead() {
+ public long getBlocksRead() {
return blocksRd;
}
/**
* @return Total remote blocks read.
*/
- public long blocksReadRemote() {
+ public long getBlocksReadRemote() {
return blocksRdRmt;
}
/**
* @return Total blocks write, local and remote.
*/
- public long blocksWritten() {
+ public long getBlocksWritten() {
return blocksWrt;
}
/**
* @return Total remote blocks write.
*/
- public long blocksWrittenRemote() {
+ public long getBlocksWrittenRemote() {
return blocksWrtRmt;
}
/**
* @return Total bytes read.
*/
- public long bytesRead() {
+ public long getBytesRead() {
return bytesRd;
}
/**
* @return Total bytes read time.
*/
- public long bytesReadTime() {
+ public long getBytesReadTime() {
return bytesRdTm;
}
/**
* @return Total bytes write.
*/
- public long bytesWritten() {
+ public long getBytesWritten() {
return bytesWrt;
}
/**
* @return Total bytes write time.
*/
- public long bytesWriteTime() {
+ 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(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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java
----------------------------------------------------------------------
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
index 06460d5..e6b40fa 100644
--- 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
@@ -44,7 +44,7 @@ public class VisorIgfsProfiler {
if (entries.size() == 1)
return entries.get(0); // No need to aggregate.
else {
- String path = entries.get(0).path();
+ String path = entries.get(0).getPath();
Collections.sort(entries, VisorIgfsProfilerEntry.ENTRY_TIMESTAMP_COMPARATOR);
@@ -61,23 +61,23 @@ public class VisorIgfsProfiler {
for (VisorIgfsProfilerEntry entry : entries) {
// Take last timestamp.
- ts = entry.timestamp();
+ ts = entry.getTimestamp();
// Take last size.
- size = entry.size();
+ size = entry.getSize();
// Take last mode.
- mode = entry.mode();
+ mode = entry.getMode();
// Aggregate metrics.
- bytesRead += entry.bytesRead();
- readTime += entry.readTime();
- userReadTime += entry.userReadTime();
- bytesWritten += entry.bytesWritten();
- writeTime += entry.writeTime();
- userWriteTime += entry.userWriteTime();
+ bytesRead += entry.getBytesRead();
+ readTime += entry.getReadTime();
+ userReadTime += entry.getUserReadTime();
+ bytesWritten += entry.getBytesWritten();
+ writeTime += entry.getWriteTime();
+ userWriteTime += entry.getUserWriteTime();
- counters.aggregate(entry.counters());
+ counters.aggregate(entry.getCounters());
}
return new VisorIgfsProfilerEntry(path, ts, mode, size, bytesRead, readTime, userReadTime,
@@ -85,4 +85,4 @@ public class VisorIgfsProfiler {
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
----------------------------------------------------------------------
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
index ba805c1..b8bfe9e 100644
--- 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
@@ -32,7 +32,6 @@ 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 org.apache.ignite.lang.IgniteBiTuple;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsProfilerLogsDir;
@@ -40,14 +39,14 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsPr
* Remove all IGFS profiler logs.
*/
@GridInternal
-public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteBiTuple<Integer, Integer>> {
+public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, VisorIgfsProfilerClearTaskResult> {
/** */
private static final long serialVersionUID = 0L;
/**
* Job to clear profiler logs.
*/
- private static class VisorIgfsProfilerClearJob extends VisorJob<String, IgniteBiTuple<Integer, Integer>> {
+ private static class VisorIgfsProfilerClearJob extends VisorJob<String, VisorIgfsProfilerClearTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -62,7 +61,7 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteB
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<Integer, Integer> run(String arg) {
+ @Override protected VisorIgfsProfilerClearTaskResult run(String arg) {
int deleted = 0;
int notDeleted = 0;
@@ -106,7 +105,7 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteB
throw U.convertException(e);
}
- return new IgniteBiTuple<>(deleted, notDeleted);
+ return new VisorIgfsProfilerClearTaskResult(deleted, notDeleted);
}
/** {@inheritDoc} */
@@ -119,4 +118,4 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteB
@Override protected VisorIgfsProfilerClearJob job(String arg) {
return new VisorIgfsProfilerClearJob(arg, debug);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..2320228
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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}.
+ */
+public class VisorIgfsProfilerClearTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Count of deleted files. */
+ private Integer deleted;
+
+ /** Count of not deleted files. */
+ private Integer notDeleted;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsProfilerClearTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param deleted Count of deleted files.
+ * @param notDeleted Count of not deleted files.
+ */
+ public VisorIgfsProfilerClearTaskResult(Integer deleted, Integer 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ deleted = in.readInt();
+ notDeleted = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsProfilerClearTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
----------------------------------------------------------------------
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
index b157296..e7ce1a3 100644
--- 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
@@ -17,16 +17,19 @@
package org.apache.ignite.internal.visor.igfs;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Comparator;
import org.apache.ignite.igfs.IgfsMode;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Visor IGFS profiler information about one file.
*/
-public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
+public class VisorIgfsProfilerEntry extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -39,46 +42,53 @@ public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
};
/** Path to file. */
- private final String path;
+ private String path;
/** Timestamp of last file operation. */
- private final long ts;
+ private long ts;
/** IGFS mode. */
- private final IgfsMode mode;
+ private IgfsMode mode;
/** File size. */
- private final long size;
+ private long size;
/** How many bytes were read. */
- private final long bytesRead;
+ private long bytesRead;
/** How long read take. */
- private final long readTime;
+ private long readTime;
/** User read time. */
- private final long userReadTime;
+ private long userReadTime;
/** How many bytes were written. */
- private final long bytesWritten;
+ private long bytesWritten;
/** How long write take. */
- private final long writeTime;
+ private long writeTime;
/** User write read time. */
- private final long userWriteTime;
+ private long userWriteTime;
/** Calculated uniformity. */
private double uniformity = -1;
/** Counters for uniformity calculation. */
- private final VisorIgfsProfilerUniformityCounters counters;
+ private VisorIgfsProfilerUniformityCounters counters;
/** Read speed in bytes per second or {@code -1} if speed not available. */
- private final long readSpeed;
+ private long readSpeed;
/** Write speed in bytes per second or {@code -1} if speed not available. */
- private final long writeSpeed;
+ private long writeSpeed;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsProfilerEntry() {
+ // No-op.
+ }
/** Create data transfer object with given parameters. */
public VisorIgfsProfilerEntry(
@@ -133,77 +143,77 @@ public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
/**
* @return Path to file.
*/
- public String path() {
+ public String getPath() {
return path;
}
/**
* @return Timestamp of last file operation.
*/
- public long timestamp() {
+ public long getTimestamp() {
return ts;
}
/**
* @return IGFS mode.
*/
- public IgfsMode mode() {
+ public IgfsMode getMode() {
return mode;
}
/**
* @return File size.
*/
- public long size() {
+ public long getSize() {
return size;
}
/**
* @return How many bytes were read.
*/
- public long bytesRead() {
+ public long getBytesRead() {
return bytesRead;
}
/**
* @return How long read take.
*/
- public long readTime() {
+ public long getReadTime() {
return readTime;
}
/**
* @return User read time.
*/
- public long userReadTime() {
+ public long getUserReadTime() {
return userReadTime;
}
/**
* @return How many bytes were written.
*/
- public long bytesWritten() {
+ public long getBytesWritten() {
return bytesWritten;
}
/**
* @return How long write take.
*/
- public long writeTime() {
+ public long getWriteTime() {
return writeTime;
}
/**
* @return User write read time.
*/
- public long userWriteTime() {
+ public long getUserWriteTime() {
return userWriteTime;
}
/**
* @return Calculated uniformity.
*/
- public double uniformity() {
+ public double getUniformity() {
if (uniformity < 0)
uniformity = counters.calc();
@@ -213,25 +223,61 @@ public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
/**
* @return Counters for uniformity calculation.
*/
- public VisorIgfsProfilerUniformityCounters counters() {
+ public VisorIgfsProfilerUniformityCounters getCounters() {
return counters;
}
/**
* @return Read speed in bytes per second or {@code -1} if speed not available.
*/
- public long readSpeed() {
+ public long getReadSpeed() {
return readSpeed;
}
/**
* @return Write speed in bytes per second or {@code -1} if speed not available.
*/
- public long writeSpeed() {
+ 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ path = U.readString(in);
+ ts = in.readLong();
+ mode = IgfsMode.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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
----------------------------------------------------------------------
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
index d57d7f9..bd17733 100644
--- 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
@@ -203,8 +203,8 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
if (logsDir != null)
return parse(logsDir, arg);
- else
- return Collections.emptyList();
+
+ return Collections.emptyList();
}
catch (IOException | IllegalArgumentException e) {
throw new IgniteException("Failed to parse profiler logs for IGFS: " + arg, e);
@@ -481,12 +481,12 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
Map<String, List<VisorIgfsProfilerEntry>> byPath = new HashMap<>();
for (VisorIgfsProfilerEntry entry : entries) {
- List<VisorIgfsProfilerEntry> grp = byPath.get(entry.path());
+ List<VisorIgfsProfilerEntry> grp = byPath.get(entry.getPath());
if (grp == null) {
grp = new ArrayList<>();
- byPath.put(entry.path(), grp);
+ byPath.put(entry.getPath(), grp);
}
grp.add(entry);
@@ -541,4 +541,4 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
@Override protected VisorIgfsProfilerJob job(String arg) {
return new VisorIgfsProfilerJob(arg, debug);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
----------------------------------------------------------------------
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
index 9184ce3..8ab4f1f 100644
--- 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
@@ -17,10 +17,14 @@
package org.apache.ignite.internal.visor.igfs;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
-import org.apache.ignite.internal.LessNamingBean;
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;
@@ -32,7 +36,7 @@ import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY
* </p>
* Count read frequency for each file and compare with ideal uniform distribution.
*/
-public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNamingBean {
+public class VisorIgfsProfilerUniformityCounters extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -43,7 +47,14 @@ public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNa
private long blockSize = UNIFORMITY_DFLT_BLOCK_SIZE;
/** Collection of calculated counters. */
- private final ArrayList<Integer> counters = new ArrayList<>();
+ private ArrayList<Integer> counters = new ArrayList<>();
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsProfilerUniformityCounters() {
+ // No-op.
+ }
/**
* Calculate block size.
@@ -199,4 +210,23 @@ public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNa
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(ObjectInput in) throws IOException, ClassNotFoundException {
+ fileSize = in.readLong();
+ blockSize = in.readLong();
+ counters = (ArrayList<Integer>)U.readIntList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsProfilerUniformityCounters.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java
----------------------------------------------------------------------
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
index 62d93d4..68a11e7 100644
--- 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
@@ -31,14 +31,14 @@ import org.apache.ignite.lang.IgniteBiTuple;
* Task to set IGFS instance sampling state.
*/
@GridInternal
-public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<IgniteBiTuple<String, Boolean>, Void> {
+public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<VisorIgfsSamplingStateTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
/**
* Job that perform parsing of IGFS profiler logs.
*/
- private static class VisorIgfsSamplingStateJob extends VisorJob<IgniteBiTuple<String, Boolean>, Void> {
+ private static class VisorIgfsSamplingStateJob extends VisorJob<VisorIgfsSamplingStateTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -48,19 +48,19 @@ public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<IgniteBiTuple<S
* @param arg Job argument.
* @param debug Debug flag.
*/
- private VisorIgfsSamplingStateJob(IgniteBiTuple<String, Boolean> arg, boolean debug) {
+ private VisorIgfsSamplingStateJob(VisorIgfsSamplingStateTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(IgniteBiTuple<String, Boolean> arg) {
+ @Override protected Void run(VisorIgfsSamplingStateTaskArg arg) {
try {
- ((IgfsEx)ignite.fileSystem(arg.get1())).globalSampling(arg.get2());
+ ((IgfsEx)ignite.fileSystem(arg.getName())).globalSampling(arg.isEnabled());
return null;
}
catch (IllegalArgumentException iae) {
- throw new IgniteException("Failed to set sampling state for IGFS: " + arg.get1(), iae);
+ throw new IgniteException("Failed to set sampling state for IGFS: " + arg.getName(), iae);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -74,7 +74,7 @@ public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<IgniteBiTuple<S
}
/** {@inheritDoc} */
- @Override protected VisorIgfsSamplingStateJob job(IgniteBiTuple<String, Boolean> arg) {
+ @Override protected VisorIgfsSamplingStateJob job(VisorIgfsSamplingStateTaskArg arg) {
return new VisorIgfsSamplingStateJob(arg, debug);
}
-}
\ No newline at end of file
+}
[2/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
----------------------------------------------------------------------
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
index bd59690..510129b 100644
--- 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
@@ -17,15 +17,17 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
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.lang.IgniteBiTuple;
import org.apache.ignite.spi.IgniteSpi;
import org.apache.ignite.spi.IgniteSpiConfiguration;
@@ -36,39 +38,43 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject
/**
* Data transfer object for node SPIs configuration properties.
*/
-public class VisorSpisConfiguration implements Serializable, LessNamingBean {
+public class VisorSpisConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Discovery SPI. */
- private IgniteBiTuple<String, Map<String, Object>> discoSpi;
+ private VisorSpiDescription discoSpi;
/** Communication SPI. */
- private IgniteBiTuple<String, Map<String, Object>> commSpi;
+ private VisorSpiDescription commSpi;
/** Event storage SPI. */
- private IgniteBiTuple<String, Map<String, Object>> evtSpi;
+ private VisorSpiDescription evtSpi;
/** Collision SPI. */
- private IgniteBiTuple<String, Map<String, Object>> colSpi;
+ private VisorSpiDescription colSpi;
/** Deployment SPI. */
- private IgniteBiTuple<String, Map<String, Object>> deploySpi;
+ private VisorSpiDescription deploySpi;
/** Checkpoint SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] cpSpis;
+ private VisorSpiDescription[] cpSpis;
/** Failover SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] failSpis;
+ private VisorSpiDescription[] failSpis;
/** Load balancing SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] loadBalancingSpis;
-
- /** Swap space SPIs. */
- private IgniteBiTuple<String, Map<String, Object>> swapSpaceSpis;
+ private VisorSpiDescription[] loadBalancingSpis;
/** Indexing SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] indexingSpis;
+ private VisorSpiDescription[] indexingSpis;
+
+ /**
+ * Default constructor.
+ */
+ public VisorSpisConfiguration() {
+ // No-op.
+ }
/**
* Collects SPI information based on GridSpiConfiguration-annotated methods.
@@ -77,7 +83,7 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
* @param spi SPI to collect information on.
* @return Tuple where first component is SPI name and map with properties as second.
*/
- private static IgniteBiTuple<String, Map<String, Object>> collectSpiInfo(IgniteSpi spi) {
+ private static VisorSpiDescription collectSpiInfo(IgniteSpi spi) {
Class<? extends IgniteSpi> spiCls = spi.getClass();
HashMap<String, Object> res = new HashMap<>();
@@ -123,114 +129,129 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
}
}
- return new IgniteBiTuple<String, Map<String, Object>>(spi.getName(), res);
+ 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 IgniteBiTuple<String, Map<String, Object>>[] collectSpiInfo(IgniteSpi[] spis) {
- IgniteBiTuple[] res = new IgniteBiTuple[spis.length];
+ 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 (IgniteBiTuple<String, Map<String, Object>>[])res;
+ return res;
}
/**
+ * Create data transfer object for node SPIs configuration properties.
+ *
* @param c Grid configuration.
- * @return Data transfer object for node SPIs configuration properties.
*/
- public static VisorSpisConfiguration from(IgniteConfiguration c) {
- VisorSpisConfiguration cfg = new VisorSpisConfiguration();
-
- cfg.discoSpi = collectSpiInfo(c.getDiscoverySpi());
- cfg.commSpi = collectSpiInfo(c.getCommunicationSpi());
- cfg.evtSpi = collectSpiInfo(c.getEventStorageSpi());
- cfg.colSpi = collectSpiInfo(c.getCollisionSpi());
- cfg.deploySpi = collectSpiInfo(c.getDeploymentSpi());
- cfg.cpSpis = collectSpiInfo(c.getCheckpointSpi());
- cfg.failSpis = collectSpiInfo(c.getFailoverSpi());
- cfg.loadBalancingSpis = collectSpiInfo(c.getLoadBalancingSpi());
- cfg.swapSpaceSpis = collectSpiInfo(c.getSwapSpaceSpi());
- cfg.indexingSpis = F.asArray(collectSpiInfo(c.getIndexingSpi()));
-
- return cfg;
+ 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 IgniteBiTuple<String, Map<String, Object>> discoverySpi() {
+ public VisorSpiDescription getDiscoverySpi() {
return discoSpi;
}
/**
* @return Communication SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> communicationSpi() {
+ public VisorSpiDescription getCommunicationSpi() {
return commSpi;
}
/**
* @return Event storage SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> eventStorageSpi() {
+ public VisorSpiDescription getEventStorageSpi() {
return evtSpi;
}
/**
* @return Collision SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> collisionSpi() {
+ public VisorSpiDescription getCollisionSpi() {
return colSpi;
}
/**
* @return Deployment SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> deploymentSpi() {
+ public VisorSpiDescription getDeploymentSpi() {
return deploySpi;
}
/**
* @return Checkpoint SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] checkpointSpis() {
+ public VisorSpiDescription[] getCheckpointSpis() {
return cpSpis;
}
/**
* @return Failover SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] failoverSpis() {
+ public VisorSpiDescription[] getFailoverSpis() {
return failSpis;
}
/**
* @return Load balancing SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] loadBalancingSpis() {
+ public VisorSpiDescription[] getLoadBalancingSpis() {
return loadBalancingSpis;
}
/**
- * @return Swap space SPIs.
- */
- public IgniteBiTuple<String, Map<String, Object>> swapSpaceSpi() {
- return swapSpaceSpis;
- }
-
- /**
* @return Indexing SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] indexingSpis() {
+ 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(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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..32f5644
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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(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} */
+ public String toString() {
+ return S.toString(VisorSuppressedError.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
----------------------------------------------------------------------
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
index 6855c43..063e754 100644
--- 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
@@ -17,28 +17,33 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.TransactionConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.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 implements Serializable, LessNamingBean {
+public class VisorTransactionConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Default cache concurrency. */
- private TransactionConcurrency dfltTxConcurrency;
+ private TransactionConcurrency dfltConcurrency;
/** Default transaction isolation. */
- private TransactionIsolation dfltTxIsolation;
+ private TransactionIsolation dfltIsolation;
/** Default transaction timeout. */
- private long dfltTxTimeout;
+ private long dfltTimeout;
/** Pessimistic tx log linger. */
private int pessimisticTxLogLinger;
@@ -46,53 +51,62 @@ public class VisorTransactionConfiguration implements Serializable, LessNamingBe
/** Pessimistic tx log size. */
private int pessimisticTxLogSize;
- /** Default transaction serializable flag. */
- private boolean txSerEnabled;
+ /** Transaction manager factory. */
+ private String txMgrFactory;
/**
- * Create data transfer object for transaction configuration.
- *
- * @param src Transaction configuration.
- * @return Data transfer object.
+ * Default constructor.
*/
- public static VisorTransactionConfiguration from(TransactionConfiguration src) {
- VisorTransactionConfiguration cfg = new VisorTransactionConfiguration();
+ public VisorTransactionConfiguration() {
+ // No-op.
+ }
- cfg.dfltTxConcurrency = src.getDefaultTxConcurrency();
- cfg.dfltTxIsolation = src.getDefaultTxIsolation();
- cfg.dfltTxTimeout = src.getDefaultTxTimeout();
- cfg.pessimisticTxLogLinger = src.getPessimisticTxLogLinger();
- cfg.pessimisticTxLogSize = src.getPessimisticTxLogSize();
- cfg.txSerEnabled = src.isTxSerializableEnabled();
+ /**
+ * Whether to use JTA {@code javax.transaction.Synchronization}
+ * instead of {@code javax.transaction.xa.XAResource}.
+ */
+ private boolean useJtaSync;
- return cfg;
+ /**
+ * 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 defaultTxConcurrency() {
- return dfltTxConcurrency;
+ public TransactionConcurrency getDefaultTxConcurrency() {
+ return dfltConcurrency;
}
/**
* @return Default cache transaction isolation.
*/
- public TransactionIsolation defaultTxIsolation() {
- return dfltTxIsolation;
+ public TransactionIsolation getDefaultTxIsolation() {
+ return dfltIsolation;
}
/**
* @return Default transaction timeout.
*/
- public long defaultTxTimeout() {
- return dfltTxTimeout;
+ public long getDefaultTxTimeout() {
+ return dfltTimeout;
}
/**
* @return Pessimistic log cleanup delay in milliseconds.
*/
- public int pessimisticTxLogLinger() {
+ public int getPessimisticTxLogLinger() {
return pessimisticTxLogLinger;
}
@@ -104,10 +118,38 @@ public class VisorTransactionConfiguration implements Serializable, LessNamingBe
}
/**
- * @return {@code True} if serializable transactions are enabled, {@code false} otherwise.
+ * @return Transaction manager factory.
*/
- public boolean txSerializableEnabled() {
- return txSerEnabled;
+ 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(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} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
index 00587b4..934c0c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
@@ -17,32 +17,44 @@
package org.apache.ignite.internal.visor.query;
-import java.io.Serializable;
+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 VisorQueryArg implements Serializable {
+public class VisorQueryArg extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Cache name for query. */
- private final String cacheName;
+ private String cacheName;
/** Query text. */
- private final String qryTxt;
+ private String qryTxt;
/** Distributed joins enabled flag. */
- private final boolean distributedJoins;
+ private boolean distributedJoins;
/** Enforce join order flag. */
- private final boolean enforceJoinOrder;
+ private boolean enforceJoinOrder;
/** Flag whether to execute query locally. */
- private final boolean loc;
+ private boolean loc;
/** Result batch size. */
- private final int pageSize;
+ private int pageSize;
+
+ /**
+ * Default constructor.
+ */
+ public VisorQueryArg() {
+ // No-op.
+ }
/**
* @param cacheName Cache name for query.
@@ -65,42 +77,67 @@ public class VisorQueryArg implements Serializable {
/**
* @return Cache name.
*/
- public String cacheName() {
+ public String getCacheName() {
return cacheName;
}
/**
* @return Query txt.
*/
- public String queryText() {
+ public String getQueryText() {
return qryTxt;
}
/**
* @return Distributed joins enabled flag.
*/
- public boolean distributedJoins() {
+ public boolean isDistributedJoins() {
return distributedJoins;
}
/**
* @return Enforce join order flag.
*/
- public boolean enforceJoinOrder() {
+ public boolean isEnforceJoinOrder() {
return enforceJoinOrder;
}
/**
* @return {@code true} if query should be executed locally.
*/
- public boolean local() {
+ public boolean isLocal() {
return loc;
}
/**
* @return Page size.
*/
- public int pageSize() {
+ public int getPageSize() {
return pageSize;
}
+
+ /** {@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);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(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();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorQueryArg.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
----------------------------------------------------------------------
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
index 18b0d71..b91a8b3 100644
--- 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
@@ -17,15 +17,18 @@
package org.apache.ignite.internal.visor.query;
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+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 implements Serializable, LessNamingBean {
+public class VisorQueryField extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -42,6 +45,13 @@ public class VisorQueryField implements Serializable, LessNamingBean {
private String fieldTypeName;
/**
+ * Default constructor.
+ */
+ public VisorQueryField() {
+ // No-op.
+ }
+
+ /**
* Create data transfer object with given parameters.
*
* @param schemaName Schema name.
@@ -59,28 +69,28 @@ public class VisorQueryField implements Serializable, LessNamingBean {
/**
* @return Schema name.
*/
- public String schemaName() {
+ public String getSchemaName() {
return schemaName;
}
/**
* @return Type name.
*/
- public String typeName() {
+ public String getTypeName() {
return typeName;
}
/**
* @return Field name.
*/
- public String fieldName() {
+ public String getFieldName() {
return fieldName;
}
/**
* @return Field type name.
*/
- public String fieldTypeName() {
+ public String getFieldTypeName() {
return fieldTypeName;
}
@@ -88,7 +98,7 @@ public class VisorQueryField implements Serializable, LessNamingBean {
* @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 fullName(boolean schema) {
+ public String getFullName(boolean schema) {
if (!F.isEmpty(typeName)) {
if (schema && !F.isEmpty(schemaName))
return schemaName + "." + typeName + "." + fieldName;
@@ -100,6 +110,22 @@ public class VisorQueryField implements Serializable, LessNamingBean {
}
/** {@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(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);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index 2a5905e..7f1adac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -38,7 +38,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
import org.apache.ignite.lang.IgniteBiPredicate;
-import org.apache.ignite.lang.IgniteBiTuple;
import static org.apache.ignite.internal.visor.query.VisorQueryUtils.RMV_DELAY;
import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_CACHE_WITH_FILTER;
@@ -53,7 +52,7 @@ import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchSqlQue
/**
* Job for execute SCAN or SQL query and get first page of results.
*/
-public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
+public class VisorQueryJob extends VisorJob<VisorQueryArg, VisorQueryTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -87,8 +86,8 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorQueryArg arg,
IgniteBiPredicate<Object, Object> filter) {
ScanQuery<Object, Object> qry = new ScanQuery<>(filter);
- qry.setPageSize(arg.pageSize());
- qry.setLocal(arg.local());
+ qry.setPageSize(arg.getPageSize());
+ qry.setLocal(arg.isLocal());
return c.withKeepBinary().query(qry);
}
@@ -104,11 +103,11 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(final VisorQueryArg arg) {
+ @Override protected VisorQueryTaskResult run(final VisorQueryArg arg) {
try {
UUID nid = ignite.localNode().id();
- String qryTxt = arg.queryText();
+ String qryTxt = arg.getQueryText();
boolean scan = qryTxt == null;
@@ -121,7 +120,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
// Generate query ID to store query cursor in node local storage.
String qryId = (scanAny ? SCAN_QRY_NAME : SQL_QRY_NAME) + "-" + UUID.randomUUID();
- IgniteCache<Object, Object> c = cache(arg.cacheName());
+ IgniteCache<Object, Object> c = cache(arg.getCacheName());
if (scanAny) {
long start = U.currentTimeMillis();
@@ -131,15 +130,16 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
if (scanWithFilter) {
boolean caseSensitive = qryTxt.startsWith(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE);
- String ptrn = qryTxt.substring(
- caseSensitive ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length() : SCAN_CACHE_WITH_FILTER.length());
+ String ptrn = qryTxt.substring(caseSensitive
+ ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length()
+ : SCAN_CACHE_WITH_FILTER.length());
filter = new VisorQueryScanSubstringFilter(caseSensitive, ptrn);
}
VisorQueryCursor<Cache.Entry<Object, Object>> cur = new VisorQueryCursor<>(near ? near(c) : scan(c, arg, filter));
- List<Object[]> rows = fetchScanQueryRows(cur, arg.pageSize());
+ List<Object[]> rows = fetchScanQueryRows(cur, arg.getPageSize());
long duration = U.currentTimeMillis() - start; // Scan duration + fetch duration.
@@ -153,15 +153,15 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
else
cur.close();
- return new IgniteBiTuple<>(null, new VisorQueryResultEx(nid, qryId, SCAN_COL_NAMES, rows, hasNext,
+ return new VisorQueryTaskResult(null, new VisorQueryResultEx(nid, qryId, SCAN_COL_NAMES, rows, hasNext,
duration));
}
else {
- SqlFieldsQuery qry = new SqlFieldsQuery(arg.queryText());
- qry.setPageSize(arg.pageSize());
- qry.setDistributedJoins(arg.distributedJoins());
- qry.setEnforceJoinOrder(arg.enforceJoinOrder());
- qry.setLocal(arg.local());
+ SqlFieldsQuery qry = new SqlFieldsQuery(arg.getQueryText());
+ qry.setPageSize(arg.getPageSize());
+ qry.setLocal(arg.isLocal());
+ qry.setDistributedJoins(arg.isDistributedJoins());
+ qry.setEnforceJoinOrder(arg.isEnforceJoinOrder());
long start = U.currentTimeMillis();
@@ -170,7 +170,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
Collection<GridQueryFieldMetadata> meta = cur.fieldsMeta();
if (meta == null)
- return new IgniteBiTuple<>(
+ return new VisorQueryTaskResult(
new VisorExceptionWrapper(new SQLException("Fail to execute query. No metadata available.")), null);
else {
List<VisorQueryField> names = new ArrayList<>(meta.size());
@@ -179,7 +179,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
names.add(new VisorQueryField(col.schemaName(), col.typeName(),
col.fieldName(), col.fieldTypeName()));
- List<Object[]> rows = fetchSqlQueryRows(cur, arg.pageSize());
+ List<Object[]> rows = fetchSqlQueryRows(cur, arg.getPageSize());
long duration = U.currentTimeMillis() - start; // Query duration + fetch duration.
@@ -193,12 +193,12 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
else
cur.close();
- return new IgniteBiTuple<>(null, new VisorQueryResultEx(nid, qryId, names, rows, hasNext, duration));
+ return new VisorQueryTaskResult(null, new VisorQueryResultEx(nid, qryId, names, rows, hasNext, duration));
}
}
}
catch (Throwable e) {
- return new IgniteBiTuple<>(new VisorExceptionWrapper(e), null);
+ return new VisorQueryTaskResult(new VisorExceptionWrapper(e), null);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java
----------------------------------------------------------------------
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
index 52a167d..277694d 100644
--- 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
@@ -26,25 +26,24 @@ 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 org.apache.ignite.lang.IgniteBiTuple;
/**
* Task for collecting next page previously executed SQL or SCAN query.
*/
@GridInternal
-public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<String, Integer>, VisorQueryResult> {
+public class VisorQueryNextPageTask extends VisorOneNodeTask<VisorQueryNextPageTaskArg, VisorQueryResult> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorQueryNextPageJob job(IgniteBiTuple<String, Integer> arg) {
+ @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<IgniteBiTuple<String, Integer>, VisorQueryResult> {
+ private static class VisorQueryNextPageJob extends VisorJob<VisorQueryNextPageTaskArg, VisorQueryResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -54,13 +53,13 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
* @param arg Job argument.
* @param debug Debug flag.
*/
- private VisorQueryNextPageJob(IgniteBiTuple<String, Integer> arg, boolean debug) {
+ private VisorQueryNextPageJob(VisorQueryNextPageTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected VisorQueryResult run(IgniteBiTuple<String, Integer> arg) {
- return arg.get1().startsWith(VisorQueryUtils.SCAN_QRY_NAME) ? nextScanPage(arg) : nextSqlPage(arg);
+ @Override protected VisorQueryResult run(VisorQueryNextPageTaskArg arg) {
+ return arg.getQueryId().startsWith(VisorQueryUtils.SCAN_QRY_NAME) ? nextScanPage(arg) : nextSqlPage(arg);
}
/**
@@ -69,19 +68,19 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
* @param arg Query name and page size.
* @return Query result with next page.
*/
- private VisorQueryResult nextSqlPage(IgniteBiTuple<String, Integer> arg) {
+ private VisorQueryResult nextSqlPage(VisorQueryNextPageTaskArg arg) {
long start = U.currentTimeMillis();
ConcurrentMap<String, VisorQueryCursor<List<?>>> storage = ignite.cluster().nodeLocalMap();
- String qryId = arg.get1();
+ String qryId = arg.getQueryId();
VisorQueryCursor<List<?>> cur = storage.get(qryId);
if (cur == null)
throw new IgniteException("SQL query results are expired.");
- List<Object[]> nextRows = VisorQueryUtils.fetchSqlQueryRows(cur, arg.get2());
+ List<Object[]> nextRows = VisorQueryUtils.fetchSqlQueryRows(cur, arg.getPageSize());
boolean hasMore = cur.hasNext();
@@ -102,19 +101,19 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
* @param arg Query name and page size.
* @return Next page with data.
*/
- private VisorQueryResult nextScanPage(IgniteBiTuple<String, Integer> arg) {
+ private VisorQueryResult nextScanPage(VisorQueryNextPageTaskArg arg) {
long start = U.currentTimeMillis();
ConcurrentMap<String, VisorQueryCursor<Cache.Entry<Object, Object>>> storage = ignite.cluster().nodeLocalMap();
- String qryId = arg.get1();
+ String qryId = arg.getQueryId();
VisorQueryCursor<Cache.Entry<Object, Object>> cur = storage.get(qryId);
if (cur == null)
throw new IgniteException("Scan query results are expired.");
- List<Object[]> rows = VisorQueryUtils.fetchScanQueryRows(cur, arg.get2());
+ List<Object[]> rows = VisorQueryUtils.fetchScanQueryRows(cur, arg.getPageSize());
boolean hasMore = cur.hasNext();
@@ -134,4 +133,4 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
return S.toString(VisorQueryNextPageJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..7752f5d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ qryId = U.readString(in);
+ pageSize = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorQueryNextPageTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
----------------------------------------------------------------------
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
index 21d1ed7..0fcfa85 100644
--- 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
@@ -17,26 +17,36 @@
package org.apache.ignite.internal.visor.query;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Result for cache query tasks.
*/
-public class VisorQueryResult implements Serializable, LessNamingBean {
+public class VisorQueryResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Rows fetched from query. */
- private final List<Object[]> rows;
+ private List<Object[]> rows;
/** Whether query has more rows to fetch. */
- private final boolean hasMore;
+ private boolean hasMore;
/** Query duration */
- private final long duration;
+ private long duration;
+
+ /**
+ * Default constructor.
+ */
+ public VisorQueryResult() {
+ // No-op.
+ }
/**
* Create task result with given parameters
@@ -54,25 +64,39 @@ public class VisorQueryResult implements Serializable, LessNamingBean {
/**
* @return Rows fetched from query.
*/
- public List<Object[]> rows() {
+ public List<Object[]> getRows() {
return rows;
}
/**
* @return Whether query has more rows to fetch.
*/
- public boolean hasMore() {
+ public boolean isHasMore() {
return hasMore;
}
/**
* @return Duration of next page fetching.
*/
- public long duration() {
+ public long getDuration() {
return duration;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, rows);
+ out.writeBoolean(hasMore);
+ out.writeLong(duration);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ rows = U.readList(in);
+ hasMore = in.readBoolean();
+ duration = in.readLong();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorQueryResult.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
index 218cb36..a7d1ce0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
@@ -17,10 +17,14 @@
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;
/**
* Result for cache query tasks.
@@ -30,13 +34,20 @@ public class VisorQueryResultEx extends VisorQueryResult {
private static final long serialVersionUID = 0L;
/** Node where query executed. */
- private final UUID resNodeId;
+ private UUID resNodeId;
/** Query ID to store in node local. */
- private final String qryId;
+ private String qryId;
/** Query columns descriptors. */
- private final Collection<VisorQueryField> cols;
+ private Collection<VisorQueryField> cols;
+
+ /**
+ * Default constructor.
+ */
+ public VisorQueryResultEx() {
+ // No-op.
+ }
/**
* @param resNodeId Node where query executed.
@@ -64,26 +75,44 @@ public class VisorQueryResultEx extends VisorQueryResult {
/**
* @return Response node id.
*/
- public UUID responseNodeId() {
+ public UUID getResponseNodeId() {
return resNodeId;
}
/**
* @return Query id.
*/
- public String queryId() {
+ public String getQueryId() {
return qryId;
}
/**
* @return Columns.
*/
- public Collection<VisorQueryField> columns() {
+ public Collection<VisorQueryField> getColumns() {
return cols;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ super.writeExternalData(out);
+
+ U.writeUuid(out, resNodeId);
+ U.writeString(out, qryId);
+ U.writeCollection(out, cols);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternalData(in);
+
+ resNodeId = U.readUuid(in);
+ qryId = U.readString(in);
+ cols = U.readCollection(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorQueryResultEx.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
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
index d996f6c..c3c4432 100644
--- 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
@@ -19,14 +19,12 @@ package org.apache.ignite.internal.visor.query;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
-import org.apache.ignite.lang.IgniteBiTuple;
/**
* Task for execute SCAN or SQL query and get first page of results.
*/
@GridInternal
-public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
+public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, VisorQueryTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -34,4 +32,4 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTupl
@Override protected VisorQueryJob job(VisorQueryArg arg) {
return new VisorQueryJob(arg, debug);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskResult.java
new file mode 100644
index 0000000..c1ee102
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTaskResult.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+import org.apache.ignite.internal.visor.VisorTaskResultWrapper;
+import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+
+/**
+ * Result for {@link VisorQueryTask}.
+ */
+public class VisorQueryTaskResult extends VisorDataTransferObject implements VisorTaskResultWrapper<VisorQueryResultEx> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Exception on query execution. */
+ private VisorExceptionWrapper error;
+
+ /** Query result. */
+ private VisorQueryResultEx res;
+
+ /**
+ * Default constructor.
+ */
+ public VisorQueryTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param error Cache name for query.
+ * @param res Query text.
+ */
+ public VisorQueryTaskResult(VisorExceptionWrapper error, VisorQueryResultEx res) {
+ this.error = error;
+ this.res = res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public VisorExceptionWrapper getError() {
+ return error;
+ }
+
+ /** {@inheritDoc} */
+ @Override public VisorQueryResultEx getResult() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeObject(error);
+ out.writeObject(res);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ error = (VisorExceptionWrapper)in.readObject();
+ res = (VisorQueryResultEx)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorQueryTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java
----------------------------------------------------------------------
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
index 1c27ecb..81c6bf8 100644
--- 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
@@ -961,10 +961,8 @@ public class VisorMimeTypes {
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
- */
+ // 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";
@@ -972,10 +970,8 @@ public class VisorMimeTypes {
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.
- */
+ // 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";
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 9805950..cec19fb 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
@@ -52,7 +52,6 @@ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyMBean;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicyMBean;
-import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyMBean;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
@@ -138,7 +137,7 @@ public class VisorTaskUtils {
/** Comparator for log files by last modified date. */
private static final Comparator<VisorLogFile> LAST_MODIFIED = new Comparator<VisorLogFile>() {
@Override public int compare(VisorLogFile f1, VisorLogFile f2) {
- return Long.compare(f2.lastModified(), f1.lastModified());
+ return Long.compare(f2.getLastModified(), f1.getLastModified());
}
};
@@ -290,6 +289,26 @@ public class VisorTaskUtils {
}
/**
+ * Compact classes names.
+
+ * @param clss Classes to compact.
+ * @return Compacted string.
+ */
+ @Nullable public static List<String> compactClasses(Class<?>[] clss) {
+ if (clss == null)
+ return null;
+
+ int len = clss.length;
+
+ List<String> res = new ArrayList<>(len);
+
+ for (Class<?> cls: clss)
+ res.add(U.compact(cls.getName()));
+
+ return res;
+ }
+
+ /**
* Joins array elements to string.
*
* @param arr Array.
@@ -630,6 +649,7 @@ public class VisorTaskUtils {
raf.seek(pos);
byte[] buf = new byte[toRead];
+
int cntRead = raf.read(buf, 0, toRead);
if (cntRead != toRead)
@@ -681,9 +701,6 @@ public class VisorTaskUtils {
if (plc instanceof FifoEvictionPolicyMBean)
return ((FifoEvictionPolicyMBean)plc).getMaxSize();
- if (plc instanceof SortedEvictionPolicyMBean)
- return ((SortedEvictionPolicyMBean)plc).getMaxSize();
-
return null;
}
@@ -858,8 +875,6 @@ public class VisorTaskUtils {
if (cmdFilePath == null || !cmdFilePath.exists())
throw new FileNotFoundException(String.format("File not found: %s", cmdFile));
- String ignite = cmdFilePath.getCanonicalPath();
-
File nodesCfgPath = U.resolveIgnitePath(cfgPath);
if (nodesCfgPath == null || !nodesCfgPath.exists())
@@ -872,6 +887,8 @@ public class VisorTaskUtils {
List<Process> run = new ArrayList<>();
try {
+ String igniteCmd = cmdFilePath.getCanonicalPath();
+
for (int i = 0; i < nodesToStart; i++) {
if (U.isMacOs()) {
Map<String, String> macEnv = new HashMap<>(System.getenv());
@@ -900,9 +917,9 @@ public class VisorTaskUtils {
entry.getKey(), val.replace('\n', ' ').replace("'", "\'")));
}
- run.add(openInConsole(envs.toString(), ignite, quitePar, nodeCfg));
+ run.add(openInConsole(envs.toString(), igniteCmd, quitePar, nodeCfg));
} else
- run.add(openInConsole(null, envVars, ignite, quitePar, nodeCfg));
+ run.add(openInConsole(null, envVars, igniteCmd, quitePar, nodeCfg));
}
return run;
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
index 69ec1ae..3c0f69e 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
@@ -18,6 +18,7 @@
package org.apache.ignite.plugin.segmentation;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.jetbrains.annotations.Nullable;
/**
* Policy that defines how node will react on topology segmentation. Note that default
@@ -45,5 +46,18 @@ public enum SegmentationPolicy {
* {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and it is up to user to
* implement logic to handle this event.
*/
- NOOP
-}
\ No newline at end of file
+ NOOP;
+
+ /** Enumerated values. */
+ private static final SegmentationPolicy[] 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 SegmentationPolicy fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 9cce826..888974b 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -43,7 +43,6 @@ org.apache.ignite.cache.CachePartialUpdateException
org.apache.ignite.cache.CachePeekMode
org.apache.ignite.cache.CacheRebalanceMode
org.apache.ignite.cache.CacheServerNotFoundException
-org.apache.ignite.cache.CacheTypeFieldMetadata
org.apache.ignite.cache.CacheWriteSynchronizationMode
org.apache.ignite.cache.QueryEntity
org.apache.ignite.cache.QueryIndex
@@ -62,6 +61,7 @@ org.apache.ignite.cache.affinity.fair.FairAffinityFunction$FullAssignmentMap$2
org.apache.ignite.cache.affinity.fair.FairAffinityFunction$PartitionSetComparator
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction$HashComparator
+org.apache.ignite.cache.eviction.AbstractEvictionPolicy
org.apache.ignite.cache.eviction.EvictionFilter
org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy
org.apache.ignite.cache.eviction.igfs.IgfsEvictionFilter
@@ -229,6 +229,7 @@ org.apache.ignite.internal.IgniteKernal
org.apache.ignite.internal.IgniteKernal$1
org.apache.ignite.internal.IgniteKernal$5
org.apache.ignite.internal.IgniteMessagingImpl
+org.apache.ignite.internal.IgniteNeedReconnectException
org.apache.ignite.internal.IgniteSchedulerImpl
org.apache.ignite.internal.IgniteServicesImpl
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$1
@@ -545,30 +546,31 @@ org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender$DeferredAckMessageBuffer
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2
-org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$3
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$4
-org.apache.ignite.internal.processors.cache.IgniteCacheProxy$5
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$6
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$7
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
-org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
org.apache.ignite.internal.processors.cache.QueryCursorImpl$State
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.CacheDefaultBinaryAffinityKeyMapper
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$1
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$5
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$6
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataPredicate
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetadataProcessor
+org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$3
+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
+org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage
+org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage
+org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage$ProposalStatus
+org.apache.ignite.internal.processors.cache.binary.MetadataUpdateResult$ResultType
org.apache.ignite.internal.processors.cache.datastructures.CacheDataStructuresManager$BlockSetCallable
org.apache.ignite.internal.processors.cache.datastructures.CacheDataStructuresManager$QueueHeaderPredicate
org.apache.ignite.internal.processors.cache.datastructures.CacheDataStructuresManager$RemoveSetDataCallable
-org.apache.ignite.internal.processors.cache.distributed.GridCacheCommittedTxInfo
org.apache.ignite.internal.processors.cache.distributed.GridCacheTtlUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$1
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$2
@@ -621,7 +623,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionsRes
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
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$10$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$11
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$3
@@ -712,6 +713,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomi
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.NearCacheUpdates
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.UpdateErrors
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$2
@@ -812,13 +814,26 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishReq
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
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$12
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$13
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$14
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$15
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$16
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$17
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$18
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$19
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$2
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$20
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$21
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$3
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
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$7
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$8
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$FinishClosure
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse
@@ -937,19 +952,6 @@ 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$1
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$10
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$11
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$12
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$13
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$14
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$15
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$2
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$4
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$5
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$6
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$9
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$FinishClosure
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
@@ -987,12 +989,12 @@ org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl
org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserKeyCacheObjectImpl
org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage
org.apache.ignite.internal.processors.clock.GridClockDeltaVersion
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLA
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2MLA
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLA
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2
-org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4MLA
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2MLA
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4MLA
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T1
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T10
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T11
@@ -1292,7 +1294,6 @@ 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.IgniteSQLException
-org.apache.ignite.internal.processors.query.QueryUtils$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
@@ -1679,32 +1680,41 @@ 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.VisorDataTransferObject
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.binary.VisorBinaryMetadata
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTask
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTask$VisorPortableCollectMetadataJob
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTaskResult
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataField
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$VisorCacheClearCallable
org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob
org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob$1
org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheSizeCallable
+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
-org.apache.ignite.internal.visor.cache.VisorCacheDefaultConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheEvictionConfiguration
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.VisorCacheMetadataTask
org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask$VisorCacheMetadataJob
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.VisorCacheNearConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob
@@ -1726,8 +1736,10 @@ org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask$VisorCacheResetQueryMetricsJob
+org.apache.ignite.internal.visor.cache.VisorCacheSqlIndexMetadata
+org.apache.ignite.internal.visor.cache.VisorCacheSqlMetadata
+org.apache.ignite.internal.visor.cache.VisorCacheStartArg
org.apache.ignite.internal.visor.cache.VisorCacheStartTask
-org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
org.apache.ignite.internal.visor.cache.VisorCacheStopTask
org.apache.ignite.internal.visor.cache.VisorCacheStopTask$VisorCacheStopJob
@@ -1736,17 +1748,20 @@ org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask
org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask$VisorCachesSwapBackupsJob
org.apache.ignite.internal.visor.cache.VisorCacheTypeFieldMetadata
org.apache.ignite.internal.visor.cache.VisorCacheTypeMetadata
+org.apache.ignite.internal.visor.cache.VisorPartitionMap
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob
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
@@ -1757,11 +1772,13 @@ 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.VisorFileBlockArg
org.apache.ignite.internal.visor.file.VisorFileBlockTask
-org.apache.ignite.internal.visor.file.VisorFileBlockTask$VisorFileBlockArg
org.apache.ignite.internal.visor.file.VisorFileBlockTask$VisorFileBlockJob
+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.igfs.VisorIgfs
org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint
org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask
@@ -1769,6 +1786,7 @@ org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask$VisorIgfsFormatJob
org.apache.ignite.internal.visor.igfs.VisorIgfsMetrics
org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask
org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask$VisorIgfsProfilerClearJob
+org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTaskResult
org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerEntry
org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask
org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask$VisorIgfsProfilerJob
@@ -1777,11 +1795,13 @@ org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask
org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask$VisorIgfsResetMetricsJob
org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask
org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask$VisorIgfsSamplingStateJob
+org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTaskArg
org.apache.ignite.internal.visor.log.VisorLogFile
+org.apache.ignite.internal.visor.log.VisorLogSearchArg
org.apache.ignite.internal.visor.log.VisorLogSearchResult
org.apache.ignite.internal.visor.log.VisorLogSearchTask
-org.apache.ignite.internal.visor.log.VisorLogSearchTask$VisorLogSearchArg
org.apache.ignite.internal.visor.log.VisorLogSearchTask$VisorLogSearchJob
+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.VisorLatestVersionTask
@@ -1807,21 +1827,26 @@ 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.VisorNodeEventsCollectorTask$VisorNodeEventsCollectorTaskArg
+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.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.VisorPeerToPeerConfiguration
org.apache.ignite.internal.visor.node.VisorRestConfiguration
org.apache.ignite.internal.visor.node.VisorSegmentationConfiguration
+org.apache.ignite.internal.visor.node.VisorSpiDescription
org.apache.ignite.internal.visor.node.VisorSpisConfiguration
+org.apache.ignite.internal.visor.node.VisorSuppressedError
org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
org.apache.ignite.internal.visor.query.VisorCancelQueriesTask
org.apache.ignite.internal.visor.query.VisorCancelQueriesTask$VisorCancelQueriesJob
@@ -1834,10 +1859,12 @@ org.apache.ignite.internal.visor.query.VisorQueryField
org.apache.ignite.internal.visor.query.VisorQueryJob
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.VisorQueryResult
org.apache.ignite.internal.visor.query.VisorQueryResultEx
org.apache.ignite.internal.visor.query.VisorQueryScanSubstringFilter
org.apache.ignite.internal.visor.query.VisorQueryTask
+org.apache.ignite.internal.visor.query.VisorQueryTaskResult
org.apache.ignite.internal.visor.query.VisorRunningQuery
org.apache.ignite.internal.visor.service.VisorCancelServiceTask
org.apache.ignite.internal.visor.service.VisorCancelServiceTask$VisorCancelServiceJob
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
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
index ad8c2ed..19d130e 100644
--- 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
@@ -64,7 +64,6 @@ class VisorConsole {
org.apache.ignite.visor.commands.cache.VisorCacheClearCommand
org.apache.ignite.visor.commands.cache.VisorCacheResetCommand
org.apache.ignite.visor.commands.cache.VisorCacheCommand
- org.apache.ignite.visor.commands.cache.VisorCacheSwapCommand
org.apache.ignite.visor.commands.config.VisorConfigurationCommand
org.apache.ignite.visor.commands.deploy.VisorDeployCommand
org.apache.ignite.visor.commands.disco.VisorDiscoveryCommand
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
----------------------------------------------------------------------
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
index 67aaa14..517028a 100644
--- 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
@@ -105,7 +105,7 @@ class VisorCacheClearCommand {
val res = executeOne(nid, classOf[VisorCacheClearTask], cacheName)
- t += (nodeId8(nid), res.get1(), res.get2())
+ t += (nodeId8(nid), res.getSizeBefore, res.getSizeAfter)
println("Cleared cache with name: " + escapeName(cacheName))
[7/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
index 7556e7c..389f483 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
@@ -18,13 +18,13 @@
package org.apache.ignite.internal.visor.cache;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCompute;
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.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
@@ -34,7 +34,7 @@ import org.apache.ignite.resources.JobContextResource;
* Task that clears specified caches on specified node.
*/
@GridInternal
-public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<Integer, Integer>> {
+public class VisorCacheClearTask extends VisorOneNodeTask<String, VisorCacheClearTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -46,7 +46,7 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
/**
* Job that clear specified caches.
*/
- private static class VisorCacheClearJob extends VisorJob<String, IgniteBiTuple<Integer, Integer>> {
+ private static class VisorCacheClearJob extends VisorJob<String, VisorCacheClearTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -54,10 +54,10 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
private final String cacheName;
/** */
- private final IgniteInClosure<IgniteFuture<Integer>> lsnr;
+ private final IgniteInClosure<IgniteFuture<Long>> lsnr;
/** */
- private IgniteFuture<Integer>[] futs;
+ private IgniteFuture<Long>[] futs;
/** */
@JobContextResource
@@ -74,11 +74,11 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
this.cacheName = cacheName;
- lsnr = new IgniteInClosure<IgniteFuture<Integer>>() {
+ lsnr = new IgniteInClosure<IgniteFuture<Long>>() {
/** */
private static final long serialVersionUID = 0L;
- @Override public void apply(IgniteFuture<Integer> f) {
+ @Override public void apply(IgniteFuture<Long> f) {
assert futs[0].isDone();
assert futs[1] == null || futs[1].isDone();
assert futs[2] == null || futs[2].isDone();
@@ -89,11 +89,17 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
}
/**
- * @param fut Future for asynchronous cache operation.
+ * @param subJob Sub job to execute asynchronously.
* @param idx Index.
* @return {@code true} If subJob was not completed and this job should be suspended.
*/
- private boolean callAsync(IgniteFuture<Integer> fut, int idx) {
+ private boolean callAsync(IgniteCallable<Long> subJob, int idx) {
+ IgniteCompute compute = ignite.compute(ignite.cluster().forCacheNodes(cacheName)).withAsync();
+
+ compute.call(subJob);
+
+ IgniteFuture<Long> fut = compute.future();
+
futs[idx] = fut;
if (fut.isDone())
@@ -107,32 +113,26 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<Integer, Integer> run(final String cacheName) {
+ @Override protected VisorCacheClearTaskResult run(final String cacheName) {
if (futs == null)
futs = new IgniteFuture[3];
if (futs[0] == null || futs[1] == null || futs[2] == null) {
IgniteCache cache = ignite.cache(cacheName);
- if (futs[0] == null) {
- if (callAsync(cache.sizeAsync(CachePeekMode.PRIMARY), 0))
- return null;
- }
+ if (futs[0] == null && callAsync(new VisorCacheSizeCallable(cache), 0))
+ return null;
- if (futs[1] == null) {
- if (callAsync(cache.clearAsync(), 1))
- return null;
- }
-
- if (futs[2] == null) {
- if (callAsync(cache.sizeAsync(CachePeekMode.PRIMARY), 2))
- return null;
- }
+ if (futs[1] == null && callAsync(new VisorCacheClearCallable(cache), 1))
+ return null;
+
+ if (futs[2] == null && callAsync(new VisorCacheSizeCallable(cache), 2))
+ return null;
}
assert futs[0].isDone() && futs[1].isDone() && futs[2].isDone();
- return new IgniteBiTuple<>(futs[0].get(), futs[2].get());
+ return new VisorCacheClearTaskResult(futs[0].get(), futs[2].get());
}
/** {@inheritDoc} */
@@ -143,11 +143,9 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
/**
* Callable to get cache size.
- *
- * @deprecated This class needed only for compatibility.
*/
- @GridInternal @Deprecated
- private static class VisorCacheSizeCallable implements IgniteCallable<Integer> {
+ @GridInternal
+ private static class VisorCacheSizeCallable implements IgniteCallable<Long> {
/** */
private static final long serialVersionUID = 0L;
@@ -162,18 +160,16 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
}
/** {@inheritDoc} */
- @Override public Integer call() throws Exception {
- return cache.size(CachePeekMode.PRIMARY);
+ @Override public Long call() throws Exception {
+ return cache.sizeLong(CachePeekMode.PRIMARY);
}
}
/**
* Callable to clear cache.
- *
- * @deprecated This class needed only for compatibility.
*/
- @GridInternal @Deprecated
- private static class VisorCacheClearCallable implements IgniteCallable<Integer> {
+ @GridInternal
+ private static class VisorCacheClearCallable implements IgniteCallable<Long> {
/** */
private static final long serialVersionUID = 0L;
@@ -188,10 +184,10 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
}
/** {@inheritDoc} */
- @Override public Integer call() throws Exception {
+ @Override public Long call() throws Exception {
cache.clear();
- return 0;
+ return 0L;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..aba31f1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ sizeBefore = in.readLong();
+ sizeAfter = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheClearTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 30973b0..28eda46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -17,17 +17,19 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Collection;
import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.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;
@@ -35,7 +37,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
/**
* Data transfer object for cache configuration properties.
*/
-public class VisorCacheConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -57,9 +59,6 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
/** Write synchronization mode. */
private CacheWriteSynchronizationMode writeSynchronizationMode;
- /** Swap enabled flag. */
- private boolean swapEnabled;
-
/** Invalidate. */
private boolean invalidate;
@@ -72,12 +71,12 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
/** Max concurrent async operations. */
private int maxConcurrentAsyncOps;
- /** Memory mode. */
- private CacheMemoryMode memoryMode;
-
/** Cache interceptor. */
private String interceptor;
+ /** Gets default lock acquisition timeout. */
+ private long dfltLockTimeout;
+
/** Cache affinityCfg config. */
private VisorCacheAffinityConfiguration affinityCfg;
@@ -90,9 +89,6 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
/** Near cache config. */
private VisorCacheNearConfiguration nearCfg;
- /** Default config. */
- private VisorCacheDefaultConfiguration dfltCfg;
-
/** Store config. */
private VisorCacheStoreConfiguration storeCfg;
@@ -121,24 +117,31 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
private boolean sys;
/**
+ * Default constructor.
+ */
+ public VisorCacheConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for cache configuration properties.
+ *
* @param ignite Grid.
* @param ccfg Cache configuration.
- * @return Data transfer object for cache configuration properties.
*/
- public VisorCacheConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
+ public VisorCacheConfiguration(IgniteEx ignite, CacheConfiguration ccfg) {
name = ccfg.getName();
mode = ccfg.getCacheMode();
atomicityMode = ccfg.getAtomicityMode();
atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode();
eagerTtl = ccfg.isEagerTtl();
writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
- swapEnabled = ccfg.isSwapEnabled();
invalidate = ccfg.isInvalidate();
startSize = ccfg.getStartSize();
offHeapMaxMemory = ccfg.getOffHeapMaxMemory();
maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
- memoryMode = ccfg.getMemoryMode();
interceptor = compactClass(ccfg.getInterceptor());
+ dfltLockTimeout = ccfg.getDefaultLockTimeout();
typeMeta = VisorCacheTypeMetadata.list(ccfg.getQueryEntities(), ccfg.getCacheStoreFactory());
statisticsEnabled = ccfg.isStatisticsEnabled();
mgmtEnabled = ccfg.isManagementEnabled();
@@ -147,209 +150,250 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
sys = ignite.context().cache().systemCache(ccfg.getName());
- affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
- rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
- evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
- nearCfg = VisorCacheNearConfiguration.from(ccfg);
- dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
-
- storeCfg = new VisorCacheStoreConfiguration().from(ignite, ccfg);
+ affinityCfg = new VisorCacheAffinityConfiguration(ccfg);
+ rebalanceCfg = new VisorCacheRebalanceConfiguration(ccfg);
+ evictCfg = new VisorCacheEvictionConfiguration(ccfg);
+ nearCfg = new VisorCacheNearConfiguration(ccfg);
- qryCfg = new VisorCacheQueryConfiguration().from(ccfg);
+ storeCfg = new VisorCacheStoreConfiguration(ignite, ccfg);
- return this;
+ qryCfg = new VisorCacheQueryConfiguration(ccfg);
}
/**
* @return Cache name.
*/
- @Nullable public String name() {
+ @Nullable public String getName() {
return name;
}
/**
* @return Cache mode.
*/
- public CacheMode mode() {
+ public CacheMode getMode() {
return mode;
}
/**
* @return Cache atomicity mode
*/
- public CacheAtomicityMode atomicityMode() {
+ public CacheAtomicityMode getAtomicityMode() {
return atomicityMode;
}
/**
* @return Cache atomicity write ordering mode.
*/
- public CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ public CacheAtomicWriteOrderMode getAtomicWriteOrderMode() {
return atomicWriteOrderMode;
}
/**
* @return Eager ttl flag
*/
- public boolean eagerTtl() {
+ public boolean getEagerTtl() {
return eagerTtl;
}
/**
* @return Write synchronization mode.
*/
- public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ public CacheWriteSynchronizationMode getWriteSynchronizationMode() {
return writeSynchronizationMode;
}
/**
- * @return Swap enabled flag.
- */
- public boolean swapEnabled() {
- return swapEnabled;
- }
-
- /**
* @return Invalidate.
*/
- public boolean invalidate() {
+ public boolean isInvalidate() {
return invalidate;
}
/**
* @return Start size.
*/
- public int startSize() {
+ public int getStartSize() {
return startSize;
}
/**
* @return Off-heap max memory.
*/
- public long offsetHeapMaxMemory() {
+ public long getOffsetHeapMaxMemory() {
return offHeapMaxMemory;
}
/**
* @return Max concurrent async operations
*/
- public int maxConcurrentAsyncOperations() {
+ public int getMaxConcurrentAsyncOperations() {
return maxConcurrentAsyncOps;
}
/**
- * @return Memory mode.
+ * @return Cache interceptor.
*/
- public CacheMemoryMode memoryMode() {
- return memoryMode;
+ @Nullable public String getInterceptor() {
+ return interceptor;
}
/**
- * @return Cache interceptor.
+ * @return Gets default lock acquisition timeout.
*/
- @Nullable public String interceptor() {
- return interceptor;
+ public long getDefaultLockTimeout() {
+ return dfltLockTimeout;
}
/**
* @return Collection of type metadata.
*/
- public Collection<VisorCacheTypeMetadata> typeMeta() {
+ public Collection<VisorCacheTypeMetadata> getTypeMeta() {
return typeMeta;
}
/**
* @return {@code true} if cache statistics enabled.
*/
- public boolean statisticsEnabled() {
+ public boolean isStatisticsEnabled() {
return statisticsEnabled;
}
/**
* @return Whether management is enabled.
*/
- public boolean managementEnabled() {
+ public boolean isManagementEnabled() {
return mgmtEnabled;
}
/**
* @return Class name of cache loader factory.
*/
- public String loaderFactory() {
+ public String getLoaderFactory() {
return ldrFactory;
}
/**
* @return Class name of cache writer factory.
*/
- public String writerFactory() {
+ public String getWriterFactory() {
return writerFactory;
}
/**
* @return Class name of expiry policy factory.
*/
- public String expiryPolicyFactory() {
+ public String getExpiryPolicyFactory() {
return expiryPlcFactory;
}
/**
* @return Cache affinityCfg config.
*/
- public VisorCacheAffinityConfiguration affinityConfiguration() {
+ public VisorCacheAffinityConfiguration getAffinityConfiguration() {
return affinityCfg;
}
/**
* @return Preload config.
*/
- public VisorCacheRebalanceConfiguration rebalanceConfiguration() {
+ public VisorCacheRebalanceConfiguration getRebalanceConfiguration() {
return rebalanceCfg;
}
/**
* @return Eviction config.
*/
- public VisorCacheEvictionConfiguration evictConfiguration() {
+ public VisorCacheEvictionConfiguration getEvictConfiguration() {
return evictCfg;
}
/**
* @return Near cache config.
*/
- public VisorCacheNearConfiguration nearConfiguration() {
+ public VisorCacheNearConfiguration getNearConfiguration() {
return nearCfg;
}
/**
- * @return Dgc config
- */
- public VisorCacheDefaultConfiguration defaultConfiguration() {
- return dfltCfg;
- }
-
- /**
* @return Store config
*/
- public VisorCacheStoreConfiguration storeConfiguration() {
+ public VisorCacheStoreConfiguration getStoreConfiguration() {
return storeCfg;
}
/**
* @return Cache query configuration.
*/
- public VisorCacheQueryConfiguration queryConfiguration() {
+ public VisorCacheQueryConfiguration getQueryConfiguration() {
return qryCfg;
}
/**
* @return System cache state.
*/
- public boolean system() {
+ public boolean isSystem() {
return sys;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ U.writeEnum(out, mode);
+ U.writeEnum(out, atomicityMode);
+ U.writeEnum(out, atomicWriteOrderMode);
+ out.writeBoolean(eagerTtl);
+ U.writeEnum(out, writeSynchronizationMode);
+ out.writeBoolean(invalidate);
+ out.writeInt(startSize);
+ out.writeLong(offHeapMaxMemory);
+ out.writeInt(maxConcurrentAsyncOps);
+ U.writeString(out, interceptor);
+ out.writeLong(dfltLockTimeout);
+ out.writeObject(affinityCfg);
+ out.writeObject(rebalanceCfg);
+ out.writeObject(evictCfg);
+ out.writeObject(nearCfg);
+ out.writeObject(storeCfg);
+ U.writeCollection(out, typeMeta);
+ out.writeBoolean(statisticsEnabled);
+ out.writeBoolean(mgmtEnabled);
+ U.writeString(out, ldrFactory);
+ U.writeString(out, writerFactory);
+ U.writeString(out, expiryPlcFactory);
+ out.writeObject(qryCfg);
+ out.writeBoolean(sys);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ mode = CacheMode.fromOrdinal(in.readByte());
+ atomicityMode = CacheAtomicityMode.fromOrdinal(in.readByte());
+ atomicWriteOrderMode = CacheAtomicWriteOrderMode.fromOrdinal(in.readByte());
+ eagerTtl = in.readBoolean();
+ writeSynchronizationMode = CacheWriteSynchronizationMode.fromOrdinal(in.readByte());
+ invalidate = in.readBoolean();
+ startSize = in.readInt();
+ offHeapMaxMemory = in.readLong();
+ maxConcurrentAsyncOps = in.readInt();
+ interceptor = U.readString(in);
+ dfltLockTimeout = in.readLong();
+ affinityCfg = (VisorCacheAffinityConfiguration)in.readObject();
+ rebalanceCfg = (VisorCacheRebalanceConfiguration)in.readObject();
+ evictCfg = (VisorCacheEvictionConfiguration)in.readObject();
+ nearCfg = (VisorCacheNearConfiguration)in.readObject();
+ storeCfg = (VisorCacheStoreConfiguration)in.readObject();
+ typeMeta = U.readCollection(in);
+ statisticsEnabled = in.readBoolean();
+ mgmtEnabled = in.readBoolean();
+ ldrFactory = U.readString(in);
+ writerFactory = U.readString(in);
+ expiryPlcFactory = U.readString(in);
+ qryCfg = (VisorCacheQueryConfiguration)in.readObject();
+ sys = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
index c872d98..c2a3c02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
@@ -67,11 +67,11 @@ public class VisorCacheConfigurationCollectorJob
* @return Data transfer object to send it to Visor.
*/
protected VisorCacheConfiguration config(CacheConfiguration ccfg) {
- return new VisorCacheConfiguration().from(ignite, ccfg);
+ return new VisorCacheConfiguration(ignite, ccfg);
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheConfigurationCollectorJob.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
deleted file mode 100644
index 03b5020..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
+++ /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.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for default cache configuration properties.
- */
-public class VisorCacheDefaultConfiguration implements Serializable, LessNamingBean {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Default transaction timeout. */
- private long txLockTimeout;
-
- /**
- * @param ccfg Cache configuration.
- * @return Data transfer object for default cache configuration properties.
- */
- public static VisorCacheDefaultConfiguration from(CacheConfiguration ccfg) {
- VisorCacheDefaultConfiguration cfg = new VisorCacheDefaultConfiguration();
-
- cfg.txLockTimeout = ccfg.getDefaultLockTimeout();
-
- return cfg;
- }
-
- /**
- * @return Default transaction timeout.
- */
- public long txLockTimeout() {
- return txLockTimeout;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorCacheDefaultConfiguration.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
index 05d5c38..315bdcf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
@@ -17,11 +17,14 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -30,7 +33,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
/**
* Data transfer object for eviction configuration properties.
*/
-public class VisorCacheEvictionConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheEvictionConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -59,83 +62,110 @@ public class VisorCacheEvictionConfiguration implements Serializable, LessNaming
private float maxOverflowRatio;
/**
- * @param ccfg Cache configuration.
- * @return Data transfer object for eviction configuration properties.
+ * Default constructor.
*/
- public static VisorCacheEvictionConfiguration from(CacheConfiguration ccfg) {
- VisorCacheEvictionConfiguration cfg = new VisorCacheEvictionConfiguration();
-
- final EvictionPolicy plc = ccfg.getEvictionPolicy();
-
- cfg.plc = compactClass(plc);
- cfg.plcMaxSize = evictionPolicyMaxSize(plc);
- cfg.filter = compactClass(ccfg.getEvictionFilter());
- cfg.syncConcurrencyLvl = ccfg.getEvictSynchronizedConcurrencyLevel();
- cfg.syncTimeout = ccfg.getEvictSynchronizedTimeout();
- cfg.syncKeyBufSize = ccfg.getEvictSynchronizedKeyBufferSize();
- cfg.evictSynchronized = ccfg.isEvictSynchronized();
- cfg.maxOverflowRatio = ccfg.getEvictMaxOverflowRatio();
+ public VisorCacheEvictionConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * Create data transfer object for eviction configuration properties.
+ * @param ccfg Cache configuration.
+ */
+ public VisorCacheEvictionConfiguration(CacheConfiguration ccfg) {
+ final EvictionPolicy evictionPlc = ccfg.getEvictionPolicy();
+
+ plc = compactClass(evictionPlc);
+ plcMaxSize = evictionPolicyMaxSize(evictionPlc);
+ filter = compactClass(ccfg.getEvictionFilter());
+ syncConcurrencyLvl = ccfg.getEvictSynchronizedConcurrencyLevel();
+ syncTimeout = ccfg.getEvictSynchronizedTimeout();
+ syncKeyBufSize = ccfg.getEvictSynchronizedKeyBufferSize();
+ evictSynchronized = ccfg.isEvictSynchronized();
+ maxOverflowRatio = ccfg.getEvictMaxOverflowRatio();
}
/**
* @return Eviction policy.
*/
- @Nullable public String policy() {
+ @Nullable public String getPolicy() {
return plc;
}
/**
* @return Cache eviction policy max size.
*/
- @Nullable public Integer policyMaxSize() {
+ @Nullable public Integer getPolicyMaxSize() {
return plcMaxSize;
}
/**
* @return Eviction filter to specify which entries should not be evicted.
*/
- @Nullable public String filter() {
+ @Nullable public String getFilter() {
return filter;
}
/**
* @return synchronized eviction concurrency level.
*/
- public int synchronizedConcurrencyLevel() {
+ public int getSynchronizedConcurrencyLevel() {
return syncConcurrencyLvl;
}
/**
* @return synchronized eviction timeout.
*/
- public long synchronizedTimeout() {
+ public long getSynchronizedTimeout() {
return syncTimeout;
}
/**
* @return Synchronized key buffer size.
*/
- public int synchronizedKeyBufferSize() {
+ public int getSynchronizedKeyBufferSize() {
return syncKeyBufSize;
}
/**
* @return Synchronous evicts flag.
*/
- public boolean evictSynchronized() {
+ public boolean isEvictSynchronized() {
return evictSynchronized;
}
/**
* @return Eviction max overflow ratio.
*/
- public float maxOverflowRatio() {
+ public float getMaxOverflowRatio() {
return maxOverflowRatio;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, plc);
+ out.writeObject(plcMaxSize);
+ U.writeString(out, filter);
+ out.writeInt(syncConcurrencyLvl);
+ out.writeLong(syncTimeout);
+ out.writeInt(syncKeyBufSize);
+ out.writeBoolean(evictSynchronized);
+ out.writeFloat(maxOverflowRatio);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ plc = U.readString(in);
+ plcMaxSize = (Integer)in.readObject();
+ filter = U.readString(in);
+ syncConcurrencyLvl = in.readInt();
+ syncTimeout = in.readLong();
+ syncKeyBufSize = in.readInt();
+ evictSynchronized = in.readBoolean();
+ maxOverflowRatio = in.readFloat();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheEvictionConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
----------------------------------------------------------------------
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
index 212aaa9..65e1e9c 100644
--- 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
@@ -37,18 +37,18 @@ import org.apache.ignite.internal.visor.VisorOneNodeTask;
*/
@GridInternal
public class VisorCacheLoadTask extends
- VisorOneNodeTask<GridTuple3<Set<String>, Long, Object[]>, Map<String, Integer>> {
+ VisorOneNodeTask<VisorCacheLoadTaskArg, Map<String, Integer>> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorCachesLoadJob job(GridTuple3<Set<String>, Long, Object[]> arg) {
+ @Override protected VisorCachesLoadJob job(VisorCacheLoadTaskArg arg) {
return new VisorCachesLoadJob(arg, debug);
}
/** Job that load caches. */
private static class VisorCachesLoadJob extends
- VisorJob<GridTuple3<Set<String>, Long, Object[]>, Map<String, Integer>> {
+ VisorJob<VisorCacheLoadTaskArg, Map<String, Integer>> {
/** */
private static final long serialVersionUID = 0L;
@@ -56,18 +56,17 @@ public class VisorCacheLoadTask extends
* @param arg Cache names, ttl and loader arguments.
* @param debug Debug flag.
*/
- private VisorCachesLoadJob(GridTuple3<Set<String>, Long, Object[]> arg, boolean debug) {
+ private VisorCachesLoadJob(VisorCacheLoadTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Map<String, Integer> run(GridTuple3<Set<String>, Long, Object[]> arg) {
- Set<String> cacheNames = arg.get1();
- Long ttl = arg.get2();
- Object[] ldrArgs = arg.get3();
+ @Override protected Map<String, Integer> run(VisorCacheLoadTaskArg arg) {
+ Set<String> cacheNames = arg.getCacheNames();
+ long ttl = arg.getTtl();
+ Object[] ldrArgs = arg.getLdrArgs();
assert cacheNames != null && !cacheNames.isEmpty();
- assert ttl != null;
Map<String, Integer> res = U.newHashMap(cacheNames.size());
@@ -96,4 +95,4 @@ public class VisorCacheLoadTask extends
return S.toString(VisorCachesLoadJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..b210dd0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.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 task returns cache load results.
+ */
+public class VisorCacheLoadTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache names to load data. */
+ private Set<String> 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<String> cacheNames, long ttl, Object[] ldrArgs) {
+ this.cacheNames = cacheNames;
+ this.ttl = ttl;
+ this.ldrArgs = ldrArgs;
+ }
+
+ /**
+ * @return Cache names to load data.
+ */
+ public Set<String> 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[] getLdrArgs() {
+ 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(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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java
----------------------------------------------------------------------
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
index 6ba783c..598c8cf 100644
--- 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
@@ -34,7 +34,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName;
* Task to get cache SQL metadata.
*/
@GridInternal
-public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSqlMetadata> {
+public class VisorCacheMetadataTask extends VisorOneNodeTask<String, VisorCacheSqlMetadata> {
/** */
private static final long serialVersionUID = 0L;
@@ -46,7 +46,7 @@ public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSq
/**
* Job to get cache SQL metadata.
*/
- private static class VisorCacheMetadataJob extends VisorJob<String, GridCacheSqlMetadata> {
+ private static class VisorCacheMetadataJob extends VisorJob<String, VisorCacheSqlMetadata> {
/** */
private static final long serialVersionUID = 0L;
@@ -59,12 +59,18 @@ public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSq
}
/** {@inheritDoc} */
- @Override protected GridCacheSqlMetadata run(String cacheName) {
+ @Override protected VisorCacheSqlMetadata run(String cacheName) {
try {
IgniteInternalCache<Object, Object> cache = ignite.cachex(cacheName);
- if (cache != null)
- return F.first(cache.context().queries().sqlMetadata());
+ 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(cacheName));
}
@@ -78,4 +84,4 @@ public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSq
return S.toString(VisorCacheMetadataJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 507aacd..fba4b4e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -17,25 +17,28 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+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.LessNamingBean;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for {@link CacheMetrics}.
*/
-public class VisorCacheMetrics implements Serializable, LessNamingBean {
+public class VisorCacheMetrics extends VisorDataTransferObject {
/** */
- private static final float MICROSECONDS_IN_SECOND = 1_000_000;
+ private static final long serialVersionUID = 0L;
/** */
- private static final long serialVersionUID = 0L;
+ private static final float MICROSECONDS_IN_SECOND = 1_000_000;
/** Cache name. */
private String name;
@@ -161,7 +164,7 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
private long offHeapAllocatedSize;
/** Number of cache entries stored in off-heap memory. */
- private long offHeapEntriesCount;
+ private long offHeapEntriesCnt;
/**
* Calculate rate of metric per second.
@@ -174,11 +177,19 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
}
/**
+ * Default constructor.
+ */
+ public VisorCacheMetrics() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for given cache metrics.
+ *
* @param ignite Ignite.
* @param cacheName Cache name.
- * @return Data transfer object for given cache metrics.
*/
- public VisorCacheMetrics from(IgniteEx ignite, String cacheName) {
+ public VisorCacheMetrics(IgniteEx ignite, String cacheName) {
GridCacheProcessor cacheProcessor = ignite.context().cache();
IgniteCache<Object, Object> c = cacheProcessor.jcache(cacheName);
@@ -217,7 +228,7 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
commitsPerSec = perSecond(m.getAverageTxCommitTime());
rollbacksPerSec = perSecond(m.getAverageTxRollbackTime());
- qryMetrics = VisorCacheQueryMetrics.from(c.queryMetrics());
+ qryMetrics = new VisorCacheQueryMetrics(c.queryMetrics());
dhtEvictQueueCurrSize = m.getDhtEvictQueueCurrentSize();
txThreadMapSize = m.getTxThreadMapSize();
@@ -238,15 +249,13 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
GridCacheAdapter<Object, Object> ca = cacheProcessor.internalCache(cacheName);
offHeapAllocatedSize = ca.offHeapAllocatedSize();
- offHeapEntriesCount = ca.offHeapEntriesCount();
-
- return this;
+ offHeapEntriesCnt = ca.offHeapEntriesCount();
}
/**
* @return Cache name.
*/
- public String name() {
+ public String getName() {
return name;
}
@@ -255,287 +264,287 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
*
* @param name New value for cache name.
*/
- public void name(String name) {
+ public void setName(String name) {
this.name = name;
}
/**
* @return Cache mode.
*/
- public CacheMode mode() {
+ public CacheMode getMode() {
return mode;
}
/**
* @return Cache system state.
*/
- public boolean system() {
+ public boolean isSystem() {
return sys;
}
/**
* @return Total number of reads of the owning entity (either cache or entry).
*/
- public long reads() {
+ public long getReads() {
return reads;
}
/**
* @return The mean time to execute gets
*/
- public float avgReadTime() {
+ public float getAvgReadTime() {
return avgReadTime;
}
/**
* @return Total number of writes of the owning entity (either cache or entry).
*/
- public long writes() {
+ public long getWrites() {
return writes;
}
/**
* @return Total number of hits for the owning entity (either cache or entry).
*/
- public long hits() {
+ public long getHits() {
return hits;
}
/**
* @return Total number of misses for the owning entity (either cache or entry).
*/
- public long misses() {
+ public long getMisses() {
return misses;
}
/**
* @return Total number of transaction commits.
*/
- public long txCommits() {
+ public long getTxCommits() {
return txCommits;
}
/**
* @return avgTxCommitTime
*/
- public float avgTxCommitTime() {
+ public float getAvgTxCommitTime() {
return avgTxCommitTime;
}
/**
* @return The mean time to execute tx rollbacks.
*/
- public float avgTxRollbackTime() {
+ public float getAvgTxRollbackTime() {
return avgTxRollbackTime;
}
/**
* @return The total number of puts to the cache.
*/
- public long puts() {
+ public long getPuts() {
return puts;
}
/**
* @return The mean time to execute puts.
*/
- public float avgPutTime() {
+ public float getAvgPutTime() {
return avgPutTime;
}
/**
* @return The total number of removals from the cache.
*/
- public long removals() {
+ public long getRemovals() {
return removals;
}
/**
* @return The mean time to execute removes.
*/
- public float avgRemovalTime() {
+ public float getAvgRemovalTime() {
return avgRemovalTime;
}
/**
* @return The total number of evictions from the cache.
*/
- public long evictions() {
+ public long getEvictions() {
return evictions;
}
/**
* @return Total number of transaction rollbacks.
*/
- public long txRollbacks() {
+ public long getTxRollbacks() {
return txRollbacks;
}
/**
* @return Reads per second.
*/
- public int readsPerSecond() {
+ public int getReadsPerSecond() {
return readsPerSec;
}
/**
* @return Puts per second.
*/
- public int putsPerSecond() {
+ public int getPutsPerSecond() {
return putsPerSec;
}
/**
* @return Removes per second.
*/
- public int removalsPerSecond() {
+ public int getRemovalsPerSecond() {
return removalsPerSec;
}
/**
* @return Commits per second.
*/
- public int commitsPerSecond() {
+ public int getCommitsPerSecond() {
return commitsPerSec;
}
/**
* @return Rollbacks per second.
*/
- public int rollbacksPerSecond() {
+ public int getRollbacksPerSecond() {
return rollbacksPerSec;
}
/**
* @return Number of non-{@code null} values in the cache.
*/
- public int size() {
+ public int getSize() {
return size;
}
/**
* @return Gets number of keys in the cache, possibly with {@code null} values.
*/
- public int keySize() {
+ public int getKeySize() {
return keySize;
}
/**
* @return Gets query metrics for cache.
*/
- public VisorCacheQueryMetrics queryMetrics() {
+ public VisorCacheQueryMetrics getQueryMetrics() {
return qryMetrics;
}
/**
* @return Current size of evict queue used to batch up evictions.
*/
- public int dhtEvictQueueCurrentSize() {
+ public int getDhtEvictQueueCurrentSize() {
return dhtEvictQueueCurrSize;
}
/**
* @return Gets transaction per-thread map size.
*/
- public int txThreadMapSize() {
+ public int GetTxThreadMapSize() {
return txThreadMapSize;
}
/**
* @return Transaction per-Xid map size.
*/
- public int txXidMapSize() {
+ public int getTxXidMapSize() {
return txXidMapSize;
}
/**
* @return Committed transaction queue size.
*/
- public int txCommitQueueSize() {
+ public int getTxCommitQueueSize() {
return txCommitQueueSize;
}
/**
* @return Prepared transaction queue size.
*/
- public int txPrepareQueueSize() {
+ public int getTxPrepareQueueSize() {
return txPrepareQueueSize;
}
/**
* @return Start version counts map size.
*/
- public int txStartVersionCountsSize() {
+ public int getTxStartVersionCountsSize() {
return txStartVerCountsSize;
}
/**
* @return Number of cached committed transaction IDs.
*/
- public int txCommittedVersionsSize() {
+ public int getTxCommittedVersionsSize() {
return txCommittedVersionsSize;
}
/**
* @return Number of cached rolled back transaction IDs.
*/
- public int txRolledbackVersionsSize() {
+ public int getTxRolledbackVersionsSize() {
return txRolledbackVersionsSize;
}
/**
* @return DHT thread map size
*/
- public int txDhtThreadMapSize() {
+ public int getTxDhtThreadMapSize() {
return txDhtThreadMapSize;
}
/**
* @return Transaction DHT per-Xid map size.
*/
- public int txDhtXidMapSize() {
+ public int getTxDhtXidMapSize() {
return txDhtXidMapSize;
}
/**
* @return Committed DHT transaction queue size.
*/
- public int txDhtCommitQueueSize() {
+ public int getTxDhtCommitQueueSize() {
return txDhtCommitQueueSize;
}
/**
* @return Prepared DHT transaction queue size.
*/
- public int txDhtPrepareQueueSize() {
+ public int getTxDhtPrepareQueueSize() {
return txDhtPrepareQueueSize;
}
/**
* @return DHT start version counts map size.
*/
- public int txDhtStartVersionCountsSize() {
+ public int getTxDhtStartVersionCountsSize() {
return txDhtStartVerCountsSize;
}
/**
* @return Number of cached committed DHT transaction IDs.
*/
- public int txDhtCommittedVersionsSize() {
+ public int getTxDhtCommittedVersionsSize() {
return txDhtCommittedVersionsSize;
}
/**
* @return Number of cached rolled back DHT transaction IDs.
*/
- public int txDhtRolledbackVersionsSize() {
+ public int getTxDhtRolledbackVersionsSize() {
return txDhtRolledbackVersionsSize;
}
/**
* @return Memory size allocated in off-heap.
*/
- public long offHeapAllocatedSize() {
+ public long getOffHeapAllocatedSize() {
return offHeapAllocatedSize;
}
@@ -543,7 +552,99 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
* @return Number of cache entries stored in off-heap memory.
*/
public long offHeapEntriesCount() {
- return offHeapEntriesCount;
+ return offHeapEntriesCnt;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ U.writeEnum(out, 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(offHeapAllocatedSize);
+ out.writeLong(offHeapEntriesCnt);
+ out.writeObject(qryMetrics);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ mode = CacheMode.fromOrdinal(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();
+ offHeapAllocatedSize = in.readLong();
+ offHeapEntriesCnt = in.readLong();
+ qryMetrics = (VisorCacheQueryMetrics)in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index 4fd85de..a2764ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -36,13 +36,13 @@ import org.jetbrains.annotations.Nullable;
* Task that collect cache metrics from all nodes.
*/
@GridInternal
-public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiTuple<Boolean, Collection<String>>,
+public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<VisorCacheMetricsCollectorTaskArg,
Iterable<VisorCacheAggregatedMetrics>, Collection<VisorCacheMetrics>> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorCacheMetricsCollectorJob job(IgniteBiTuple<Boolean, Collection<String>> arg) {
+ @Override protected VisorCacheMetricsCollectorJob job(VisorCacheMetricsCollectorTaskArg arg) {
return new VisorCacheMetricsCollectorJob(arg, debug);
}
@@ -55,15 +55,15 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
Collection<VisorCacheMetrics> cms = res.getData();
for (VisorCacheMetrics cm : cms) {
- VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.name());
+ VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.getName());
if (am == null) {
- am = VisorCacheAggregatedMetrics.from(cm);
+ am = new VisorCacheAggregatedMetrics(cm);
- grpAggrMetrics.put(cm.name(), am);
+ grpAggrMetrics.put(cm.getName(), am);
}
- am.metrics().put(res.getNode().id(), cm);
+ am.getMetrics().put(res.getNode().id(), cm);
}
}
}
@@ -76,7 +76,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
* Job that collect cache metrics from node.
*/
private static class VisorCacheMetricsCollectorJob
- extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Collection<VisorCacheMetrics>> {
+ extends VisorJob<VisorCacheMetricsCollectorTaskArg, Collection<VisorCacheMetrics>> {
/** */
private static final long serialVersionUID = 0L;
@@ -87,19 +87,17 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
* @param arg Whether to collect metrics for all caches or for specified cache name only.
* @param debug Debug flag.
*/
- private VisorCacheMetricsCollectorJob(IgniteBiTuple<Boolean, Collection<String>> arg, boolean debug) {
+ private VisorCacheMetricsCollectorJob(VisorCacheMetricsCollectorTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Collection<VisorCacheMetrics> run(final IgniteBiTuple<Boolean, Collection<String>> arg) {
+ @Override protected Collection<VisorCacheMetrics> run(final VisorCacheMetricsCollectorTaskArg arg) {
assert arg != null;
- Boolean showSysCaches = arg.get1();
+ Boolean showSysCaches = arg.isShowSystemCaches();
- assert showSysCaches != null;
-
- Collection<String> cacheNames = arg.get2();
+ Collection<String> cacheNames = arg.getCacheNames();
assert cacheNames != null;
@@ -115,9 +113,9 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
if (ca.context().started()) {
String cacheName = ca.getName();
- VisorCacheMetrics cm = new VisorCacheMetrics().from(ignite, cacheName);
+ VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName);
- if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.system()))
+ if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem()))
res.add(cm);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..f0fa60a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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 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.
+ */
+@SuppressWarnings("PublicInnerClass")
+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 Collection<String> 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, Collection<String> 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 Collection<String> getCacheNames() {
+ return cacheNames;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(showSysCaches);
+ U.writeCollection(out, cacheNames);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ showSysCaches = in.readBoolean();
+ cacheNames = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheMetricsCollectorTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
index 8771da4..4ec75c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
@@ -17,12 +17,15 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.processors.cache.GridCacheUtils;
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;
@@ -31,7 +34,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
/**
* Data transfer object for near cache configuration properties.
*/
-public class VisorCacheNearConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheNearConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -48,54 +51,74 @@ public class VisorCacheNearConfiguration implements Serializable, LessNamingBean
private Integer nearEvictMaxSize;
/**
- * @param ccfg Cache configuration.
- * @return Data transfer object for near cache configuration properties.
+ * Default constructor.
*/
- public static VisorCacheNearConfiguration from(CacheConfiguration ccfg) {
- VisorCacheNearConfiguration cfg = new VisorCacheNearConfiguration();
+ public VisorCacheNearConfiguration() {
+ // No-op.
+ }
- cfg.nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
+ /**
+ * Create data transfer object for near cache configuration properties.
+ *
+ * @param ccfg Cache configuration.
+ */
+ public VisorCacheNearConfiguration(CacheConfiguration ccfg) {
+ nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
- if (cfg.nearEnabled) {
+ if (nearEnabled) {
NearCacheConfiguration nccfg = ccfg.getNearConfiguration();
- cfg.nearStartSize = nccfg.getNearStartSize();
- cfg.nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
- cfg.nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
+ nearStartSize = nccfg.getNearStartSize();
+ nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
+ nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
}
-
- return cfg;
}
/**
* @return {@code true} if near cache enabled.
*/
- public boolean nearEnabled() {
+ public boolean isNearEnabled() {
return nearEnabled;
}
/**
* @return Near cache start size.
*/
- public int nearStartSize() {
+ public int getNearStartSize() {
return nearStartSize;
}
/**
* @return Near cache eviction policy.
*/
- @Nullable public String nearEvictPolicy() {
+ @Nullable public String getNearEvictPolicy() {
return nearEvictPlc;
}
/**
* @return Near cache eviction policy max size.
*/
- @Nullable public Integer nearEvictMaxSize() {
+ @Nullable public Integer getNearEvictMaxSize() {
return nearEvictMaxSize;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(nearEnabled);
+ out.writeInt(nearStartSize);
+ U.writeString(out, nearEvictPlc);
+ out.writeObject(nearEvictMaxSize);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ nearEnabled = in.readBoolean();
+ nearStartSize = in.readInt();
+ nearEvictPlc = U.readString(in);
+ nearEvictMaxSize = (Integer)in.readObject();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheNearConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
index a6c0839..87cac1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
@@ -17,70 +17,67 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+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 for information about keys in cache partition.
*/
-public class VisorCachePartition implements Serializable, LessNamingBean {
+public class VisorCachePartition extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** */
- private int part;
+ private int partId;
/** */
- private int heap;
+ private long cnt;
- /** */
- private long offheap;
-
- /** */
- private long swap;
+ /**
+ * Default constructor.
+ */
+ public VisorCachePartition() {
+ // No-op.
+ }
/**
* Full constructor.
*
- * @param part Partition id.
- * @param heap Number of keys in heap.
- * @param offheap Number of keys in offheap.
- * @param swap Number of keys in swap.
+ * @param partId Partition id.
+ * @param cnt Number of keys in partition.
*/
- public VisorCachePartition(int part, int heap, long offheap, long swap) {
- this.part = part;
- this.heap = heap;
- this.offheap = offheap;
- this.swap = swap;
+ public VisorCachePartition(int partId, long cnt) {
+ this.partId = partId;
+ this.cnt = cnt;
}
/**
* @return Partition id.
*/
- public int partition() {
- return part;
+ public int getPartitionId() {
+ return partId;
}
/**
- * @return Number of keys in heap.
+ * @return Number of keys in partition.
*/
- public int heap() {
- return heap;
+ public long getCount() {
+ return cnt;
}
- /**
- * @return Number of keys in offheap.
- */
- public long offheap() {
- return offheap;
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeInt(partId);
+ out.writeLong(cnt);
}
- /**
- * @return Number of keys in swap.
- */
- public long swap() {
- return swap;
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ partId = in.readInt();
+ cnt = in.readLong();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
----------------------------------------------------------------------
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
index af48825..1cd7a29 100644
--- 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
@@ -17,16 +17,19 @@
package org.apache.ignite.internal.visor.cache;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
* Data transfer object for information about cache partitions.
*/
-public class VisorCachePartitions implements Serializable, LessNamingBean {
+public class VisorCachePartitions extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -47,42 +50,50 @@ public class VisorCachePartitions implements Serializable, LessNamingBean {
/**
* Add primary partition descriptor.
*
- * @param part Partition id.
- * @param heap Number of primary keys in heap.
- * @param offheap Number of primary keys in offheap.
- * @param swap Number of primary keys in swap.
+ * @param partId Partition id.
+ * @param cnt Number of primary keys in partition.
*/
- public void addPrimary(int part, int heap, long offheap, long swap) {
- primary.add(new VisorCachePartition(part, heap, offheap, swap));
+ public void addPrimary(int partId, long cnt) {
+ primary.add(new VisorCachePartition(partId, cnt));
}
/**
* Add backup partition descriptor.
*
- * @param part Partition id.
- * @param heap Number of backup keys in heap.
- * @param offheap Number of backup keys in offheap.
- * @param swap Number of backup keys in swap.
+ * @param partId Partition id.
+ * @param cnt Number of backup keys in partition.
*/
- public void addBackup(int part, int heap, long offheap, long swap) {
- backup.add(new VisorCachePartition(part, heap, offheap, swap));
+ public void addBackup(int partId, long cnt) {
+ backup.add(new VisorCachePartition(partId, cnt));
}
/**
* @return Get list of primary partitions.
*/
- public List<VisorCachePartition> primary() {
+ public List<VisorCachePartition> getPrimary() {
return primary;
}
/**
* @return Get list of backup partitions.
*/
- public List<VisorCachePartition> backup() {
+ public List<VisorCachePartition> getBackup() {
return backup;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, primary);
+ U.writeCollection(out, backup);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ primary = U.readList(in);
+ backup = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCachePartitions.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
----------------------------------------------------------------------
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
index 9cee477..b7ca975 100644
--- 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
@@ -21,14 +21,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
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.GridCacheSwapManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
@@ -47,7 +45,8 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName;
* Task that collect keys distribution in partitions.
*/
@GridInternal
-public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUID, VisorCachePartitions>, VisorCachePartitions> {
+public class VisorCachePartitionsTask extends VisorMultiNodeTask<String,
+ Map<UUID, VisorCachePartitions>, VisorCachePartitions> {
/** */
private static final long serialVersionUID = 0L;
@@ -108,8 +107,6 @@ public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUI
&& ca.context().affinityNode();
if (partitioned) {
- GridCacheSwapManager swap = ca.context().swap();
-
GridDhtCacheAdapter dca = null;
if (ca instanceof GridNearCacheAdapter)
@@ -122,21 +119,16 @@ public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUI
List<GridDhtLocalPartition> locParts = top.localPartitions();
- try {
- for (GridDhtLocalPartition part : locParts) {
- int p = part.id();
+ for (GridDhtLocalPartition part : locParts) {
+ int p = part.id();
- int sz = part.publicSize();
+ int sz = part.publicSize();
- // Pass -1 as topology version in order not to wait for topology version.
- if (part.primary(AffinityTopologyVersion.NONE))
- parts.addPrimary(p, sz, swap.offheapEntriesCount(p), swap.swapEntriesCount(p));
- else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE))
- parts.addBackup(p, sz, swap.offheapEntriesCount(p), swap.swapEntriesCount(p));
- }
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException("Failed to collect keys distribution in partitions", e);
+ // Pass -1 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);
}
}
}
[3/8] ignite git commit: GG-11732 Merged with master.
Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
----------------------------------------------------------------------
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
index f1d2165..b115b36 100644
--- 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
@@ -17,9 +17,14 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
+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.event.VisorGridEvent;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
@@ -28,12 +33,12 @@ import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
/**
* Data collector job result.
*/
-public class VisorNodeDataCollectorJobResult implements Serializable {
+public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
- /** Ignite instance name. */
- private String igniteInstanceName;
+ /** Grid name. */
+ private String gridName;
/** Node topology version. */
private long topVer;
@@ -42,22 +47,22 @@ public class VisorNodeDataCollectorJobResult implements Serializable {
private boolean taskMonitoringEnabled;
/** Node events. */
- private final Collection<VisorGridEvent> evts = new ArrayList<>();
+ private Collection<VisorGridEvent> evts = new ArrayList<>();
/** Exception while collecting node events. */
private Throwable evtsEx;
/** Node caches. */
- private final Collection<VisorCache> caches = new ArrayList<>();
+ private Collection<VisorCache> caches = new ArrayList<>();
/** Exception while collecting node caches. */
private Throwable cachesEx;
/** Node IGFSs. */
- private final Collection<VisorIgfs> igfss = new ArrayList<>();
+ private Collection<VisorIgfs> igfss = new ArrayList<>();
/** All IGFS endpoints collected from nodes. */
- private final Collection<VisorIgfsEndpoint> igfsEndpoints = new ArrayList<>();
+ private Collection<VisorIgfsEndpoint> igfsEndpoints = new ArrayList<>();
/** Exception while collecting node IGFSs. */
private Throwable igfssEx;
@@ -66,128 +71,170 @@ public class VisorNodeDataCollectorJobResult implements Serializable {
private long errCnt;
/**
- * @return Ignite instance name.
+ * Default constructor.
*/
- public String igniteInstanceName() {
- return igniteInstanceName;
+ public VisorNodeDataCollectorJobResult() {
+ // No-op.
}
/**
- * @param igniteInstanceName New Ignite instance name.
+ * @return Grid name.
*/
- public void igniteInstanceName(String igniteInstanceName) {
- this.igniteInstanceName = igniteInstanceName;
+ 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 topologyVersion() {
+ public long getTopologyVersion() {
return topVer;
}
/**
* @param topVer New topology version value.
*/
- public void topologyVersion(long topVer) {
+ public void setTopologyVersion(long topVer) {
this.topVer = topVer;
}
/**
* @return Current task monitoring state.
*/
- public boolean taskMonitoringEnabled() {
+ public boolean isTaskMonitoringEnabled() {
return taskMonitoringEnabled;
}
/**
* @param taskMonitoringEnabled New value of task monitoring state.
*/
- public void taskMonitoringEnabled(boolean taskMonitoringEnabled) {
+ public void setTaskMonitoringEnabled(boolean taskMonitoringEnabled) {
this.taskMonitoringEnabled = taskMonitoringEnabled;
}
/**
* @return Collection of collected events.
*/
- public Collection<VisorGridEvent> events() {
+ public Collection<VisorGridEvent> getEvents() {
return evts;
}
/**
* @return Exception caught during collecting events.
*/
- public Throwable eventsEx() {
+ public Throwable getEventsEx() {
return evtsEx;
}
/**
* @param evtsEx Exception caught during collecting events.
*/
- public void eventsEx(Throwable evtsEx) {
+ public void setEventsEx(Throwable evtsEx) {
this.evtsEx = evtsEx;
}
/**
* @return Collected cache metrics.
*/
- public Collection<VisorCache> caches() {
+ public Collection<VisorCache> getCaches() {
return caches;
}
/**
* @return Exception caught during collecting caches metrics.
*/
- public Throwable cachesEx() {
+ public Throwable getCachesEx() {
return cachesEx;
}
/**
* @param cachesEx Exception caught during collecting caches metrics.
*/
- public void cachesEx(Throwable cachesEx) {
+ public void setCachesEx(Throwable cachesEx) {
this.cachesEx = cachesEx;
}
/**
* @return Collected IGFSs metrics.
*/
- public Collection<VisorIgfs> igfss() {
+ public Collection<VisorIgfs> getIgfss() {
return igfss;
}
/**
* @return Collected IGFSs endpoints.
*/
- public Collection<VisorIgfsEndpoint> igfsEndpoints() {
+ public Collection<VisorIgfsEndpoint> getIgfsEndpoints() {
return igfsEndpoints;
}
/**
* @return Exception caught during collecting IGFSs metrics.
*/
- public Throwable igfssEx() {
+ public Throwable getIgfssEx() {
return igfssEx;
}
/**
* @param igfssEx Exception caught during collecting IGFSs metrics.
*/
- public void igfssEx(Throwable igfssEx) {
+ public void setIgfssEx(Throwable igfssEx) {
this.igfssEx = igfssEx;
}
/**
* @return Errors count.
*/
- public long errorCount() {
+ public long getErrorCount() {
return errCnt;
}
/**
- * @param errorCount Errors count.
+ * @param errCnt Errors count.
*/
- public void errorCount(long errorCount) {
- errCnt = errorCount;
+ public void setErrorCount(long errCnt) {
+ this.errCnt = errCnt;
+ }
+
+ /** {@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, caches);
+ out.writeObject(cachesEx);
+ U.writeCollection(out, igfss);
+ U.writeCollection(out, igfsEndpoints);
+ out.writeObject(igfssEx);
+ out.writeLong(errCnt);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ gridName = U.readString(in);
+ topVer = in.readLong();
+ taskMonitoringEnabled = in.readBoolean();
+ evts = U.readCollection(in);
+ evtsEx = (Throwable)in.readObject();
+ caches = U.readCollection(in);
+ cachesEx = (Throwable)in.readObject();
+ igfss = U.readCollection(in);
+ igfsEndpoints = U.readCollection(in);
+ igfssEx = (Throwable)in.readObject();
+ errCnt = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeDataCollectorJobResult.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
----------------------------------------------------------------------
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
index 50879e7..1f2fe77 100644
--- 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
@@ -66,11 +66,13 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
else {
// Ignore nodes that left topology.
if (!(unhandledEx instanceof ClusterGroupEmptyException))
- taskRes.unhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx));
+ taskRes.getUnhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx));
}
}
}
+ taskRes.active(true /*ignite.active()*/);
+
return taskRes;
}
@@ -83,33 +85,33 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
*/
protected void reduceJobResult(VisorNodeDataCollectorTaskResult taskRes,
VisorNodeDataCollectorJobResult jobRes, UUID nid) {
- taskRes.igniteInstanceNames().put(nid, jobRes.igniteInstanceName());
+ taskRes.getGridNames().put(nid, jobRes.getGridName());
- taskRes.topologyVersions().put(nid, jobRes.topologyVersion());
+ taskRes.getTopologyVersions().put(nid, jobRes.getTopologyVersion());
- taskRes.taskMonitoringEnabled().put(nid, jobRes.taskMonitoringEnabled());
+ taskRes.isTaskMonitoringEnabled().put(nid, jobRes.isTaskMonitoringEnabled());
- taskRes.errorCounts().put(nid, jobRes.errorCount());
+ taskRes.getErrorCounts().put(nid, jobRes.getErrorCount());
- if (!jobRes.events().isEmpty())
- taskRes.events().addAll(jobRes.events());
+ if (!jobRes.getEvents().isEmpty())
+ taskRes.getEvents().addAll(jobRes.getEvents());
- if (jobRes.eventsEx() != null)
- taskRes.eventsEx().put(nid, new VisorExceptionWrapper(jobRes.eventsEx()));
+ if (jobRes.getEventsEx() != null)
+ taskRes.getEventsEx().put(nid, new VisorExceptionWrapper(jobRes.getEventsEx()));
- if (!jobRes.caches().isEmpty())
- taskRes.caches().put(nid, jobRes.caches());
+ if (!jobRes.getCaches().isEmpty())
+ taskRes.getCaches().put(nid, jobRes.getCaches());
- if (jobRes.cachesEx() != null)
- taskRes.cachesEx().put(nid, new VisorExceptionWrapper(jobRes.cachesEx()));
+ if (jobRes.getCachesEx() != null)
+ taskRes.getCachesEx().put(nid, new VisorExceptionWrapper(jobRes.getCachesEx()));
- if (!jobRes.igfss().isEmpty())
- taskRes.igfss().put(nid, jobRes.igfss());
+ if (!jobRes.getIgfss().isEmpty())
+ taskRes.getIgfss().put(nid, jobRes.getIgfss());
- if (!jobRes.igfsEndpoints().isEmpty())
- taskRes.igfsEndpoints().put(nid, jobRes.igfsEndpoints());
+ if (!jobRes.getIgfsEndpoints().isEmpty())
+ taskRes.getIgfsEndpoints().put(nid, jobRes.getIgfsEndpoints());
- if (jobRes.igfssEx() != null)
- taskRes.igfssEx().put(nid, new VisorExceptionWrapper(jobRes.igfssEx()));
+ if (jobRes.getIgfssEx() != null)
+ taskRes.getIgfssEx().put(nid, new VisorExceptionWrapper(jobRes.getIgfssEx()));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java
----------------------------------------------------------------------
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
index 975dd28..8d016dc 100644
--- 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
@@ -17,12 +17,17 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+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 collector task arguments.
*/
-public class VisorNodeDataCollectorTaskArg implements Serializable {
+public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -74,70 +79,93 @@ public class VisorNodeDataCollectorTaskArg implements Serializable {
/**
* @return {@code true} if Visor should collect information about tasks.
*/
- public boolean taskMonitoringEnabled() {
+ public boolean isTaskMonitoringEnabled() {
return taskMonitoringEnabled;
}
/**
* @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks.
*/
- public void taskMonitoringEnabled(boolean taskMonitoringEnabled) {
+ public void setTaskMonitoringEnabled(boolean taskMonitoringEnabled) {
this.taskMonitoringEnabled = taskMonitoringEnabled;
}
/**
* @return Key for store and read last event order number.
*/
- public String eventsOrderKey() {
+ public String getEventsOrderKey() {
return evtOrderKey;
}
/**
* @param evtOrderKey Key for store and read last event order number.
*/
- public void eventsOrderKey(String evtOrderKey) {
+ public void setEventsOrderKey(String evtOrderKey) {
this.evtOrderKey = evtOrderKey;
}
/**
* @return Key for store and read events throttle counter.
*/
- public String eventsThrottleCounterKey() {
+ public String getEventsThrottleCounterKey() {
return evtThrottleCntrKey;
}
/**
* @param evtThrottleCntrKey Key for store and read events throttle counter.
*/
- public void eventsThrottleCounterKey(String evtThrottleCntrKey) {
+ public void setEventsThrottleCounterKey(String evtThrottleCntrKey) {
this.evtThrottleCntrKey = evtThrottleCntrKey;
}
/**
* @return Number of items to evaluate cache size.
*/
- public int sample() {
+ public int getSample() {
return sample;
}
/**
* @param sample Number of items to evaluate cache size.
*/
- public void sample(int sample) {
+ public void setSample(int sample) {
this.sample = sample;
}
/**
* @return {@code true} if Visor should collect metrics for system caches.
*/
- public boolean systemCaches() {
+ public boolean getSystemCaches() {
return sysCaches;
}
/**
* @param sysCaches {@code true} if Visor should collect metrics for system caches.
*/
- public void systemCaches(boolean sysCaches) {
+ public void setSystemCaches(boolean sysCaches) {
this.sysCaches = sysCaches;
}
-}
\ No newline at end of file
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(taskMonitoringEnabled);
+ U.writeString(out, evtOrderKey);
+ U.writeString(out, evtThrottleCntrKey);
+ out.writeInt(sample);
+ out.writeBoolean(sysCaches);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ taskMonitoringEnabled = in.readBoolean();
+ evtOrderKey = U.readString(in);
+ evtThrottleCntrKey = U.readString(in);
+ sample = in.readInt();
+ sysCaches = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeDataCollectorTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
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
index 3cea146..aa4fda5 100644
--- 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
@@ -17,14 +17,18 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+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.LessNamingBean;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.internal.visor.cache.VisorCache;
import org.apache.ignite.internal.visor.event.VisorGridEvent;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
@@ -34,52 +38,62 @@ import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
/**
* Data collector task result.
*/
-public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamingBean {
+public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
+ /** Grid active flag. */
+ private boolean active;
+
/** Unhandled exceptions from nodes. */
- private final Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
/** Nodes grid names. */
- private final Map<UUID, String> igniteInstanceNames = new HashMap<>();
+ private Map<UUID, String> gridNames = new HashMap<>();
/** Nodes topology versions. */
- private final Map<UUID, Long> topVersions = new HashMap<>();
+ private Map<UUID, Long> topVersions = new HashMap<>();
/** All task monitoring state collected from nodes. */
- private final Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>();
+ private Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>();
/** Nodes error counts. */
- private final Map<UUID, Long> errCnts = new HashMap<>();
+ private Map<UUID, Long> errCnts = new HashMap<>();
/** All events collected from nodes. */
- private final List<VisorGridEvent> evts = new ArrayList<>();
+ private List<VisorGridEvent> evts = new ArrayList<>();
/** Exceptions caught during collecting events from nodes. */
- private final Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
/** All caches collected from nodes. */
- private final Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
+ private Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
/** Exceptions caught during collecting caches from nodes. */
- private final Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
/** All IGFS collected from nodes. */
- private final Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
+ private Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
/** All IGFS endpoints collected from nodes. */
- private final Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
+ private Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
/** Exceptions caught during collecting IGFS from nodes. */
- private final Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
+
+ /**
+ * Default constructor.
+ */
+ public VisorNodeDataCollectorTaskResult() {
+ // No-op.
+ }
/**
* @return {@code true} If no data was collected.
*/
public boolean isEmpty() {
return
- igniteInstanceNames.isEmpty() &&
+ gridNames.isEmpty() &&
topVersions.isEmpty() &&
unhandledEx.isEmpty() &&
taskMonitoringEnabled.isEmpty() &&
@@ -93,86 +107,139 @@ public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamin
}
/**
+ * @return {@code True} if grid is active.
+ */
+ public boolean active() {
+ return active;
+ }
+
+ /**
+ * @param active active New value of grid active flag.
+ */
+ public void active(boolean active) {
+ this.active = active;
+ }
+
+ /**
* @return Unhandled exceptions from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> unhandledEx() {
+ public Map<UUID, VisorExceptionWrapper> getUnhandledEx() {
return unhandledEx;
}
/**
- * @return Nodes Ignite instance names.
+ * @return Nodes grid names.
*/
- public Map<UUID, String> igniteInstanceNames() {
- return igniteInstanceNames;
+ public Map<UUID, String> getGridNames() {
+ return gridNames;
}
/**
* @return Nodes topology versions.
*/
- public Map<UUID, Long> topologyVersions() {
+ public Map<UUID, Long> getTopologyVersions() {
return topVersions;
}
/**
* @return All task monitoring state collected from nodes.
*/
- public Map<UUID, Boolean> taskMonitoringEnabled() {
+ public Map<UUID, Boolean> isTaskMonitoringEnabled() {
return taskMonitoringEnabled;
}
/**
* @return All events collected from nodes.
*/
- public List<VisorGridEvent> events() {
+ public List<VisorGridEvent> getEvents() {
return evts;
}
/**
* @return Exceptions caught during collecting events from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> eventsEx() {
+ public Map<UUID, VisorExceptionWrapper> getEventsEx() {
return evtsEx;
}
/**
* @return All caches collected from nodes.
*/
- public Map<UUID, Collection<VisorCache>> caches() {
+ public Map<UUID, Collection<VisorCache>> getCaches() {
return caches;
}
/**
* @return Exceptions caught during collecting caches from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> cachesEx() {
+ public Map<UUID, VisorExceptionWrapper> getCachesEx() {
return cachesEx;
}
/**
* @return All IGFS collected from nodes.
*/
- public Map<UUID, Collection<VisorIgfs>> igfss() {
+ public Map<UUID, Collection<VisorIgfs>> getIgfss() {
return igfss;
}
/**
* @return All IGFS endpoints collected from nodes.
*/
- public Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints() {
+ public Map<UUID, Collection<VisorIgfsEndpoint>> getIgfsEndpoints() {
return igfsEndpoints;
}
/**
* @return Exceptions caught during collecting IGFS from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> igfssEx() {
+ public Map<UUID, VisorExceptionWrapper> getIgfssEx() {
return igfssEx;
}
/**
* @return Nodes error counts.
*/
- public Map<UUID, Long> errorCounts() {
+ public Map<UUID, Long> getErrorCounts() {
return errCnts;
}
+
+ /** {@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, caches);
+ U.writeMap(out, cachesEx);
+ U.writeMap(out, igfss);
+ U.writeMap(out, igfsEndpoints);
+ U.writeMap(out, igfssEx);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(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);
+ caches = U.readMap(in);
+ cachesEx = U.readMap(in);
+ igfss = U.readMap(in);
+ igfsEndpoints = U.readMap(in);
+ igfssEx = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeDataCollectorTaskResult.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java
----------------------------------------------------------------------
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
index f219908..bb6c83e 100644
--- 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
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -38,18 +37,14 @@ 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 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.EVT_MAPPER;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.concat;
/**
* Task that runs on specified node and returns events data.
*/
@GridInternal
-public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg,
+public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEventsCollectorTaskArg,
Iterable<? extends VisorGridEvent>, Collection<? extends VisorGridEvent>> {
/** */
private static final long serialVersionUID = 0L;
@@ -72,114 +67,6 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
}
/**
- * Argument for task returns events data.
- */
- @SuppressWarnings("PublicInnerClass")
- public static class VisorNodeEventsCollectorTaskArg implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Node local storage key. */
- private final String keyOrder;
-
- /** Arguments for type filter. */
- private final int[] typeArg;
-
- /** Arguments for time filter. */
- private final Long timeArg;
-
- /** Task or job events with task name contains. */
- private final String taskName;
-
- /** Task or job events with session. */
- private final IgniteUuid taskSesId;
-
- /**
- * @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 keyOrder() {
- return keyOrder;
- }
-
- /**
- * @return Arguments for type filter.
- */
- public int[] typeArgument() {
- return typeArg;
- }
-
- /**
- * @return Arguments for time filter.
- */
- public Long timeArgument() {
- return timeArg;
- }
-
- /**
- * @return Task or job events with task name contains.
- */
- public String taskName() {
- return taskName;
- }
-
- /**
- * @return Task or job events with session.
- */
- public IgniteUuid taskSessionId() {
- return taskSesId;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorNodeEventsCollectorTaskArg.class, this);
- }
- }
-
- /**
* Job for task returns events data.
*/
protected static class VisorNodeEventsCollectorJob extends VisorJob<VisorNodeEventsCollectorTaskArg,
@@ -279,12 +166,12 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
/** {@inheritDoc} */
@Override protected Collection<? extends VisorGridEvent> run(final VisorNodeEventsCollectorTaskArg arg) {
- final long startEvtTime = arg.timeArgument() == null ? 0L : System.currentTimeMillis() - arg.timeArgument();
+ final long startEvtTime = arg.getTimeArgument() == null ? 0L : System.currentTimeMillis() - arg.getTimeArgument();
final ConcurrentMap<String, Long> nl = ignite.cluster().nodeLocalMap();
- final Long startEvtOrder = arg.keyOrder() != null && nl.containsKey(arg.keyOrder()) ?
- nl.get(arg.keyOrder()) : -1L;
+ final Long startEvtOrder = arg.getKeyOrder() != null && nl.containsKey(arg.getKeyOrder()) ?
+ nl.get(arg.getKeyOrder()) : -1L;
Collection<Event> evts = ignite.events().localQuery(new IgnitePredicate<Event>() {
/** */
@@ -292,10 +179,10 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
@Override public boolean apply(Event evt) {
return evt.localOrder() > startEvtOrder &&
- (arg.typeArgument() == null || F.contains(arg.typeArgument(), evt.type())) &&
+ (arg.getTypeArgument() == null || F.contains(arg.getTypeArgument(), evt.type())) &&
(evt.timestamp() >= startEvtTime) &&
- (arg.taskName() == null || filterByTaskName(evt, arg.taskName())) &&
- (arg.taskSessionId() == null || filterByTaskSessionId(evt, arg.taskSessionId()));
+ (arg.getTaskName() == null || filterByTaskName(evt, arg.getTaskName())) &&
+ (arg.getTaskSessionId() == null || filterByTaskSessionId(evt, arg.getTaskSessionId()));
}
});
@@ -319,8 +206,8 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
}
// Update latest order in node local, if not empty.
- if (arg.keyOrder() != null && !res.isEmpty())
- nl.put(arg.keyOrder(), maxOrder);
+ if (arg.getKeyOrder() != null && !res.isEmpty())
+ nl.put(arg.getKeyOrder(), maxOrder);
return res;
}
@@ -330,4 +217,4 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
return S.toString(VisorNodeEventsCollectorJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..b59e722
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.
+ */
+@SuppressWarnings("PublicInnerClass")
+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.writeGridUuid(out, taskSesId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ keyOrder = U.readString(in);
+ typeArg = (int[])in.readObject();
+ timeArg = (Long)in.readObject();
+ taskName = U.readString(in);
+ taskSesId = U.readGridUuid(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeEventsCollectorTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
----------------------------------------------------------------------
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
index 42afc73..8c8ac7f 100644
--- 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
@@ -35,8 +35,7 @@ import org.jetbrains.annotations.Nullable;
* Task to run gc on nodes.
*/
@GridInternal
-public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBiTuple<Long, Long>>,
- IgniteBiTuple<Long, Long>> {
+public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, VisorNodeGcTaskResult>, VisorNodeGcTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -46,11 +45,11 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
}
/** {@inheritDoc} */
- @Nullable @Override protected Map<UUID, IgniteBiTuple<Long, Long>> reduce0(List<ComputeJobResult> results) {
- Map<UUID, IgniteBiTuple<Long, Long>> total = new HashMap<>();
+ @Nullable @Override protected Map<UUID, VisorNodeGcTaskResult> reduce0(List<ComputeJobResult> results) {
+ Map<UUID, VisorNodeGcTaskResult> total = new HashMap<>();
for (ComputeJobResult res : results) {
- IgniteBiTuple<Long, Long> jobRes = res.getData();
+ VisorNodeGcTaskResult jobRes = res.getData();
total.put(res.getNode().id(), jobRes);
}
@@ -59,7 +58,7 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
}
/** Job that perform GC on node. */
- private static class VisorNodeGcJob extends VisorJob<Void, IgniteBiTuple<Long, Long>> {
+ private static class VisorNodeGcJob extends VisorJob<Void, VisorNodeGcTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -74,14 +73,14 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<Long, Long> run(Void arg) {
+ @Override protected VisorNodeGcTaskResult run(Void arg) {
ClusterNode locNode = ignite.localNode();
long before = freeHeap(locNode);
System.gc();
- return new IgniteBiTuple<>(before, freeHeap(locNode));
+ return new VisorNodeGcTaskResult(before, freeHeap(locNode));
}
/**
@@ -99,4 +98,4 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
return S.toString(VisorNodeGcJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..240e4aa
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ sizeBefore = in.readLong();
+ sizeAfter = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeGcTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
----------------------------------------------------------------------
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
index f59ea01..6169dcb 100644
--- 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
@@ -22,7 +22,6 @@ import java.util.UUID;
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.util.lang.GridTuple3;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
@@ -32,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
* Ping other node.
*/
@GridInternal
-public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean, Long, Long>> {
+public class VisorNodePingTask extends VisorOneNodeTask<UUID, VisorNodePingTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -42,19 +41,19 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
}
/** {@inheritDoc} */
- @Nullable @Override protected GridTuple3<Boolean, Long, Long> reduce0(List<ComputeJobResult> results) {
+ @Nullable @Override protected VisorNodePingTaskResult reduce0(List<ComputeJobResult> results) {
try {
return super.reduce0(results);
}
catch (ClusterTopologyException ignored) {
- return new GridTuple3<>(false, -1L, -1L);
+ return new VisorNodePingTaskResult(false, -1L, -1L);
}
}
/**
* Job that ping node.
*/
- private static class VisorNodePingJob extends VisorJob<UUID, GridTuple3<Boolean, Long, Long>> {
+ private static class VisorNodePingJob extends VisorJob<UUID, VisorNodePingTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -67,10 +66,10 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
}
/** {@inheritDoc} */
- @Override protected GridTuple3<Boolean, Long, Long> run(UUID nodeToPing) {
+ @Override protected VisorNodePingTaskResult run(UUID nodeToPing) {
long start = System.currentTimeMillis();
- return new GridTuple3<>(ignite.cluster().pingNode(nodeToPing), start, System.currentTimeMillis());
+ return new VisorNodePingTaskResult(ignite.cluster().pingNode(nodeToPing), start, System.currentTimeMillis());
}
/** {@inheritDoc} */
@@ -78,4 +77,4 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
return S.toString(VisorNodePingJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..ccaa755
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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(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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..e1a7432
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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<VisorSuppressedError> 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<VisorSuppressedError> 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<VisorSuppressedError> getErrors() {
+ return errors;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(order);
+ U.writeCollection(out, errors);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ order = in.readLong();
+ errors = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeSuppressedErrors.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
----------------------------------------------------------------------
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
index 1f673ca..3ff0d80 100644
--- 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
@@ -37,8 +37,7 @@ import org.jetbrains.annotations.Nullable;
*/
@GridInternal
public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID, Long>,
- Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>>,
- IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> {
+ Map<UUID, VisorNodeSuppressedErrors>, VisorNodeSuppressedErrors> {
/** */
private static final long serialVersionUID = 0L;
@@ -48,13 +47,13 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
}
/** {@inheritDoc} */
- @Nullable @Override protected Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>>
+ @Nullable @Override protected Map<UUID, VisorNodeSuppressedErrors>
reduce0(List<ComputeJobResult> results) {
- Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> taskRes =
+ Map<UUID, VisorNodeSuppressedErrors> taskRes =
new HashMap<>(results.size());
for (ComputeJobResult res : results) {
- IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> jobRes = res.getData();
+ VisorNodeSuppressedErrors jobRes = res.getData();
taskRes.put(res.getNode().id(), jobRes);
}
@@ -65,8 +64,7 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
/**
* Job to collect last errors on nodes.
*/
- private static class VisorNodeSuppressedErrorsJob extends VisorJob<Map<UUID, Long>,
- IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> {
+ private static class VisorNodeSuppressedErrorsJob extends VisorJob<Map<UUID, Long>, VisorNodeSuppressedErrors> {
/** */
private static final long serialVersionUID = 0L;
@@ -81,20 +79,20 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> run(Map<UUID, Long> arg) {
+ @Override protected VisorNodeSuppressedErrors run(Map<UUID, Long> arg) {
Long lastOrder = arg.get(ignite.localNode().id());
long order = lastOrder != null ? lastOrder : 0;
List<IgniteExceptionRegistry.ExceptionInfo> errors = ignite.context().exceptionRegistry().getErrors(order);
- List<IgniteExceptionRegistry.ExceptionInfo> wrapped = new ArrayList<>(errors.size());
+ List<VisorSuppressedError> wrapped = new ArrayList<>(errors.size());
for (IgniteExceptionRegistry.ExceptionInfo error : errors) {
if (error.order() > order)
order = error.order();
- wrapped.add(new IgniteExceptionRegistry.ExceptionInfo(error.order(),
+ wrapped.add(new VisorSuppressedError(error.order(),
new VisorExceptionWrapper(error.error()),
error.message(),
error.threadId(),
@@ -102,7 +100,7 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
error.time()));
}
- return new IgniteBiTuple<>(order, wrapped);
+ return new VisorNodeSuppressedErrors(order, wrapped);
}
/** {@inheritDoc} */
@@ -110,4 +108,4 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
return S.toString(VisorNodeSuppressedErrorsJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
----------------------------------------------------------------------
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
index 93177fd..8662416 100644
--- 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
@@ -17,18 +17,21 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.Collection;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
-
/**
* Data transfer object for node P2P configuration properties.
*/
-public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBean {
+public class VisorPeerToPeerConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -39,44 +42,62 @@ public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBea
private int p2pMissedResCacheSize;
/** List of packages from the system classpath that need to be loaded from task originating node. */
- private String p2pLocClsPathExcl;
+ private Collection<String> p2pLocClsPathExcl;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node P2P configuration properties.
+ * Default constructor.
*/
- public static VisorPeerToPeerConfiguration from(IgniteConfiguration c) {
- VisorPeerToPeerConfiguration cfg = new VisorPeerToPeerConfiguration();
-
- cfg.p2pEnabled = c.isPeerClassLoadingEnabled();
- cfg.p2pMissedResCacheSize = c.getPeerClassLoadingMissedResourcesCacheSize();
- cfg.p2pLocClsPathExcl = compactArray(c.getPeerClassLoadingLocalClassPathExclude());
+ public VisorPeerToPeerConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * 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 p2pEnabled() {
+ public boolean isPeerClassLoadingEnabled() {
return p2pEnabled;
}
/**
* @return Missed resource cache size.
*/
- public int p2pMissedResponseCacheSize() {
+ public int getPeerClassLoadingMissedResourcesCacheSize() {
return p2pMissedResCacheSize;
}
/**
* @return List of packages from the system classpath that need to be loaded from task originating node.
*/
- @Nullable public String p2pLocalClassPathExclude() {
+ @Nullable public Collection<String> 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ p2pEnabled = in.readBoolean();
+ p2pMissedResCacheSize = in.readInt();
+ p2pLocClsPathExcl = U.readCollection(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorPeerToPeerConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
----------------------------------------------------------------------
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
index 78a54b3..b2ad034 100644
--- 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
@@ -17,11 +17,14 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+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.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
import static java.lang.System.getProperty;
@@ -33,7 +36,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.intValue;
/**
* Create data transfer object for node REST configuration properties.
*/
-public class VisorRestConfiguration implements Serializable, LessNamingBean {
+public class VisorRestConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -43,9 +46,6 @@ public class VisorRestConfiguration implements Serializable, LessNamingBean {
/** Whether or not SSL is enabled for TCP binary protocol. */
private boolean tcpSslEnabled;
- /** Rest accessible folders (log command can get files from). */
- private String[] accessibleFolders;
-
/** Jetty config path. */
private String jettyPath;
@@ -65,95 +65,116 @@ public class VisorRestConfiguration implements Serializable, LessNamingBean {
private String tcpSslCtxFactory;
/**
+ * Default constructor.
+ */
+ public VisorRestConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for node REST configuration properties.
+ *
* @param c Grid configuration.
- * @return Create data transfer object for node REST configuration properties.
*/
- public static VisorRestConfiguration from(IgniteConfiguration c) {
- VisorRestConfiguration cfg = new VisorRestConfiguration();
+ public VisorRestConfiguration(IgniteConfiguration c) {
+ assert c != null;
ConnectorConfiguration clnCfg = c.getConnectorConfiguration();
- boolean restEnabled = clnCfg != null;
-
- cfg.restEnabled = restEnabled;
+ restEnabled = clnCfg != null;
if (restEnabled) {
- cfg.tcpSslEnabled = clnCfg.isSslEnabled();
- cfg.jettyPath = clnCfg.getJettyPath();
- cfg.jettyHost = getProperty(IGNITE_JETTY_HOST);
- cfg.jettyPort = intValue(IGNITE_JETTY_PORT, null);
- cfg.tcpHost = clnCfg.getHost();
- cfg.tcpPort = clnCfg.getPort();
- cfg.tcpSslCtxFactory = compactClass(clnCfg.getSslContextFactory());
+ tcpSslEnabled = clnCfg.isSslEnabled();
+ jettyPath = clnCfg.getJettyPath();
+ jettyHost = getProperty(IGNITE_JETTY_HOST);
+ jettyPort = intValue(IGNITE_JETTY_PORT, null);
+ tcpHost = clnCfg.getHost();
+ tcpPort = clnCfg.getPort();
+ tcpSslCtxFactory = compactClass(clnCfg.getSslContextFactory());
}
-
- return cfg;
}
/**
* @return Whether REST enabled or not.
*/
- public boolean restEnabled() {
+ public boolean isRestEnabled() {
return restEnabled;
}
/**
* @return Whether or not SSL is enabled for TCP binary protocol.
*/
- public boolean tcpSslEnabled() {
+ public boolean isTcpSslEnabled() {
return tcpSslEnabled;
}
/**
- * @return Rest accessible folders (log command can get files from).
- */
- @Nullable public String[] accessibleFolders() {
- return accessibleFolders;
- }
-
- /**
* @return Jetty config path.
*/
- @Nullable public String jettyPath() {
+ @Nullable public String getJettyPath() {
return jettyPath;
}
/**
* @return Jetty host.
*/
- @Nullable public String jettyHost() {
+ @Nullable public String getJettyHost() {
return jettyHost;
}
/**
* @return Jetty port.
*/
- @Nullable public Integer jettyPort() {
+ @Nullable public Integer getJettyPort() {
return jettyPort;
}
/**
* @return REST TCP binary host.
*/
- @Nullable public String tcpHost() {
+ @Nullable public String getTcpHost() {
return tcpHost;
}
/**
* @return REST TCP binary port.
*/
- @Nullable public Integer tcpPort() {
+ @Nullable public Integer getTcpPort() {
return tcpPort;
}
/**
* @return Context factory for SSL.
*/
- @Nullable public String tcpSslContextFactory() {
+ @Nullable public String getTcpSslContextFactory() {
return tcpSslCtxFactory;
}
/** {@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.writeObject(tcpPort);
+ U.writeString(out, tcpSslCtxFactory);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(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 = (Integer)in.readObject();
+ tcpSslCtxFactory = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorRestConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
----------------------------------------------------------------------
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
index 44909fc..2a61097 100644
--- 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
@@ -17,10 +17,13 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +32,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
/**
* Data transfer object for node segmentation configuration properties.
*/
-public class VisorSegmentationConfiguration implements Serializable, LessNamingBean {
+public class VisorSegmentationConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -46,57 +49,79 @@ public class VisorSegmentationConfiguration implements Serializable, LessNamingB
private boolean waitOnStart;
/** Whether or not all resolvers should succeed for node to be in correct segment. */
- private boolean passRequired;
+ private boolean allResolversPassReq;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node segmentation configuration properties.
+ * Default constructor.
*/
- public static VisorSegmentationConfiguration from(IgniteConfiguration c) {
- VisorSegmentationConfiguration cfg = new VisorSegmentationConfiguration();
-
- cfg.plc = c.getSegmentationPolicy();
- cfg.resolvers = compactArray(c.getSegmentationResolvers());
- cfg.checkFreq = c.getSegmentCheckFrequency();
- cfg.waitOnStart = c.isWaitForSegmentOnStart();
- cfg.passRequired = c.isAllSegmentationResolversPassRequired();
+ public VisorSegmentationConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * 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();
}
/**
* @return Segmentation policy.
*/
- public SegmentationPolicy policy() {
+ public SegmentationPolicy getPolicy() {
return plc;
}
/**
* @return Segmentation resolvers.
*/
- @Nullable public String resolvers() {
+ @Nullable public String getResolvers() {
return resolvers;
}
/**
* @return Frequency of network segment check by discovery manager.
*/
- public long checkFrequency() {
+ public long getCheckFrequency() {
return checkFreq;
}
/**
* @return Whether or not node should wait for correct segment on start.
*/
- public boolean waitOnStart() {
+ public boolean isWaitOnStart() {
return waitOnStart;
}
/**
* @return Whether or not all resolvers should succeed for node to be in correct segment.
*/
- public boolean passRequired() {
- return passRequired;
+ public boolean isAllSegmentationResolversPassRequired() {
+ return allResolversPassReq;
+ }
+
+ /** {@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);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
+ plc = SegmentationPolicy.fromOrdinal(in.readByte());
+ resolvers = U.readString(in);
+ checkFreq = in.readLong();
+ waitOnStart = in.readBoolean();
+ allResolversPassReq = in.readBoolean();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb9112e6/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..a2c2374
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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<String, Object> 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<String, Object> fldDesc) {
+ this.clsName = clsName;
+ this.fldDesc = fldDesc;
+ }
+
+ /**
+ * @return SPI class name.
+ */
+ public String getClassName() {
+ return clsName;
+ }
+
+ /**
+ * @return SPI fields description.
+ */
+ public Map<String, Object> 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(ObjectInput in) throws IOException, ClassNotFoundException {
+ clsName = U.readString(in);
+ fldDesc = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorSpiDescription.class, this);
+ }
+}