[
https://issues.apache.org/jira/browse/NIFI-4504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16304165#comment-16304165
]
ASF GitHub Bot commented on NIFI-4504:
--------------------------------------
Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2284#discussion_r158756282
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java
---
@@ -166,6 +166,21 @@
*/
<K> boolean remove(K key, Serializer<K> serializer) throws IOException;
+ /**
+ * Removes the entry with the given key from the cache, if it is
present,
+ * and returns the value that was removed from the map.
+ *
+ * @param <K> type of key
+ * @param <V> type of value
+ * @param key key
+ * @param keySerializer key serializer
+ * @param valueDeserializer value deserializer
+ * @return the value previously associated with the key, or null if
there was no mapping
+ * null can also indicate that the map previously associated null with
the key
+ * @throws IOException ex
+ */
+ <K, V> V removeAndGet(K key, Serializer<K> keySerializer,
Deserializer<V> valueDeserializer) throws IOException;
--- End diff --
This new method should have a default implementation which throws
UnsupportedOperationException.
> SimpleMapCache/PersistentMapCache: Add removeAndGet and removeByPatternAndGet
> -----------------------------------------------------------------------------
>
> Key: NIFI-4504
> URL: https://issues.apache.org/jira/browse/NIFI-4504
> Project: Apache NiFi
> Issue Type: Improvement
> Affects Versions: 1.4.0
> Reporter: Jon Kessler
> Assignee: Michael Moser
> Priority: Minor
>
> Typical map implementations return the value that was removed when performing
> a remove. Because you couldn't update the existing remove methods without it
> being a breaking change I suggest adding new versions of the remove and
> removeByPattern methods that return the removed value(s).
> These changes should also be applied up the chain to any class that makes use
> of these classes such as the MapCacheServer and
> AtomicDistributedMapCacheClient.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)