mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Myint <andymy...@gmail.com>
Subject How to make IoAcceptor Multi thread
Date Wed, 10 Jun 2009 07:08:48 GMT
Do I need to make my IoHandler thread-safe?

It depends on your implementation. If you access the resource which is
shared across multiple sessions, you have to make it thread-safe. If the
resource is not shared at all and accessed by only one session (e.g. storing
context information as a session attribute), then you don't need to make it
thread-safe. It is because all events generated by MINA are transmitted to
your handler in order (when using the Executor Filter), and the newer event
is not processed if the event handler method for the older event for the
same session hasn't returned yet.


IoAcceptor is processing message in order. How can I make IoAcceptor send
event to iohandler asynchronously so that iohandler will be receving events
without having to wait for previous one to be finished. Following is my
spring config.


    <bean id="ioAcceptorUDP"
class="org.apache.mina.transport.socket.nio.NioDatagramAcceptor"
init-method="bind" destroy-method="unbind">
        <property name="defaultLocalAddress" value="${listener.port.udp}" />
        <property name="handler" ref="udpHandler" />
        <property name="filterChainBuilder" ref="filterChainBuilder" />
    </bean>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message