Trustin Lee wrote:
Hi,
In MINA 1.1, we can call IoService.setHandler() whenever we want. Any
incoming connections will use the handler currently set. But is it a good
way to set different handler for different sessions in the same
service? We
didn't have this problem in 1.0 because we had to specify the handler as a
parameter in a bind() call. It was not supposed to be changed at that
time.
Any feed back and your user story would be appreciated.
Thanks in advance,
Trustin
Do we need a setHandler() method in the interface at all? I would be
fine with having to specify it in the constructor when creating my
SocketAcceptor, SocketConnector, etc. In that case there shouldn't be
any non-args constructor in these classes.
Or we could just throw IllegalStateException once the service is in use
(bind() called or connect(addr) called at least once) and make sure we
document this. IMO, it would be a bad idea to let the user change the
handler once the service is in use.
/Niklas