[ 
http://issues.apache.org/jira/browse/DIRMINA-210?page=comments#action_12377753 
] 

Trustin Lee commented on DIRMINA-210:
-------------------------------------

The question here is how we can let user allocate buffers.  Why I chose the use 
of static method was because it was very easy to use everywhere.  Unlike NIO 
buffers, we have our own allocation strategy which is plugged in globally.  The 
problem we're discussing arises when we want a multiple allocators for multiple 
services.

Here's my idea about resolving this issue:

1) Make MINA can have multiple allocators.
2) Let user can specify the name or type of the allocator it wants to use.  If 
not specified, the default one is used.   We could also store the current 
allocator in thread local though I'm not sure using ThreadLocal will be OK 
under extreme situation.

I don't like getting allocator by calling a method such as 
IoSession.getAllocator(), because the code will be not as simple as before.

> Investigate removal of static methods in ByteBuffer
> ---------------------------------------------------
>
>          Key: DIRMINA-210
>          URL: http://issues.apache.org/jira/browse/DIRMINA-210
>      Project: Directory MINA
>         Type: Improvement

>     Reporter: peter royal
>     Assignee: peter royal

>
> The removal of the static methods in ByteBuffer should be investigated. 
> Since the ByteBufferAllocator exists, that interface could be used directly. 
> For backwards compatibility ( and simple cases ), the static methods could be 
> retained and use a supplied instance. 
> Potentially, the MINA internals could all access buffers via the allocator, 
> leaving only user-code to use the optional static methods (after statically 
> supplying the allocator).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to