incubator-directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit Perroud (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRECTMEMORY-70) Move Pointer.class and Pointer."statistics" into an intermediate class CacheEntry
Date Mon, 27 Feb 2012 09:55:48 GMT

    [ https://issues.apache.org/jira/browse/DIRECTMEMORY-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217132#comment-13217132
] 

Benoit Perroud commented on DIRECTMEMORY-70:
--------------------------------------------

Just to ensure I'm not completely off road, I extracted the following simplier interface to
replace the {{OffHeapMemoryBuffer}}

{{code}}
public interface ByteBufferAllocator
{
    
    /**
     * Allocate the given size off heap, or return null if the allocation failed.
     * @param size
     * @return
     */
    ByteBuffer allocate( final int size );

    /**
     * Return the given ByteBuffer making it available for a future usage 
     * @param buffer
     */
    void free( final ByteBuffer buffer );

}
{{/code}}

This is lean and easy to understand. Two implementations are (almost) ready to be used : a
merging one, i.e. where returned pointers are merged together, and a slab'style allocator,
where buffers are of the same predefined sizes (i.e. 128b, 512b, 2k, 8k, 32k,... application
specific).

{{MemoryManagerService}} is a more high level view with existing store, retrieve, free and
"collectExpire" functions, and wrap the allocated {{ByteBuffer}} in a {{Pointer}} and return
it.

{{MemoryManagerService}} is augmented with Input and OutputStream functionalities to be able
to stream in files, socket data, etc.

WDYT ?

                
> 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
>
>
> 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

        

Mime
View raw message