# ignite-42
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cd78b9cf Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cd78b9cf Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cd78b9cf Branch: refs/heads/ignite-32 Commit: cd78b9cf4da08ca9a21e8b548389579b31cc87f8 Parents: 2be29c8 Author: sboikov <semen.boi...@inria.fr> Authored: Wed Jan 21 22:09:34 2015 +0300 Committer: sboikov <semen.boi...@inria.fr> Committed: Wed Jan 21 23:16:16 2015 +0300 ---------------------------------------------------------------------- .../store/CacheNodeWithStoreStartup.java | 1 - .../store/dummy/CacheDummyPersonStore.java | 3 +- .../hibernate/CacheHibernatePersonStore.java | 9 +- .../store/jdbc/CacheJdbcPersonStore.java | 4 +- .../apache/ignite/cache/CacheConfiguration.java | 3 +- .../java/org/apache/ignite/cache/CacheFlag.java | 3 - .../cache/CachePartialUpdateException.java | 22 ++- .../cache/store/CacheLoadOnlyStoreAdapter.java | 7 +- .../cache/store/jdbc/CacheJdbcBlobStore.java | 2 +- .../java/org/gridgain/grid/cache/GridCache.java | 19 +- .../grid/cache/GridCacheAtomicityMode.java | 3 +- .../grid/cache/GridCacheDistributionMode.java | 7 +- .../grid/cache/affinity/GridCacheAffinity.java | 37 ++-- .../affinity/GridCacheAffinityFunction.java | 3 +- .../affinity/GridCacheAffinityKeyMapper.java | 4 +- ...GridCacheConsistentHashAffinityFunction.java | 3 +- .../grid/cache/cloner/GridCacheCloner.java | 7 +- .../cache/eviction/GridCacheEvictionFilter.java | 3 +- .../processors/cache/CacheInvokeEntry.java | 22 ++- .../processors/cache/CacheInvokeResult.java | 22 ++- .../processors/cache/GridCacheAdapter.java | 183 +++++++++---------- .../GridCacheDefaultAffinityKeyMapper.java | 3 +- .../processors/cache/GridCacheStoreManager.java | 30 +-- .../grid/GridCacheAffinityBackupsSelfTest.java | 1 + .../store/GridCacheBalancingStoreSelfTest.java | 1 - .../GridCacheAbstractFailoverSelfTest.java | 1 + .../cache/GridCacheAbstractFullApiSelfTest.java | 44 ++--- ...actQueueFailoverDataConsistencySelfTest.java | 1 - ...CacheAtomicReferenceApiSelfAbstractTest.java | 2 - 29 files changed, 234 insertions(+), 216 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheNodeWithStoreStartup.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheNodeWithStoreStartup.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheNodeWithStoreStartup.java index 1176215..f715bae 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheNodeWithStoreStartup.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheNodeWithStoreStartup.java @@ -51,7 +51,6 @@ public class CacheNodeWithStoreStartup { * @return Grid configuration. * @throws IgniteCheckedException If failed. */ - @SuppressWarnings("unchecked") public static IgniteConfiguration configure() throws IgniteCheckedException { IgniteConfiguration cfg = new IgniteConfiguration(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java index 1b87275..c6b02df 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java @@ -105,8 +105,7 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> { /** * @return Current transaction. */ - @Nullable - private IgniteTx transaction() { + @Nullable private IgniteTx transaction() { CacheStoreSession ses = session(); return ses != null ? ses.transaction() : null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java index 8392e45..d7c2cd7 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java @@ -25,7 +25,6 @@ import org.hibernate.*; import org.hibernate.cfg.*; import org.jetbrains.annotations.*; -import javax.cache.*; import javax.cache.integration.*; import java.util.*; @@ -203,9 +202,9 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> { IgniteTx tx = storeSes.transaction(); - Map<Object, Object> props = storeSes.properties(); + Map<String, Session> props = storeSes.properties(); - Session ses = (Session)props.remove(ATTR_SES); + Session ses = props.remove(ATTR_SES); if (ses != null) { Transaction hTx = ses.getTransaction(); @@ -243,9 +242,9 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> { Session ses; if (tx != null) { - Map<Object, Object> props = session().properties(); + Map<String, Session> props = session().properties(); - ses = (Session)props.get(ATTR_SES); + ses = props.get(ATTR_SES); if (ses == null) { ses = sesFactory.openSession(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java index bb23e82..e291c14 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java @@ -69,9 +69,9 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> { @Override public void txEnd(boolean commit) { IgniteTx tx = transaction(); - Map<Object, Object> props = session().properties(); + Map<String, Connection> props = session().properties(); - try (Connection conn = (Connection)props.remove(ATTR_NAME)) { + try (Connection conn = props.remove(ATTR_NAME)) { if (conn != null) { if (commit) conn.commit(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java index 5a91df8..86ac8df 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java @@ -19,7 +19,7 @@ package org.apache.ignite.cache; import org.apache.ignite.Ignite; import org.apache.ignite.cache.store.*; -import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.*; import org.apache.ignite.portables.PortableObject; import org.apache.ignite.spi.indexing.*; import org.gridgain.grid.cache.*; @@ -33,7 +33,6 @@ import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; import javax.cache.configuration.*; -import javax.cache.integration.*; import java.util.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java index bd44880..1bca873 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java @@ -33,9 +33,6 @@ public enum CacheFlag { /** Skip swap space for reads and writes. */ SKIP_SWAP, - /** Always get data from primary node (never from backup). */ - GET_PRIMARY, - /** Synchronous commit. */ SYNC_COMMIT, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/apache/ignite/cache/CachePartialUpdateException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CachePartialUpdateException.java b/modules/core/src/main/java/org/apache/ignite/cache/CachePartialUpdateException.java index 08ce72e..427f387 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CachePartialUpdateException.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CachePartialUpdateException.java @@ -1,10 +1,18 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.ignite.cache; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java index 85aee26..ab928d5 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java @@ -20,7 +20,6 @@ package org.apache.ignite.cache.store; import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; -import org.apache.ignite.transactions.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -102,7 +101,7 @@ public abstract class CacheLoadOnlyStoreAdapter<K, V, I> extends CacheStore<K, V * Note that returned iterator doesn't have to be thread-safe. Thus it could * operate on raw streams, DB connections, etc. without additional synchronization. * - * @param args Arguments passes into {@link GridCache#loadCache(org.apache.ignite.lang.IgniteBiPredicate, long, Object...)} method. + * @param args Arguments passes into {@link GridCache#loadCache(IgniteBiPredicate, long, Object...)} method. * @return Iterator over input records. * @throws CacheLoaderException If iterator can't be created with the given arguments. */ @@ -115,7 +114,7 @@ public abstract class CacheLoadOnlyStoreAdapter<K, V, I> extends CacheStore<K, V * If {@code null} is returned then this record will be just skipped. * * @param rec A raw data record. - * @param args Arguments passed into {@link GridCache#loadCache(org.apache.ignite.lang.IgniteBiPredicate, long, Object...)} method. + * @param args Arguments passed into {@link GridCache#loadCache(IgniteBiPredicate, long, Object...)} method. * @return Cache entry to be saved in cache or {@code null} if no entry could be produced from this record. */ @Nullable protected abstract IgniteBiTuple<K, V> parse(I rec, @Nullable Object... args); @@ -277,7 +276,7 @@ public abstract class CacheLoadOnlyStoreAdapter<K, V, I> extends CacheStore<K, V /** * @param c Closure for loaded entries. * @param buf Set of input records to process. - * @param args Arguments passed into {@link GridCache#loadCache(org.apache.ignite.lang.IgniteBiPredicate, long, Object...)} method. + * @param args Arguments passed into {@link GridCache#loadCache(IgniteBiPredicate, long, Object...)} method. */ Worker(IgniteBiInClosure<K, V> c, Collection<I> buf, Object[] args) { this.c = c; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java index a3cb47d..4ad668b 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java @@ -38,7 +38,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.*; /** - * {@link org.apache.ignite.cache.store.CacheStore} implementation backed by JDBC. This implementation + * {@link CacheStore} implementation backed by JDBC. This implementation * stores objects in underlying database in {@code BLOB} format. * <p> * Store will create table {@code ENTRIES} in the database to store data. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java index d003bf1..09026ca 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java @@ -19,6 +19,7 @@ package org.gridgain.grid.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; +import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.gridgain.grid.cache.affinity.*; @@ -187,14 +188,14 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { public Iterator<Map.Entry<K, V>> offHeapIterator() throws IgniteCheckedException; /** - * Delegates to {@link org.apache.ignite.cache.store.CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method + * Delegates to {@link CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method * to load state from the underlying persistent storage. The loaded values * will then be given to the optionally passed in predicate, and, if the predicate returns * {@code true}, will be stored in cache. If predicate is {@code null}, then * all loaded values will be stored in cache. * <p> * Note that this method does not receive keys as a parameter, so it is up to - * {@link org.apache.ignite.cache.store.CacheStore} implementation to provide all the data to be loaded. + * {@link CacheStore} implementation to provide all the data to be loaded. * <p> * This method is not transactional and may end up loading a stale value into * cache if another thread has updated the value immediately after it has been @@ -205,20 +206,20 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * filter values to be put into cache. * @param ttl Time to live for loaded entries ({@code 0} for infinity). * @param args Optional user arguments to be passed into - * {@link org.apache.ignite.cache.store.CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} method. + * {@link CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} method. * @throws IgniteCheckedException If loading failed. */ public void loadCache(@Nullable IgniteBiPredicate<K, V> p, long ttl, @Nullable Object... args) throws IgniteCheckedException; /** - * Asynchronously delegates to {@link org.apache.ignite.cache.store.CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} method + * Asynchronously delegates to {@link CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} method * to reload state from the underlying persistent storage. The reloaded values * will then be given to the optionally passed in predicate, and if the predicate returns * {@code true}, will be stored in cache. If predicate is {@code null}, then * all reloaded values will be stored in cache. * <p> * Note that this method does not receive keys as a parameter, so it is up to - * {@link org.apache.ignite.cache.store.CacheStore} implementation to provide all the data to be loaded. + * {@link CacheStore} implementation to provide all the data to be loaded. * <p> * This method is not transactional and may end up loading a stale value into * cache if another thread has updated the value immediately after it has been @@ -229,7 +230,7 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * filter values to be put into cache. * @param ttl Time to live for loaded entries ({@code 0} for infinity). * @param args Optional user arguments to be passed into - * {@link org.apache.ignite.cache.store.CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method. + * {@link CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method. * @return Future to be completed whenever loading completes. */ public IgniteFuture<?> loadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, long ttl, @Nullable Object... args); @@ -252,7 +253,7 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { /** * Forces this cache node to re-balance its partitions. This method is usually used when - * {@link org.apache.ignite.cache.CacheConfiguration#getPreloadPartitionedDelay()} configuration parameter has non-zero value. + * {@link CacheConfiguration#getPreloadPartitionedDelay()} configuration parameter has non-zero value. * When many nodes are started or stopped almost concurrently, it is more efficient to delay * preloading until the node topology is stable to make sure that no redundant re-partitioning * happens. @@ -260,12 +261,12 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * In case of{@link GridCacheMode#PARTITIONED} caches, for better efficiency user should * usually make sure that new nodes get placed on the same place of consistent hash ring as * the left nodes, and that nodes are restarted before - * {@link org.apache.ignite.cache.CacheConfiguration#getPreloadPartitionedDelay() preloadDelay} expires. To place nodes + * {@link CacheConfiguration#getPreloadPartitionedDelay() preloadDelay} expires. To place nodes * on the same place in consistent hash ring, use * {@link GridCacheConsistentHashAffinityFunction#setHashIdResolver(GridCacheAffinityNodeHashResolver)} to make sure that * a node maps to the same hash ID if re-started. * <p> - * See {@link org.apache.ignite.cache.CacheConfiguration#getPreloadPartitionedDelay()} for more information on how to configure + * See {@link CacheConfiguration#getPreloadPartitionedDelay()} for more information on how to configure * preload re-partition delay. * <p> * @return Future that will be completed when preloading is finished. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java index 21cf540..f49afdb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java @@ -17,6 +17,7 @@ package org.gridgain.grid.cache; +import org.apache.ignite.cache.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; @@ -26,7 +27,7 @@ import org.jetbrains.annotations.*; * used whenever transactions and explicit locking are not needed. Note that in {@link #ATOMIC} * mode cache will still maintain full data consistency across all cache nodes. * <p> - * Cache atomicity may be set via {@link org.apache.ignite.cache.CacheConfiguration#getAtomicityMode()} + * Cache atomicity may be set via {@link CacheConfiguration#getAtomicityMode()} * configuration property. */ public enum GridCacheAtomicityMode { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheDistributionMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheDistributionMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheDistributionMode.java index 2fbb613..66f116d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheDistributionMode.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheDistributionMode.java @@ -17,12 +17,13 @@ package org.gridgain.grid.cache; +import org.apache.ignite.cache.*; import org.jetbrains.annotations.*; /** * This enum defines mode in which partitioned cache operates. * <p> - * Partitioned distribution mode can be configured via {@link org.apache.ignite.cache.CacheConfiguration#getDistributionMode()} + * Partitioned distribution mode can be configured via {@link CacheConfiguration#getDistributionMode()} * configuration property. */ public enum GridCacheDistributionMode { @@ -37,14 +38,14 @@ public enum GridCacheDistributionMode { * recently accessed keys in a smaller near cache. Amount of recently accessed keys to cache is * controlled by near eviction policy. * - * @see org.apache.ignite.cache.CacheConfiguration#getNearEvictionPolicy() + * @see CacheConfiguration#getNearEvictionPolicy() */ NEAR_ONLY, /** * Mode in which local node may store primary and/or backup keys, and also will cache recently accessed keys. * Amount of recently accessed keys to cache is controlled by near eviction policy. - * @see org.apache.ignite.cache.CacheConfiguration#getNearEvictionPolicy() + * @see CacheConfiguration#getNearEvictionPolicy() */ NEAR_PARTITIONED, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinity.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinity.java b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinity.java index 7c2746d..4406320 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinity.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinity.java @@ -17,6 +17,7 @@ package org.gridgain.grid.cache.affinity; +import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.jetbrains.annotations.*; @@ -42,8 +43,8 @@ public interface GridCacheAffinity<K> { * * @return Number of cache partitions. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public int partitions(); @@ -53,8 +54,8 @@ public interface GridCacheAffinity<K> { * @param key Key to get partition id for. * @return Partition id. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public int partition(K key); @@ -109,8 +110,8 @@ public interface GridCacheAffinity<K> { * @param n Grid node. * @return Partition ids for which given projection has primary ownership. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public int[] primaryPartitions(ClusterNode n); @@ -131,8 +132,8 @@ public interface GridCacheAffinity<K> { * @param n Grid node. * @return Partition ids for which given projection has backup ownership. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public int[] backupPartitions(ClusterNode n); @@ -150,8 +151,8 @@ public interface GridCacheAffinity<K> { * @param n Grid node. * @return Partition ids for which given projection has ownership. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public int[] allPartitions(ClusterNode n); @@ -212,13 +213,13 @@ public interface GridCacheAffinity<K> { * first in the returned collection. * <p> * If there are only cache nodes in the projection with - * {@link org.apache.ignite.cache.CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}, then this + * {@link CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}, then this * method will return an empty collection. * * @param key Key to get affinity nodes for. * @return Collection of primary and backup nodes for the key with primary node * always first, or an empty collection if this projection contains only nodes with - * {@link org.apache.ignite.cache.CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}. + * {@link CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}. */ public Collection<ClusterNode> mapKeyToPrimaryAndBackups(K key); @@ -228,8 +229,8 @@ public interface GridCacheAffinity<K> { * @param part Partition id. * @return Primary node for the given partition. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public ClusterNode mapPartitionToNode(int part); @@ -239,8 +240,8 @@ public interface GridCacheAffinity<K> { * @param parts Partition ids. * @return Mapping of given partitions to their primary nodes. * @see GridCacheAffinityFunction - * @see org.apache.ignite.cache.CacheConfiguration#getAffinity() - * @see org.apache.ignite.cache.CacheConfiguration#setAffinity(GridCacheAffinityFunction) + * @see CacheConfiguration#getAffinity() + * @see CacheConfiguration#setAffinity(GridCacheAffinityFunction) */ public Map<Integer, ClusterNode> mapPartitionsToNodes(Collection<Integer> parts); @@ -249,13 +250,13 @@ public interface GridCacheAffinity<K> { * first in the returned collection. * <p> * If there are only cache nodes in the projection with - * {@link org.apache.ignite.cache.CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}, then this + * {@link CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}, then this * method will return an empty collection. * * @param part Partition to get affinity nodes for. * @return Collection of primary and backup nodes for partition with primary node * always first, or an empty collection if this projection contains only nodes with - * {@link org.apache.ignite.cache.CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}. + * {@link CacheConfiguration#getDistributionMode()} property set to {@code NEAR_ONLY}. */ public Collection<ClusterNode> mapPartitionToPrimaryAndBackups(int part); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityFunction.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityFunction.java b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityFunction.java index de01914..6a92c85 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityFunction.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityFunction.java @@ -17,6 +17,7 @@ package org.gridgain.grid.cache.affinity; +import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.gridgain.grid.cache.*; @@ -26,7 +27,7 @@ import java.util.*; /** * Cache key affinity which maps keys to nodes. This interface is utilized for * both, replicated and partitioned caches. Cache affinity can be configured - * for individual caches via {@link org.apache.ignite.cache.CacheConfiguration#getAffinity()} method. + * for individual caches via {@link CacheConfiguration#getAffinity()} method. * <p> * Whenever a key is given to cache, it is first passed to a pluggable * {@link GridCacheAffinityKeyMapper} which may potentially map this key to an alternate http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityKeyMapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityKeyMapper.java b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityKeyMapper.java index 715b64f..5beb223 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityKeyMapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/GridCacheAffinityKeyMapper.java @@ -17,6 +17,8 @@ package org.gridgain.grid.cache.affinity; +import org.apache.ignite.cache.*; + import java.io.*; /** @@ -35,7 +37,7 @@ import java.io.*; * than the cache key itself, whenever needed. * <p> * A custom (other than default) affinity mapper can be provided - * via {@link org.apache.ignite.cache.CacheConfiguration#getAffinityMapper()} configuration property. + * via {@link CacheConfiguration#getAffinityMapper()} configuration property. * <p> * For more information on affinity mapping and examples refer to {@link GridCacheAffinityFunction} and * {@link GridCacheAffinityKeyMapped @GridCacheAffinityKeyMapped} documentation. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/affinity/consistenthash/GridCacheConsistentHashAffinityFunction.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/consistenthash/GridCacheConsistentHashAffinityFunction.java b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/consistenthash/GridCacheConsistentHashAffinityFunction.java index b5ac5c1..40a3457 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/affinity/consistenthash/GridCacheConsistentHashAffinityFunction.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/affinity/consistenthash/GridCacheConsistentHashAffinityFunction.java @@ -18,6 +18,7 @@ package org.gridgain.grid.cache.affinity.consistenthash; import org.apache.ignite.*; +import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; @@ -55,7 +56,7 @@ import java.util.concurrent.atomic.*; * </li> * </ul> * <p> - * Cache affinity can be configured for individual caches via {@link org.apache.ignite.cache.CacheConfiguration#getAffinity()} method. + * Cache affinity can be configured for individual caches via {@link CacheConfiguration#getAffinity()} method. */ public class GridCacheConsistentHashAffinityFunction implements GridCacheAffinityFunction { /** */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/cloner/GridCacheCloner.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/cloner/GridCacheCloner.java b/modules/core/src/main/java/org/gridgain/grid/cache/cloner/GridCacheCloner.java index 6e82572..648756f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/cloner/GridCacheCloner.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/cloner/GridCacheCloner.java @@ -18,6 +18,7 @@ package org.gridgain.grid.cache.cloner; import org.apache.ignite.*; +import org.apache.ignite.cache.*; import org.gridgain.grid.cache.*; import org.jetbrains.annotations.*; @@ -34,7 +35,7 @@ import org.jetbrains.annotations.*; * and will affect the cached values returned to other threads even before * the transaction commits. * <p> - * Cache cloner can be set in cache configuration via {@link org.apache.ignite.cache.CacheConfiguration#getCloner()} + * Cache cloner can be set in cache configuration via {@link CacheConfiguration#getCloner()} * method. By default, cache uses {@link GridCacheBasicCloner} implementation * which will clone only objects implementing {@link Cloneable} interface. You * can also configure cache to use {@link GridCacheDeepCloner} which will perform @@ -44,8 +45,8 @@ import org.jetbrains.annotations.*; * * @see GridCacheBasicCloner * @see GridCacheDeepCloner - * @see org.apache.ignite.cache.CacheConfiguration#getCloner() - * @see org.apache.ignite.cache.CacheConfiguration#setCloner(GridCacheCloner) + * @see CacheConfiguration#getCloner() + * @see CacheConfiguration#setCloner(GridCacheCloner) * */ public interface GridCacheCloner { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/cache/eviction/GridCacheEvictionFilter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/eviction/GridCacheEvictionFilter.java b/modules/core/src/main/java/org/gridgain/grid/cache/eviction/GridCacheEvictionFilter.java index a280426..e73dadf 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/eviction/GridCacheEvictionFilter.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/eviction/GridCacheEvictionFilter.java @@ -17,6 +17,7 @@ package org.gridgain.grid.cache.eviction; +import org.apache.ignite.cache.*; import org.gridgain.grid.cache.*; /** @@ -25,7 +26,7 @@ import org.gridgain.grid.cache.*; * If {@link #evictAllowed(GridCacheEntry)} method returns {@code false} then eviction * policy will not be notified and entry will never be evicted. * <p> - * Eviction filter can be configured via {@link org.apache.ignite.cache.CacheConfiguration#getEvictionFilter()} + * Eviction filter can be configured via {@link CacheConfiguration#getEvictionFilter()} * configuration property. Default value is {@code null} which means that all * cache entries will be tracked by eviction policy. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java index 055263d..6e1a931 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java @@ -1,10 +1,18 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.gridgain.grid.kernal.processors.cache; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeResult.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeResult.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeResult.java index ab0959e..c2175c6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeResult.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeResult.java @@ -1,10 +1,18 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.gridgain.grid.kernal.processors.cache; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java index e383af2..1f91190 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java @@ -3377,6 +3377,93 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im return ctx.tm().synchronizations(); } + /** {@inheritDoc} */ + @Override public void loadCache(final IgniteBiPredicate<K, V> p, final long ttl, Object[] args) + throws IgniteCheckedException { + final boolean replicate = ctx.isDrEnabled(); + final long topVer = ctx.affinity().affinityTopologyVersion(); + + if (ctx.store().isLocalStore()) { + try (final IgniteDataLoader<K, V> ldr = ctx.kernalContext().<K, V>dataLoad().dataLoader(ctx.namex(), false)) { + ldr.updater(new GridDrDataLoadCacheUpdater<K, V>()); + + LocalStoreLoadClosure c = new LocalStoreLoadClosure(p, ldr, ttl); + + ctx.store().loadCache(c, args); + + c.onDone(); + } + } + else { + // Version for all loaded entries. + final GridCacheVersion ver0 = ctx.versions().nextForLoad(); + + ctx.store().loadCache(new CIX3<K, V, GridCacheVersion>() { + @Override public void applyx(K key, V val, @Nullable GridCacheVersion ver) + throws PortableException { + assert ver == null; + + loadEntry(key, val, ver0, p, topVer, replicate, ttl); + } + }, args); + } + } + + /** + * @param key Key. + * @param val Value. + * @param ver Cache version. + * @param p Optional predicate. + * @param topVer Topology version. + * @param replicate Replication flag. + * @param ttl TTL. + */ + private void loadEntry(K key, + V val, + GridCacheVersion ver, + @Nullable IgniteBiPredicate<K, V> p, + long topVer, + boolean replicate, + long ttl) { + if (p != null && !p.apply(key, val)) + return; + + if (ctx.portableEnabled()) { + key = (K)ctx.marshalToPortable(key); + val = (V)ctx.marshalToPortable(val); + } + + GridCacheEntryEx<K, V> entry = entryEx(key, false); + + try { + entry.initialValue(val, null, ver, ttl, -1, false, topVer, replicate ? DR_LOAD : DR_NONE); + } + catch (IgniteCheckedException e) { + throw new IgniteException("Failed to put cache value: " + entry, e); + } + catch (GridCacheEntryRemovedException ignore) { + if (log.isDebugEnabled()) + log.debug("Got removed entry during loadCache (will ignore): " + entry); + } + finally { + ctx.evicts().touch(entry, topVer); + } + + CU.unwindEvicts(ctx); + } + + /** {@inheritDoc} */ + @Override public IgniteFuture<?> loadCacheAsync(final IgniteBiPredicate<K, V> p, final long ttl, final Object[] args) { + return ctx.closures().callLocalSafe( + ctx.projectSafe(new Callable<Object>() { + @Nullable @Override public Object call() throws IgniteCheckedException { + loadCache(p, ttl, args); + + return null; + } + }), true); + } + /** * @param keys Keys. * @param replaceExisting Replace existing values flag. @@ -3495,94 +3582,6 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im } /** {@inheritDoc} */ - @Override public void loadCache(final IgniteBiPredicate<K, V> p, final long ttl, Object[] args) - throws IgniteCheckedException { - final boolean replicate = ctx.isDrEnabled(); - final long topVer = ctx.affinity().affinityTopologyVersion(); - - if (ctx.store().isLocalStore()) { - try (final IgniteDataLoader<K, V> ldr = ctx.kernalContext().<K, V>dataLoad().dataLoader(ctx.namex(), false)) { - ldr.updater(new GridDrDataLoadCacheUpdater<K, V>()); - - LocalStoreLoadClosure c = new LocalStoreLoadClosure(p, ldr, ttl); - - ctx.store().loadCache(c, args); - - c.onDone(); - } - } - else { - // Version for all loaded entries. - final GridCacheVersion ver0 = ctx.versions().nextForLoad(); - - ctx.store().loadCache(new CIX3<K, V, GridCacheVersion>() { - @Override - public void applyx(K key, V val, @Nullable GridCacheVersion ver) - throws PortableException { - assert ver == null; - - loadEntry(key, val, ver0, p, topVer, replicate, ttl); - } - }, args); - } - } - - /** - * @param key Key. - * @param val Value. - * @param ver Cache version. - * @param p Optional predicate. - * @param topVer Topology version. - * @param replicate Replication flag. - * @param ttl TTL. - */ - private void loadEntry(K key, - V val, - GridCacheVersion ver, - @Nullable IgniteBiPredicate<K, V> p, - long topVer, - boolean replicate, - long ttl) { - if (p != null && !p.apply(key, val)) - return; - - if (ctx.portableEnabled()) { - key = (K)ctx.marshalToPortable(key); - val = (V)ctx.marshalToPortable(val); - } - - GridCacheEntryEx<K, V> entry = entryEx(key, false); - - try { - entry.initialValue(val, null, ver, ttl, -1, false, topVer, replicate ? DR_LOAD : DR_NONE); - } - catch (IgniteCheckedException e) { - throw new IgniteException("Failed to put cache value: " + entry, e); - } - catch (GridCacheEntryRemovedException ignore) { - if (log.isDebugEnabled()) - log.debug("Got removed entry during loadCache (will ignore): " + entry); - } - finally { - ctx.evicts().touch(entry, topVer); - } - - CU.unwindEvicts(ctx); - } - - /** {@inheritDoc} */ - @Override public IgniteFuture<?> loadCacheAsync(final IgniteBiPredicate<K, V> p, final long ttl, final Object[] args) { - return ctx.closures().callLocalSafe( - ctx.projectSafe(new Callable<Object>() { - @Nullable @Override public Object call() throws IgniteCheckedException { - loadCache(p, ttl, args); - - return null; - } - }), true); - } - - /** {@inheritDoc} */ @Nullable @Override public GridCacheEntry<K, V> randomEntry() { GridCacheMapEntry<K, V> e = map.randomEntry(); @@ -4643,9 +4642,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im ctx.denyOnFlags(F.asList(LOCAL, READ)); return ctx.closures().callLocalSafe(ctx.projectSafe(new Callable<V>() { - @Nullable - @Override - public V call() throws IgniteCheckedException { + @Nullable @Override public V call() throws IgniteCheckedException { return reload(key, filter); } }), true); @@ -5250,6 +5247,8 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im @Override public Void call() throws Exception { GridCacheAdapter<K, V> cache = ((GridKernal)ignite).context().cache().internalCache(cacheName); + assert cache != null : cacheName; + cache.context().gate().enter(); try { @@ -5351,7 +5350,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im * */ static class SkipStoreUpdater<K, V> implements IgniteDataLoadCacheUpdater<K, V> { - /** {@inheritDoc} */ + /** {@inheritDoc} */ @Override public void update(IgniteCache<K, V> cache, Collection<Map.Entry<K, V>> entries) throws IgniteCheckedException { cache = cache.flagsOn(SKIP_STORE); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheDefaultAffinityKeyMapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheDefaultAffinityKeyMapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheDefaultAffinityKeyMapper.java index bcf4ee2..e7d74cd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheDefaultAffinityKeyMapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheDefaultAffinityKeyMapper.java @@ -18,6 +18,7 @@ package org.gridgain.grid.kernal.processors.cache; import org.apache.ignite.*; +import org.apache.ignite.cache.*; import org.apache.ignite.portables.*; import org.apache.ignite.resources.*; import org.gridgain.grid.cache.affinity.*; @@ -37,7 +38,7 @@ import java.lang.reflect.*; * conjunction with this mapper to automatically provide custom affinity keys for cache keys. * <p> * If non-default affinity mapper is used, is should be provided via - * {@link org.apache.ignite.cache.CacheConfiguration#getAffinityMapper()} configuration property. + * {@link CacheConfiguration#getAffinityMapper()} configuration property. */ public class GridCacheDefaultAffinityKeyMapper implements GridCacheAffinityKeyMapper { /** */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java index dddede9..2791f26 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java @@ -570,29 +570,29 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { } else { if (store != null) { - Map<K, IgniteBiTuple<V, GridCacheVersion>> map0; + Collection<Cache.Entry<? extends K, ?>> entries; if (convertPortable) { - map0 = U.newHashMap(map.size()); + entries = new ArrayList<>(map.size()); for (Map.Entry<K, IgniteBiTuple<V, GridCacheVersion>> e : map.entrySet()) { - IgniteBiTuple<V, GridCacheVersion> t = e.getValue(); + K k = e.getKey(); + Object v = locStore ? e.getValue() : e.getValue().get1(); - map0.put((K)cctx.unwrapPortableIfNeeded(e.getKey(), false), - F.t((V)cctx.unwrapPortableIfNeeded(t.get1(), false), t.get2())); + entries.add(new CacheEntryImpl<>( + (K)cctx.unwrapPortableIfNeeded(k, false), + (V)cctx.unwrapPortableIfNeeded(v, false))); } } - else - map0 = map; - - if (log.isDebugEnabled()) - log.debug("Storing values in cache store [map=" + map0 + ']'); + else { + entries = new ArrayList<>(map.size()); - // TODO IGNITE-42. - Collection<Cache.Entry<? extends K, ?>> entries = new ArrayList<>(map.size()); + for (Map.Entry<K, IgniteBiTuple<V, GridCacheVersion>> e : map.entrySet()) + entries.add(new CacheEntryImpl<>(e.getKey(), locStore ? e.getValue() : e.getValue().get1())); + } - for (Map.Entry<K, IgniteBiTuple<V, GridCacheVersion>> e : map.entrySet()) - entries.add(new CacheEntryImpl<>(e.getKey(), locStore ? e.getValue() : e.getValue().get1())); + if (log.isDebugEnabled()) + log.debug("Storing values in cache store [entries=" + entries + ']'); initSession(tx); @@ -619,7 +619,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { } if (log.isDebugEnabled()) - log.debug("Stored value in cache store [map=" + map0 + ']'); + log.debug("Stored value in cache store [entries=" + entries + ']'); return true; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/test/java/org/gridgain/grid/GridCacheAffinityBackupsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/GridCacheAffinityBackupsSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/GridCacheAffinityBackupsSelfTest.java index 2e159f9..9c34fb3 100644 --- a/modules/core/src/test/java/org/gridgain/grid/GridCacheAffinityBackupsSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/GridCacheAffinityBackupsSelfTest.java @@ -39,6 +39,7 @@ public class GridCacheAffinityBackupsSelfTest extends GridCommonAbstractTest { /** Affinity function. */ private GridCacheAffinityFunction func; + /** */ private int nodesCnt = 5; /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/test/java/org/gridgain/grid/cache/store/GridCacheBalancingStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/cache/store/GridCacheBalancingStoreSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/cache/store/GridCacheBalancingStoreSelfTest.java index a4ed706..de046ac 100644 --- a/modules/core/src/test/java/org/gridgain/grid/cache/store/GridCacheBalancingStoreSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/cache/store/GridCacheBalancingStoreSelfTest.java @@ -25,7 +25,6 @@ import org.gridgain.testframework.junits.common.*; import org.jetbrains.annotations.*; import javax.cache.*; -import javax.cache.integration.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFailoverSelfTest.java index 51f3fce..149f8f0 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFailoverSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFailoverSelfTest.java @@ -66,6 +66,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac return 3; } + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 0ec83e4..28a002c 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -800,21 +800,15 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract private void checkTransform(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) throws Exception { IgniteCache<String, Integer> cache = jcache(); - List<String> keys = Arrays.asList("key1", "key2", "key3"); - - String key1 = keys.get(0); - String key2 = keys.get(1); - String key3 = keys.get(2); - - cache.put(key2, 1); - cache.put(key3, 3); + cache.put("key2", 1); + cache.put("key3", 3); IgniteTx tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null; try { - assertEquals("null", cache.invoke(key1, INCR_PROCESSOR)); - assertEquals("1", cache.invoke(key2, INCR_PROCESSOR)); - assertEquals("3", cache.invoke(key3, RMV_PROCESSOR)); + assertEquals("null", cache.invoke("key1", INCR_PROCESSOR)); + assertEquals("1", cache.invoke("key2", INCR_PROCESSOR)); + assertEquals("3", cache.invoke("key3", RMV_PROCESSOR)); if (tx != null) tx.commit(); @@ -829,27 +823,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx.close(); } - assertEquals((Integer)1, cache.get(key1)); - assertEquals((Integer)2, cache.get(key2)); - assertNull(cache.get(key3)); + assertEquals((Integer)1, cache.get("key1")); + assertEquals((Integer)2, cache.get("key2")); + assertNull(cache.get("key3")); for (int i = 0; i < gridCount(); i++) - assertNull("Failed for cache: " + i, cache(i).peek(key3)); + assertNull("Failed for cache: " + i, cache(i).peek("key3")); - cache.remove(key1); - cache.put(key2, 1); - cache.put(key3, 3); + cache.remove("key1"); + cache.put("key2", 1); + cache.put("key3", 3); - assertEquals("null", cache.invoke(key1, INCR_PROCESSOR)); - assertEquals("1", cache.invoke(key2, INCR_PROCESSOR)); - assertEquals("3", cache.invoke(key3, RMV_PROCESSOR)); + assertEquals("null", cache.invoke("key1", INCR_PROCESSOR)); + assertEquals("1", cache.invoke("key2", INCR_PROCESSOR)); + assertEquals("3", cache.invoke("key3", RMV_PROCESSOR)); - assertEquals((Integer)1, cache.get(key1)); - assertEquals((Integer)2, cache.get(key2)); - assertNull(cache.get(key3)); + assertEquals((Integer)1, cache.get("key1")); + assertEquals((Integer)2, cache.get("key2")); + assertNull(cache.get("key3")); for (int i = 0; i < gridCount(); i++) - assertNull(cache(i).peek(key3)); + assertNull(cache(i).peek("key3")); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java index e982cd3..de29b39 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java @@ -98,7 +98,6 @@ public abstract class GridCacheAbstractQueueFailoverDataConsistencySelfTest exte ccfg.setSwapEnabled(false); ccfg.setQueryIndexEnabled(false); ccfg.setCacheStoreFactory(null); - ccfg.setLoadPreviousValue(true); return ccfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd78b9cf/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java index 6a5a43f..2c2f0c9 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java @@ -26,8 +26,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.cache.datastructures.*; -import org.gridgain.grid.kernal.*; -import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.testframework.junits.common.*; import org.mockito.*;