sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Desruisseaux (JIRA)" <>
Subject [jira] [Commented] (SIS-375) Cache : override default Map methods
Date Tue, 21 Nov 2017 00:27:00 GMT


Martin Desruisseaux commented on SIS-375:

Thanks for the patch. Applied with the following modifications:

* Omitted {{computeIfPresent}} because the use of {{Cache.lock}} in this context is equivalent
to a no-op: when the lock is released, {{Cache}} discovers that a value exists for the key
and does not overwrite it with the new values (because the purpose of {{Cache}} is to avoid
recomputing values). The default implementation inherited from {{java.util.Map}}, while non-atomic,
should have a reasonably consistent behavior.
* Rewrote {{putIfAbsent}} in a way more similar to the existing {{put}} method, which avoid
taking the {{Cache.lock}}. This locking mechanism does not apply here since we are not waiting
for a value that may be computed in another thread.
* Rewrote {{replace}} in the same way than {{putIfAbsent}}. In this case, above argument is
more questionable because this method relies on a previous value which may be under computation.
This may need to be revisited.

> Cache : override default Map methods
> ------------------------------------
>                 Key: SIS-375
>                 URL:
>             Project: Spatial Information Systems
>          Issue Type: Task
>          Components: Utilities
>    Affects Versions: 0.8
>            Reporter: Alexis Manin
>            Assignee: Martin Desruisseaux
>            Priority: Minor
>              Labels: newbie, patch
>             Fix For: 1.0
>         Attachments: cache.diff
> The aim here is to provide thread-safe implementations of the default utility methods
of Map interface for SIS Cache implementation.
> I attach a patch with the implementations I've done. Hope it helps !

This message was sent by Atlassian JIRA

View raw message