geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Reich (JIRA)" <>
Subject [jira] [Commented] (GEODE-2727) optimize new 1.8 ConcurrentMap default methods on Region
Date Thu, 15 Jun 2017 23:38:00 GMT


Nick Reich commented on GEODE-2727:

>From the ConcurrentMap javadocs:
default V getOrDefault(Object key,
                       V defaultValue)
This implementation assumes that the ConcurrentMap cannot contain null values and get() returning
null unambiguously means the key is absent. Implementations which support null values must
override this default implementation.
While we store tokens instead of nulls, we ultimately return nulls when there is no value.
Thus, get() returning null does NOT mean the key is absent and thus we need to override getOrDefault()
in order to adhere to the ConcurrentMap interface specifications.

> optimize new 1.8 ConcurrentMap default methods on Region
> --------------------------------------------------------
>                 Key: GEODE-2727
>                 URL:
>             Project: Geode
>          Issue Type: Improvement
>          Components: regions
>            Reporter: Darrel Schneider
>            Assignee: Nick Reich
>              Labels: region_interface, storage_2
> FRED: I can now edit this!
> In JDK 1.8 ConcurrentMap added the following default methods to the interface:
>   getOrDefault
>   computeIfAbsent
>   computeIfPresent
>   compute
>   merge
>   foreach
>   replaceAll
> All of the default implementations of these methods have issues with get returning null
when the key actually exists. So they do not support invalid region entries.
> The other problem with all of them (except getOrDefault) is that they will make multiple
round trips when done from a proxy. In a distributed environment we should implement these
to send the lambda to the primary so that the entire operation can be done with one message
and while the RegionEntry is locked.
> This would require that the lambda parameter by serializable which would be consistent
with what we do for other parameters to Region methods (for example "put").
> From a performance point of view "foreach" and "replaceAll" are the worst since they
bring back to whoever is executing the method all the keys and values from the entire cluster.
> It is also worth considering how the operations behave in a geode transaction.

This message was sent by Atlassian JIRA

View raw message