Skip to content

Commit

Permalink
#ignite-683: Revert renaming replace methods in GridCacheProjectionEx.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Apr 13, 2015
1 parent b3d371c commit f9e922a
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
Expand Up @@ -706,7 +706,7 @@ public boolean put(K key, V val)
* @throws NullPointerException If either key or value are {@code null}.
* @throws IgniteCheckedException If replace operation failed.
*/
public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException;
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
Expand All @@ -726,7 +726,7 @@ public boolean put(K key, V val)
* @return Future for the replace operation.
* @throws NullPointerException If either key or value are {@code null}.
*/
public IgniteInternalFuture<Boolean> getAndReplaceAsync(K key, V oldVal, V newVal);
public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal);

/**
* Stores given key-value pairs in cache. If filters are provided, then entries will
Expand Down
Expand Up @@ -2579,7 +2579,7 @@ public IgniteInternalFuture<Boolean> putAsync0(final K key, final V val,
}

/** {@inheritDoc} */
@Override public boolean getAndReplace(final K key, final V oldVal, final V newVal) throws IgniteCheckedException {
@Override public boolean replace(final K key, final V oldVal, final V newVal) throws IgniteCheckedException {
A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal");

if (keyCheck)
Expand All @@ -2606,7 +2606,7 @@ public IgniteInternalFuture<Boolean> putAsync0(final K key, final V val,
}

/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> getAndReplaceAsync(final K key, final V oldVal, final V newVal) {
@Override public IgniteInternalFuture<Boolean> replaceAsync(final K key, final V oldVal, final V newVal) {
final boolean statsEnabled = ctx.config().isStatisticsEnabled();

final long start = statsEnabled ? System.nanoTime() : 0L;
Expand Down
Expand Up @@ -423,12 +423,12 @@ public boolean deserializePortables() {
}

/** {@inheritDoc} */
@Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException {
return getAndReplaceAsync(key, oldVal, newVal).get();
@Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException {
return replaceAsync(key, oldVal, newVal).get();
}

/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> getAndReplaceAsync(K key, V oldVal, V newVal) {
@Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
CacheEntryPredicate fltr = cctx.equalsValue(oldVal);

return cache.putAsync(key, newVal, fltr);
Expand Down
Expand Up @@ -753,23 +753,23 @@ public GridCacheProjectionImpl<K, V> gateProjection() {
}

/** {@inheritDoc} */
@Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException {
@Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);

try {
return delegate.getAndReplace(key, oldVal, newVal);
return delegate.replace(key, oldVal, newVal);
}
finally {
gate.leave(prev);
}
}

/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> getAndReplaceAsync(K key, V oldVal, V newVal) {
@Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);

try {
return delegate.getAndReplaceAsync(key, oldVal, newVal);
return delegate.replaceAsync(key, oldVal, newVal);
}
finally {
gate.leave(prev);
Expand Down
Expand Up @@ -931,12 +931,12 @@ public Set<Entry<K, V>> entrySetx(CacheEntryPredicate... filter) {

try {
if (isAsync()) {
setFuture(delegate.getAndReplaceAsync(key, oldVal, newVal));
setFuture(delegate.replaceAsync(key, oldVal, newVal));

return false;
}
else
return delegate.getAndReplace(key, oldVal, newVal);
return delegate.replace(key, oldVal, newVal);
}
finally {
gate.leave(prev);
Expand Down
Expand Up @@ -395,12 +395,12 @@ public void near(GridNearAtomicCache<K, V> near) {
}

/** {@inheritDoc} */
@Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException {
return getAndReplaceAsync(key, oldVal, newVal).get();
@Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException {
return replaceAsync(key, oldVal, newVal).get();
}

/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> getAndReplaceAsync(K key, V oldVal, V newVal) {
@Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal");

return putAsync(key, newVal, ctx.equalsValArray(oldVal));
Expand Down
Expand Up @@ -450,13 +450,13 @@ public void processDhtAtomicUpdateRequest(
}

/** {@inheritDoc} */
@Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException {
return dht.getAndReplace(key, oldVal, newVal);
@Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException {
return dht.replace(key, oldVal, newVal);
}

/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> getAndReplaceAsync(K key, V oldVal, V newVal) {
return dht.getAndReplaceAsync(key, oldVal, newVal);
@Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
return dht.replaceAsync(key, oldVal, newVal);
}

/** {@inheritDoc} */
Expand Down
Expand Up @@ -198,14 +198,14 @@ public GridLocalAtomicCache(GridCacheContext<K, V> ctx) {
}

/** {@inheritDoc} */
@Override public boolean getAndReplace(K key, V oldVal, V newVal) throws IgniteCheckedException {
@Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException {
A.notNull(oldVal, "oldVal");

return put(key, newVal, ctx.equalsValArray(oldVal));
}

/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> getAndReplaceAsync(K key, V oldVal, V newVal) {
@Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
return putAsync(key, newVal, ctx.equalsValArray(oldVal));
}

Expand Down
Expand Up @@ -1491,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.getAndReplace(fileId, oldInfo, newInfo);
boolean b = metaCache.replace(fileId, oldInfo, newInfo);

assert b : "Inconsistent transaction state [oldInfo=" + oldInfo + ", newInfo=" + newInfo +
", c=" + c + ']';
Expand Down
Expand Up @@ -837,7 +837,7 @@ private static class CasCommand extends CacheProjectionCommand {
return exp == null && val == null ? c.removeAsync(key) :
exp == null ? c.putIfAbsentAsync(key, val) :
val == null ? c.removeAsync(key, exp) :
c.getAndReplaceAsync(key, exp, val);
c.replaceAsync(key, exp, val);
}
}

Expand Down
Expand Up @@ -553,7 +553,7 @@ private ReplaceCallable(GridCache<Object, Object> cache) {

/** {@inheritDoc} */
@Override protected void operation(int key) throws Exception {
cache.getAndReplace(key, key, key);
cache.replace(key, key, key);
}
}
}

0 comments on commit f9e922a

Please sign in to comment.