Well, since one single connector is managing all the session, we can access and close all session from there, rather than managing our own list of connectors separately. Again, a minor difference. We don't go through and close DataChannel objects, just sessions on the connector (and rely on sessionClosed() call on datachannels to handle any cleanup)
And yes, DataChannel objects simply call connect on the connector...Again, the DataChannels were from a previous architecture before we were using MINA. They aren't particularly useful, but they're not changing to prevent massive refactoring of the interface the rest of the app uses. On Wed, Mar 11, 2009 at 4:20 PM, Emmanuel Lecharny <[email protected]> wrote: > Squee wrote: >> >> Yes, we could I suppose, but it's kinda handy to have only one >> connector to manage, especially when we need to shut it down and close >> connections, rather than running to every connector to close it down. >> Either way works, but it's definitely easier to use a single >> connector. That was one thing we liked about moving to MINA from using >> Sockets directly and managing that kind of thing ourselves. And of >> course all of the other benefits MINA provides :) >> > > There is still something mysterious to me : if you manage more than one > session, then you have more than one DataChannel opened. You will have to > close them anyway, one by one. If you use Connector instead you just have > the same problem, without the burden to use the SingleSessionIoHandler > class. > > A Session is associated to a single connection anyway. If you have > sequential sessions (ie, you establish a new one when you're done with the > previous one), you just havs to switch the handler when switching the > session. If you have parallel sessions, then you can use as many connectors > as needed to handle all the sessions, and each session will have its own > handler. > In any case, you just have to call connect(SocketChannel handle, > SocketAddress remoteAddress), which will deal with all the details you are > handling on your side not using a connector atm... > > -- > -- > cordialement, regards, > Emmanuel Lécharny > www.iktek.com > directory.apache.org > > >
