Hi 向秦贤,

thank you for your prompt replay.
The code I am writing is a Diameter test client
(http://www.ietf.org/rfc/rfc4006.txt). I have to simulate a load caming
from a multi-threaded server that uses Diameter for Accounting purposes.
Because of that the different commands sent from the different threads
are not related each other.
I was thinking not to use any queue in order to gather all the commands
but I wanted to directly use IoSession from the different thread to send
the commands.
If I understand correctly IoSession does not support concurrent use of
the sendMessage method, in this case I must use some sort of queueuing
in order to serialize the commands sent by the different threads.

thanks again
Stefano

向秦贤 wrote:
> Hi,
> Just awt event processing like.
> there are
> 1,don't share IoSession self in multiple thread. If there are some stuff
> need shared, just create other state object by yourself, IoSession should
> not and not know your state.
> 2, even if mina to do it with queue support, nor use it. Your protocol
> must
> assure some order of command.
> 3, I guess if you want Full Duplex works, but you must assure command
> orders. As I known, there are few protocol works in network in tcp. udp
> works for it. If tcp, you can check out jira with a ftp client provide
> multiple IoSession community local.
>
> Regards
>
> 2007/7/13, Stefano Antonelli <[EMAIL PROTECTED]>:
>>
>> Hi All,
>>
>> I want to write a multi threaded client protocol using Mina but I am
>> having some problem.
>>
>> I did the fallowing:
>> - I wrote a ProtocolDecoded/ProtocolEncoder ant tested it carefully
>> - The protocol is TCP
>> - The usage scenario is:
>>
>> 1. I configure a Connector to use the Encoder/Decoder
>> 2. I connect it and get The IoSession
>> 3. I share the IoSession between some threads. Each thread calls
>> session.write, that means taht the IoSession is accessed
>> concurrently.
>> 4. I also wrote an IoHandler class in order to process the answer
>> from the server
>>
>> The problem is that it is working ok with just one thread but it is
>> failing to send some message in a multi threaded scenario.
>> I checked my code and it seems ok.
>> Am I doing something wrong with Mina? Is it ok to concurrently access
>> the
>> IoSession from different threads?
>>
>> Thank you all
>>
>> Stefano
>>
>>
>
>

Reply via email to