# ignite-339 Refactored VisorCacheAffinityConfiguration
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ff0c1e1d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ff0c1e1d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ff0c1e1d Branch: refs/heads/ignite-141 Commit: ff0c1e1dbbd6da1a8724b4b40ecbf1095f506be9 Parents: adb2454 Author: anovikov <anovi...@gridgain.com> Authored: Fri Feb 27 15:49:47 2015 +0700 Committer: anovikov <anovi...@gridgain.com> Committed: Fri Feb 27 15:49:47 2015 +0700 ---------------------------------------------------------------------- .../ignite/internal/visor/cache/VisorCache.java | 190 ++------ .../cache/VisorCacheAffinityConfiguration.java | 53 +-- .../visor/cache/VisorCacheConfiguration.java | 462 ++++--------------- .../cache/VisorCacheDefaultConfiguration.java | 27 +- .../cache/VisorCacheEvictionConfiguration.java | 81 +--- .../cache/VisorCacheNearConfiguration.java | 42 +- .../cache/VisorCachePreloadConfiguration.java | 54 +-- .../cache/VisorCacheStoreConfiguration.java | 148 +++++- .../VisorCacheWriteBehindConfiguration.java | 137 ------ .../internal/visor/util/VisorTaskUtils.java | 4 +- .../commands/cache/VisorCacheCommand.scala | 26 +- 11 files changed, 304 insertions(+), 920 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 72a93e0..500e517 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 @@ -77,19 +77,19 @@ public class VisorCache implements Serializable { private long swapKeys; /** Number of partitions. */ - private int partsCnt; + private int partitions; /** Primary partitions IDs with sizes. */ - private Collection<IgnitePair<Integer>> primaryParts; + private Collection<IgnitePair<Integer>> primaryPartitions; /** Backup partitions IDs with sizes. */ - private Collection<IgnitePair<Integer>> backupParts; + private Collection<IgnitePair<Integer>> backupPartitions; /** Cache metrics. */ private VisorCacheMetrics metrics; /** Cache partitions states. */ - private GridDhtPartitionMap partsMap; + private GridDhtPartitionMap partitionsMap; /** * @param ignite Grid. @@ -209,22 +209,22 @@ public class VisorCache implements Serializable { VisorCache cache = new VisorCache(); - cache.name(cacheName); - cache.mode(mode); - cache.memorySize(memSz); - cache.size(size); - cache.nearSize(near); - cache.dhtSize(size - near); - cache.primarySize(ca.primarySize()); - cache.offHeapAllocatedSize(ca.offHeapAllocatedSize()); - cache.offHeapEntriesCount(ca.offHeapEntriesCount()); - cache.swapSize(swapSize); - cache.swapKeys(swapKeys); - cache.partitions(ca.affinity().partitions()); - cache.primaryPartitions(pps); - cache.backupPartitions(bps); - cache.metrics(VisorCacheMetrics.from(ca)); - cache.partitionMap(partsMap); + cache.name = cacheName; + cache.mode = mode; + cache.memorySize = memSz; + cache.size = size; + cache.nearSize = near; + cache.dhtSize = size - near; + cache.primarySize = ca.primarySize(); + cache.offHeapAllocatedSize = ca.offHeapAllocatedSize(); + cache.offHeapEntriesCnt = ca.offHeapEntriesCount(); + cache.swapSize = swapSize; + cache.swapKeys = swapKeys; + cache.partitions = ca.affinity().partitions(); + cache.primaryPartitions = pps; + cache.backupPartitions = bps; + cache.metrics = VisorCacheMetrics.from(ca); + cache.partitionsMap = partsMap; return cache; } @@ -235,21 +235,21 @@ public class VisorCache implements Serializable { public VisorCache history() { VisorCache c = new VisorCache(); - c.name(name); - c.mode(mode); - c.memorySize(memorySize); - c.size(size); - c.nearSize(nearSize); - c.dhtSize(dhtSize); - c.primarySize(primarySize); - c.offHeapAllocatedSize(offHeapAllocatedSize); - c.offHeapEntriesCount(offHeapEntriesCnt); - c.swapSize(swapSize); - c.swapKeys(swapKeys); - c.partitions(partsCnt); - c.primaryPartitions(Collections.<IgnitePair<Integer>>emptyList()); - c.backupPartitions(Collections.<IgnitePair<Integer>>emptyList()); - c.metrics(metrics); + c.name = name; + c.mode = mode; + c.memorySize = memorySize; + 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.primaryPartitions = Collections.emptyList(); + c.backupPartitions = Collections.emptyList(); + c.metrics = metrics; return c; } @@ -262,13 +262,6 @@ public class VisorCache implements Serializable { } /** - * @param name New cache name. - */ - public void name(String name) { - this.name = name; - } - - /** * @return Cache mode. */ public CacheMode mode() { @@ -276,13 +269,6 @@ public class VisorCache implements Serializable { } /** - * @param mode New cache mode. - */ - public void mode(CacheMode mode) { - this.mode = mode; - } - - /** * @return Cache size in bytes. */ public long memorySize() { @@ -290,13 +276,6 @@ public class VisorCache implements Serializable { } /** - * @param memorySize New cache size in bytes. - */ - public void memorySize(long memorySize) { - this.memorySize = memorySize; - } - - /** * @return Number of all entries in cache. */ public int size() { @@ -304,13 +283,6 @@ public class VisorCache implements Serializable { } /** - * @param size New number of all entries in cache. - */ - public void size(int size) { - this.size = size; - } - - /** * @return Number of all entries in near cache. */ public int nearSize() { @@ -318,13 +290,6 @@ public class VisorCache implements Serializable { } /** - * @param nearSize New number of all entries in near cache. - */ - public void nearSize(int nearSize) { - this.nearSize = nearSize; - } - - /** * @return Number of all entries in DHT cache. */ public int dhtSize() { @@ -332,13 +297,6 @@ public class VisorCache implements Serializable { } /** - * @param dhtSize New number of all entries in DHT cache. - */ - public void dhtSize(int dhtSize) { - this.dhtSize = dhtSize; - } - - /** * @return Number of primary entries in cache. */ public int primarySize() { @@ -346,13 +304,6 @@ public class VisorCache implements Serializable { } /** - * @param primarySize New number of primary entries in cache. - */ - public void primarySize(int primarySize) { - this.primarySize = primarySize; - } - - /** * @return Memory size allocated in off-heap. */ public long offHeapAllocatedSize() { @@ -360,13 +311,6 @@ public class VisorCache implements Serializable { } /** - * @param offHeapAllocatedSize New memory size allocated in off-heap. - */ - public void offHeapAllocatedSize(long offHeapAllocatedSize) { - this.offHeapAllocatedSize = offHeapAllocatedSize; - } - - /** * @return Number of cache entries stored in off-heap memory. */ public long offHeapEntriesCount() { @@ -374,13 +318,6 @@ public class VisorCache implements Serializable { } /** - * @param offHeapEntriesCnt New number of cache entries stored in off-heap memory. - */ - public void offHeapEntriesCount(long offHeapEntriesCnt) { - this.offHeapEntriesCnt = offHeapEntriesCnt; - } - - /** * @return Size in bytes for swap space. */ public long swapSize() { @@ -388,13 +325,6 @@ public class VisorCache implements Serializable { } /** - * @param swapSize New size in bytes for swap space. - */ - public void swapSize(long swapSize) { - this.swapSize = swapSize; - } - - /** * @return Number of cache entries stored in swap space. */ public long swapKeys() { @@ -402,52 +332,24 @@ public class VisorCache implements Serializable { } /** - * @param swapKeys New number of cache entries stored in swap space. - */ - public void swapKeys(long swapKeys) { - this.swapKeys = swapKeys; - } - - /** * @return Number of partitions. */ public int partitions() { - return partsCnt; - } - - /** - * @param partsCnt New number of partitions. - */ - public void partitions(int partsCnt) { - this.partsCnt = partsCnt; + return partitions; } /** * @return Primary partitions IDs with sizes. */ public Collection<IgnitePair<Integer>> primaryPartitions() { - return primaryParts; - } - - /** - * @param primaryParts New primary partitions IDs with sizes. - */ - public void primaryPartitions(Collection<IgnitePair<Integer>> primaryParts) { - this.primaryParts = primaryParts; + return primaryPartitions; } /** * @return Backup partitions IDs with sizes. */ public Collection<IgnitePair<Integer>> backupPartitions() { - return backupParts; - } - - /** - * @param backupParts New backup partitions IDs with sizes. - */ - public void backupPartitions(Collection<IgnitePair<Integer>> backupParts) { - this.backupParts = backupParts; + return backupPartitions; } /** @@ -458,24 +360,10 @@ public class VisorCache implements Serializable { } /** - * @param metrics New cache metrics. - */ - public void metrics(VisorCacheMetrics metrics) { - this.metrics = metrics; - } - - /** * @return Cache partitions states. */ @Nullable public GridDhtPartitionMap partitionMap() { - return partsMap; - } - - /** - * @param partsMap New cache partitions states. - */ - public void partitionMap(@Nullable GridDhtPartitionMap partsMap) { - this.partsMap = partsMap; + return partitionsMap; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 3d4d84a..0f6a84f 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 @@ -71,11 +71,12 @@ public class VisorCacheAffinityConfiguration implements Serializable { VisorCacheAffinityConfiguration cfg = new VisorCacheAffinityConfiguration(); - cfg.function(compactClass(aff)); - cfg.mapper(compactClass(ccfg.getAffinityMapper())); - cfg.partitionedBackups(ccfg.getBackups()); - cfg.defaultReplicas(dfltReplicas); - cfg.excludeNeighbors(excludeNeighbors); + cfg.function = compactClass(aff); + cfg.mapper = compactClass(ccfg.getAffinityMapper()); + cfg.partitions = aff.partitions(); + cfg.partitionedBackups = ccfg.getBackups(); + cfg.dfltReplicas = dfltReplicas; + cfg.excludeNeighbors = excludeNeighbors; return cfg; } @@ -88,13 +89,6 @@ public class VisorCacheAffinityConfiguration implements Serializable { } /** - * @param function New cache affinity function. - */ - public void function(String function) { - this.function = function; - } - - /** * @return Cache affinity mapper. */ public String mapper() { @@ -102,13 +96,6 @@ public class VisorCacheAffinityConfiguration implements Serializable { } /** - * @param mapper New cache affinity mapper. - */ - public void mapper(String mapper) { - this.mapper = mapper; - } - - /** * @return Count of key backups. */ public int partitionedBackups() { @@ -116,13 +103,6 @@ public class VisorCacheAffinityConfiguration implements Serializable { } /** - * @param partitionedBackups New count of key backups. - */ - public void partitionedBackups(int partitionedBackups) { - this.partitionedBackups = partitionedBackups; - } - - /** * @return Cache affinity partitions. */ public Integer partitions() { @@ -130,13 +110,6 @@ public class VisorCacheAffinityConfiguration implements Serializable { } /** - * @param partitions New cache affinity partitions. - */ - public void partitions(Integer partitions) { - this.partitions = partitions; - } - - /** * @return Cache partitioned affinity default replicas. */ @Nullable public Integer defaultReplicas() { @@ -144,26 +117,12 @@ public class VisorCacheAffinityConfiguration implements Serializable { } /** - * @param dfltReplicas New cache partitioned affinity default replicas. - */ - public void defaultReplicas(Integer dfltReplicas) { - this.dfltReplicas = dfltReplicas; - } - - /** * @return Cache partitioned affinity exclude neighbors. */ @Nullable public Boolean excludeNeighbors() { return excludeNeighbors; } - /** - * @param excludeNeighbors New cache partitioned affinity exclude neighbors. - */ - public void excludeNeighbors(Boolean excludeNeighbors) { - this.excludeNeighbors = excludeNeighbors; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(VisorCacheAffinityConfiguration.class, this); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 7bfaf79..cf149f7 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 @@ -19,10 +19,7 @@ package org.apache.ignite.internal.visor.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.store.jdbc.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.visor.node.*; import org.jetbrains.annotations.*; @@ -99,39 +96,30 @@ public class VisorCacheConfiguration implements Serializable { /** Cache interceptor. */ private String interceptor; - /** Cache affinity config. */ - private VisorCacheAffinityConfiguration affinity; + /** Should value bytes be stored. */ + private boolean valBytes; + + /** Cache affinityCfg config. */ + private VisorCacheAffinityConfiguration affinityCfg; /** Preload config. */ - private VisorCachePreloadConfiguration preload; + private VisorCachePreloadConfiguration preloadCfg; /** Eviction config. */ - private VisorCacheEvictionConfiguration evict; + private VisorCacheEvictionConfiguration evictCfg; /** Near cache config. */ - private VisorCacheNearConfiguration near; + private VisorCacheNearConfiguration nearCfg; /** Default config */ - private VisorCacheDefaultConfiguration dflt; + private VisorCacheDefaultConfiguration dfltCfg; /** Store config */ - private VisorCacheStoreConfiguration store; - - /** Write behind config */ - private VisorCacheWriteBehindConfiguration writeBehind; + private VisorCacheStoreConfiguration storeCfg; /** Collection of type metadata. */ private Collection<VisorCacheTypeMetadata> typeMeta; - /** Whether cache has JDBC store. */ - private boolean jdbcStore; - - /** Whether cache should operate in read-through mode. */ - private boolean readThrough; - - /** Whether cache should operate in write-through mode. */ - private boolean writeThrough; - /** Whether statistics collection is enabled. */ private boolean statisticsEnabled; @@ -156,50 +144,41 @@ public class VisorCacheConfiguration implements Serializable { * @return Data transfer object for cache configuration properties. */ public static VisorCacheConfiguration from(Ignite ignite, CacheConfiguration ccfg) { - GridCacheContext cctx = ((IgniteKernal)ignite).internalCache(ccfg.getName()).context(); - - boolean jdbcStore = cctx.store().configuredStore() instanceof CacheAbstractJdbcStore; - VisorCacheConfiguration cfg = new VisorCacheConfiguration(); - cfg.name(ccfg.getName()); - cfg.mode(ccfg.getCacheMode()); - cfg.distributionMode(ccfg.getDistributionMode()); - cfg.atomicityMode(ccfg.getAtomicityMode()); - cfg.atomicWriteOrderMode(ccfg.getAtomicWriteOrderMode()); - cfg.eagerTtl(ccfg.isEagerTtl()); - cfg.writeSynchronizationMode(ccfg.getWriteSynchronizationMode()); - cfg.swapEnabled(ccfg.isSwapEnabled()); - cfg.queryIndexEnabled(ccfg.isQueryIndexEnabled()); - cfg.invalidate(ccfg.isInvalidate()); - cfg.startSize(ccfg.getStartSize()); - cfg.transactionManagerLookupClassName(ccfg.getTransactionManagerLookupClassName()); - cfg.offsetHeapMaxMemory(ccfg.getOffHeapMaxMemory()); - cfg.maxQueryIteratorCount(ccfg.getMaximumQueryIteratorCount()); - cfg.maxConcurrentAsyncOperations(ccfg.getMaxConcurrentAsyncOperations()); - cfg.memoryMode(ccfg.getMemoryMode()); - cfg.indexingSpiName(ccfg.getIndexingSpiName()); - cfg.interceptor(compactClass(ccfg.getInterceptor())); - cfg.affinityConfiguration(VisorCacheAffinityConfiguration.from(ccfg)); - cfg.preloadConfiguration(VisorCachePreloadConfiguration.from(ccfg)); - cfg.evictConfiguration(VisorCacheEvictionConfiguration.from(ccfg)); - cfg.nearConfiguration(VisorCacheNearConfiguration.from(ccfg)); - cfg.defaultConfiguration(VisorCacheDefaultConfiguration.from(ccfg)); - cfg.storeConfiguration(VisorCacheStoreConfiguration.from(ccfg)); - cfg.writeBehind(VisorCacheWriteBehindConfiguration.from(ccfg)); - - cfg.typeMeta(VisorCacheTypeMetadata.list(ccfg.getTypeMetadata())); - cfg.jdbcStore(jdbcStore); - - cfg.readThrough(ccfg.isReadThrough()); - cfg.writeThrough(ccfg.isWriteThrough()); - cfg.statisticsEnabled(ccfg.isStatisticsEnabled()); - cfg.managementEnabled(ccfg.isManagementEnabled()); - cfg.loaderFactory(compactClass(ccfg.getCacheLoaderFactory())); - cfg.writerFactory(compactClass(ccfg.getCacheWriterFactory())); - cfg.expiryPolicyFactory(compactClass(ccfg.getExpiryPolicyFactory())); - - cfg.queryConfiguration(VisorCacheQueryConfiguration.from(ccfg.getQueryConfiguration())); + cfg.name = ccfg.getName(); + cfg.mode = ccfg.getCacheMode(); + cfg.distributionMode = ccfg.getDistributionMode(); + cfg.atomicityMode = ccfg.getAtomicityMode(); + cfg.atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode(); + cfg.eagerTtl = ccfg.isEagerTtl(); + cfg.writeSynchronizationMode = ccfg.getWriteSynchronizationMode(); + cfg.swapEnabled = ccfg.isSwapEnabled(); + cfg.qryIdxEnabled = ccfg.isQueryIndexEnabled(); + cfg.invalidate = ccfg.isInvalidate(); + cfg.startSize = ccfg.getStartSize(); + cfg.tmLookupClsName = ccfg.getTransactionManagerLookupClassName(); + cfg.offHeapMaxMemory = ccfg.getOffHeapMaxMemory(); + cfg.maxQryIterCnt = ccfg.getMaximumQueryIteratorCount(); + cfg.maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations(); + cfg.memoryMode = ccfg.getMemoryMode(); + cfg.indexingSpiName = ccfg.getIndexingSpiName(); + cfg.interceptor = compactClass(ccfg.getInterceptor()); + cfg.valBytes = ccfg.isStoreValueBytes(); + cfg.typeMeta = VisorCacheTypeMetadata.list(ccfg.getTypeMetadata()); + cfg.statisticsEnabled = ccfg.isStatisticsEnabled(); + cfg.mgmtEnabled = ccfg.isManagementEnabled(); + cfg.ldrFactory = compactClass(ccfg.getCacheLoaderFactory()); + cfg.writerFactory = compactClass(ccfg.getCacheWriterFactory()); + cfg.expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory()); + + cfg.affinityCfg = VisorCacheAffinityConfiguration.from(ccfg); + cfg.preloadCfg = VisorCachePreloadConfiguration.from(ccfg); + cfg.evictCfg = VisorCacheEvictionConfiguration.from(ccfg); + cfg.nearCfg = VisorCacheNearConfiguration.from(ccfg); + cfg.dfltCfg = VisorCacheDefaultConfiguration.from(ccfg); + cfg.storeCfg = VisorCacheStoreConfiguration.from(ignite, ccfg); + cfg.qryCfg = VisorCacheQueryConfiguration.from(ccfg.getQueryConfiguration()); return cfg; } @@ -229,13 +208,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param name New cache name. - */ - public void name(@Nullable String name) { - this.name = name; - } - - /** * @return Cache mode. */ public CacheMode mode() { @@ -243,13 +215,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param mode New cache mode. - */ - public void mode(CacheMode mode) { - this.mode = mode; - } - - /** * @return Distribution mode. */ public CacheDistributionMode distributionMode() { @@ -257,13 +222,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param distributionMode New distribution mode. - */ - public void distributionMode(CacheDistributionMode distributionMode) { - this.distributionMode = distributionMode; - } - - /** * @return Cache atomicity mode */ public CacheAtomicityMode atomicityMode() { @@ -271,13 +229,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param atomicityMode New cache atomicity mode - */ - public void atomicityMode(CacheAtomicityMode atomicityMode) { - this.atomicityMode = atomicityMode; - } - - /** * @return Cache atomic sequence reserve size */ public int atomicSequenceReserveSize() { @@ -285,13 +236,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param atomicSeqReserveSize New cache atomic sequence reserve size - */ - public void atomicSequenceReserveSize(int atomicSeqReserveSize) { - this.atomicSeqReserveSize = atomicSeqReserveSize; - } - - /** * @return Cache atomicity write ordering mode. */ public CacheAtomicWriteOrderMode atomicWriteOrderMode() { @@ -299,13 +243,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param atomicWriteOrderMode New cache atomicity write ordering mode. - */ - public void atomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode) { - this.atomicWriteOrderMode = atomicWriteOrderMode; - } - - /** * @return Eager ttl flag */ public boolean eagerTtl() { @@ -313,13 +250,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param eagerTtl New eager ttl flag - */ - public void eagerTtl(boolean eagerTtl) { - this.eagerTtl = eagerTtl; - } - - /** * @return Write synchronization mode. */ public CacheWriteSynchronizationMode writeSynchronizationMode() { @@ -327,13 +257,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param writeSynchronizationMode New write synchronization mode. - */ - public void writeSynchronizationMode(CacheWriteSynchronizationMode writeSynchronizationMode) { - this.writeSynchronizationMode = writeSynchronizationMode; - } - - /** * @return Sequence reserve size. */ public int sequenceReserveSize() { @@ -341,13 +264,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param seqReserveSize New sequence reserve size. - */ - public void sequenceReserveSize(int seqReserveSize) { - this.seqReserveSize = seqReserveSize; - } - - /** * @return Swap enabled flag. */ public boolean swapEnabled() { @@ -355,13 +271,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param swapEnabled New swap enabled flag. - */ - public void swapEnabled(boolean swapEnabled) { - this.swapEnabled = swapEnabled; - } - - /** * @return Flag indicating whether Ignite should attempt to index value and/or key instances stored in cache. */ public boolean queryIndexEnabled() { @@ -369,14 +278,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param qryIdxEnabled New flag indicating whether Ignite should attempt to index value and/or key instances stored - * in cache. - */ - public void queryIndexEnabled(boolean qryIdxEnabled) { - this.qryIdxEnabled = qryIdxEnabled; - } - - /** * @return Invalidate. */ public boolean invalidate() { @@ -384,13 +285,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param invalidate New invalidate. - */ - public void invalidate(boolean invalidate) { - this.invalidate = invalidate; - } - - /** * @return Start size. */ public int startSize() { @@ -398,13 +292,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param startSize New start size. - */ - public void startSize(int startSize) { - this.startSize = startSize; - } - - /** * @return Name of class implementing GridCacheTmLookup. */ @Nullable public String transactionManagerLookupClassName() { @@ -412,13 +299,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param tmLookupClsName New name of class implementing GridCacheTmLookup. - */ - public void transactionManagerLookupClassName(@Nullable String tmLookupClsName) { - this.tmLookupClsName = tmLookupClsName; - } - - /** * @return Off-heap max memory. */ public long offsetHeapMaxMemory() { @@ -426,13 +306,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param offHeapMaxMemory New off-heap max memory. - */ - public void offsetHeapMaxMemory(long offHeapMaxMemory) { - this.offHeapMaxMemory = offHeapMaxMemory; - } - - /** * @return Max query iterator count */ public int maxQueryIteratorCount() { @@ -440,13 +313,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param maxQryIterCnt New max query iterator count - */ - public void maxQueryIteratorCount(int maxQryIterCnt) { - this.maxQryIterCnt = maxQryIterCnt; - } - - /** * @return Max concurrent async operations */ public int maxConcurrentAsyncOperations() { @@ -454,13 +320,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param maxConcurrentAsyncOps New max concurrent async operations - */ - public void maxConcurrentAsyncOperations(int maxConcurrentAsyncOps) { - this.maxConcurrentAsyncOps = maxConcurrentAsyncOps; - } - - /** * @return Memory mode. */ public CacheMemoryMode memoryMode() { @@ -468,13 +327,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param memoryMode New memory mode. - */ - public void memoryMode(CacheMemoryMode memoryMode) { - this.memoryMode = memoryMode; - } - - /** * @return Name of SPI to use for indexing. */ public String indexingSpiName() { @@ -482,13 +334,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param indexingSpiName New name of SPI to use for indexing. - */ - public void indexingSpiName(String indexingSpiName) { - this.indexingSpiName = indexingSpiName; - } - - /** * @return Cache interceptor. */ @Nullable public String interceptor() { @@ -496,116 +341,19 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param interceptor New cache interceptor. - */ - public void interceptor(@Nullable String interceptor) { - this.interceptor = interceptor; - } - - /** - * @return Cache affinity config. - */ - public VisorCacheAffinityConfiguration affinityConfiguration() { - return affinity; - } - - /** - * @param affinity New cache affinity config. - */ - public void affinityConfiguration(VisorCacheAffinityConfiguration affinity) { - this.affinity = affinity; - } - - /** - * @return Preload config. - */ - public VisorCachePreloadConfiguration preloadConfiguration() { - return preload; - } - - /** - * @param preload New preload config. - */ - public void preloadConfiguration(VisorCachePreloadConfiguration preload) { - this.preload = preload; - } - - /** - * @return Eviction config. - */ - public VisorCacheEvictionConfiguration evictConfiguration() { - return evict; - } - - /** - * @param evict New eviction config. - */ - public void evictConfiguration(VisorCacheEvictionConfiguration evict) { - this.evict = evict; - } - - /** - * @return Near cache config. - */ - public VisorCacheNearConfiguration nearConfiguration() { - return near; - } - - /** - * @param near New near cache config. - */ - public void nearConfiguration(VisorCacheNearConfiguration near) { - this.near = near; - } - - /** - * @return Dgc config - */ - public VisorCacheDefaultConfiguration defaultConfiguration() { - return dflt; - } - - /** - * @param dflt New default config + * @return Should value bytes be stored. */ - public void defaultConfiguration(VisorCacheDefaultConfiguration dflt) { - this.dflt = dflt; + public boolean valueBytes() { + return valBytes; } /** - * @return Store config + * @param valBytes New should value bytes be stored. */ - public VisorCacheStoreConfiguration storeConfiguration() { - return store; + public void valueBytes(boolean valBytes) { + this.valBytes = valBytes; } - /** - * @param store New store config - */ - public void storeConfiguration(VisorCacheStoreConfiguration store) { - this.store = store; - } - - /** - * @return Write behind config - */ - public VisorCacheWriteBehindConfiguration writeBehind() { - return writeBehind; - } - - /** - * @param writeBehind New write behind config - */ - public void writeBehind(VisorCacheWriteBehindConfiguration writeBehind) { - this.writeBehind = writeBehind; - } - - /** - * @param typeMeta New collection of type metadata. - */ - public void typeMeta(Collection<VisorCacheTypeMetadata> typeMeta) { - this.typeMeta = typeMeta; - } /** * @return Collection of type metadata. @@ -615,48 +363,6 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @return {@code true} if cache has JDBC store. - */ - public boolean jdbcStore() { - return jdbcStore; - } - - /** - * @param jdbcStore {@code true} if cache has JDBC store. - */ - public void jdbcStore(boolean jdbcStore) { - this.jdbcStore = jdbcStore; - } - - /** - * @return Whether cache should operate in read-through mode. - */ - public boolean readThrough() { - return readThrough; - } - - /** - * @param readThrough New whether cache should operate in read-through mode. - */ - public void readThrough(boolean readThrough) { - this.readThrough = readThrough; - } - - /** - * @return Whether cache should operate in write-through mode. - */ - public boolean writeThrough() { - return writeThrough; - } - - /** - * @param writeThrough New whether cache should operate in write-through mode. - */ - public void writeThrough(boolean writeThrough) { - this.writeThrough = writeThrough; - } - - /** * @return {@code true} if cache statistics enabled. */ public boolean statisticsEnabled() { @@ -664,71 +370,73 @@ public class VisorCacheConfiguration implements Serializable { } /** - * @param statisticsEnabled {@code true} if cache statistics enabled. + * @return Whether management is enabled. */ - public void statisticsEnabled(boolean statisticsEnabled) { - this.statisticsEnabled = statisticsEnabled; + public boolean managementEnabled() { + return mgmtEnabled; } /** - * @return Whether management is enabled. + * @return Class name of cache loader factory. */ - public boolean managementEnabled() { - return mgmtEnabled; + public String loaderFactory() { + return ldrFactory; } /** - * @param mgmtEnabled New whether management is enabled. + * @return Class name of cache writer factory. */ - public void managementEnabled(boolean mgmtEnabled) { - this.mgmtEnabled = mgmtEnabled; + public String writerFactory() { + return writerFactory; } /** - * @return Class name of cache loader factory. + * @return Class name of expiry policy factory. */ - public String loaderFactory() { - return ldrFactory; + public String expiryPolicyFactory() { + return expiryPlcFactory; } /** - * @param ldrFactory New class name of cache loader factory. + * @return Cache affinityCfg config. */ - public void loaderFactory(String ldrFactory) { - this.ldrFactory = ldrFactory; + public VisorCacheAffinityConfiguration affinityConfiguration() { + return affinityCfg; } /** - * @return Class name of cache writer factory. + * @return Preload config. */ - public String writerFactory() { - return writerFactory; + public VisorCachePreloadConfiguration preloadConfiguration() { + return preloadCfg; } /** - * @param writerFactory New class name of cache writer factory. + * @return Eviction config. */ - public void writerFactory(String writerFactory) { - this.writerFactory = writerFactory; + public VisorCacheEvictionConfiguration evictConfiguration() { + return evictCfg; } /** - * @return Class name of expiry policy factory. + * @return Near cache config. */ - public String expiryPolicyFactory() { - return expiryPlcFactory; + public VisorCacheNearConfiguration nearConfiguration() { + return nearCfg; } /** - * @param expiryPlcFactory New class name of expiry policy factory. + * @return Dgc config */ - public void expiryPolicyFactory(String expiryPlcFactory) { - this.expiryPlcFactory = expiryPlcFactory; + public VisorCacheDefaultConfiguration defaultConfiguration() { + return dfltCfg; } - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheConfiguration.class, this); + /** + * @return Store config + */ + public VisorCacheStoreConfiguration storeConfiguration() { + return storeCfg; } /** @@ -738,10 +446,8 @@ public class VisorCacheConfiguration implements Serializable { return qryCfg; } - /** - * @param qryCfg New cache query configuration. - */ - public void queryConfiguration(VisorCacheQueryConfiguration qryCfg) { - this.qryCfg = qryCfg; + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(VisorCacheConfiguration.class, this); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 index 97f8f30..0996e65 100644 --- 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 @@ -45,9 +45,9 @@ public class VisorCacheDefaultConfiguration implements Serializable { public static VisorCacheDefaultConfiguration from(CacheConfiguration ccfg) { VisorCacheDefaultConfiguration cfg = new VisorCacheDefaultConfiguration(); - cfg.timeToLive(ccfg.getDefaultTimeToLive()); - cfg.txLockTimeout(ccfg.getDefaultLockTimeout()); - cfg.queryTimeout(ccfg.getDefaultQueryTimeout()); + cfg.ttl = ccfg.getDefaultTimeToLive(); + cfg.txLockTimeout = ccfg.getDefaultLockTimeout(); + cfg.qryTimeout = ccfg.getDefaultQueryTimeout(); return cfg; } @@ -60,13 +60,6 @@ public class VisorCacheDefaultConfiguration implements Serializable { } /** - * @param ttl New tTL value. - */ - public void timeToLive(long ttl) { - this.ttl = ttl; - } - - /** * @return Default transaction timeout. */ public long txLockTimeout() { @@ -74,26 +67,12 @@ public class VisorCacheDefaultConfiguration implements Serializable { } /** - * @param txLockTimeout New default transaction timeout. - */ - public void txLockTimeout(long txLockTimeout) { - this.txLockTimeout = txLockTimeout; - } - - /** * @return Default query timeout. */ public long queryTimeout() { return qryTimeout; } - /** - * @param qryTimeout New default query timeout. - */ - public void queryTimeout(long qryTimeout) { - this.qryTimeout = qryTimeout; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(VisorCacheDefaultConfiguration.class, this); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 4b1a516..4c84f8d 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 @@ -69,15 +69,15 @@ public class VisorCacheEvictionConfiguration implements Serializable { final CacheEvictionPolicy plc = ccfg.getEvictionPolicy(); - cfg.policy(compactClass(plc)); - cfg.policyMaxSize(evictionPolicyMaxSize(plc)); - cfg.filter(compactClass(ccfg.getEvictionFilter())); - cfg.synchronizedConcurrencyLevel(ccfg.getEvictSynchronizedConcurrencyLevel()); - cfg.synchronizedTimeout(ccfg.getEvictSynchronizedTimeout()); - cfg.synchronizedKeyBufferSize(ccfg.getEvictSynchronizedKeyBufferSize()); - cfg.evictSynchronized(ccfg.isEvictSynchronized()); - cfg.nearSynchronized(ccfg.isEvictNearSynchronized()); - cfg.maxOverflowRatio(ccfg.getEvictMaxOverflowRatio()); + 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.nearSynchronized = ccfg.isEvictNearSynchronized(); + cfg.maxOverflowRatio = ccfg.getEvictMaxOverflowRatio(); return cfg; } @@ -90,13 +90,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param plc New eviction policy. - */ - public void policy(String plc) { - this.plc = plc; - } - - /** * @return Cache eviction policy max size. */ @Nullable public Integer policyMaxSize() { @@ -104,13 +97,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param plcMaxSize New cache eviction policy max size. - */ - public void policyMaxSize(Integer plcMaxSize) { - this.plcMaxSize = plcMaxSize; - } - - /** * @return Eviction filter to specify which entries should not be evicted. */ @Nullable public String filter() { @@ -118,13 +104,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param filter New eviction filter to specify which entries should not be evicted. - */ - public void filter(String filter) { - this.filter = filter; - } - - /** * @return synchronized eviction concurrency level. */ public int synchronizedConcurrencyLevel() { @@ -132,13 +111,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param syncConcurrencyLvl New synchronized eviction concurrency level. - */ - public void synchronizedConcurrencyLevel(int syncConcurrencyLvl) { - this.syncConcurrencyLvl = syncConcurrencyLvl; - } - - /** * @return synchronized eviction timeout. */ public long synchronizedTimeout() { @@ -146,13 +118,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param syncTimeout New synchronized eviction timeout. - */ - public void synchronizedTimeout(long syncTimeout) { - this.syncTimeout = syncTimeout; - } - - /** * @return Synchronized key buffer size. */ public int synchronizedKeyBufferSize() { @@ -160,13 +125,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param syncKeyBufSize New synchronized key buffer size. - */ - public void synchronizedKeyBufferSize(int syncKeyBufSize) { - this.syncKeyBufSize = syncKeyBufSize; - } - - /** * @return Synchronous evicts flag. */ public boolean evictSynchronized() { @@ -174,13 +132,6 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param evictSynchronized New synchronous evicts flag. - */ - public void evictSynchronized(boolean evictSynchronized) { - this.evictSynchronized = evictSynchronized; - } - - /** * @return Synchronous near evicts flag. */ public boolean nearSynchronized() { @@ -188,26 +139,12 @@ public class VisorCacheEvictionConfiguration implements Serializable { } /** - * @param nearSynchronized New synchronous near evicts flag. - */ - public void nearSynchronized(boolean nearSynchronized) { - this.nearSynchronized = nearSynchronized; - } - - /** * @return Eviction max overflow ratio. */ public float maxOverflowRatio() { return maxOverflowRatio; } - /** - * @param maxOverflowRatio New eviction max overflow ratio. - */ - public void maxOverflowRatio(float maxOverflowRatio) { - this.maxOverflowRatio = maxOverflowRatio; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(VisorCacheEvictionConfiguration.class, this); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 1f551a7..10db203 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 @@ -52,10 +52,10 @@ public class VisorCacheNearConfiguration implements Serializable { public static VisorCacheNearConfiguration from(CacheConfiguration ccfg) { VisorCacheNearConfiguration cfg = new VisorCacheNearConfiguration(); - cfg.nearEnabled(GridCacheUtils.isNearEnabled(ccfg)); - cfg.nearStartSize(ccfg.getNearStartSize()); - cfg.nearEvictPolicy(compactClass(ccfg.getNearEvictionPolicy())); - cfg.nearEvictMaxSize(evictionPolicyMaxSize(ccfg.getNearEvictionPolicy())); + cfg.nearEnabled = GridCacheUtils.isNearEnabled(ccfg); + cfg.nearStartSize = ccfg.getNearStartSize(); + cfg.nearEvictPlc = compactClass(ccfg.getNearEvictionPolicy()); + cfg.nearEvictMaxSize = evictionPolicyMaxSize(ccfg.getNearEvictionPolicy()); return cfg; } @@ -68,13 +68,6 @@ public class VisorCacheNearConfiguration implements Serializable { } /** - * @param nearEnabled New flag to enable/disable near cache eviction policy. - */ - public void nearEnabled(boolean nearEnabled) { - this.nearEnabled = nearEnabled; - } - - /** * @return Near cache start size. */ public int nearStartSize() { @@ -82,13 +75,6 @@ public class VisorCacheNearConfiguration implements Serializable { } /** - * @param nearStartSize New near cache start size. - */ - public void nearStartSize(int nearStartSize) { - this.nearStartSize = nearStartSize; - } - - /** * @return Near cache eviction policy. */ @Nullable public String nearEvictPolicy() { @@ -96,28 +82,14 @@ public class VisorCacheNearConfiguration implements Serializable { } /** - * @param nearEvictPlc New near cache eviction policy. - */ - public void nearEvictPolicy(String nearEvictPlc) { - this.nearEvictPlc = nearEvictPlc; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheNearConfiguration.class, this); - } - - /** * @return Near cache eviction policy max size. */ @Nullable public Integer nearEvictMaxSize() { return nearEvictMaxSize; } - /** - * @param nearEvictMaxSize New near cache eviction policy max size. - */ - public void nearEvictMaxSize(@Nullable Integer nearEvictMaxSize) { - this.nearEvictMaxSize = nearEvictMaxSize; + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(VisorCacheNearConfiguration.class, this); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePreloadConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePreloadConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePreloadConfiguration.java index 19a3734..f331789 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePreloadConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePreloadConfiguration.java @@ -55,12 +55,12 @@ public class VisorCachePreloadConfiguration implements Serializable { public static VisorCachePreloadConfiguration from(CacheConfiguration ccfg) { VisorCachePreloadConfiguration cfg = new VisorCachePreloadConfiguration(); - cfg.mode(ccfg.getPreloadMode()); - cfg.batchSize(ccfg.getPreloadBatchSize()); - cfg.threadPoolSize(ccfg.getPreloadThreadPoolSize()); - cfg.partitionedDelay(ccfg.getPreloadPartitionedDelay()); - cfg.throttle(ccfg.getPreloadThrottle()); - cfg.timeout(ccfg.getPreloadTimeout()); + cfg.mode = ccfg.getPreloadMode(); + cfg.batchSize = ccfg.getPreloadBatchSize(); + cfg.threadPoolSize = ccfg.getPreloadThreadPoolSize(); + cfg.partitionedDelay = ccfg.getPreloadPartitionedDelay(); + cfg.throttle = ccfg.getPreloadThrottle(); + cfg.timeout = ccfg.getPreloadTimeout(); return cfg; } @@ -73,13 +73,6 @@ public class VisorCachePreloadConfiguration implements Serializable { } /** - * @param mode New cache preload mode. - */ - public void mode(CachePreloadMode mode) { - this.mode = mode; - } - - /** * @return Preload thread pool size. */ public int threadPoolSize() { @@ -87,13 +80,6 @@ public class VisorCachePreloadConfiguration implements Serializable { } /** - * @param threadPoolSize New preload thread pool size. - */ - public void threadPoolSize(int threadPoolSize) { - this.threadPoolSize = threadPoolSize; - } - - /** * @return Cache preload batch size. */ public int batchSize() { @@ -101,13 +87,6 @@ public class VisorCachePreloadConfiguration implements Serializable { } /** - * @param batchSize New cache preload batch size. - */ - public void batchSize(int batchSize) { - this.batchSize = batchSize; - } - - /** * @return Preloading partitioned delay. */ public long partitionedDelay() { @@ -115,13 +94,6 @@ public class VisorCachePreloadConfiguration implements Serializable { } /** - * @param partitionedDelay New preloading partitioned delay. - */ - public void partitionedDelay(long partitionedDelay) { - this.partitionedDelay = partitionedDelay; - } - - /** * @return Time in milliseconds to wait between preload messages. */ public long throttle() { @@ -129,26 +101,12 @@ public class VisorCachePreloadConfiguration implements Serializable { } /** - * @param throttle New time in milliseconds to wait between preload messages. - */ - public void throttle(long throttle) { - this.throttle = throttle; - } - - /** * @return Preload timeout. */ public long timeout() { return timeout; } - /** - * @param timeout New preload timeout. - */ - public void timeout(long timeout) { - this.timeout = timeout; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(VisorCachePreloadConfiguration.class, this); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 b1ed170..7284b7d 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,7 +17,11 @@ package org.apache.ignite.internal.visor.cache; +import org.apache.ignite.*; +import org.apache.ignite.cache.store.*; +import org.apache.ignite.cache.store.jdbc.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -32,21 +36,58 @@ public class VisorCacheStoreConfiguration implements Serializable { /** */ private static final long serialVersionUID = 0L; - /** Cache store. */ + /** Whether cache has JDBC store. */ + private boolean jdbcStore; + + /** Cache store class name. */ private String store; - /** Should value bytes be stored. */ - private boolean valBytes; + /** Cache store factory class name. */ + private String storeFactory; + + /** Whether cache should operate in read-through mode. */ + private boolean readThrough; + + /** Whether cache should operate in write-through mode. */ + private boolean writeThrough; + + /** Flag indicating whether write-behind behaviour should be used for the cache store. */ + private boolean writeBehindEnabled; + + /** Maximum batch size for write-behind cache store operations. */ + private int batchSz; + + /** Frequency with which write-behind cache is flushed to the cache store in milliseconds. */ + private long flushFreq; + + /** Maximum object count in write-behind cache. */ + private int flushSz; + + /** Number of threads that will perform cache flushing. */ + private int flushThreadCnt; /** * @param ccfg Cache configuration. * @return Data transfer object for cache store configuration properties. */ - public static VisorCacheStoreConfiguration from(CacheConfiguration ccfg) { + public static VisorCacheStoreConfiguration from(Ignite ignite, CacheConfiguration ccfg) { VisorCacheStoreConfiguration cfg = new VisorCacheStoreConfiguration(); - cfg.store(compactClass(ccfg.getCacheStoreFactory())); - cfg.valueBytes(ccfg.isStoreValueBytes()); + CacheStore store = ((IgniteKernal)ignite).internalCache(ccfg.getName()).context().store().configuredStore(); + + cfg.jdbcStore = store instanceof CacheAbstractJdbcStore; + + cfg.store = compactClass(store); + cfg.storeFactory = compactClass(ccfg.getCacheStoreFactory()); + + cfg.readThrough = ccfg.isReadThrough(); + cfg.writeThrough = ccfg.isWriteThrough(); + + cfg.writeBehindEnabled = ccfg.isWriteBehindEnabled(); + cfg.batchSz = ccfg.getWriteBehindBatchSize(); + cfg.flushFreq = ccfg.getWriteBehindFlushFrequency(); + cfg.flushSz = ccfg.getWriteBehindFlushSize(); + cfg.flushThreadCnt = ccfg.getWriteBehindFlushThreadCount(); return cfg; } @@ -59,6 +100,13 @@ public class VisorCacheStoreConfiguration implements Serializable { } /** + * @return {@code true} if cache has JDBC store. + */ + public boolean jdbcStore() { + return jdbcStore; + } + + /** * @return Cache store class name. */ @Nullable public String store() { @@ -66,24 +114,94 @@ public class VisorCacheStoreConfiguration implements Serializable { } /** - * @param store Cache store class name. + * @return Cache store factory class name.. + */ + public String storeFactory() { + return storeFactory; + } + + /** + * @return Whether cache should operate in read-through mode. + */ + public boolean readThrough() { + return readThrough; + } + + /** + * @return Whether cache should operate in write-through mode. + */ + public boolean writeThrough() { + return writeThrough; + } + + /** + * @return Flag indicating whether write-behind behaviour should be used for the cache store. + */ + public boolean writeBehindEnabled() { + return writeBehindEnabled; + } + + /** + * @param writeBehindEnabled New flag indicating whether write-behind behaviour should be used for the cache store. + */ + public void writeBehindEnabled(boolean writeBehindEnabled) { + this.writeBehindEnabled = writeBehindEnabled; + } + + /** + * @return Maximum batch size for write-behind cache store operations. + */ + public int batchSize() { + return batchSz; + } + + /** + * @param batchSize New maximum batch size for write-behind cache store operations. + */ + public void batchSize(int batchSize) { + this.batchSz = batchSize; + } + + /** + * @return Frequency with which write-behind cache is flushed to the cache store in milliseconds. + */ + public long flushFrequency() { + return flushFreq; + } + + /** + * @param flushFreq New frequency with which write-behind cache is flushed to the cache store in milliseconds. + */ + public void flushFrequency(long flushFreq) { + this.flushFreq = flushFreq; + } + + /** + * @return Maximum object count in write-behind cache. + */ + public int flushSize() { + return flushSz; + } + + /** + * @param flushSize New maximum object count in write-behind cache. */ - public void store(String store) { - this.store = store; + public void flushSize(int flushSize) { + this.flushSz = flushSize; } /** - * @return Should value bytes be stored. + * @return Number of threads that will perform cache flushing. */ - public boolean valueBytes() { - return valBytes; + public int flushThreadCount() { + return flushThreadCnt; } /** - * @param valBytes New should value bytes be stored. + * @param flushThreadCnt New number of threads that will perform cache flushing. */ - public void valueBytes(boolean valBytes) { - this.valBytes = valBytes; + public void flushThreadCount(int flushThreadCnt) { + this.flushThreadCnt = flushThreadCnt; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheWriteBehindConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheWriteBehindConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheWriteBehindConfiguration.java deleted file mode 100644 index c55078c..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheWriteBehindConfiguration.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.visor.cache; - -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Data transfer object for write-behind cache configuration properties. - */ -public class VisorCacheWriteBehindConfiguration implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Flag indicating whether write-behind behaviour should be used for the cache store. */ - private boolean enabled; - - /** Maximum batch size for write-behind cache store operations. */ - private int batchSize; - - /** Frequency with which write-behind cache is flushed to the cache store in milliseconds. */ - private long flushFreq; - - /** Maximum object count in write-behind cache. */ - private int flushSize; - - /** Number of threads that will perform cache flushing. */ - private int flushThreadCnt; - - /** - * @param ccfg Cache configuration. - * @return Data transfer object for write-behind cache configuration properties. - */ - public static VisorCacheWriteBehindConfiguration from(CacheConfiguration ccfg) { - VisorCacheWriteBehindConfiguration cfg = new VisorCacheWriteBehindConfiguration(); - - cfg.enabled(ccfg.isWriteBehindEnabled()); - cfg.batchSize(ccfg.getWriteBehindBatchSize()); - cfg.flushFrequency(ccfg.getWriteBehindFlushFrequency()); - cfg.flushSize(ccfg.getWriteBehindFlushSize()); - cfg.flushThreadCount(ccfg.getWriteBehindFlushThreadCount()); - - return cfg; - } - - /** - * @return Flag indicating whether write-behind behaviour should be used for the cache store. - */ - public boolean enabled() { - return enabled; - } - - /** - * @param enabled New flag indicating whether write-behind behaviour should be used for the cache store. - */ - public void enabled(boolean enabled) { - this.enabled = enabled; - } - - /** - * @return Maximum batch size for write-behind cache store operations. - */ - public int batchSize() { - return batchSize; - } - - /** - * @param batchSize New maximum batch size for write-behind cache store operations. - */ - public void batchSize(int batchSize) { - this.batchSize = batchSize; - } - - /** - * @return Frequency with which write-behind cache is flushed to the cache store in milliseconds. - */ - public long flushFrequency() { - return flushFreq; - } - - /** - * @param flushFreq New frequency with which write-behind cache is flushed to the cache store in milliseconds. - */ - public void flushFrequency(long flushFreq) { - this.flushFreq = flushFreq; - } - - /** - * @return Maximum object count in write-behind cache. - */ - public int flushSize() { - return flushSize; - } - - /** - * @param flushSize New maximum object count in write-behind cache. - */ - public void flushSize(int flushSize) { - this.flushSize = flushSize; - } - - /** - * @return Number of threads that will perform cache flushing. - */ - public int flushThreadCount() { - return flushThreadCnt; - } - - /** - * @param flushThreadCnt New number of threads that will perform cache flushing. - */ - public void flushThreadCount(int flushThreadCnt) { - this.flushThreadCnt = flushThreadCnt; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheWriteBehindConfiguration.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 a9b4e57..b03674f 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 @@ -229,7 +229,7 @@ public class VisorTaskUtils { * @param obj Object for compact. * @return Compacted string. */ - @Nullable public static String compactClass(Object obj) { + @Nullable public static String compactClass(@Nullable Object obj) { if (obj == null) return null; @@ -613,7 +613,7 @@ public class VisorTaskUtils { * @param plc Eviction policy. * @return Extracted max size. */ - public static Integer evictionPolicyMaxSize(CacheEvictionPolicy plc) { + public static Integer evictionPolicyMaxSize(@Nullable CacheEvictionPolicy plc) { if (plc instanceof CacheLruEvictionPolicyMBean) return ((CacheLruEvictionPolicyMBean)plc).getMaxSize(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff0c1e1d/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 3c1aa01..97adeac 100644 --- 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 @@ -776,7 +776,6 @@ object VisorCacheCommand { val evictCfg = cfg.evictConfiguration() val defaultCfg = cfg.defaultConfiguration() val storeCfg = cfg.storeConfiguration() - val writeBehind = cfg.writeBehind() val cacheT = VisorTextTable() @@ -836,20 +835,25 @@ object VisorCacheCommand { cacheT += ("Indexing SPI Name", cfg.indexingSpiName()) cacheT += ("Cache Interceptor", cfg.interceptor()) - cacheT += ("Store Enabled", storeCfg.enabled()) - cacheT += ("Store", storeCfg.store()) - cacheT += ("Store Values In Bytes", storeCfg.valueBytes()) + cacheT += ("Concurrent Asynchronous Operations Number", cfg.maxConcurrentAsyncOperations()) + cacheT += ("Memory Mode", cfg.memoryMode()) + + cacheT += ("Store Values In Bytes", cfg.valueBytes()) cacheT += ("Off-Heap Size", cfg.offsetHeapMaxMemory()) - cacheT += ("Write-Behind Enabled", writeBehind.enabled()) - cacheT += ("Write-Behind Flush Size", writeBehind.flushSize()) - cacheT += ("Write-Behind Frequency", writeBehind.flushFrequency()) - cacheT += ("Write-Behind Flush Threads Count", writeBehind.flushThreadCount()) - cacheT += ("Write-Behind Batch Size", writeBehind.batchSize()) + cacheT += ("Store Enabled", storeCfg.enabled()) + cacheT += ("Store", storeCfg.store()) + cacheT += ("Store Factory", storeCfg.storeFactory()) - cacheT += ("Concurrent Asynchronous Operations Number", cfg.maxConcurrentAsyncOperations()) - cacheT += ("Memory Mode", cfg.memoryMode()) + cacheT += ("Store Read-Through", storeCfg.readThrough()) + cacheT += ("Store Write-Through", storeCfg.writeThrough()) + + cacheT += ("Write-Behind Enabled", storeCfg.writeBehindEnabled()) + 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()) println(title)