You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Michael Bauroth <Mi...@falcom.de> on 2006/08/05 00:59:22 UTC

ByteBuffer and Spring

Hi,

is it possible to define over a Spring config file, if the ByteBuffer 
should use heap or direct memory instead?

Regards
Michael

P.S. If somebody is interested, I could publish the resulting config 
file for demonstrating purposes, when I'm ready.

Re: ByteBuffer and Spring

Posted by Michael Bauroth <mi...@falcom.de>.
Hi Niklas,

it works indeed! :)

Thanx
Michael

Niklas Therning wrote:

> Michael Bauroth wrote:
> 
>>Hi,
>>
>>is it possible to define over a Spring config file, if the ByteBuffer
>>should use heap or direct memory instead?
>>
>>Regards
>>Michael
>>
>>P.S. If somebody is interested, I could publish the resulting config
>>file for demonstrating purposes, when I'm ready.
>>
> 
> This isn't very nice but it should work:
> 
> <bean id="notImportant"
> class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
> <property name="targetClass" value="org.apache.mina.common.ByteBuffer"/>
> <property name="targetMethod" value="setUseDirectBuffers"/>
> <property name="arguments">
> <list>
> <value>true</value>
> </list>
> </property>
> </bean>
> 
> You asked in a previous mail how to set the allocator. You could use the
> same approach:
> 
> <bean id="notImportant2"
> class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
> <property name="targetClass" value="org.apache.mina.common.ByteBuffer"/>
> <property name="targetMethod" value="setAllocator"/>
> <property name="arguments">
> <list>
> <bean class="org.apache.mina.common.SimpleByteBufferAllocator"/>
> </list>
> </property>
> </bean>
> 
> HTH
> 


Re: ByteBuffer and Spring

Posted by Niklas Therning <ni...@trillian.se>.
Michael Bauroth wrote:
> Hi,
>
> is it possible to define over a Spring config file, if the ByteBuffer
> should use heap or direct memory instead?
>
> Regards
> Michael
>
> P.S. If somebody is interested, I could publish the resulting config
> file for demonstrating purposes, when I'm ready.
>
This isn't very nice but it should work:

<bean id="notImportant"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.apache.mina.common.ByteBuffer"/>
<property name="targetMethod" value="setUseDirectBuffers"/>
<property name="arguments">
<list>
<value>true</value>
</list>
</property>
</bean>

You asked in a previous mail how to set the allocator. You could use the
same approach:

<bean id="notImportant2"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.apache.mina.common.ByteBuffer"/>
<property name="targetMethod" value="setAllocator"/>
<property name="arguments">
<list>
<bean class="org.apache.mina.common.SimpleByteBufferAllocator"/>
</list>
</property>
</bean>

HTH

-- 
Niklas Therning
www.spamdrain.net