http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java new file mode 100644 index 0000000..6c41374 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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; + +import org.apache.ignite.transactions.*; +import org.jetbrains.annotations.*; + +/** + * Mode indicating how GridGain should wait for write replies from other nodes. Default + * value is {@link #FULL_ASYNC}}, which means that GridGain will not wait for responses from + * participating nodes. This means that by default remote nodes may get their state updated slightly after + * any of the cache write methods complete, or after {@link IgniteTx#commit()} method completes. + * <p> + * Note that regardless of write synchronization mode, cache data will always remain fully + * consistent across all participating nodes. + * <p> + * Write synchronization mode may be configured via {@link org.apache.ignite.cache.CacheConfiguration#getWriteSynchronizationMode()} + * configuration property. + */ +public enum CacheWriteSynchronizationMode { + /** + * Flag indicating that GridGain should wait for write or commit replies from all nodes. + * This behavior guarantees that whenever any of the atomic or transactional writes + * complete, all other participating nodes which cache the written data have been updated. + */ + FULL_SYNC, + + /** + * Flag indicating that GridGain will not wait for write or commit responses from participating nodes, + * which means that remote nodes may get their state updated a bit after any of the cache write methods + * complete, or after {@link IgniteTx#commit()} method completes. + */ + FULL_ASYNC, + + /** + * This flag only makes sense for {@link CacheMode#PARTITIONED} mode. When enabled, GridGain + * will wait for write or commit to complete on {@code primary} node, but will not wait for + * backups to be updated. + */ + PRIMARY_SYNC; + + /** Enumerated values. */ + private static final CacheWriteSynchronizationMode[] VALS = values(); + + /** + * Efficiently gets enumerated value from its ordinal. + * + * @param ord Ordinal value. + * @return Enumerated value or {@code null} if ordinal out of range. + */ + @Nullable public static CacheWriteSynchronizationMode fromOrdinal(int ord) { + return ord >= 0 && ord < VALS.length ? VALS[ord] : null; + } +}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java deleted file mode 100644 index 3a070d4..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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; - -import org.apache.ignite.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.cache.datastructures.*; -import org.apache.ignite.cache.store.CacheStore; -import org.apache.ignite.lang.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Main entry point for all <b>Data Grid APIs.</b> You can get a named cache by calling {@link org.apache.ignite.Ignite#cache(String)} - * method. - * <h1 class="header">Functionality</h1> - * This API extends {@link GridCacheProjection} API which contains vast majority of cache functionality - * and documentation. In addition to {@link GridCacheProjection} functionality this API provides: - * <ul> - * <li> - * Various {@code 'loadCache(..)'} methods to load cache either synchronously or asynchronously. - * These methods don't specify any keys to load, and leave it to the underlying storage to load cache - * data based on the optionally passed in arguments. - * </li> - * <li> - * Method {@link #affinity()} provides {@link org.apache.ignite.cache.affinity.GridCacheAffinityFunction} service for information on - * data partitioning and mapping keys to grid nodes responsible for caching those keys. - * </li> - * <li> - * Method {@link #dataStructures()} provides {@link org.apache.ignite.cache.datastructures.GridCacheDataStructures} service for - * creating and working with distributed concurrent data structures, such as - * {@link org.apache.ignite.cache.datastructures.GridCacheAtomicLong}, {@link org.apache.ignite.cache.datastructures.GridCacheAtomicReference}, {@link org.apache.ignite.cache.datastructures.GridCacheQueue}, etc. - * </li> - * <li> - * Methods like {@code 'tx{Un}Synchronize(..)'} witch allow to get notifications for transaction state changes. - * This feature is very useful when integrating cache transactions with some other in-house transactions. - * </li> - * <li>Method {@link #metrics()} to provide metrics for the whole cache.</li> - * <li>Method {@link #configuration()} to provide cache configuration bean.</li> - * </ul> - * - * @param <K> Cache key type. - * @param <V> Cache value type. - */ -public interface GridCache<K, V> extends GridCacheProjection<K, V> { - /** - * Gets configuration bean for this cache. - * - * @return Configuration bean for this cache. - */ - public CacheConfiguration configuration(); - - /** - * Registers transactions synchronizations for all transactions started by this cache. - * Use it whenever you need to get notifications on transaction lifecycle and possibly change - * its course. It is also particularly useful when integrating cache transactions - * with some other in-house transactions. - * - * @param syncs Transaction synchronizations to register. - */ - public void txSynchronize(@Nullable IgniteTxSynchronization syncs); - - /** - * Removes transaction synchronizations. - * - * @param syncs Transactions synchronizations to remove. - * @see #txSynchronize(IgniteTxSynchronization) - */ - public void txUnsynchronize(@Nullable IgniteTxSynchronization syncs); - - /** - * Gets registered transaction synchronizations. - * - * @return Registered transaction synchronizations. - * @see #txSynchronize(IgniteTxSynchronization) - */ - public Collection<IgniteTxSynchronization> txSynchronizations(); - - /** - * Gets affinity service to provide information about data partitioning - * and distribution. - * - * @return Cache data affinity service. - */ - public GridCacheAffinity<K> affinity(); - - /** - * Gets data structures service to provide a gateway for creating various - * distributed data structures similar in APIs to {@code java.util.concurrent} package. - * - * @return Cache data structures service. - */ - public GridCacheDataStructures dataStructures(); - - /** - * Gets metrics (statistics) for this cache. - * - * @return Cache metrics. - */ - public GridCacheMetrics metrics(); - - /** - * Gets size (in bytes) of all entries swapped to disk. - * - * @return Size (in bytes) of all entries swapped to disk. - * @throws IgniteCheckedException In case of error. - */ - public long overflowSize() throws IgniteCheckedException; - - /** - * Gets number of cache entries stored in off-heap memory. - * - * @return Number of cache entries stored in off-heap memory. - */ - public long offHeapEntriesCount(); - - /** - * Gets memory size allocated in off-heap. - * - * @return Allocated memory size. - */ - public long offHeapAllocatedSize(); - - /** - * Gets size in bytes for swap space. - * - * @return Size in bytes. - * @throws IgniteCheckedException If failed. - */ - public long swapSize() throws IgniteCheckedException; - - /** - * Gets number of swap entries (keys). - * - * @return Number of entries stored in swap. - * @throws IgniteCheckedException If failed. - */ - public long swapKeys() throws IgniteCheckedException; - - /** - * Gets iterator over keys and values belonging to this cache swap space on local node. This - * iterator is thread-safe, which means that cache (and therefore its swap space) - * may be modified concurrently with iteration over swap. - * <p> - * Returned iterator supports {@code remove} operation which delegates to - * {@link #removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * <h2 class="header">Cache Flags</h2> - * This method is not available if any of the following flags are set on projection: - * {@link GridCacheFlag#SKIP_SWAP}. - * - * @return Iterator over keys. - * @throws IgniteCheckedException If failed. - * @see #promote(Object) - */ - public Iterator<Map.Entry<K, V>> swapIterator() throws IgniteCheckedException; - - /** - * Gets iterator over keys and values belonging to this cache off-heap memory on local node. This - * iterator is thread-safe, which means that cache (and therefore its off-heap memory) - * may be modified concurrently with iteration over off-heap. To achieve better performance - * the keys and values deserialized on demand, whenever accessed. - * <p> - * Returned iterator supports {@code remove} operation which delegates to - * {@link #removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @return Iterator over keys. - * @throws IgniteCheckedException If failed. - */ - public Iterator<Map.Entry<K, V>> offHeapIterator() throws IgniteCheckedException; - - /** - * 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 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 - * loaded. It is mostly useful when pre-loading the cache from underlying - * data store before start, or for read-only caches. - * - * @param p Optional predicate (may be {@code null}). If provided, will be used to - * 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 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 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 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 - * loaded. It is mostly useful when pre-loading the cache from underlying - * data store before start, or for read-only caches. - * - * @param p Optional predicate (may be {@code null}). If provided, will be used to - * 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 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); - - /** - * Gets a random entry out of cache. In the worst cache scenario this method - * has complexity of <pre>O(S * N/64)</pre> where {@code N} is the size of internal hash - * table and {@code S} is the number of hash table buckets to sample, which is {@code 5} - * by default. However, if the table is pretty dense, with density factor of {@code N/64}, - * which is true for near fully populated caches, this method will generally perform significantly - * faster with complexity of O(S) where {@code S = 5}. - * <p> - * Note that this method is not available on {@link GridCacheProjection} API since it is - * impossible (or very hard) to deterministically return a number value when pre-filtering - * and post-filtering is involved (e.g. projection level predicate filters). - * - * @return Random entry, or {@code null} if cache is empty. - */ - @Nullable public GridCacheEntry<K, V> randomEntry(); - - /** - * Forces this cache node to re-balance its partitions. This method is usually used when - * {@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. - * <p> - * In case of{@link CacheMode#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 CacheConfiguration#getPreloadPartitionedDelay() preloadDelay} expires. To place nodes - * on the same place in consistent hash ring, use - * {@link org.apache.ignite.cache.affinity.consistenthash.GridCacheConsistentHashAffinityFunction#setHashIdResolver(GridCacheAffinityNodeHashResolver)} to make sure that - * a node maps to the same hash ID if re-started. - * <p> - * 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. - */ - public IgniteFuture<?> forceRepartition(); - - /** - * Resets metrics for current cache. - */ - public void resetMetrics(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheDistributionMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheDistributionMode.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheDistributionMode.java deleted file mode 100644 index cafdea0..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheDistributionMode.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.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 CacheConfiguration#getDistributionMode()} - * configuration property. - */ -public enum GridCacheDistributionMode { - /** - * Mode in which local node does not cache any data and communicates with other cache nodes - * via remote calls. - */ - CLIENT_ONLY, - - /** - * Mode in which local node will not be either primary or backup node for any keys, but will cache - * recently accessed keys in a smaller near cache. Amount of recently accessed keys to cache is - * controlled by near eviction policy. - * - * @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 CacheConfiguration#getNearEvictionPolicy() - */ - NEAR_PARTITIONED, - - /** - * Mode in which local node may store primary or backup keys, but does not cache recently accessed keys - * in near cache. - */ - PARTITIONED_ONLY; - - /** Enumerated values. */ - private static final GridCacheDistributionMode[] VALS = values(); - - /** - * Efficiently gets enumerated value from its ordinal. - * - * @param ord Ordinal value. - * @return Enumerated value or {@code null} if ordinal out of range. - */ - @Nullable public static GridCacheDistributionMode fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheEntry.java deleted file mode 100644 index 7053287..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheEntry.java +++ /dev/null @@ -1,622 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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; - -import org.apache.ignite.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import javax.cache.*; -import java.util.*; -import java.util.Map.*; -import java.util.concurrent.*; - -/** - * This interface provides a rich API for working with individual cache entries. It - * includes the following main functionality: - * <ul> - * <li> - * Various {@code 'get(..)'} methods to synchronously or asynchronously get values from cache. - * All {@code 'get(..)'} methods are transactional and will participate in an ongoing transaction - * if there is one. - * </li> - * <li> - * Various {@code 'set(..)'}, {@code 'setIfAbsent(..)'}, and {@code 'replace(..)'} methods to - * synchronously or asynchronously put single or multiple entries into cache. - * All these methods are transactional and will participate in an ongoing transaction - * if there is one. - * </li> - * <li> - * Various {@code 'remove(..)'} methods to synchronously or asynchronously remove single or multiple keys - * from cache. All {@code 'remove(..)'} methods are transactional and will participate in an ongoing transaction - * if there is one. - * </li> - * <li> - * Various {@code 'invalidate(..)'} methods to set cached values to {@code null}. - * <li> - * <li> - * Various {@code 'isLocked(..)'} methods to check on distributed locks on a single or multiple keys - * in cache. All locking methods are not transactional and will not enlist keys into ongoing transaction, - * if any. - * </li> - * <li> - * Various {@code 'peek(..)'} methods to peek at values in global or transactional memory, swap - * storage, or persistent storage. - * </li> - * <li> - * Various {@code 'reload(..)'} methods to reload latest values from persistent storage. - * </li> - * <li> - * Method {@link #evict()} to evict elements from cache, and optionally store - * them in underlying swap storage for later access. All {@code 'evict(..)'} methods are not - * transactional and will not enlist evicted keys into ongoing transaction, if any. - * </li> - * <li> - * Methods for {@link #timeToLive(long)} to change or lookup entry's time to live. - * </ul> - * <h1 class="header">Extended Put And Remove Methods</h1> - * All methods that end with {@code 'x'} provide the same functionality as their sibling - * methods that don't end with {@code 'x'}, however instead of returning a previous value they - * return a {@code boolean} flag indicating whether operation succeeded or not. Returning - * a previous value may involve a network trip or a persistent store lookup and should be - * avoided whenever not needed. - * <h1 class="header">Predicate Filters</h1> - * All filters passed into methods on this API are checked <b>atomically</b>. In other words the value - * of cache entry is guaranteed not to change throughout the cache operation. - * <h1 class="header">Transactions</h1> - * Cache API supports distributed transactions. All {@code 'get(..)'}, {@code 'put(..)'}, {@code 'replace(..)'}, - * and {@code 'remove(..)'} operations are transactional and will participate in an ongoing transaction. - * Other methods like {@code 'peek(..)'} may be transaction-aware, i.e. check in-transaction entries first, but - * will not affect the current state of transaction. See {@link IgniteTx} documentation for more information - * about transactions. - * @param <K> Key type. - * @param <V> Value type. - */ -public interface GridCacheEntry<K, V> extends Map.Entry<K, V>, Cache.Entry<K, V> { - /** - * Cache projection to which this entry belongs. Note that entry and its - * parent projections have same flags and filters. - * - * @return Cache projection for the cache to which this entry belongs. - */ - public GridCacheProjection<K, V> projection(); - - /** - * This method has the same semantic as {@link GridCacheProjection#peek(Object)} method. - * - * @return See {@link GridCacheProjection#peek(Object)}. - */ - @Nullable public V peek(); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#peek(Object, Collection)} method. - * - * @param modes See {@link GridCacheProjection#peek(Object, Collection)}. - * @return See {@link GridCacheProjection#peek(Object, Collection)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#peek(Object, Collection)}. - */ - @Nullable public V peek(@Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#reload(Object)} method. - * - * @return See {@link GridCacheProjection#reload(Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#reload(Object)}. - */ - @Nullable public V reload() throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#reloadAsync(Object)} method. - * - * @return See {@link GridCacheProjection#reloadAsync(Object)}. - */ - public IgniteFuture<V> reloadAsync(); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#isLocked(Object)} method. - * - * @return See {@link GridCacheProjection#isLocked(Object)}. - */ - public boolean isLocked(); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#isLockedByThread(Object)} method. - * - * @return See {@link GridCacheProjection#isLockedByThread(Object)}. - */ - public boolean isLockedByThread(); - - /** - * Gets current version of this cache entry. - * - * @return Version of this cache entry. - */ - public Object version(); - - /** - * Gets expiration time for this entry. - * - * @return Absolute time when this value expires. - */ - public long expirationTime(); - - /** - * Gets time to live, i.e. maximum life time, of this entry in milliseconds. - * - * @return Time to live value for this entry. - */ - public long timeToLive(); - - /** - * Sets time to live, i.e. maximum life time, of this entry in milliseconds. - * Note that this method is transactional - if entry is enlisted into a transaction, - * then time-to-live will not be set until transaction commit. - * <p> - * When called outside the transaction, this method will have no effect until the - * next update operation. - * - * @param ttl Time to live value for this entry. - */ - public void timeToLive(long ttl); - - /** - * Gets the flag indicating current node's primary ownership for this entry. - * <p> - * Note, that this value is dynamic and may change with grid topology changes. - * - * @return {@code True} if current grid node is the primary owner for this entry. - */ - public boolean primary(); - - /** - * Gets the flag indicating if current node is backup for this entry. - * <p> - * Note, that this value is dynamic and may change with grid topology changes. - * - * @return {@code True} if current grid node is the backup for this entry. - */ - public boolean backup(); - - /** - * Gets affinity partition id for this entry. - * - * @return Partition id. - */ - public int partition(); - - /** - * This method has the same semantic as {@link #get()} method, however it - * wraps {@link IgniteCheckedException} into {@link IgniteException} if failed in order to - * comply with {@link Entry} interface. - * - * @return See {@link #get()} - */ - @Nullable @Override public V getValue(); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#get(Object)} method. - * - * @return See {@link GridCacheProjection#get(Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#get(Object)}. - */ - @Nullable public V get() throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#getAsync(Object)} method. - * - * @return See {@link GridCacheProjection#getAsync(Object)}. - */ - public IgniteFuture<V> getAsync(); - - /** - * This method has the same semantic as {@link #set(Object, org.apache.ignite.lang.IgnitePredicate[])} method, however it - * wraps {@link IgniteCheckedException} into {@link IgniteException} if failed in order to - * comply with {@link Entry} interface. - * - * @return See {@link #set(Object, org.apache.ignite.lang.IgnitePredicate[])} - */ - @Nullable @Override public V setValue(V val); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param val See {@link GridCacheProjection#put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} - * @param filter See {@link GridCacheProjection#put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @throws IgniteCheckedException See {@link GridCacheProjection#put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - @Nullable public V set(V val, @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param val See {@link GridCacheProjection#putAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} - * @param filter See {@link GridCacheProjection#putAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#putAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - public IgniteFuture<V> setAsync(V val, @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putIfAbsent(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#putIfAbsent(Object, Object)} - * @return See {@link GridCacheProjection#putIfAbsent(Object, Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#putIfAbsent(Object, Object)}. - */ - @Nullable public V setIfAbsent(V val) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putIfAbsentAsync(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#putIfAbsentAsync(Object, Object)} - * @return See {@link GridCacheProjection#putIfAbsentAsync(Object, Object)}. - */ - public IgniteFuture<V> setIfAbsentAsync(V val); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param val See {@link GridCacheProjection#putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} - * @param filter See {@link GridCacheProjection#putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @throws IgniteCheckedException See {@link GridCacheProjection#putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - public boolean setx(V val, @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) - throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putxAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param val See {@link GridCacheProjection#putxAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} - * @param filter See {@link GridCacheProjection#putxAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#putxAsync(Object, Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - public IgniteFuture<Boolean> setxAsync(V val, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putxIfAbsent(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#putxIfAbsent(Object, Object)} - * @return See {@link GridCacheProjection#putxIfAbsent(Object, Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#putxIfAbsent(Object, Object)}. - */ - public boolean setxIfAbsent(@Nullable V val) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#putxIfAbsentAsync(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#putxIfAbsentAsync(Object, Object)} - * @return See {@link GridCacheProjection#putxIfAbsentAsync(Object, Object)}. - */ - public IgniteFuture<Boolean> setxIfAbsentAsync(V val); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#replace(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#replace(Object, Object)} - * @return See {@link GridCacheProjection#replace(Object, Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#replace(Object, Object)}. - */ - @Nullable public V replace(V val) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#replaceAsync(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#replaceAsync(Object, Object)} - * @return See {@link GridCacheProjection#replaceAsync(Object, Object)}. - */ - public IgniteFuture<V> replaceAsync(V val); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#replacex(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#replacex(Object, Object)} - * @return See {@link GridCacheProjection#replacex(Object, Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#replacex(Object, Object)}. - */ - public boolean replacex(V val) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#replacexAsync(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#replacexAsync(Object, Object)} - * @return See {@link GridCacheProjection#replacexAsync(Object, Object)}. - */ - public IgniteFuture<Boolean> replacexAsync(V val); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#replace(Object, Object, Object)} method. - * - * @param oldVal See {@link GridCacheProjection#replace(Object, Object, Object)} - * @param newVal See {@link GridCacheProjection#replace(Object, Object, Object)} - * @return See {@link GridCacheProjection#replace(Object, Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#replace(Object, Object)}. - */ - public boolean replace(V oldVal, V newVal) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#replaceAsync(Object, Object, Object)} method. - * - * @param oldVal See {@link GridCacheProjection#replaceAsync(Object, Object, Object)} - * @param newVal See {@link GridCacheProjection#replaceAsync(Object, Object, Object)} - * @return See {@link GridCacheProjection#replaceAsync(Object, Object)}. - */ - public IgniteFuture<Boolean> replaceAsync(V oldVal, V newVal); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#remove(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param filter See {@link GridCacheProjection#remove(Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#remove(Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @throws IgniteCheckedException See {@link GridCacheProjection#remove(Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - @Nullable public V remove(@Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#removeAsync(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param filter See {@link GridCacheProjection#removeAsync(Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#removeAsync(Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - public IgniteFuture<V> removeAsync(@Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param filter See {@link GridCacheProjection#removex(Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#removex(Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @throws IgniteCheckedException See {@link GridCacheProjection#removex(Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - public boolean removex(@Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#removexAsync(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @param filter See {@link GridCacheProjection#removexAsync(Object, org.apache.ignite.lang.IgnitePredicate[])}. - * @return See {@link GridCacheProjection#removexAsync(Object, org.apache.ignite.lang.IgnitePredicate[])}. - */ - public IgniteFuture<Boolean> removexAsync(@Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#remove(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#remove(Object, Object)}. - * @return See {@link GridCacheProjection#remove(Object, Object)}. - * @throws IgniteCheckedException See {@link GridCacheProjection#remove(Object, Object)}. - */ - public boolean remove(V val) throws IgniteCheckedException; - - /** - * This method has the same semantic as - * {@link GridCacheProjection#removeAsync(Object, Object)} method. - * - * @param val See {@link GridCacheProjection#removeAsync(Object, Object)}. - * @return See {@link GridCacheProjection#removeAsync(Object, Object)}. - */ - public IgniteFuture<Boolean> removeAsync(V val); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#evict(Object)} method. - * - * @return See {@link GridCacheProjection#evict(Object)}. - */ - public boolean evict(); - - /** - * This method has the same semantic as - * {@link GridCacheProjection#clear(Object)} method. - * - * @return See {@link GridCacheProjection#clear(Object)}. - */ - public boolean clear(); - - /** - * Optimizes the size of this entry. If entry is expired at the time - * of the call then entry is removed locally. - * - * @throws IgniteCheckedException If failed to compact. - * @return {@code true} if entry was cleared from cache (if value was {@code null}). - */ - public boolean compact() throws IgniteCheckedException; - - /** - * Synchronously acquires lock on a cached object associated with this entry - * only if the passed in filter (if any) passes. This method together with - * filter check will be executed as one atomic operation. - * <h2 class="header">Transactions</h2> - * Locks are not transactional and should not be used from within transactions. - * If you do need explicit locking within transaction, then you should use - * {@link IgniteTxConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * <h2 class="header">Cache Flags</h2> - * This method is not available if any of the following flags are set on projection: - * {@link GridCacheFlag#LOCAL}, {@link GridCacheFlag#READ}. - * - * @param timeout Timeout in milliseconds to wait for lock to be acquired - * ({@code '0'} for no expiration). - * @param filter Optional filter to validate prior to acquiring the lock. - * @return {@code True} if all filters passed and lock was acquired, - * {@code false} otherwise. - * @throws IgniteCheckedException If lock acquisition resulted in error. - * @throws GridCacheFlagException If flags validation failed. - */ - public boolean lock(long timeout, @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) - throws IgniteCheckedException; - - /** - * Asynchronously acquires lock on a cached object associated with this entry - * only if the passed in filter (if any) passes. This method together with - * filter check will be executed as one atomic operation. - * <h2 class="header">Transactions</h2> - * Locks are not transactional and should not be used from within transactions. If you do - * need explicit locking within transaction, then you should use - * {@link IgniteTxConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * <h2 class="header">Cache Flags</h2> - * This method is not available if any of the following flags are set on projection: - * {@link GridCacheFlag#LOCAL}, {@link GridCacheFlag#READ}. - * - * @param timeout Timeout in milliseconds to wait for lock to be acquired - * ({@code '0'} for no expiration). - * @param filter Optional filter to validate prior to acquiring the lock. - * @return Future for the lock operation. The future will return {@code true} - * whenever all filters pass and locks are acquired before timeout is expired, - * {@code false} otherwise. - * @throws GridCacheFlagException If flags validation failed. - */ - public IgniteFuture<Boolean> lockAsync(long timeout, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter); - - /** - * Unlocks this entry only if current thread owns the lock. If optional filter - * will not pass, then unlock will not happen. If this entry was never locked by - * current thread, then this method will do nothing. - * <h2 class="header">Transactions</h2> - * Locks are not transactional and should not be used from within transactions. If you do - * need explicit locking within transaction, then you should use - * {@link IgniteTxConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * <h2 class="header">Cache Flags</h2> - * This method is not available if any of the following flags are set on projection: - * {@link GridCacheFlag#LOCAL}, {@link GridCacheFlag#READ}. - * - * @param filter Optional filter that needs to pass prior to unlock taking effect. - * @throws IgniteCheckedException If unlock execution resulted in error. - * @throws GridCacheFlagException If flags validation failed. - */ - public void unlock(IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; - - /** - * Checks whether entry is currently present in cache or not. If entry is not in - * cache (e.g. has been removed) {@code false} is returned. In this case all - * operations on this entry will cause creation of a new entry in cache. - * - * @return {@code True} if entry is in cache, {@code false} otherwise. - */ - public boolean isCached(); - - /** - * Gets size of serialized key and value in addition to any overhead added by {@code GridGain} itself. - * - * @return size in bytes. - * @throws IgniteCheckedException If failed to evaluate entry size. - */ - public int memorySize() throws IgniteCheckedException; - - /** - * Removes metadata by name. - * - * @param name Name of the metadata to remove. - * @param <V> Type of the value. - * @return Value of removed metadata or {@code null}. - */ - public <V> V removeMeta(String name); - - /** - * Removes metadata only if its current value is equal to {@code val} passed in. - * - * @param name Name of metadata attribute. - * @param val Value to compare. - * @param <V> Value type. - * @return {@code True} if value was removed, {@code false} otherwise. - */ - public <V> boolean removeMeta(String name, V val); - - /** - * Gets metadata by name. - * - * @param name Metadata name. - * @param <V> Type of the value. - * @return Metadata value or {@code null}. - */ - public <V> V meta(String name); - - /** - * Adds given metadata value only if it was absent. - * - * @param name Metadata name. - * @param c Factory closure to produce value to add if it's not attached already. - * Not that unlike {@link #addMeta(String, Object)} method the factory closure will - * not be called unless the value is required and therefore value will only be created - * when it is actually needed. - * @param <V> Type of the value. - * @return {@code null} if new value was put, or current value if put didn't happen. - */ - @Nullable public <V> V putMetaIfAbsent(String name, Callable<V> c); - - /** - * Adds given metadata value only if it was absent. - * - * @param name Metadata name. - * @param val Value to add if it's not attached already. - * @param <V> Type of the value. - * @return {@code null} if new value was put, or current value if put didn't happen. - */ - @Nullable public <V> V putMetaIfAbsent(String name, V val); - - /** - * Adds a new metadata. - * - * @param name Metadata name. - * @param val Metadata value. - * @param <V> Type of the value. - * @return Metadata previously associated with given name, or - * {@code null} if there was none. - */ - @Nullable public <V> V addMeta(String name, V val); - - /** - * Replaces given metadata with new {@code newVal} value only if its current value - * is equal to {@code curVal}. Otherwise, it is no-op. - * - * @param name Name of the metadata. - * @param curVal Current value to check. - * @param newVal New value. - * @return {@code true} if replacement occurred, {@code false} otherwise. - */ - public <V> boolean replaceMeta(String name, V curVal, V newVal); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlag.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlag.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlag.java deleted file mode 100644 index f8f9ca9..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlag.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache; - -import org.apache.ignite.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import javax.cache.processor.*; - -/** - * Cache projection flags that specify projection behaviour. This flags can be explicitly passed into - * the following methods on {@link GridCacheProjection}: - * <ul> - * <li>{@link GridCacheProjection#flagsOn(GridCacheFlag...)}</li> - * <li>{@link GridCacheProjection#flagsOff(GridCacheFlag...)}</li> - * </ul> - * Also, some flags, like {@link #LOCAL}, or {@link #READ} may be implicitly set whenever - * creating new projections and passing entries to predicate filters. - */ -public enum GridCacheFlag { - /** - * Only operations that don't require any communication with - * other cache nodes are allowed. This flag is automatically set - * on underlying projection for all the entries that are given to - * predicate filters to make sure that no distribution happens - * from inside of predicate evaluation. - */ - LOCAL, - - /** - * Only operations that don't change cached data are allowed. - * This flag is automatically set on underlying projection for - * all the entries that are given to predicate filters to make - * sure that data cannot be updated during predicate evaluation. - */ - READ, - - /** - * Clone values prior to returning them to user. - * <p> - * Whenever values are returned from cache, they cannot be directly updated - * as cache holds the same references internally. If it is needed to - * update values that are returned from cache, this flag will provide - * automatic cloning of values prior to returning so they can be directly - * updated. - * - * @see CacheConfiguration#getCloner() - */ - CLONE, - - /** Skips store, i.e. no read-through and no write-through behavior. */ - SKIP_STORE, - - /** Skip swap space for reads and writes. */ - SKIP_SWAP, - - /** Synchronous commit. */ - SYNC_COMMIT, - - /** - * Switches a cache projection to work in {@code 'invalidation'} mode. - * Instead of updating remote entries with new values, small invalidation - * messages will be sent to set the values to {@code null}. - * - * @see IgniteTx#isInvalidate() - * @see CacheConfiguration#isInvalidate() - */ - INVALIDATE, - - /** - * Skips version check during {@link IgniteCache#invoke(Object, EntryProcessor, Object[])} writes in - * {@link CacheAtomicityMode#ATOMIC} mode. By default, in {@code ATOMIC} mode, whenever - * {@code transform(...)} is called, cache values (and not the {@code transform} closure) are sent from primary - * node to backup nodes to ensure proper update ordering. - * <p> - * By setting this flag, version check is skipped, and the {@code transform} closure is applied on both, primary - * and backup nodes. Use this flag for better performance if you are sure that there are no - * concurrent updates happening for the same key when {@code transform(...)} method is called. - */ - FORCE_TRANSFORM_BACKUP; - - /** */ - private static final GridCacheFlag[] VALS = values(); - - /** - * Efficiently gets enumerated value from its ordinal. - * - * @param ord Ordinal value. - * @return Enumerated value or {@code null} if ordinal out of range. - */ - @Nullable public static GridCacheFlag fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlagException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlagException.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlagException.java deleted file mode 100644 index 4104029..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheFlagException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache; - -import org.apache.ignite.*; -import org.apache.ignite.internal.util.typedef.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Exception thrown when projection flags check fails. - */ -public class GridCacheFlagException extends IgniteException { - /** */ - private static final long serialVersionUID = 0L; - - /** Flags that caused this exception. */ - private Collection<GridCacheFlag> flags; - - /** - * @param flags Cause flags. - */ - public GridCacheFlagException(@Nullable GridCacheFlag... flags) { - this(F.asList(flags)); - } - - /** - * @param flags Cause flags. - */ - public GridCacheFlagException(@Nullable Collection<GridCacheFlag> flags) { - super(message(flags)); - - this.flags = flags; - } - - /** - * @return Cause flags. - */ - public Collection<GridCacheFlag> flags() { - return flags; - } - - /** - * @param flags Flags. - * @return String information about cause flags. - */ - private static String message(Collection<GridCacheFlag> flags) { - return "Cache projection flag violation (if flag is LOCAL, make sure to use peek(..) " + - "instead of get(..) methods)" + (F.isEmpty(flags) ? "." : " [flags=" + flags + ']'); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptor.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptor.java deleted file mode 100644 index 52e3acb..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptor.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache; - -import org.apache.ignite.cache.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -/** - * Cache interceptor. Cache interceptor can be used for getting callbacks before - * and after cache {@code get(...)}, {@code put(...)}, and {@code remove(...)} - * operations. The {@code onBefore} callbacks can also be used to change the values - * stored in cache or preventing entries from being removed from cache. - * <p> - * Cache interceptor is configured via {@link CacheConfiguration#getInterceptor()} - * configuration property. - * <p> - * Any grid resource from {@code org.apache.ignite.resources} package can be injected - * into implementation of this interface. - */ -public interface GridCacheInterceptor<K, V> { - /** - * This method is called within {@link GridCacheProjection#get(Object)} - * and similar operations to provide control over returned value. - * <p> - * If this method returns {@code null}, then {@code get()} operation - * results in {@code null} as well. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Value mapped to {@code key} at the moment of {@code get()} operation. - * @return The new value to be returned as result of {@code get()} operation. - * @see GridCacheProjection#get(Object) - */ - @Nullable public V onGet(K key, @Nullable V val); - - /** - * This method is called within {@link GridCacheProjection#put(Object, Object, IgnitePredicate[])} - * and similar operations before new value is stored in cache. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param oldVal Old value. - * @param newVal New value. - * @return Value to be put to cache. Returning {@code null} cancels the update. - * @see GridCacheProjection#put(Object, Object, IgnitePredicate[]) - */ - @Nullable public V onBeforePut(K key, @Nullable V oldVal, V newVal); - - /** - * This method is called after new value has been stored. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Current value. - */ - public void onAfterPut(K key, V val); - - /** - * This method is called within {@link GridCacheProjection#remove(Object, IgnitePredicate[])} - * and similar operations to provide control over returned value. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Old value. - * @return Tuple. The first value is the flag whether remove should be cancelled or not. - * The second is the value to be returned as result of {@code remove()} operation, - * may be {@code null}. - * @see GridCacheProjection#remove(Object, IgnitePredicate[]) - */ - @Nullable public IgniteBiTuple<Boolean, V> onBeforeRemove(K key, @Nullable V val); - - /** - * This method is called after value has been removed. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Removed value. - */ - public void onAfterRemove(K key, V val); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptorAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptorAdapter.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptorAdapter.java deleted file mode 100644 index 9794ae1..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheInterceptorAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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; - -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -/** - * Cache interceptor convenience adapter. It provides no-op implementations for all - * interceptor callbacks. - */ -public class GridCacheInterceptorAdapter<K, V> implements GridCacheInterceptor<K, V> { - /** {@inheritDoc} */ - @Nullable @Override public V onGet(K key, V val) { - return val; - } - - /** {@inheritDoc} */ - @Nullable @Override public V onBeforePut(K key, @Nullable V oldVal, V newVal) { - return newVal; - } - - /** {@inheritDoc} */ - @Override public void onAfterPut(K key, V val) { - // No-op. - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteBiTuple<Boolean, V> onBeforeRemove(K key, @Nullable V val) { - return new IgniteBiTuple<>(false, val); - } - - /** {@inheritDoc} */ - @Override public void onAfterRemove(K key, V val) { - // No-op. - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMBean.java deleted file mode 100644 index 3ee1d4b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMBean.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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; - -import org.apache.ignite.cache.CacheConfiguration; -import org.apache.ignite.mbean.*; - -/** - * This interface defines JMX view on {@link GridCache}. - */ -@IgniteMBeanDescription("MBean that provides access to cache descriptor.") -public interface GridCacheMBean { - /** - * Gets name of this cache. - * - * @return Cache name. - */ - @IgniteMBeanDescription("Cache name.") - public String name(); - - /** - * Gets metrics (statistics) for this cache. - * - * @return Cache metrics. - */ - @IgniteMBeanDescription("Formatted cache metrics.") - public String metricsFormatted(); - - /** - * Gets number of entries that was swapped to disk. - * - * @return Number of entries that was swapped to disk. - */ - @IgniteMBeanDescription("Number of entries that was swapped to disk.") - public long getOverflowSize(); - - /** - * Gets number of entries stored in off-heap memory. - * - * @return Number of entries stored in off-heap memory. - */ - @IgniteMBeanDescription("Number of entries stored in off-heap memory.") - public long getOffHeapEntriesCount(); - - /** - * Gets memory size allocated in off-heap. - * - * @return Memory size allocated in off-heap. - */ - @IgniteMBeanDescription("Memory size allocated in off-heap.") - public long getOffHeapAllocatedSize(); - - /** - * Returns number of non-{@code null} values in the cache. - * - * @return Number of non-{@code null} values in the cache. - */ - @IgniteMBeanDescription("Number of non-null values in the cache.") - public int getSize(); - - /** - * Gets number of keys in the cache, possibly with {@code null} values. - * - * @return Number of keys in the cache. - */ - @IgniteMBeanDescription("Number of keys in the cache (possibly with null values).") - public int getKeySize(); - - /** - * Returns {@code true} if this cache is empty. - * - * @return {@code true} if this cache is empty. - */ - @IgniteMBeanDescription("True if cache is empty.") - public boolean isEmpty(); - - /** - * Gets current size of evict queue used to batch up evictions. - * - * @return Current size of evict queue. - */ - @IgniteMBeanDescription("Current size of evict queue.") - public int getDhtEvictQueueCurrentSize(); - - /** - * Gets transaction per-thread map size. - * - * @return Thread map size. - */ - @IgniteMBeanDescription("Transaction per-thread map size.") - public int getTxThreadMapSize(); - - /** - * Gets transaction per-Xid map size. - * - * @return Transaction per-Xid map size. - */ - @IgniteMBeanDescription("Transaction per-Xid map size.") - public int getTxXidMapSize(); - - /** - * Gets committed transaction queue size. - * - * @return Committed transaction queue size. - */ - @IgniteMBeanDescription("Transaction committed queue size.") - public int getTxCommitQueueSize(); - - /** - * Gets prepared transaction queue size. - * - * @return Prepared transaction queue size. - */ - @IgniteMBeanDescription("Transaction prepared queue size.") - public int getTxPrepareQueueSize(); - - /** - * Gets start version counts map size. - * - * @return Start version counts map size. - */ - @IgniteMBeanDescription("Transaction start version counts map size.") - public int getTxStartVersionCountsSize(); - - /** - * Gets number of cached committed transaction IDs. - * - * @return Number of cached committed transaction IDs. - */ - @IgniteMBeanDescription("Transaction committed ID map size.") - public int getTxCommittedVersionsSize(); - - /** - * Gets number of cached rolled back transaction IDs. - * - * @return Number of cached rolled back transaction IDs. - */ - @IgniteMBeanDescription("Transaction rolled back ID map size.") - public int getTxRolledbackVersionsSize(); - - /** - * Gets transaction DHT per-thread map size. - * - * @return DHT thread map size. - */ - @IgniteMBeanDescription("Transaction DHT per-thread map size.") - public int getTxDhtThreadMapSize(); - - /** - * Gets transaction DHT per-Xid map size. - * - * @return Transaction DHT per-Xid map size. - */ - @IgniteMBeanDescription("Transaction DHT per-Xid map size.") - public int getTxDhtXidMapSize(); - - /** - * Gets committed DHT transaction queue size. - * - * @return Committed DHT transaction queue size. - */ - @IgniteMBeanDescription("Transaction DHT committed queue size.") - public int getTxDhtCommitQueueSize(); - - /** - * Gets prepared DHT transaction queue size. - * - * @return Prepared DHT transaction queue size. - */ - @IgniteMBeanDescription("Transaction DHT prepared queue size.") - public int getTxDhtPrepareQueueSize(); - - /** - * Gets DHT start version counts map size. - * - * @return DHT start version counts map size. - */ - @IgniteMBeanDescription("Transaction DHT start version counts map size.") - public int getTxDhtStartVersionCountsSize(); - - /** - * Gets number of cached committed DHT transaction IDs. - * - * @return Number of cached committed DHT transaction IDs. - */ - @IgniteMBeanDescription("Transaction DHT committed ID map size.") - public int getTxDhtCommittedVersionsSize(); - - /** - * Gets number of cached rolled back DHT transaction IDs. - * - * @return Number of cached rolled back DHT transaction IDs. - */ - @IgniteMBeanDescription("Transaction DHT rolled back ID map size.") - public int getTxDhtRolledbackVersionsSize(); - - /** - * Returns {@code True} if write-behind is enabled. - * - * @return {@code True} if write-behind is enabled. - */ - @IgniteMBeanDescription("True if write-behind is enabled for this cache.") - public boolean isWriteBehindEnabled(); - - /** - * Gets the maximum size of the write-behind buffer. When the count of unique keys - * in write buffer exceeds this value, the buffer is scheduled for write to the underlying store. - * <p/> - * If this value is {@code 0}, then flush is performed only on time-elapsing basis. However, - * when this value is {@code 0}, the cache critical size is set to - * {@link CacheConfiguration#DFLT_WRITE_BEHIND_CRITICAL_SIZE} - * - * @return Buffer size that triggers flush procedure. - */ - @IgniteMBeanDescription("Size of internal buffer that triggers flush procedure.") - public int getWriteBehindFlushSize(); - - /** - * Gets the number of flush threads that will perform store update operations. - * - * @return Count of worker threads. - */ - @IgniteMBeanDescription("Count of flush threads.") - public int getWriteBehindFlushThreadCount(); - - /** - * Gets the cache flush frequency. All pending operations on the underlying store will be performed - * within time interval not less then this value. - * <p/> - * If this value is {@code 0}, then flush is performed only when buffer size exceeds flush size. - * - * @return Flush frequency in milliseconds. - */ - @IgniteMBeanDescription("Flush frequency interval in milliseconds.") - public long getWriteBehindFlushFrequency(); - - /** - * Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch. - * - * @return Maximum size of batch. - */ - @IgniteMBeanDescription("Maximum size of batch for similar operations.") - public int getWriteBehindStoreBatchSize(); - - /** - * Gets count of write buffer overflow events since initialization. Each overflow event causes - * the ongoing flush operation to be performed synchronously. - * - * @return Count of cache overflow events since start. - */ - @IgniteMBeanDescription("Count of cache overflow events since write-behind cache has started.") - public int getWriteBehindTotalCriticalOverflowCount(); - - /** - * Gets count of write buffer overflow events in progress at the moment. Each overflow event causes - * the ongoing flush operation to be performed synchronously. - * - * @return Count of cache overflow events since start. - */ - @IgniteMBeanDescription("Count of cache overflow events since write-behind cache has started.") - public int getWriteBehindCriticalOverflowCount(); - - /** - * Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state - * when underlying store failed due some reason and cache has enough space to retain this entry till - * the next try. - * - * @return Count of entries in store-retry state. - */ - @IgniteMBeanDescription("Count of cache cache entries that are currently in retry state.") - public int getWriteBehindErrorRetryCount(); - - /** - * Gets count of entries that were processed by the write-behind store and have not been - * flushed to the underlying store yet. - * - * @return Total count of entries in cache store internal buffer. - */ - @IgniteMBeanDescription("Count of cache entries that are waiting to be flushed.") - public int getWriteBehindBufferSize(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMemoryMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMemoryMode.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMemoryMode.java deleted file mode 100644 index b5d6371..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMemoryMode.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache; - -/** - * Defines set of memory modes. Memory modes help control whether cache entries are - * stored on heap memory, offheap memory, or in swap space. - */ -public enum GridCacheMemoryMode { - /** - * Entries will be stored on-heap first. The onheap tiered storage works as follows: - * <nl> - * <li>Entries are cached on heap memory first.</li> - * <li> - * If offheap memory is enabled and eviction policy evicts an entry from heap memory, entry will - * be moved to offheap memory. If offheap memory is disabled, then entry is simply discarded. - * </li> - * <li> - * If swap space is enabled and offheap memory fills up, then entry will be evicted into swap space. - * If swap space is disabled, then entry will be discarded. If swap is enabled and offheap memory - * is disabled, then entry will be evicted directly from heap memory into swap. - * </li> - * </nl> - * <p> - * <b>Note</b> that heap memory evictions are handled by configured {@link org.apache.ignite.cache.eviction.GridCacheEvictionPolicy} - * implementation. By default, no eviction policy is enabled, so entries never leave heap - * memory space unless explicitly removed. - */ - ONHEAP_TIERED, - - /** - * Works the same as {@link #ONHEAP_TIERED}, except that entries never end up in heap memory and get - * stored in offheap memory right away. Entries get cached in offheap memory first and then - * get evicted to swap, if one is configured. - */ - OFFHEAP_TIERED, - - /** - * Entry keys will be stored on heap memory, and values will be stored in offheap memory. Note - * that in this mode entries can be evicted only to swap. The evictions will happen according - * to configured {@link org.apache.ignite.cache.eviction.GridCacheEvictionPolicy}. - */ - OFFHEAP_VALUES, -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMetrics.java deleted file mode 100644 index 8a3235c..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheMetrics.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache; - -import java.io.*; - -/** - * Cache metrics used to obtain statistics on cache itself. - * Use {@link GridCache#metrics()} to obtain metrics for a cache. - */ -public interface GridCacheMetrics extends Serializable { - /** - * Gets create time of the owning entity (either cache or entry). - * - * @return Create time. - */ - public long createTime(); - - /** - * Gets last write time of the owning entity (either cache or entry). - * - * @return Last write time. - */ - public long writeTime(); - - /** - * Gets last read time of the owning entity (either cache or entry). - * - * @return Last read time. - */ - public long readTime(); - - /** - * Gets last time transaction was committed. - * - * @return Last commit time. - */ - public long commitTime(); - - /** - * Gets last time transaction was rollback. - * - * @return Last rollback time. - */ - public long rollbackTime(); - - /** - * Gets total number of reads of the owning entity (either cache or entry). - * - * @return Total number of reads. - */ - public int reads(); - - /** - * Gets total number of writes of the owning entity (either cache or entry). - * - * @return Total number of writes. - */ - public int writes(); - - /** - * Gets total number of hits for the owning entity (either cache or entry). - * - * @return Number of hits. - */ - public int hits(); - - /** - * Gets total number of misses for the owning entity (either cache or entry). - * - * @return Number of misses. - */ - public int misses(); - - /** - * Gets total number of transaction commits. - * - * @return Number of transaction commits. - */ - public int txCommits(); - - /** - * Gets total number of transaction rollbacks. - * - * @return Number of transaction rollbacks. - */ - public int txRollbacks(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCacheName.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheName.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCacheName.java deleted file mode 100644 index 367f4b9..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCacheName.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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; - -import java.lang.annotation.*; -import java.util.concurrent.*; - -/** - * Allows to specify cache name from grid computations. It is used to provide cache name - * for affinity routing of grid computations, such as {@link org.apache.ignite.compute.ComputeJob}, {@link Runnable}, - * {@link Callable}, or {@link org.apache.ignite.lang.IgniteClosure}. It should be used only in conjunction with - * {@link org.apache.ignite.cache.affinity.GridCacheAffinityKeyMapped @GridCacheAffinityKeyMapped} annotation, and should be attached to a method or field - * that provides cache name for the computation. Only one annotation per class - * is allowed. In the absence of this annotation, the default no-name cache - * will be used for providing key-to-node affinity. - * <p> - * Refer to {@link org.apache.ignite.cache.affinity.GridCacheAffinityKeyMapped @GridCacheAffinityKeyMapped} documentation for more information - * and examples about this annotation. - * @see org.apache.ignite.cache.affinity.GridCacheAffinityKeyMapped - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.METHOD}) -public @interface GridCacheName { - // No-op. -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCachePeekMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCachePeekMode.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCachePeekMode.java index a5d63e2..e08d091 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCachePeekMode.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/GridCachePeekMode.java @@ -23,9 +23,9 @@ import java.util.*; /** * Enumeration of all supported cache peek modes. Peek modes can be passed into various - * {@code 'GridCacheProjection.peek(..)'} and {@code GridCacheEntry.peek(..)} methods, - * such as {@link GridCacheProjection#peek(Object, Collection)}, - * {@link GridCacheEntry#peek()}, and others. + * {@code 'CacheProjection.peek(..)'} and {@code CacheEntry.peek(..)} methods, + * such as {@link CacheProjection#peek(Object, Collection)}, + * {@link CacheEntry#peek()}, and others. * <p> * The following modes are supported: * <ul> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/GridCachePreloadMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCachePreloadMode.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCachePreloadMode.java deleted file mode 100644 index 11aea17..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCachePreloadMode.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache; - -import org.jetbrains.annotations.*; - -/** - * Cache preload mode. When preloading is enabled (i.e. has value other than {@link #NONE}), distributed caches - * will attempt to preload all necessary values from other grid nodes. This enumeration is used to configure - * preloading via {@link CacheConfiguration#getPreloadMode()} configuration property. If not configured - * explicitly, then {@link CacheConfiguration#DFLT_PRELOAD_MODE} is used. - * <p> - * Replicated caches will try to load the full set of cache entries from other nodes (or as defined by - * pluggable {@link org.apache.ignite.cache.affinity.GridCacheAffinityFunction}), while partitioned caches will only load the entries for which - * current node is primary or back up. - * <p> - * Note that preload mode only makes sense for {@link CacheMode#REPLICATED} and {@link CacheMode#PARTITIONED} - * caches. Caches with {@link CacheMode#LOCAL} mode are local by definition and therefore cannot preload - * any values from neighboring nodes. - */ -public enum GridCachePreloadMode { - /** - * Synchronous preload mode. Distributed caches will not start until all necessary data - * is loaded from other available grid nodes. - */ - SYNC, - - /** - * Asynchronous preload mode. Distributed caches will start immediately and will load all necessary - * data from other available grid nodes in the background. - */ - ASYNC, - - /** - * In this mode no preloading will take place which means that caches will be either loaded on - * demand from persistent store whenever data is accessed, or will be populated explicitly. - */ - NONE; - - /** Enumerated values. */ - private static final GridCachePreloadMode[] VALS = values(); - - /** - * Efficiently gets enumerated value from its ordinal. - * - * @param ord Ordinal value. - * @return Enumerated value or {@code null} if ordinal out of range. - */ - @Nullable public static GridCachePreloadMode fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -}