Threading
-
I'm developing a
Formatter
class which will be used in a Web app. The formatter is responsible for replacing an occurrence of a text with some other text - regular expressions. I've coded aTextReplacement
class which holds match and replacement values. Next, I created a collection (TextReplacementCollection
) for it. I thought it would be a good idea to allow user to have more than oneTextReplacementCollection
instance in aFormatter
so I've made another collection of key-and-value pairs -TextReplacementCollectionDictionary
. For example, one collection could be used for replacing smiles and the other for securing html. Now I'm concern about the multithreading and performance issues. For example, one of the collection is being changed (admin page) and at the same time the formatter is using it for a formatting operation (forum page). What technique should I use to synchronize the collections so that it wouldn't slow the whole site down and wouldn't bring any unpredictable results?
43 68 65 65 72 73 2c 4d 69 63 68 61 65 6c