Michael Kobit created NIFI-1305:
-----------------------------------

             Summary: Clarify Jacadoc on 
DistributedMapCacheClient.getAndPutIfAbsent
                 Key: NIFI-1305
                 URL: https://issues.apache.org/jira/browse/NIFI-1305
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Documentation & Website
    Affects Versions: 0.4.0
            Reporter: Michael Kobit
            Priority: Trivial


The Javadoc for this method on DistributedMapCacheClient 
(https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java#L53-L71)
 is unclear about what happens if the key does not exist in the cache.

It looks like from the implementation of DistributedMapCacheClientService that 
it returns the value if it present, otherwise returns the computed value. The 
Javadoc doesn't state what is returned happens if an item does not exist.

I spent some time trying to figure out what makes sense from a client's 
perspective, and I had some trouble trying to understand what should happen. It 
seems obvious to me now that the cache should return either the existing value 
or the newly computed value, but it took some time to get there. 

I think the documentation should be clearer about what is returned in the case 
where the item does not exist



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to