Design problem :
Using a non-thread-safe component (Collection, API, ...) in/with a multithread component ...
Example :
component1 : A multithread socket server who send messages ... to a message handler
component2 : A non-thread-safe message handler who process messages ... from a server
My solution :
Adding a thread-safe component ( buffer ) between the server and the message handler, the buffer will receive messages in multithread manner from the server and send them in the same order to the message handler in a single thread manner.
My question :
Is there a better solution ? an appropriate design pattern may be proxy or pipeline ?