[
https://issues.apache.org/jira/browse/DIRECTMEMORY-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219132#comment-13219132
]
Benoit Perroud commented on DIRECTMEMORY-70:
--------------------------------------------
Thanks a lot for the review !
Answering your comments :
The {{{TreeMap}}} usage is safe here because the map is initialized at
initialization, then only read. On {{{MergingByteBufferAllocatorImpl}}} the
{{{TreeMap}}} manipulations are all done inside a {{{Lock}}} guard, so should
also be fine.
I will rework the {{{getCapacity()}}} to reduce it's computational cost.
The {{{ConcurrentLinkedQueue}}} is just used as a repository for free buffers.
We don't care about ordering, sorting or other, we just want to put a free
buffer, and retrieve it later. Here a {{{LinkedList}}} could fit but
concurrency is expected, I didn't find a lighter structure than this one.
The {{{ArrayList}} used in {{{MemoryManagerServiceImpl}}} is because we know
the size of the list, and we need index access. I just did it wrong, thanks for
pointing this out :) Note that buffers are not stored in this structure, but in
the {{ConcurrentLinkedQueue}} so no zillion entries here.
Regarding Guava iteration, I just copy-pasted the existing one, but I agree we
should rework on this. I will open a ticket for this point.
Thanks again for your time !
> Move Pointer.class and Pointer."statistics" into an intermediate class
> CacheEntry
> ---------------------------------------------------------------------------------
>
> Key: DIRECTMEMORY-70
> URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-70
> Project: Apache DirectMemory
> Issue Type: Improvement
> Reporter: Benoit Perroud
> Attachments:
> DIRECTMEMORY-70-MemoryManagerService-to-hide-implementation.patch,
> DIRECTMEMORY-70-byte-bufer-allocator.patch,
> DIRECTMEMORY-70-byte-bufer-allocator.patch,
> DIRECTMEMORY-72-byteBufferAllocator-v2.patch
>
>
> In order to achieve better separation of responsabilities, attributes like
> Pointer.class, Pointer.hits, Pointer.lastHit, etc. should be moved into an
> intermediate class, for instance CacheEntry.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira