Hi Tigran,
we'll probably need to introduce another allowBufferDispose method in
CompositeBuffer, which will propagate the dispose flag to underlying
Buffers.
Now when you dispose CompositeBuffer, if its allowInternalBuffersDispose
flag is true, it iterates over all the internal Buffers and calls
internalBuffer.tryDispose(). So it's up to each internal Buffer to
decide if it wants to be disposed or not.
Specifically for CompositeBuffer, allowBufferDispose means whether this
CompositeBuffer instance will or will not be returned to a thread-local
object cache after CompositeBuffer.tryDispose is called.
Thanks.
WBR,
Alexey.
On 03/22/2012 04:03 PM, Tigran Mkrtchyan wrote:
> test case attached
>
> On Thu, Mar 22, 2012 at 3:43 PM, Tigran Mkrtchyan
> <tigran.mkrtchyan_at_desy.de> wrote:
>> Hi,
>>
>> I have a following code:
>>
>> Buffer buffer1 = ...;
>> Buffer buffer2 = ...;
>>
>> Buffer composite = BuffersBuffer.create(MemoryManager.DEFAULT_MEMORY_MANAGER,
>> buffer1, buffer2 );
>> composite.allowBufferDispose(true);
>>
>> At this point I expect that
>>
>> composite.tryDispose() and composite.dispose() will dispose buffer1 and buffer2.
>>
>> Nevertheless this is not the case. I think
>>
>> composite.allowBufferDispose(true);
>>
>> have to propagate to buffer1 and buffer2 or
>>
>> BuffersBuffer.removeAndDisposeBuffers have to call dispose on
>> underlying buffers instead of tryDispose.
>>
>> Tigran.