Concurrency issues

Feb 6, 2014 at 7:05 PM

I have recently taken over some code source written few years ago based on this protocol handler. I found several suspicious error messages in the logs and traced them back to what I think are concurrency issues.

Initially, not knowing where this code was from and not fully understanding it, I went on and started refactoring, introducing thread-safe collections and locks I managed to get rid of the error messages but unfortunately, the refactoring seems to have "broken" the logic; the searches now return inconsistent information. i..e. duplicated properties, mixed up IDs, etc...

Does anyone have suggestion regarding this handler and the fact that it is invoked in a multi threaded fashion?
Am I right in thinking that this code is not thread-safe?

Thanks in advance.