dev@grizzly.java.net

Re: Grizzly 2.0 TCPNIOTransportFilter

From: John ROM <snake-john_at_gmx.de>
Date: Mon, 15 Dec 2008 16:22:31 +0100

>
> >
> > 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?
Yes super that should work nicely and looks much better (-:

>
> WBR,
> Alexey.
>

>

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger