Actually, this was a bad idea...
The pb with the semaphore is that it creates a lock that is global for an instance of the codec filter. If one don't crate as many filter as there are sessions, then this will create a bottleneck.
The synchronized(decoder) is also a problem though : it creates a bottleneck on the decoder, which might not be instanciated for each session, but shared. In this case, we have a serialization of the decoding across all the server, which is even worse (and that was what this patch was trying to solve, AFAICT).
The right solution would instead be to synchronized on the session, because there is no way that could create a bottleneck :
- each session will be able to use the decoder at will, in a serial way
- a session won't lock another session during a decoding
A side remark : on TCP, there is no reason we should have an executor being present before the decoder, because that would forbid the decoding of a split messages. On UDP, there is no such problem, so we may want later to remove the synchronized section when we are on UDP.