# ignite-929
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f018e11f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f018e11f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f018e11f Branch: refs/heads/ignite-929 Commit: f018e11fd0fa4ce4ec49feead46e2aadd80abee6 Parents: 98e34ac Author: sboikov <sboi...@gridgain.com> Authored: Fri Jul 10 09:12:36 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Fri Jul 10 09:12:36 2015 +0300 ---------------------------------------------------------------------- .../main/java/org/apache/ignite/IgniteCache.java | 10 +++++++--- .../java/org/apache/ignite/cache/CacheManager.java | 11 ++++++++--- .../internal/processors/cache/IgniteCacheProxy.java | 16 +++++++++------- .../IgniteFairAffinityDynamicCacheSelfTest.java | 3 +-- ...IgniteCacheClientNodePartitionsExchangeTest.java | 1 - 5 files changed, 25 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f018e11f/modules/core/src/main/java/org/apache/ignite/IgniteCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java index 1090fe2..4938ab1 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@ -543,10 +543,14 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS CacheEntryProcessor<K, V, T> entryProcessor, Object... args); /** - * Closes cache. + * Closes this cache instance. + * <p> * For local cache equivalent to {@link #destroy()}. - * For distributed caches, if called on clients, closes client cache, if called on a server node, - * does nothing. + * For distributed caches, if called on clients, stops client cache, if called on a server node, + * just closes this cache instance and does not destroy cache data. + * <p> + * After cache instance is closed another {@link IgniteCache} instance for the same + * cache can be created using {@link Ignite#cache(String)} method. */ @Override public void close(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f018e11f/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java index e435fd9..bc6df76 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java @@ -130,6 +130,7 @@ public class CacheManager implements javax.cache.CacheManager { } /** {@inheritDoc} */ + @SuppressWarnings("unchecked") @Override public <K, V, C extends Configuration<K, V>> Cache<K, V> createCache(String cacheName, C cacheCfg) throws IllegalArgumentException { kernalGateway.readLock(); @@ -155,11 +156,11 @@ public class CacheManager implements javax.cache.CacheManager { IgniteCache<K, V> res = ignite.createCache(igniteCacheCfg); - ((IgniteCacheProxy<K, V>)res).setCacheManager(this); - if (res == null) throw new CacheException(); + ((IgniteCacheProxy<K, V>)res).setCacheManager(this); + if (igniteCacheCfg.isManagementEnabled()) enableManagement(cacheName, true); @@ -219,6 +220,7 @@ public class CacheManager implements javax.cache.CacheManager { /** * @param cacheName Cache name. + * @return Cache. */ @Nullable private <K, V> IgniteCache<K, V> getCache0(String cacheName) { if (cacheName == null) @@ -277,6 +279,8 @@ public class CacheManager implements javax.cache.CacheManager { /** * @param cacheName Cache name. + * @param objName Object name. + * @return Object name instance. */ private ObjectName getObjectName(String cacheName, String objName) { String mBeanName = "javax.cache:type=" + objName + ",CacheManager=" @@ -339,7 +343,8 @@ public class CacheManager implements javax.cache.CacheManager { /** * @param mxbean MXBean. - * @param name cache name. + * @param name Cache name. + * @param beanType Bean type. */ private void registerCacheObject(Object mxbean, String name, String beanType) { MBeanServer mBeanSrv = ignite.configuration().getMBeanServer(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f018e11f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 080502c..9767f49 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -399,7 +399,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V final CacheQuery<Map.Entry<K,V>> qry; final CacheQueryFuture<Map.Entry<K,V>> fut; - boolean isKeepPortable = opCtx != null ? opCtx.isKeepPortable() : false; + boolean isKeepPortable = opCtx != null && opCtx.isKeepPortable(); if (filter instanceof ScanQuery) { IgniteBiPredicate<K, V> p = ((ScanQuery)filter).getFilter(); @@ -464,11 +464,11 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** - * @param local Enforce local. + * @param loc Enforce local. * @return Local node cluster group. */ - private ClusterGroup projection(boolean local) { - if (local || ctx.isLocal() || isReplicatedDataNode()) + private ClusterGroup projection(boolean loc) { + if (loc || ctx.isLocal() || isReplicatedDataNode()) return ctx.kernalContext().grid().cluster().forLocal(); if (ctx.isReplicated()) @@ -1646,6 +1646,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V * * @return Projection for portable objects. */ + @SuppressWarnings("unchecked") public <K1, V1> IgniteCache<K1, V1> keepPortable() { GridCacheGateway<K, V> gate = this.gate; @@ -1784,6 +1785,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** + * @param gate Cache gateway. * @param opCtx Cache operation context to guard. * @return Previous projection set on this thread. */ @@ -1795,8 +1797,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** - * On enter. - * + * @param gate Cache gateway. * @return {@code True} if enter successful. */ private boolean onEnterIfNoStop(GridCacheGateway<K, V> gate) { @@ -1807,6 +1808,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** + * @param gate Cache gateway. * @param opCtx Operation context to guard. */ private void onLeave(GridCacheGateway<K, V> gate, CacheOperationContext opCtx) { @@ -1817,7 +1819,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** - * On leave. + * @param gate Cache gateway. */ private void onLeave(GridCacheGateway<K, V> gate) { if (lock) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f018e11f/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java index 18b77e0..e51be58 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java @@ -84,8 +84,7 @@ public class IgniteFairAffinityDynamicCacheSelfTest extends GridCommonAbstractTe cache.put(i, i); IgniteInternalFuture<Object> destFut = GridTestUtils.runAsync(new Callable<Object>() { - @Override - public Object call() throws Exception { + @Override public Object call() throws Exception { ignite(0).destroyCache(cache.getName()); return null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f018e11f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java index 801a75b..5a51a1b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java @@ -33,7 +33,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.resources.*;