alex-plekhanov commented on a change in pull request #8692:
URL: https://github.com/apache/ignite/pull/8692#discussion_r563687584



##########
File path: modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
##########
@@ -558,6 +575,47 @@
      */
     public IgniteClientFuture<Boolean> putIfAbsentAsync(K key, V val) throws 
ClientException;
 
+    /**
+     * Atomically associates the specified key with the given value if it is 
not already associated with a value.
+     * <p>
+     * This is equivalent to performing the following operations as a single 
atomic action:
+     * <pre><code>
+     * if (!cache.containsKey(key)) {}
+     *   cache.put(key, value);
+     *   return null;
+     * } else {
+     *   return cache.get(key);
+     * }
+     * </code></pre>
+     *
+     * @param key Key with which the specified value is to be associated.
+     * @param val Value to be associated with the specified key.
+     * @return Value that is already associated with the specified key, or 
{@code null} if no value was associated
+     * with the specified key and a value was set.
+     */
+    public V getAndPutIfAbsent(K key, V val) throws ClientException;
+
+    /**
+     * Atomically associates the specified key with the given value if it is 
not already associated with a value.
+     * <p>
+     * This is equivalent to performing the following operations as a single 
atomic action:
+     * <pre><code>
+     * if (!cache.containsKey(key)) {}

Review comment:
       Typo: redundant `}`

##########
File path: modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
##########
@@ -558,6 +575,47 @@
      */
     public IgniteClientFuture<Boolean> putIfAbsentAsync(K key, V val) throws 
ClientException;
 
+    /**
+     * Atomically associates the specified key with the given value if it is 
not already associated with a value.
+     * <p>
+     * This is equivalent to performing the following operations as a single 
atomic action:
+     * <pre><code>
+     * if (!cache.containsKey(key)) {}

Review comment:
       Typo: redundant `}`

##########
File path: modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
##########
@@ -571,6 +629,32 @@
      */
     public IgniteClientFuture<Void> clearAsync() throws ClientException;
 
+    /**
+     * Clears entry with specified key from the cache.
+     * In contrast to {@link #remove(Object)}}, this method does not notify 
event listeners and cache writers.

Review comment:
       Typo: redundant `}`

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java
##########
@@ -570,6 +600,38 @@
         );
     }
 
+    /** {@inheritDoc} */
+    @Override public V getAndPutIfAbsent(K key, V val) throws ClientException {
+        if (key == null)
+            throw new NullPointerException("key");
+
+        if (val == null)
+            throw new NullPointerException("val");
+
+        return cacheSingleKeyOperation(
+            key,
+            ClientOperation.CACHE_GET_AND_PUT_IF_ABSENT,
+            req -> writeObject(req, val),
+            this::readObject
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteClientFuture<V> getAndPutIfAbsentAsync(K key, V 
val) throws CacheException, TransactionException {

Review comment:
       I think `CacheException` or `TransactionException` can't be thrown here.

##########
File path: modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
##########
@@ -571,6 +629,32 @@
      */
     public IgniteClientFuture<Void> clearAsync() throws ClientException;
 
+    /**
+     * Clears entry with specified key from the cache.
+     * In contrast to {@link #remove(Object)}}, this method does not notify 
event listeners and cache writers.
+     */
+    public void clear(K key);
+
+    /**
+     * Clears entry with specified key from the cache asynchronously.
+     * In contrast to {@link #removeAsync(Object)}}, this method does not 
notify event listeners and cache writers.

Review comment:
       Typo: redundant `}`

##########
File path: modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
##########
@@ -571,6 +629,32 @@
      */
     public IgniteClientFuture<Void> clearAsync() throws ClientException;
 
+    /**
+     * Clears entry with specified key from the cache.
+     * In contrast to {@link #remove(Object)}}, this method does not notify 
event listeners and cache writers.
+     */
+    public void clear(K key);

Review comment:
       `throws ClientException` for all added `clear*` methods

##########
File path: modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
##########
@@ -571,6 +629,32 @@
      */
     public IgniteClientFuture<Void> clearAsync() throws ClientException;
 
+    /**
+     * Clears entry with specified key from the cache.
+     * In contrast to {@link #remove(Object)}}, this method does not notify 
event listeners and cache writers.

Review comment:
       Still not fixed `{@link #remove(Object)}**}**`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to