dev@grizzly.java.net

Re: Grizzly 2.0 TCPNIOTransportFilter

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Mon, 15 Dec 2008 16:06:05 +0100

Hi John,

>
> does a flag in TCPNIOTransportFilter indicating that Grizzly should
> always request a new BufferWrapper
> from MemoryManager make sense?
>
> I am asking because I know that I will be handing ByteBuffer to a
> different Thread and also
> be using SlabMemoryManager which anyway tries to reuse ByteBuffers....
>
> Or should we have another TransportFilter?
So in other words, you want to remove code, from
TCPNIOTransportFilter, which tries to retrieve Buffer from
WorkerThread, but use MemoryManager (Allocator) all the time, right?
So this should be removed:

(1)
    --------------- REMOVE BLOCK START -----------------------
         if (buffer == null) {

             WorkerThread thread = (WorkerThread)
Thread.currentThread();
             AttributeHolder workerThreadAttributes =
thread.obtainAttributes();
             buffer =
threadAssociatedBuffer.get(workerThreadAttributes);

             if (buffer == null) {
                 buffer = transport.getMemoryManager().
                         allocate(defaultBufferSize);

                 threadAssociatedBuffer.set(workerThreadAttributes,
buffer);
             }
         }
-------------- REMOVE BLOCK END -----------------------------

and remain just this:
(2)
                 buffer = transport.getMemoryManager().
                         allocate(defaultBufferSize);

Actually, once SlabMemoryManager will be more or less tested - it
could be good to make this manager default.
So, basically, we can make (2) default behavior for
TCPNIOTransportFilter. And memory manager will be responsible for
caching buffers.

What do you think?

WBR,
Alexey.

>
>
> Many Greetings
> John
> --
> Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL
> für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>