Thread variables
Ensure that in high concurrency and multi-thread environment you do not store shared thread-specific data just in static variables. Involve thread-local storage techniques specific for technology if necessary. For example, use ThreadLocal in Java or ThreadStatic attribute in C#. Implement singleton carefully If you really need singleton (think twice before making such decision), implement it in its simplest form, do not use lazy-initialization, double-locking and other voodoo.
|