Trustin,

As someone pointed out in another thread there could still be a
visibility problem, when multiple threads access the same objects,
even when they don't do it concurrently.

I am not an expert on concurrency, I just remember that visibility is
very subtle.
I would have to re-read the chapter on visibility in "Java
Concurrencty in Practice"
to be sure if there is a problem in this case. I don't think there is, though.
I will try to have a look tonight.

http://safari.java.net/0321349601/ch03

Maarten


On 3/27/07, Trustin Lee <[EMAIL PROTECTED]> wrote:
Hi Haviv,

On 3/26/07, Haviv <[EMAIL PROTECTED]> wrote:
> I am working on MINA 1.0.1 , using a custom ProtocolDecoder which extends
> the CumulativeProtocolDecoder.
> I am also using an ExecutorFilter in front of the ProtocolCodecFilter -
> meaning that my ProtocolDecoder runs
> multi threaded.
> Recently under Heavy load I have encountered some strange errors - my
> received messages got corrupted.
> After looking at the CumulativeProtocolDecoder - I was wondering why there
> isn't any synchronization block
> on CumulativeProtocolDecoder.decode method which can prevent this kind of
> behavior ?

CumulativeProtocolDecoder doesn't need to synchronize anything because
ExecutorFilter guarantees that only one event per session is processed
at the same time.

Did wrapping the code with the synchronized block fix your problem?
Could you provide us that reproduces the problem so we can make sure
if it is really a bug of CumulativeProtocolDecoder before blindly
applying your fix?

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to