mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Heath <mhe...@apache.org>
Subject Re: Reusing SocketConnector
Date Fri, 12 Oct 2007 19:21:10 GMT
chihiro wrote:
> My requirement is simple:
> 1) Object <=read from a queue (ConcurrentLinkedQueue)
> 2) Connect to a remote server via MINA and transmit the Object.
> In one of the previous posts, Trustin mentioned that one could just reuse
> the SocketConnector
> if one were connecting to the same host.
> Being a newbie to MINA:
> a) Is it ok for me to reuse the SocketConnector in each thread but just pass
> in a different IoHandler to connect( ... ) ?
> b) What does the handler.multiton package give me ? Are there samples on how
> to use it ?
> c) I'm starting a new Thread whenever a new item is dequeued. Is this a wise
> move ?

a) I don't see anything in the MINA API for specifying an IoHandler when 
calling connect(...) but this might be a good feature to add.

b) handler.multiton routes message to different handlers based on the 
class type of the messages received.

c) I don't see why you would want to start a new thread since everything 
in MINA is done asynchronously and MINA uses it's own threads for IO. 
Perhaps you could elaborate on why you're doing this.


View raw message