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

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

Yes, Niklas's approach has merit definitely.  What we need to do is find out 
how to simplify the usage of the API.  It would be nice if Niklas gives us some 
example code.

I agree with Peter that IoServiceConfig is the place.  Plus 
ByteBuffer.allocate() should be retained for backward compatibility and ease of 
use for simple servers which doesn't require extreme performance.

Another question came out from my brain today is: do we really need a boolean 
parameter to choose the type of the buffer?  I think it should go to the area 
of configuration (e.g. choosing different allocator).  So this is another point 
of simplification IMHO.

And here's more detail on my idea about retaining the static method:

public static ByteBuffer allocate(int size) {
    Thread currentThread = Thread.currentThread();
    if( currentThread instanceof MinaWorker ) {
        return ((MinaWorker) 
currentThread).getAssociatedAllocator().allocate(...);
    } else {
        return <simple allocation code here>;
    }
}

I'd not say this is easy to implement.  Just want to know what people think 
about this approach. :)

> 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