directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <trus...@gmail.com>
Subject Re: Is MINA's ProtocolSession thread safe?
Date Wed, 18 May 2005 23:56:09 GMT
Hi Horia,

2005/5/18, Horia Muntean <horia.muntean@gmail.com>:
> Is Mina's ProtocolSession thread safe?
> 
> Suppose one has 2 threads that call session.write("hello"). What is the
> result of such situation?

First, all write requests are transferred to
ProtocolFilter.filterWrite() and IoFilter.filterWrite() of registered
filters.  The evaluation order is the exact reverse of filter chain
order.  That is, the evaluation order is C -> B -> A if your filter
chain is A->B->C.  There is no synchronization at this step.  If
you've implemented a filter, you'll have to check your filterWrite is
thread-safe.

Second, the final ByteBuffer is queued to session write queue.  This
process is fully synchronized, so you don't need to worry about it.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/

Mime
View raw message