Feed on
 Posts
 Comments
Java Beans dot Asia

Just a few simple tutorials …

Category Archive for 'threads'

… While locking can prevent iterators from throwing ConcurrentMofdificationException, You have to remember to use locking everywhere a shared collection might be iterated. This is trickier than it sounds … Brian Goetz p.83-84 Question: The following code could throw ConcurrentMofdificationException, even though add() is synchronized, why? public class HiddenIterator { private final Set set = [...]

Read Full Post »

There are several ways to initialize singleton object. Some are thread safe and some are not. Until the last two days I thought that double-checked locking idiom offers the best solution for singleton initialization in multi threaded environment. Well its not. To begin, I want to describe briefly several ways to initialize singleton: Lazy initialization [...]

Read Full Post »


Page 1 of 11