Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 401F117658 for ; Mon, 20 Apr 2015 11:49:08 +0000 (UTC) Received: (qmail 70449 invoked by uid 500); 20 Apr 2015 11:49:05 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 70414 invoked by uid 500); 20 Apr 2015 11:49:05 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 70401 invoked by uid 99); 20 Apr 2015 11:49:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Apr 2015 11:49:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of root@apache.org designates 54.164.171.186 as permitted sender) Received: from [54.164.171.186] (HELO mx1-us-east.apache.org) (54.164.171.186) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Apr 2015 11:48:58 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 7B73843EC4 for ; Mon, 20 Apr 2015 11:48:13 +0000 (UTC) Received: (qmail 67777 invoked by uid 99); 20 Apr 2015 11:48:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Apr 2015 11:48:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C00E8E07A7; Mon, 20 Apr 2015 11:48:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Mon, 20 Apr 2015 11:48:17 -0000 Message-Id: <0d0d69ce4c9e43f4a6d29025e852698b@git.apache.org> In-Reply-To: <5de91c9130ca42bb80d3237233377376@git.apache.org> References: <5de91c9130ca42bb80d3237233377376@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/50] [abbrv] incubator-ignite git commit: #ignite-758: rename InternalCache to IgniteInternalCache. X-Virus-Checked: Checked by ClamAV on apache.org http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/228736f5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/InternalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/InternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/InternalCache.java deleted file mode 100644 index ffd7179..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/InternalCache.java +++ /dev/null @@ -1,1860 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.cache.store.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.dr.*; -import org.apache.ignite.internal.processors.cache.query.*; -import org.apache.ignite.internal.processors.cache.transactions.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.mxbean.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import javax.cache.*; -import javax.cache.expiry.*; -import javax.cache.processor.*; -import java.sql.*; -import java.util.*; -import java.util.Date; - -/** - * This interface provides a rich API for working with distributed caches. It includes the following - * main functionality: - *
    - *
  • - * 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. - *
  • - *
  • - * Various {@code 'put(..)'}, {@code 'putIfAbsent(..)'}, 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. - *
  • - *
  • - * 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. - *
  • - *
  • - * Various {@code 'contains(..)'} method to check if cache contains certain keys or values locally. - *
  • - *
  • - * Various {@code 'forEach(..)'}, {@code 'forAny(..)'}, and {@code 'reduce(..)'} methods to visit - * every local cache entry within this projection. - *
  • - *
  • - * Various {@code flagsOn(..)'}, {@code 'flagsOff(..)'}, and {@code 'projection(..)'} methods to - * set specific flags and filters on a cache projection. - *
  • - *
  • - * Methods like {@code 'keySet(..)'}, {@code 'values(..)'}, and {@code 'entrySet(..)'} to provide - * views on cache keys, values, and entries. - *
  • - *
  • - * Various {@code 'peek(..)'} methods to peek at values in global or transactional memory, swap - * storage, or persistent storage. - *
  • - *
  • - * Various {@code 'reload(..)'} methods to reload latest values from persistent storage. - *
  • - *
  • - * Various {@code 'promote(..)'} methods to load specified keys from swap storage into - * global cache memory. - *
  • - *
  • - * Various {@code 'lock(..)'}, {@code 'unlock(..)'}, and {@code 'isLocked(..)'} methods to acquire, release, - * and 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. - *
  • - *
  • - * Various {@code 'clear(..)'} methods to clear elements from cache, and optionally from - * swap storage. All {@code 'clear(..)'} methods are not transactional and will not enlist cleared - * keys into ongoing transaction, if any. - *
  • - *
  • - * Various {@code 'evict(..)'} methods 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. - *
  • - *
  • - * Various {@code 'txStart(..)'} methods to perform various cache - * operations within a transaction (see {@link Transaction} for more information). - *
  • - *
  • - * Various {@code 'gridProjection(..)'} methods which provide {@link org.apache.ignite.cluster.ClusterGroup} only - * for nodes on which given keys reside. All {@code 'gridProjection(..)'} methods are not - * transactional and will not enlist keys into ongoing transaction. - *
  • - *
  • - *
- *

Extended Put And Remove Methods

- * 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. - *

Predicate Filters

- * All filters passed into methods on this API are checked atomically. In other words the - * value returned by the methods is guaranteed to be consistent with the filters passed in. Note - * that filters are optional, and if not passed in, then methods will still work as is without - * filter validation. - *

Transactions

- * 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, - * if any. Other methods like {@code 'peek(..)'} or various {@code 'contains(..)'} methods may - * be transaction-aware, i.e. check in-transaction entries first, but will not affect the current - * state of transaction. See {@link Transaction} documentation for more information - * about transactions. - *

Group Locking

- * Group Locking is a feature where instead of acquiring individual locks, Ignite will lock - * multiple keys with one lock to save on locking overhead. There are 2 types of Group Locking: - * affinity-based, and partitioned-based. - *

- * With {@code affinity-based-group-locking} the keys are grouped by affinity-key. This means that - * only keys with identical affinity-key (see {@link AffinityKeyMapped}) can participate in the - * transaction, and only one lock on the affinity-key will be acquired for the whole transaction. - * {@code Affinity-group-locked} transactions are started via - * txStartAffinity(Object, TransactionConcurrency, TransactionIsolation, long, int) method. - *

- * With {@code partition-based-group-locking} the keys are grouped by partition ID. This means that - * only keys belonging to identical partition (see {@link Affinity#partition(Object)}) can participate in the - * transaction, and only one lock on the whole partition will be acquired for the whole transaction. - * {@code Partition-group-locked} transactions are started via - * txStartPartition(int, TransactionConcurrency, TransactionIsolation, long, int) method. - *

- * Group locking should always be used for transactions whenever possible. If your requirements fit either - * affinity-based or partition-based scenarios outlined above then group-locking - * can significantly improve performance of your application, often by an order of magnitude. - *

Null Keys or Values

- * Neither {@code null} keys or values are allowed to be stored in cache. If a {@code null} value - * happens to be in cache (e.g. after invalidation or remove), then cache will treat this case - * as there is no value at all. - *

Peer Class Loading

- * If peer-class-loading is enabled, all classes passed into cache API will be automatically deployed - * to any participating grid nodes. However, in case of redeployment, caches will be cleared and - * all entries will be removed. This behavior is useful during development, but should not be - * used in production. - *

Portable Objects

- * If an object is defined as portable Ignite cache will automatically store it in portable (i.e. binary) - * format. User can choose to work either with the portable format or with the deserialized form (assuming - * that class definitions are present in the classpath). By default, cache works with deserialized form - * (example shows the case when {@link Integer} is used as a key for a portable object): - *
- * InternalCache prj = Ignition.grid().cache(null);
- *
- * // Value will be serialized and stored in cache in portable format.
- * prj.put(1, new Value());
- *
- * // Value will be deserialized since it's stored in portable format.
- * Value val = prj.get(1);
- * 
- * You won't be able to work with deserialized form if class definition for the {@code Value} is not on - * classpath. Even if you have the class definition, you should always avoid full deserialization if it's not - * needed for performance reasons. To work with portable format directly you should create special projection - * using {@link #keepPortable()} method: - *
- * InternalCache prj = Ignition.grid().cache(null).keepPortable();
- *
- * // Value is not deserialized and returned in portable format.
- * GridPortableObject po = prj.get(1);
- * 
- * See {@link #keepPortable()} method JavaDoc for more details. - */ -public interface InternalCache extends Iterable> { - /** - * Gets name of this cache ({@code null} for default cache). - * - * @return Cache name. - */ - public String name(); - - /** - * Gets base cache for this projection. - * - * @param Cache key type. - * @param Cache value type. - * @return Base cache for this projection. - */ - @SuppressWarnings({"ClassReferencesSubclass"}) - public InternalCache cache(); - - /** - * @return Skip store. - */ - public boolean skipStore(); - - /** - * Set keep portable flag for queries. - */ - public void setQueryKeepPortable(); - - /** - * Returns queries facade responsible for creating various SQL, TEXT, or SCAN queries. - - * @return Queries facade responsible for creating various SQL, TEXT, or SCAN queries. - */ - public CacheQueries queries(); - - /** - * @param skipStore Skip store flag. - * @return New projection based on this one, but with skip store flag enabled. - */ - public GridCacheProxyImpl setSkipStore(boolean skipStore); - - /** - * Creates projection that will operate with portable objects. - *

- * Projection returned by this method will force cache not to deserialize portable objects, - * so keys and values will be returned from cache API methods without changes. Therefore, - * signature of the projection can contain only following types: - *

    - *
  • org.gridgain.grid.portables.PortableObject for portable classes
  • - *
  • All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)
  • - *
  • Arrays of primitives (byte[], int[], ...)
  • - *
  • {@link String} and array of {@link String}s
  • - *
  • {@link UUID} and array of {@link UUID}s
  • - *
  • {@link Date} and array of {@link Date}s
  • - *
  • {@link Timestamp} and array of {@link Timestamp}s
  • - *
  • Enums and array of enums
  • - *
  • - * Maps, collections and array of objects (but objects inside - * them will still be converted if they are portable) - *
  • - *
- *

- * For example, if you use {@link Integer} as a key and {@code Value} class as a value - * (which will be stored in portable format), you should acquire following projection - * to avoid deserialization: - *

-     * InternalCache prj = cache.keepPortable();
-     *
-     * // Value is not deserialized and returned in portable format.
-     * GridPortableObject po = prj.get(1);
-     * 
- *

- * Note that this method makes sense only if cache is working in portable mode - * (org.apache.ignite.configuration.CacheConfiguration#isPortableEnabled() returns {@code true}. If not, - * this method is no-op and will return current projection. - * - * @return Projection for portable objects. - */ - public GridCacheProxyImpl keepPortable(); - - /** - * Returns {@code true} if this map contains no key-value mappings. - * - * @return {@code true} if this map contains no key-value mappings. - */ - public boolean isEmpty(); - - /** - * @param key Key. - * @return {@code True} if cache contains mapping for a given key. - */ - public boolean containsKey(K key); - - /** - * @param key Key. - * @return Future. - */ - public IgniteInternalFuture containsKeyAsync(K key); - - /** - * @param keys Keys, - * @return {@code True} if cache contains all keys. - */ - public boolean containsKeys(Collection keys); - - /** - * @param keys Keys to check. - * @return Future. - */ - public IgniteInternalFuture containsKeysAsync(Collection keys); - - /** - * @param key Key. - * @param peekModes Peek modes. - * @param plc Expiry policy if TTL should be updated. - * @return Value. - * @throws IgniteCheckedException If failed. - */ - @Nullable public V localPeek(K key, CachePeekMode[] peekModes, @Nullable IgniteCacheExpiryPolicy plc) - throws IgniteCheckedException; - - /** - * @param peekModes Peek modes. - * @return Entries iterable. - * @throws IgniteCheckedException If failed. - */ - public Iterable> localEntries(CachePeekMode[] peekModes) throws IgniteCheckedException; - - /** - * Retrieves value mapped to the specified key from cache. Value will only be returned if - * its entry passed the optional filter provided. Filter check is atomic, and therefore the - * returned value is guaranteed to be consistent with the filter. The return value of {@code null} - * means entry did not pass the provided filter or cache has no mapping for the - * key. - *

- * If the value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disable, and if read-through is allowed, value - * will be loaded from {@link CacheStore} persistent storage via - * CacheStore#load(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to retrieve the value for. - * @return Value for the given key. - * @throws IgniteCheckedException If get operation failed. - * @throws NullPointerException if the key is {@code null}. - */ - @Nullable public V get(K key) throws IgniteCheckedException; - - /** - * @param key Key. - * @param deserializePortable Deserialize portable flag. - * @return Cached value. - * @throws IgniteCheckedException If failed. - */ - @Nullable public V get(K key, boolean deserializePortable) throws IgniteCheckedException ; - - /** - * Asynchronously retrieves value mapped to the specified key from cache. Value will only be returned if - * its entry passed the optional filter provided. Filter check is atomic, and therefore the - * returned value is guaranteed to be consistent with the filter. The return value of {@code null} - * means entry did not pass the provided filter or cache has no mapping for the - * key. - *

- * If the value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from {@link CacheStore} persistent storage via - * CacheStore#load(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key for the value to get. - * @return Future for the get operation. - * @throws NullPointerException if the key is {@code null}. - */ - public IgniteInternalFuture getAsync(K key); - - /** - * @param key Key. - * @param deserializePortable Deserialize portable flag. - * @return Read operation future. - */ - public IgniteInternalFuture getAsync(final K key, boolean deserializePortable); - - /** - * Retrieves values mapped to the specified keys from cache. Value will only be returned if - * its entry passed the optional filter provided. Filter check is atomic, and therefore the - * returned value is guaranteed to be consistent with the filter. If requested key-value pair - * is not present in the returned map, then it means that its entry did not pass the provided - * filter or cache has no mapping for the key. - *

- * If some value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from {@link CacheStore} persistent storage via - * CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param keys Keys to get. - * @return Map of key-value pairs. - * @throws IgniteCheckedException If get operation failed. - */ - public Map getAll(@Nullable Collection keys) throws IgniteCheckedException; - - /** - * @param keys Keys. - * @param deserializePortable Deserialize portable flag. - * @return Map of cached values. - * @throws IgniteCheckedException If read failed. - */ - public Map getAll(Collection keys, boolean deserializePortable) throws IgniteCheckedException; - - /** - * Asynchronously retrieves values mapped to the specified keys from cache. Value will only be returned if - * its entry passed the optional filter provided. Filter check is atomic, and therefore the - * returned value is guaranteed to be consistent with the filter. If requested key-value pair - * is not present in the returned map, then it means that its entry did not pass the provided - * filter or cache has no mapping for the key. - *

- * If some value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from {@link CacheStore} persistent storage via - * CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param keys Key for the value to get. - * @return Future for the get operation. - */ - public IgniteInternalFuture> getAllAsync(@Nullable Collection keys); - - /** - * @param keys Keys. - * @param deserializePortable Deserialize portable flag. - * @return Read future. - */ - public IgniteInternalFuture> getAllAsync(@Nullable Collection keys, - boolean deserializePortable); - - /** - * Stores given key-value pair in cache. If filters are provided, then entries will - * be stored in cache only if they pass the filter. Note that filter check is atomic, - * so value stored in cache is guaranteed to be consistent with the filters. If cache - * previously contained value for the given key, then this value is returned. - * In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches, - * the value will be loaded from the primary node, which in its turn may load the value - * from the swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) should - * always be used instead of this one to avoid the overhead associated with returning of the previous value. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Previous value associated with specified key, or {@code null} - * if entry did not pass the filter, or if there was no mapping for the key in swap - * or in persistent storage. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If put operation failed. - */ - @Nullable public V getAndPut(K key, V val) - throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache. If filters are provided, then entries will - * be stored in cache only if they pass the filter. Note that filter check is atomic, - * so value stored in cache is guaranteed to be consistent with the filters. If cache - * previously contained value for the given key, then this value is returned. Otherwise, - * in case of {@link CacheMode#REPLICATED} caches, the value will be loaded from swap - * and, if it's not there, and read-through is allowed, from the underlying - * {@link CacheStore} storage. In case of {@link CacheMode#PARTITIONED} caches, - * the value will be loaded from the primary node, which in its turn may load the value - * from the swap storage, and consecutively, if it's not in swap and read-through is allowed, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) should - * always be used instead of this one to avoid the overhead associated with returning of the previous value. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Future for the put operation. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture getAndPutAsync(K key, V val); - - /** - * Stores given key-value pair in cache. If filters are provided, then entries will - * be stored in cache only if they pass the filter. Note that filter check is atomic, - * so value stored in cache is guaranteed to be consistent with the filters. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - * Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous - * value and, therefore, does not have any overhead associated with returning a value. It - * should be used whenever return value is not required. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return {@code True} if optional filter passed and value was stored in cache, - * {@code false} otherwise. Note that this method will return {@code true} if filter is not - * specified. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If put operation failed. - */ - public boolean put(K key, V val) - throws IgniteCheckedException; - - /** - * Stores given key-value pair in cache. If filters are provided, then entries will - * be stored in cache only if they pass the filter. Note that filter check is atomic, - * so value stored in cache is guaranteed to be consistent with the filters. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - * Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous - * value and, therefore, does not have any overhead associated with returning of a value. It - * should always be used whenever return value is not required. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Future for the put operation. Future will return {@code true} if optional filter - * passed and value was stored in cache, {@code false} otherwise. Note that future will - * return {@code true} if filter is not specified. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture putAsync(K key, V val); - - /** - * Stores given key-value pair in cache only if cache had no previous mapping for it. If cache - * previously contained value for the given key, then this value is returned. - * In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches, - * the value will be loaded from the primary node, which in its turn may load the value - * from the swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method {@link #putIfAbsent(Object, Object)} should - * always be used instead of this one to avoid the overhead associated with returning of the - * previous value. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Previously contained value regardless of whether put happened or not. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If put operation failed. - */ - @Nullable public V getAndPutIfAbsent(K key, V val) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it. If cache - * previously contained value for the given key, then this value is returned. In case of - * {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches, - * the value will be loaded from the primary node, which in its turn may load the value - * from the swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method {@link #putIfAbsentAsync(Object, Object)} should - * always be used instead of this one to avoid the overhead associated with returning of the - * previous value. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Future of put operation which will provide previously contained value - * regardless of whether put happened or not. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture getAndPutIfAbsentAsync(K key, V val); - - /** - * Stores given key-value pair in cache only if cache had no previous mapping for it. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - * Unlike {@link #getAndPutIfAbsent(Object, Object)} method, it does not return previous - * value and, therefore, does not have any overhead associated with returning of a value. It - * should always be used whenever return value is not required. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return {@code true} if value is stored in cache and {@code false} otherwise. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If put operation failed. - */ - public boolean putIfAbsent(K key, V val) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - * Unlike {@link #getAndPutIfAbsent(Object, Object)} method, it does not return previous - * value and, therefore, does not have any overhead associated with returning of a value. It - * should always be used whenever return value is not required. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Future for this put operation. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture putIfAbsentAsync(K key, V val); - - /** - * Stores given key-value pair in cache only if there is a previous mapping for it. - * In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches, - * the value will be loaded from the primary node, which in its turn may load the value - * from the swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method {@link #replace(Object, Object)} should - * always be used instead of this one to avoid the overhead associated with returning of the - * previous value. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Previously contained value regardless of whether replace happened or not. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If replace operation failed. - */ - @Nullable public V getAndReplace(K key, V val) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache only if there is a previous mapping for it. If cache - * previously contained value for the given key, then this value is returned.In case of - * {@link CacheMode#PARTITIONED} caches, the value will be loaded from the primary node, - * which in its turn may load the value from the swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method {@link #replace(Object, Object)} should - * always be used instead of this one to avoid the overhead associated with returning of the - * previous value. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Future for replace operation. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture getAndReplaceAsync(K key, V val); - - /** - * Stores given key-value pair in cache only if only if there is a previous mapping for it. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - * Unlike {@link #getAndReplace(Object, Object)} method, it does not return previous - * value and, therefore, does not have any overhead associated with returning of a value. It - * should always be used whenever return value is not required. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return {@code True} if replace happened, {@code false} otherwise. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If replace operation failed. - */ - public boolean replace(K key, V val) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - * Unlike {@link #getAndReplaceAsync(Object, Object)} method, it does not return previous - * value and, therefore, does not have any overhead associated with returning of a value. It - * should always be used whenever return value is not required. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Future for the replace operation. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture replaceAsync(K key, V val); - - /** - * Stores given key-value pair in cache only if only if the previous value is equal to the - * {@code 'oldVal'} passed in. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param oldVal Old value to match. - * @param newVal Value to be associated with the given key. - * @return {@code True} if replace happened, {@code false} otherwise. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If replace operation failed. - */ - public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the - * {@code 'oldVal'} passed in. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via CacheStore#put(Transaction, Object, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param oldVal Old value to match. - * @param newVal Value to be associated with the given key. - * @return Future for the replace operation. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal); - - /** - * Stores given key-value pairs in cache. If filters are provided, then entries will - * be stored in cache only if they pass the filter. Note that filter check is atomic, - * so value stored in cache is guaranteed to be consistent with the filters. - *

- * If write-through is enabled, the stored values will be persisted to {@link CacheStore} - * via CacheStore#putAll(Transaction, Map) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param m Key-value pairs to store in cache. - * @throws IgniteCheckedException If put operation failed. - */ - public void putAll(@Nullable Map m) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pairs in cache. If filters are provided, then entries will - * be stored in cache only if they pass the filter. Note that filter check is atomic, - * so value stored in cache is guaranteed to be consistent with the filters. - *

- * If write-through is enabled, the stored values will be persisted to {@link CacheStore} - * via CacheStore#putAll(Transaction, Map) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param m Key-value pairs to store in cache. - * @return Future for putAll operation. - */ - public IgniteInternalFuture putAllAsync(@Nullable Map m); - - /** - * Set of keys cached on this node. You can remove elements from this set, but you cannot add elements - * to this set. All removal operation will be reflected on the cache itself. - *

- * Iterator over this set will not fail if set was concurrently updated - * by another thread. This means that iterator may or may not return latest - * keys depending on whether they were added before or after current - * iterator position. - *

- * NOTE: this operation is not distributed and returns only the keys cached on this node. - * - * @return Key set for this cache projection. - */ - public Set keySet(); - - /** - * Set of keys for which this node is primary. - * This set is dynamic and may change with grid topology changes. - * Note that this set will contain mappings for all keys, even if their values are - * {@code null} because they were invalidated. You can remove elements from - * this set, but you cannot add elements to this set. All removal operation will be - * reflected on the cache itself. - *

- * Iterator over this set will not fail if set was concurrently updated - * by another thread. This means that iterator may or may not return latest - * keys depending on whether they were added before or after current - * iterator position. - *

- * NOTE: this operation is not distributed and returns only the keys cached on this node. - * - * @return Primary key set for the current node. - */ - public Set primaryKeySet(); - - /** - * Collection of values cached on this node. You can remove - * elements from this collection, but you cannot add elements to this collection. - * All removal operation will be reflected on the cache itself. - *

- * Iterator over this collection will not fail if collection was - * concurrently updated by another thread. This means that iterator may or - * may not return latest values depending on whether they were added before - * or after current iterator position. - *

- * NOTE: this operation is not distributed and returns only the values cached on this node. - * - * @return Collection of cached values. - */ - public Collection values(); - - /** - * Gets set of all entries cached on this node. You can remove - * elements from this set, but you cannot add elements to this set. - * All removal operation will be reflected on the cache itself. - *

- * NOTE: this operation is not distributed and returns only the entries cached on this node. - * - * @return Entries that pass through key filter. - */ - public Set> entrySet(); - - /** - * Gets set containing cache entries that belong to provided partition or {@code null} - * if partition is not found locally. - *

- * NOTE: this operation is not distributed and returns only the entries cached on this node. - * - * @param part Partition. - * @return Set containing partition's entries or {@code null} if partition is - * not found locally. - */ - @Nullable public Set> entrySet(int part); - - /** - * Starts new transaction with the specified concurrency and isolation. - * - * @param concurrency Concurrency. - * @param isolation Isolation. - * @return New transaction. - * @throws IllegalStateException If transaction is already started by this thread. - * @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}. - */ - public Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation); - - /** - * @param concurrency Concurrency. - * @param isolation Isolation. - * @return New transaction. - */ - public IgniteInternalTx txStartEx(TransactionConcurrency concurrency, TransactionIsolation isolation); - - /** - * Starts transaction with specified isolation, concurrency, timeout, invalidation flag, - * and number of participating entries. - * - * @param concurrency Concurrency. - * @param isolation Isolation. - * @param timeout Timeout. - * @param txSize Number of entries participating in transaction (may be approximate). - * @return New transaction. - * @throws IllegalStateException If transaction is already started by this thread. - * @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}. - */ - public Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, - int txSize); - - /** - * Gets transaction started by this thread or {@code null} if this thread does - * not have a transaction. - * - * @return Transaction started by this thread or {@code null} if this thread - * does not have a transaction. - */ - @Nullable public Transaction tx(); - - /** - * Evicts entry associated with given key from cache. Note, that entry will be evicted - * only if it's not used (not participating in any locks or transactions). - *

- * If {@link org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to {@code true}, the evicted entry will - * be swapped to offheap, and then to disk. - * - * @param key Key to evict from cache. - * @return {@code True} if entry could be evicted, {@code false} otherwise. - */ - public boolean evict(K key); - - /** - * Attempts to evict all entries associated with keys. Note, - * that entry will be evicted only if it's not used (not - * participating in any locks or transactions). - *

- * If {@link org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to {@code true}, the evicted entry will - * be swapped to offheap, and then to disk. - * - * @param keys Keys to evict. - */ - public void evictAll(@Nullable Collection keys); - - /** - * Clears all entries from this cache only if the entry is not - * currently locked or participating in a transaction. - *

- * If {@link org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to {@code true}, the evicted entries will - * also be cleared from swap. - *

- * Note that this operation is local as it merely clears - * entries from local cache. It does not remove entries from - * remote caches or from underlying persistent storage. - */ - public void clearLocally(); - - /** - * Clears an entry from this cache and swap storage only if the entry - * is not currently locked, and is not participating in a transaction. - *

- * If {@link org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to {@code true}, the evicted entries will - * also be cleared from swap. - *

- * Note that this operation is local as it merely clears - * an entry from local cache. It does not remove entries from - * remote caches or from underlying persistent storage. - * - * @param key Key to clearLocally. - * @return {@code True} if entry was successfully cleared from cache, {@code false} - * if entry was in use at the time of this method invocation and could not be - * cleared. - */ - public boolean clearLocally(K key); - - /** - * Clears entries from this cache and swap storage only if the entry - * is not currently locked, and is not participating in a transaction. - *

- * If {@link org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to {@code true}, the evicted entries will - * also be cleared from swap. - *

- * Note that this operation is local as it merely clears - * an entry from local cache. It does not remove entries from - * remote caches or from underlying persistent storage. - * - * @param keys Keys to clearLocally. - */ - public void clearLocallyAll(Set keys); - - /** - * Clears key on all nodes that store it's data. That is, caches are cleared on remote - * nodes and local node, as opposed to {@link InternalCache#clearLocally(Object)} method which only - * clears local node's cache. - *

- * Ignite will make the best attempt to clear caches on all nodes. If some caches - * could not be cleared, then exception will be thrown. - * - * @param key Key to clear. - * @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes. - */ - public void clear(K key) throws IgniteCheckedException; - - /** - * Clears keys on all nodes that store it's data. That is, caches are cleared on remote - * nodes and local node, as opposed to {@link InternalCache#clearLocallyAll(Set)} method which only - * clears local node's cache. - *

- * Ignite will make the best attempt to clear caches on all nodes. If some caches - * could not be cleared, then exception will be thrown. - * - * @param keys Keys to clear. - * @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes. - */ - public void clearAll(Set keys) throws IgniteCheckedException; - - /** - * Clears cache on all nodes that store it's data. That is, caches are cleared on remote - * nodes and local node, as opposed to {@link InternalCache#clearLocally()} method which only - * clears local node's cache. - *

- * Ignite will make the best attempt to clear caches on all nodes. If some caches - * could not be cleared, then exception will be thrown. - *

- * - * @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes. - */ - public void clear() throws IgniteCheckedException; - - /** - * @return Clear future. - */ - public IgniteInternalFuture clearAsync(); - - /** - * @param key Key to clear. - * @return Clear future. - */ - public IgniteInternalFuture clearAsync(K key); - - /** - * @param keys Keys to clear. - * @return Clear future. - */ - public IgniteInternalFuture clearAsync(Set keys); - - /** - * Removes given key mapping from cache. If cache previously contained value for the given key, - * then this value is returned. In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} - * caches, the value will be loaded from the primary node, which in its turn may load the value - * from the disk-based swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) should - * always be used instead of this one to avoid the overhead associated with returning of the - * previous value. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via CacheStore#remove(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @return Previous value associated with specified key, or {@code null} - * if there was no value for this key. - * @throws NullPointerException If key is {@code null}. - * @throws IgniteCheckedException If remove operation failed. - */ - @Nullable public V getAndRemove(K key) - throws IgniteCheckedException; - - /** - * Asynchronously removes given key mapping from cache. If cache previously contained value for the given key, - * then this value is returned. In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} - * caches, the value will be loaded from the primary node, which in its turn may load the value - * from the swap storage, and consecutively, if it's not in swap, - * from the underlying persistent storage. If value has to be loaded from persistent - * storage, CacheStore#load(Transaction, Object) method will be used. - *

- * If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) should - * always be used instead of this one to avoid the overhead associated with returning of the - * previous value. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via CacheStore#remove(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @return Future for the remove operation. - * @throws NullPointerException if the key is {@code null}. - */ - public IgniteInternalFuture getAndRemoveAsync(K key); - - /** - * Removes given key mapping from cache. - *

- * This method will return {@code true} if remove did occur, which means that all optionally - * provided filters have passed and there was something to remove, {@code false} otherwise. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via CacheStore#remove(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @return {@code True} if filter passed validation and entry was removed, {@code false} otherwise. - * Note that if filter is not specified, this method will return {@code true}. - * @throws NullPointerException if the key is {@code null}. - * @throws IgniteCheckedException If remove failed. - */ - public boolean remove(K key) throws IgniteCheckedException; - - /** - * Asynchronously removes given key mapping from cache. - *

- * This method will return {@code true} if remove did occur, which means that all optionally - * provided filters have passed and there was something to remove, {@code false} otherwise. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via CacheStore#remove(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @return Future for the remove operation. The future will return {@code true} - * if optional filters passed validation and remove did occur, {@code false} otherwise. - * Note that if filter is not specified, this method will return {@code true}. - * @throws NullPointerException if the key is {@code null}. - */ - public IgniteInternalFuture removeAsync(K key); - - /** - * Removes given key mapping from cache if one exists and value is equal to the passed in value. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via CacheStore#remove(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param val Value to match against currently cached value. - * @return {@code True} if entry was removed and passed in value matched the cached one, - * {@code false} otherwise. - * @throws NullPointerException if the key or value is {@code null}. - * @throws IgniteCheckedException If remove failed. - */ - public boolean remove(K key, V val) throws IgniteCheckedException; - - /** - * Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value. - *

- * This method will return {@code true} if remove did occur, which means that all optionally - * provided filters have passed and there was something to remove, {@code false} otherwise. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via CacheStore#remove(Transaction, Object) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param val Value to match against currently cached value. - * @return Future for the remove operation. The future will return {@code true} - * if currently cached value will match the passed in one. - * @throws NullPointerException if the key or value is {@code null}. - */ - public IgniteInternalFuture removeAsync(K key, V val); - - /** - * Removes given key mappings from cache for entries for which the optionally passed in filters do - * pass. - *

- * If write-through is enabled, the values will be removed from {@link CacheStore} - * via @link CacheStore#removeAll(Transaction, Collection) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param keys Keys whose mappings are to be removed from cache. - * @throws IgniteCheckedException If remove failed. - */ - public void removeAll(@Nullable Collection keys) throws IgniteCheckedException; - - /** - * Asynchronously removes given key mappings from cache for entries for which the optionally - * passed in filters do pass. - *

- * If write-through is enabled, the values will be removed from {@link CacheStore} - * via @link CacheStore#removeAll(Transaction, Collection) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param keys Keys whose mappings are to be removed from cache. - * @return Future for the remove operation. The future will complete whenever - * remove operation completes. - */ - public IgniteInternalFuture removeAllAsync(@Nullable Collection keys); - - /** - * Removes mappings from cache for entries for which the optionally passed in filters do - * pass. If passed in filters are {@code null}, then all entries in cache will be enrolled - * into transaction. - *

- * USE WITH CARE - if your cache has many entries that pass through the filter or if filter - * is empty, then transaction will quickly become very heavy and slow. Also, locks - * are acquired in undefined order, so it may cause a deadlock when used with - * other concurrent transactional updates. - *

- * If write-through is enabled, the values will be removed from {@link CacheStore} - * via @link CacheStore#removeAll(Transaction, Collection) method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @throws IgniteCheckedException If remove failed. - */ - public void removeAll() throws IgniteCheckedException; - - /** - * @return Remove future. - */ - public IgniteInternalFuture removeAllAsync(); - - /** - * Synchronously acquires lock on a cached object with given - * key only if the passed in filter (if any) passes. This method - * together with filter check will be executed as one atomic operation. - *

Transactions

- * 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 TransactionConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * - * @param key Key to lock. - * @param timeout Timeout in milliseconds to wait for lock to be acquired - * ({@code '0'} for no expiration), {@code -1} for immediate failure if - * lock cannot be acquired immediately). - * @return {@code True} if all filters passed and lock was acquired, - * {@code false} otherwise. - * @throws IgniteCheckedException If lock acquisition resulted in error. - */ - public boolean lock(K key, long timeout) - throws IgniteCheckedException; - - /** - * Asynchronously acquires lock on a cached object with given - * key only if the passed in filter (if any) passes. This method - * together with filter check will be executed as one atomic operation. - *

Transactions

- * 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 TransactionConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * - * @param key Key to lock. - * @param timeout Timeout in milliseconds to wait for lock to be acquired - * ({@code '0'} for no expiration, {@code -1} for immediate failure if - * lock cannot be acquired immediately). - * @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. - */ - public IgniteInternalFuture lockAsync(K key, long timeout); - - /** - * All or nothing synchronous lock for passed in keys. This method - * together with filter check will be executed as one atomic operation. - * If at least one filter validation failed, no locks will be acquired. - *

Transactions

- * 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 TransactionConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * - * @param keys Keys to lock. - * @param timeout Timeout in milliseconds to wait for lock to be acquired - * ({@code '0'} for no expiration). - * @return {@code True} if all filters passed and locks were acquired before - * timeout has expired, {@code false} otherwise. - * @throws IgniteCheckedException If lock acquisition resulted in error. - */ - public boolean lockAll(@Nullable Collection keys, long timeout) throws IgniteCheckedException; - - /** - * All or nothing synchronous lock for passed in keys. This method - * together with filter check will be executed as one atomic operation. - * If at least one filter validation failed, no locks will be acquired. - *

Transactions

- * 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 TransactionConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * - * @param keys Keys to lock. - * @param timeout Timeout in milliseconds to wait for lock to be acquired - * ({@code '0'} for no expiration). - * @return Future for the collection of locks. The future will return - * {@code true} if all filters passed and locks were acquired before - * timeout has expired, {@code false} otherwise. - */ - public IgniteInternalFuture lockAllAsync(@Nullable Collection keys, long timeout); - - /** - * Unlocks given key only if current thread owns the lock. If optional filter - * will not pass, then unlock will not happen. If the key being unlocked was - * never locked by current thread, then this method will do nothing. - *

Transactions

- * 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 TransactionConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * - * @param key Key to unlock. - * @throws IgniteCheckedException If unlock execution resulted in error. - */ - public void unlock(K key) throws IgniteCheckedException; - - /** - * Unlocks given keys only if current thread owns the locks. Only the keys - * that have been locked by calling thread and pass through the filter (if any) - * will be unlocked. If none of the key locks is owned by current thread, then - * this method will do nothing. - *

Transactions

- * 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 TransactionConcurrency#PESSIMISTIC} concurrency control for transaction - * which will acquire explicit locks for relevant cache operations. - * - * @param keys Keys to unlock. - * @throws IgniteCheckedException If unlock execution resulted in error. - */ - public void unlockAll(@Nullable Collection keys) throws IgniteCheckedException; - - /** - * Checks if any node owns a lock for this key. - *

- * This is a local in-VM operation and does not involve any network trips - * or access to persistent storage in any way. - * - * @param key Key to check. - * @return {@code True} if lock is owned by some node. - */ - public boolean isLocked(K key); - - /** - * Checks if current thread owns a lock on this key. - *

- * This is a local in-VM operation and does not involve any network trips - * or access to persistent storage in any way. - * - * @param key Key to check. - * @return {@code True} if key is locked by current thread. - */ - public boolean isLockedByThread(K key); - - /** - * Gets the number of all entries cached on this node. This method will return the count of - * all cache entries and has O(1) complexity on base {@link InternalCache} projection. It is essentially the - * size of cache key set and is semantically identical to {{@code Cache.keySet().size()}. - *

- * NOTE: this operation is not distributed and returns only the number of entries cached on this node. - * - * @return Size of cache on this node. - */ - public int size(); - - /** - * @param peekModes Peek modes. - * @return Local cache size. - * @throws IgniteCheckedException If failed. - */ - public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException; - - /** - * @param peekModes Peek modes. - * @return Global cache size. - * @throws IgniteCheckedException If failed. - */ - public int size(CachePeekMode[] peekModes) throws IgniteCheckedException; - - /** - * @param peekModes Peek modes. - * @return Future. - */ - public IgniteInternalFuture sizeAsync(CachePeekMode[] peekModes); - - /** - * Gets size of near cache key set. This method will return count of all entries in near - * cache and has O(1) complexity on base cache projection. - *

- * Note that for {@code LOCAL} non-distributed caches this method will always return {@code 0} - * - * @return Size of near cache key set or {@code 0} if cache is not {@link CacheMode#PARTITIONED}. - */ - public int nearSize(); - - /** - * Gets the number of all primary entries cached on this node. For {@link CacheMode#LOCAL} non-distributed - * cache mode, this method is identical to {@link #size()}. - *

- * For {@link CacheMode#PARTITIONED} and {@link CacheMode#REPLICATED} modes, this method will - * return number of primary entries cached on this node (excluding any backups). The complexity of - * this method is O(P), where P is the total number of partitions. - *

- * NOTE: this operation is not distributed and returns only the number of primary entries cached on this node. - * - * @return Number of primary entries in cache. - */ - public int primarySize(); - - /** - * This method unswaps cache entries by given keys, if any, from swap storage - * into memory. - *

Transactions

- * This method is not transactional. - * - * @param keys Keys to promote entries for. - * @throws IgniteCheckedException If promote failed. - */ - public void promoteAll(@Nullable Collection keys) throws IgniteCheckedException; - - /** - * Gets configuration bean for this cache. - * - * @return Configuration bean for this cache. - */ - public CacheConfiguration configuration(); - - /** - * Gets affinity service to provide information about data partitioning - * and distribution. - * - * @return Cache data affinity service. - */ - public Affinity affinity(); - - /** - * Gets metrics (statistics) for this cache. - * - * @return Cache metrics. - */ - public CacheMetrics metrics(); - - /** - * Gets metrics (statistics) for this cache. - * - * @return Cache metrics. - */ - public CacheMetricsMXBean mxBean(); - - /** - * 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. - *

- * Returned iterator supports {@code remove} operation which delegates to - * removex(Object, org.apache.ignite.lang.IgnitePredicate[]) method. - * - * @return Iterator over keys. - * @throws IgniteCheckedException If failed. - */ - public Iterator> 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. - *

- * Returned iterator supports {@code remove} operation which delegates to - * removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. - * - * @return Iterator over keys. - * @throws IgniteCheckedException If failed. - */ - public Iterator> offHeapIterator() throws IgniteCheckedException; - - /** - * Forces this cache node to re-balance its partitions. This method is usually used when - * {@link CacheConfiguration#getRebalanceDelay()} configuration parameter has non-zero value. - * When many nodes are started or stopped almost concurrently, it is more efficient to delay - * rebalancing until the node topology is stable to make sure that no redundant re-partitioning - * happens. - *

- * 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#getRebalanceDelay() rebalanceDelay} expires. To place nodes - * on the same place in consistent hash ring, use - * {@link org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction#setHashIdResolver(AffinityNodeHashResolver)} to make sure that - * a node maps to the same hash ID if re-started. - *

- * See {@link org.apache.ignite.configuration.CacheConfiguration#getRebalanceDelay()} for more information on how to configure - * rebalance re-partition delay. - *

- * @return Future that will be completed when rebalancing is finished. - */ - public IgniteInternalFuture forceRepartition(); - - /** - * Creates projection for specified subject ID. - * - * @param subjId Client ID. - * @return Internal projection. - */ - GridCacheProxyImpl forSubjectId(UUID subjId); - /** - * Store DR data. - * - * @param drMap DR map. - * @throws IgniteCheckedException If put operation failed. - */ - public void putAllConflict(Map drMap) throws IgniteCheckedException; - - /** - * Store DR data asynchronously. - * - * @param drMap DR map. - * @return Future. - * @throws IgniteCheckedException If put operation failed. - */ - public IgniteInternalFuture putAllConflictAsync(Map drMap) - throws IgniteCheckedException; - - /** - * Removes DR data. - * - * @param drMap DR map. - * @throws IgniteCheckedException If remove failed. - */ - public void removeAllConflict(Map drMap) throws IgniteCheckedException; - - /** - * Removes DR data asynchronously. - * - * @param drMap DR map. - * @return Future. - * @throws IgniteCheckedException If remove failed. - */ - public IgniteInternalFuture removeAllConflictAsync(Map drMap) throws IgniteCheckedException; - - /** - * Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the - * {@code 'oldVal'} passed in. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via {@link CacheStore#write(javax.cache.Cache.Entry)} method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param oldVal Old value to match. - * @param newVal Value to be associated with the given key. - * @return Future for the replace operation. The future will return object containing actual old value and success - * flag. - * @throws NullPointerException If either key or value are {@code null}. - */ - public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal); - - /** - * Stores given key-value pair in cache only if only if the previous value is equal to the - * {@code 'oldVal'} passed in. - *

- * This method will return {@code true} if value is stored in cache and {@code false} otherwise. - *

- * If write-through is enabled, the stored value will be persisted to {@link CacheStore} - * via {@link CacheStore#write(javax.cache.Cache.Entry)} method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key to store in cache. - * @param oldVal Old value to match. - * @param newVal Value to be associated with the given key. - * @return Object containing actual old value and success flag. - * @throws NullPointerException If either key or value are {@code null}. - * @throws IgniteCheckedException If replace operation failed. - */ - public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException; - - /** - * Removes given key mapping from cache if one exists and value is equal to the passed in value. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via {@link CacheStore#delete(Object)} method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param val Value to match against currently cached value. - * @return Object containing actual old value and success flag. - * @throws NullPointerException if the key or value is {@code null}. - * @throws IgniteCheckedException If remove failed. - */ - public GridCacheReturn removex(K key, V val) throws IgniteCheckedException; - - /** - * Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value. - *

- * This method will return {@code true} if remove did occur, which means that all optionally - * provided filters have passed and there was something to remove, {@code false} otherwise. - *

- * If write-through is enabled, the value will be removed from {@link CacheStore} - * via {@link CacheStore#delete(Object)} method. - *

Transactions

- * This method is transactional and will enlist the entry into ongoing transaction - * if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param val Value to match against currently cached value. - * @return Future for the remove operation. The future will return object containing actual old value and success - * flag. - * @throws NullPointerException if the key or value is {@code null}. - */ - public IgniteInternalFuture removexAsync(K key, V val); - - /** - * Gets value from cache. Will go to primary node even if this is a backup. - * - * @param key Key to get value for. - * @return Value. - * @throws IgniteCheckedException If failed. - */ - @Nullable public V getForcePrimary(K key) throws IgniteCheckedException; - - /** - * Asynchronously gets value from cache. Will go to primary node even if this is a backup. - * - * @param key Key to get value for. - * @return Future with result. - */ - public IgniteInternalFuture getForcePrimaryAsync(K key); - - /** - * Gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries - * and will not lock any keys if pessimistic transaction is started by thread. - * - * @param keys Keys to get values for. - * @return Value. - * @throws IgniteCheckedException If failed. - */ - @Nullable public Map getAllOutTx(List keys) throws IgniteCheckedException; - - /** - * Checks whether this cache is IGFS data cache. - * - * @return {@code True} in case this cache is IGFS data cache. - */ - public boolean isIgfsDataCache(); - - /** - * Get current amount of used IGFS space in bytes. - * - * @return Amount of used IGFS space in bytes. - */ - public long igfsDataSpaceUsed(); - - /** - * Get maximum space available for IGFS. - * - * @return Amount of space available for IGFS in bytes. - */ - public long igfsDataSpaceMax(); - - /** - * Checks whether this cache is Mongo data cache. - * - * @return {@code True} if this cache is mongo data cache. - */ - public boolean isMongoDataCache(); - - /** - * Checks whether this cache is Mongo meta cache. - * - * @return {@code True} if this cache is mongo meta cache. - */ - public boolean isMongoMetaCache(); - - /** - * Gets entry set containing internal entries. - * - * @param filter Filter. - * @return Entry set. - */ - public Set> entrySetx(CacheEntryPredicate... filter); - - /** - * @return {@link javax.cache.expiry.ExpiryPolicy} associated with this projection. - */ - @Nullable public ExpiryPolicy expiry(); - - /** - * @param plc {@link ExpiryPolicy} to associate with this projection. - * @return New projection based on this one, but with the specified expiry policy. - */ - public GridCacheProxyImpl withExpiryPolicy(ExpiryPolicy plc); - - /** - * @param key Key. - * @param entryProcessor Entry processor. - * @param args Arguments. - * @return Invoke result. - * @throws IgniteCheckedException If failed. - */ - @Nullable public EntryProcessorResult invoke(K key, - EntryProcessor entryProcessor, - Object... args) throws IgniteCheckedException; - - /** - * @param key Key. - * @param entryProcessor Entry processor. - * @param args Arguments. - * @return Future. - */ - public IgniteInternalFuture> invokeAsync(K key, - EntryProcessor entryProcessor, - Object... args); - - /** - * @param keys Keys. - * @param entryProcessor Entry processor. - * @param args Arguments. - * @return Invoke results. - * @throws IgniteCheckedException If failed. - */ - public Map> invokeAll(Set keys, - EntryProcessor entryProcessor, - Object... args) throws IgniteCheckedException; - - /** - * @param keys Keys. - * @param entryProcessor Entry processor. - * @param args Arguments. - * @return Future. - */ - public IgniteInternalFuture>> invokeAllAsync(Set keys, - EntryProcessor entryProcessor, - Object... args); - - /** - * @param map Map containing keys and entry processors to be applied to values. - * @param args Arguments. - * @return Invoke results. - * @throws IgniteCheckedException If failed. - */ - public Map> invokeAll( - Map> map, - Object... args) throws IgniteCheckedException; - - /** - * @param map Map containing keys and entry processors to be applied to values. - * @param args Arguments. - * @return Future. - */ - public IgniteInternalFuture>> invokeAllAsync( - Map> map, - Object... args); - - /** - * @return Context. - */ - public GridCacheContext context(); - - /** - * 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. - *

- * 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. - *

- * 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 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 localLoadCache(@Nullable IgniteBiPredicate p, @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. - *

- * Note that this method does not receive keys as a parameter, so it is up to - * {@link CacheStore} implementati