directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From harm...@kodemuse.com
Subject Re: [eve] BufferPool Implementation
Date Fri, 12 Dec 2003 02:22:37 GMT
----- Original Message -----
From: Alex Karasulu <aok123@bellsouth.net>

> what do you think about the BufferPool


few Questions 


A) Would it be better to hide the pooling or not semantics inside the implementation.  

Would it better to rename BufferPool to BufferManager.
and have something like this: 

interface BufferManager
{
   // get a buffer. Hides pooling, reuse etc.
   Buffer getBuffer(long size, BufferUsage intendedUsageHint);

   // get a buffer of default size. Default is implementation 
   // dependent and may be set during configuration.
   Buffer getBuffer(BufferUsage intendedUsage);

   // a buffer obtained by BufferManager may be returned for future reuse.
   void release(Buffer buffer);
}

Where BufferUsage could be an enum like object to indicate intendedUsage hint. This may cause
BufferManager to give a memory mapped, direct or byte  buffer.

B) Is it a good idea to expose BufferPoolConfig ? Why would a user of BufferPool want to know
about it's internal configuration.

C) Why is a good idea to pass a_party at claim, release time. A buffer could be obtained by
one object but be operated on by other object. Object 'done with' a buffer may not know about
the initial requestor of Buffer.


You may have thought about this, but thought i'd ask rather than have the Pool nibble me.


> If anyone knows of one out there let me know.

There is one under JMule.
http://jmule.sourceforge.net/doc/javadoc/org/jmule/core/util/ByteBufferFactory.html

It has a stack with methods to lazily create, pop and push buffers.

Harmeet



Mime
View raw message