diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java index 44e4027eff89f..13b87c3dec152 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java @@ -21,7 +21,6 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cache.store.*; -import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.processors.cache.transactions.*; @@ -32,7 +31,6 @@ import java.sql.*; import java.util.*; import java.util.Date; -import java.util.concurrent.*; /** * This interface provides a rich API for working with distributed caches. It includes the following @@ -603,7 +601,7 @@ public boolean putx(K key, V val) * 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 #replacex(Object, Object)} should + * 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. *

@@ -619,7 +617,7 @@ public boolean putx(K key, V val) * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If replace operation failed. */ - @Nullable public V replace(K key, V val) throws IgniteCheckedException; + @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 @@ -629,7 +627,7 @@ public boolean putx(K key, V val) * 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 #replacex(Object, Object)} should + * 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. *

@@ -644,13 +642,13 @@ public boolean putx(K key, V val) * @return Future for replace operation. * @throws NullPointerException If either key or value are {@code null}. */ - public IgniteInternalFuture replaceAsync(K key, V val); + 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 #replace(Object, Object)} method, it does not return previous + * 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. *

@@ -666,13 +664,13 @@ public boolean putx(K key, V val) * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If replace operation failed. */ - public boolean replacex(K key, V val) throws IgniteCheckedException; + 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 #replaceAsync(Object, Object)} method, it does not return previous + * 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. *

@@ -687,7 +685,7 @@ public boolean putx(K key, V val) * @return Future for the replace operation. * @throws NullPointerException If either key or value are {@code null}. */ - public IgniteInternalFuture replacexAsync(K key, V val); + 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 @@ -708,7 +706,7 @@ public boolean putx(K key, V val) * @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; + public boolean getAndReplace(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 @@ -728,7 +726,7 @@ public boolean putx(K key, V val) * @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); + public IgniteInternalFuture getAndReplaceAsync(K key, V oldVal, V newVal); /** * Stores given key-value pairs in cache. If filters are provided, then entries will diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index c2ea41a7ff65c..0dafb8a19c52e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -2488,7 +2488,7 @@ public IgniteInternalFuture putxAsync0(final K key, final V val, } /** {@inheritDoc} */ - @Nullable @Override public V replace(final K key, final V val) throws IgniteCheckedException { + @Nullable @Override public V getAndReplace(final K key, final V val) throws IgniteCheckedException { A.notNull(key, "key", val, "val"); if (keyCheck) @@ -2508,7 +2508,7 @@ public IgniteInternalFuture putxAsync0(final K key, final V val, } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(final K key, final V val) { + @Override public IgniteInternalFuture getAndReplaceAsync(final K key, final V val) { final boolean statsEnabled = ctx.config().isStatisticsEnabled(); final long start = statsEnabled ? System.nanoTime() : 0L; @@ -2538,7 +2538,7 @@ public IgniteInternalFuture putxAsync0(final K key, final V val, } /** {@inheritDoc} */ - @Override public boolean replacex(final K key, final V val) throws IgniteCheckedException { + @Override public boolean replace(final K key, final V val) throws IgniteCheckedException { A.notNull(key, "key", val, "val"); if (keyCheck) @@ -2558,7 +2558,7 @@ public IgniteInternalFuture putxAsync0(final K key, final V val, } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(final K key, final V val) { + @Override public IgniteInternalFuture replaceAsync(final K key, final V val) { A.notNull(key, "key", val, "val"); if (keyCheck) @@ -2579,7 +2579,7 @@ public IgniteInternalFuture putxAsync0(final K key, final V val, } /** {@inheritDoc} */ - @Override public boolean replace(final K key, final V oldVal, final V newVal) throws IgniteCheckedException { + @Override public boolean getAndReplace(final K key, final V oldVal, final V newVal) throws IgniteCheckedException { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); if (keyCheck) @@ -2606,7 +2606,7 @@ public IgniteInternalFuture putxAsync0(final K key, final V val, } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(final K key, final V oldVal, final V newVal) { + @Override public IgniteInternalFuture getAndReplaceAsync(final K key, final V oldVal, final V newVal) { final boolean statsEnabled = ctx.config().isStatisticsEnabled(); final long start = statsEnabled ? System.nanoTime() : 0L; @@ -2944,7 +2944,7 @@ public IgniteInternalFuture removexAsync(final K key, @Nullable final C } /** {@inheritDoc} */ - @Override public GridCacheReturn replacex(final K key, final V oldVal, final V newVal) + @Override public GridCacheReturn replace(final K key, final V oldVal, final V newVal) throws IgniteCheckedException { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); @@ -3006,9 +3006,7 @@ public IgniteInternalFuture removexAsync(final K key, @Nullable final C } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(final K key, - final V oldVal, - final V newVal) + @Override public IgniteInternalFuture replaceAsync(final K key, final V oldVal, final V newVal) { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java index d7db04eb3cec4..fe8b78bc7b0e8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java @@ -95,7 +95,7 @@ public IgniteInternalFuture putAllConflictAsync(Map replacexAsync(K key, V oldVal, V newVal); + public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal); /** * Stores given key-value pair in cache only if only if the previous value is equal to the @@ -116,7 +116,7 @@ public IgniteInternalFuture putAllConflictAsync(Map replaceAsync(K key, V val) { - return cache.replaceAsync(key, val); + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V val) { + return cache.getAndReplaceAsync(key, val); } /** {@inheritDoc} */ - @Override public boolean replacex(K key, V val) throws IgniteCheckedException { - return replacexAsync(key, val).get(); + @Override public boolean replace(K key, V val) throws IgniteCheckedException { + return replaceAsync(key, val).get(); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V val) { - return cache.replacexAsync(key, val); + @Override public IgniteInternalFuture replaceAsync(K key, V val) { + return cache.replaceAsync(key, val); } /** {@inheritDoc} */ - @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException { - return replaceAsync(key, oldVal, newVal).get(); + @Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException { + return getAndReplaceAsync(key, oldVal, newVal).get(); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V oldVal, V newVal) { CacheEntryPredicate fltr = cctx.equalsValue(oldVal); return cache.putxAsync(key, newVal, fltr); @@ -586,15 +586,15 @@ public boolean deserializePortables() { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); - return cache.replacexAsync(key, oldVal, newVal); + return cache.replaceAsync(key, oldVal, newVal); } /** {@inheritDoc} */ - @Override public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException { - return replacexAsync(key, oldVal, newVal).get(); + @Override public GridCacheReturn replace(K key, V oldVal, V newVal) throws IgniteCheckedException { + return replaceAsync(key, oldVal, newVal).get(); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java index 54c7df19ebde0..b5759406cef7d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java @@ -20,7 +20,6 @@ import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.affinity.*; @@ -40,7 +39,6 @@ import javax.cache.processor.*; import java.io.*; import java.util.*; -import java.util.concurrent.*; /** * Cache proxy. @@ -707,11 +705,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Nullable @Override public V replace(K key, V val) throws IgniteCheckedException { + @Nullable @Override public V getAndReplace(K key, V val) throws IgniteCheckedException { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replace(key, val); + return delegate.getAndReplace(key, val); } finally { gate.leave(prev); @@ -719,11 +717,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V val) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V val) { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replaceAsync(key, val); + return delegate.getAndReplaceAsync(key, val); } finally { gate.leave(prev); @@ -731,11 +729,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public boolean replacex(K key, V val) throws IgniteCheckedException { + @Override public boolean replace(K key, V val) throws IgniteCheckedException { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replacex(key, val); + return delegate.replace(key, val); } finally { gate.leave(prev); @@ -743,11 +741,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V val) { + @Override public IgniteInternalFuture replaceAsync(K key, V val) { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replacexAsync(key, val); + return delegate.replaceAsync(key, val); } finally { gate.leave(prev); @@ -755,11 +753,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException { + @Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replace(key, oldVal, newVal); + return delegate.getAndReplace(key, oldVal, newVal); } finally { gate.leave(prev); @@ -767,11 +765,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V oldVal, V newVal) { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replaceAsync(key, oldVal, newVal); + return delegate.getAndReplaceAsync(key, oldVal, newVal); } finally { gate.leave(prev); @@ -1162,11 +1160,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replacexAsync(key, oldVal, newVal); + return delegate.replaceAsync(key, oldVal, newVal); } finally { gate.leave(prev); @@ -1174,11 +1172,11 @@ public GridCacheProjectionImpl gateProjection() { } /** {@inheritDoc} */ - @Override public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException { + @Override public GridCacheReturn replace(K key, V oldVal, V newVal) throws IgniteCheckedException { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.replacex(key, oldVal, newVal); + return delegate.replace(key, oldVal, newVal); } finally { gate.leave(prev); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index dda1c7b4fdad0..b788b9d674258 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -931,12 +931,12 @@ public Set> entrySetx(CacheEntryPredicate... filter) { try { if (isAsync()) { - setFuture(delegate.replaceAsync(key, oldVal, newVal)); + setFuture(delegate.getAndReplaceAsync(key, oldVal, newVal)); return false; } else - return delegate.replace(key, oldVal, newVal); + return delegate.getAndReplace(key, oldVal, newVal); } finally { gate.leave(prev); @@ -954,12 +954,12 @@ public Set> entrySetx(CacheEntryPredicate... filter) { try { if (isAsync()) { - setFuture(delegate.replacexAsync(key, val)); + setFuture(delegate.replaceAsync(key, val)); return false; } else - return delegate.replacex(key, val); + return delegate.replace(key, val); } finally { gate.leave(prev); @@ -977,12 +977,12 @@ public Set> entrySetx(CacheEntryPredicate... filter) { try { if (isAsync()) { - setFuture(delegate.replaceAsync(key, val)); + setFuture(delegate.getAndReplaceAsync(key, val)); return null; } else - return delegate.replace(key, val); + return delegate.getAndReplace(key, val); } finally { gate.leave(prev); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index 614770e6e5b77..0feb0b453c77d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -371,36 +371,36 @@ public void near(GridNearAtomicCache near) { } /** {@inheritDoc} */ - @Override public V replace(K key, V val) throws IgniteCheckedException { - return replaceAsync(key, val).get(); + @Override public V getAndReplace(K key, V val) throws IgniteCheckedException { + return getAndReplaceAsync(key, val).get(); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V val) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V val) { A.notNull(key, "key", val, "val"); return putAsync(key, val, ctx.hasValArray()); } /** {@inheritDoc} */ - @Override public boolean replacex(K key, V val) throws IgniteCheckedException { - return replacexAsync(key, val).get(); + @Override public boolean replace(K key, V val) throws IgniteCheckedException { + return replaceAsync(key, val).get(); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V val) { + @Override public IgniteInternalFuture replaceAsync(K key, V val) { A.notNull(key, "key", val, "val"); return putxAsync(key, val, ctx.hasValArray()); } /** {@inheritDoc} */ - @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException { - return replaceAsync(key, oldVal, newVal).get(); + @Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException { + return getAndReplaceAsync(key, oldVal, newVal).get(); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V oldVal, V newVal) { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); return putxAsync(key, newVal, ctx.equalsValArray(oldVal)); @@ -412,8 +412,8 @@ public void near(GridNearAtomicCache near) { } /** {@inheritDoc} */ - @Override public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException { - return replacexAsync(key, oldVal, newVal).get(); + @Override public GridCacheReturn replace(K key, V oldVal, V newVal) throws IgniteCheckedException { + return replaceAsync(key, oldVal, newVal).get(); } /** {@inheritDoc} */ @@ -426,7 +426,7 @@ public void near(GridNearAtomicCache near) { /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { return updateAllAsync0(F.asMap(key, newVal), null, null, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java index ce19bb4ff80a7..93976f369909b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java @@ -430,33 +430,33 @@ public void processDhtAtomicUpdateRequest( } /** {@inheritDoc} */ - @Override public V replace(K key, V val) throws IgniteCheckedException { - return dht.replace(key, val); + @Override public V getAndReplace(K key, V val) throws IgniteCheckedException { + return dht.getAndReplace(key, val); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V val) { - return dht.replaceAsync(key, val); + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V val) { + return dht.getAndReplaceAsync(key, val); } /** {@inheritDoc} */ - @Override public boolean replacex(K key, V val) throws IgniteCheckedException { - return dht.replacex(key, val); + @Override public boolean replace(K key, V val) throws IgniteCheckedException { + return dht.replace(key, val); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V val) { - return dht.replacexAsync(key, val); + @Override public IgniteInternalFuture replaceAsync(K key, V val) { + return dht.replaceAsync(key, val); } /** {@inheritDoc} */ - @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException { - return dht.replace(key, oldVal, newVal); + @Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException { + return dht.getAndReplace(key, oldVal, newVal); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { - return dht.replaceAsync(key, oldVal, newVal); + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V oldVal, V newVal) { + return dht.getAndReplaceAsync(key, oldVal, newVal); } /** {@inheritDoc} */ @@ -465,8 +465,8 @@ public void processDhtAtomicUpdateRequest( } /** {@inheritDoc} */ - @Override public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException { - return dht.replacex(key, oldVal, newVal); + @Override public GridCacheReturn replace(K key, V oldVal, V newVal) throws IgniteCheckedException { + return dht.replace(key, oldVal, newVal); } /** {@inheritDoc} */ @@ -477,8 +477,8 @@ public void processDhtAtomicUpdateRequest( /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal) { - return dht.replacexAsync(key, oldVal, newVal); + @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { + return dht.replaceAsync(key, oldVal, newVal); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java index fd0c4cf8dde43..15de79a75d0a8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java @@ -178,40 +178,40 @@ public GridLocalAtomicCache(GridCacheContext ctx) { /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public V replace(K key, V val) throws IgniteCheckedException { + @Override public V getAndReplace(K key, V val) throws IgniteCheckedException { return put(key, val, ctx.hasValArray()); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V val) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V val) { return putAsync(key, val, ctx.hasValArray()); } /** {@inheritDoc} */ - @Override public boolean replacex(K key, V val) throws IgniteCheckedException { + @Override public boolean replace(K key, V val) throws IgniteCheckedException { return putx(key, val, ctx.hasValArray()); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replacexAsync(K key, V val) { + @Override public IgniteInternalFuture replaceAsync(K key, V val) { return putxAsync(key, val, ctx.hasValArray()); } /** {@inheritDoc} */ - @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException { + @Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException { A.notNull(oldVal, "oldVal"); return putx(key, newVal, ctx.equalsValArray(oldVal)); } /** {@inheritDoc} */ - @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture getAndReplaceAsync(K key, V oldVal, V newVal) { return putxAsync(key, newVal, ctx.equalsValArray(oldVal)); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException { + @Override public GridCacheReturn replace(K key, V oldVal, V newVal) throws IgniteCheckedException { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); return (GridCacheReturn)updateAllInternal(UPDATE, @@ -251,7 +251,7 @@ public GridLocalAtomicCache(GridCacheContext ctx) { /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal) { + @Override public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal) { A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal"); return updateAllAsync0(F.asMap(key, newVal), diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java index 834e8c0dd7472..3858eeae975fa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.igfs; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; @@ -1492,7 +1491,7 @@ public void updateParentListingAsync(IgniteUuid parentId, IgniteUuid fileId, Str throw fsException("Failed to update file info (file types differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']'); - boolean b = metaCache.replace(fileId, oldInfo, newInfo); + boolean b = metaCache.getAndReplace(fileId, oldInfo, newInfo); assert b : "Inconsistent transaction state [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']'; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 854d9913cf7ba..6d91423fe347b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -837,7 +837,7 @@ private static class CasCommand extends CacheProjectionCommand { return exp == null && val == null ? c.removexAsync(key) : exp == null ? c.putxIfAbsentAsync(key, val) : val == null ? c.removeAsync(key, exp) : - c.replaceAsync(key, exp, val); + c.getAndReplaceAsync(key, exp, val); } } @@ -948,7 +948,7 @@ private static class ReplaceCommand extends CacheProjectionCommand { c = ((GridCacheProjectionEx)c).withExpiryPolicy(new ModifiedExpiryPolicy(duration)); } - return c.replacexAsync(key, val); + return c.replaceAsync(key, val); } } diff --git a/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java b/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java index 0cbc73c51cca1..6a767d8746f6f 100644 --- a/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java +++ b/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java @@ -553,7 +553,7 @@ private ReplaceCallable(GridCache cache) { /** {@inheritDoc} */ @Override protected void operation(int key) throws Exception { - cache.replace(key, key, key); + cache.getAndReplace(key, key, key); } } }