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

Reply via email to