Data integrity first

Multi-threaded code can be complex. With the advent of java.util.concurrent, multi-threaded code can now usually be written at a higher level than was previously possible. However, multi-threaded code can still be complex.

One should likely treat the basic thread-safety of a class as being fundamental. Performance optimizations and "tricky" code should likely be avoided unless they are really necessary.

As usual, when faced with various implementation decisions, one should weigh carefully the pros and cons, such as:

For example, using a read-write lock with a Map might be tempting in a given circumstance, but you'll likely find that a ConcurrentHashMap works just fine.

Would you use this technique?
Yes   No   Undecided   
© 2018 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
Over 2,000,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -