1.1 --- a/samples/reentrant/src/org/apidesign/reentrant/CriticalSectionReentrantImmutable.java Sat Jun 14 10:04:19 2008 +0200
1.2 +++ b/samples/reentrant/src/org/apidesign/reentrant/CriticalSectionReentrantImmutable.java Sat Jun 14 10:04:34 2008 +0200
1.3 @@ -13,7 +13,10 @@
1.4 // BEGIN: reentrant.merge.immutable
1.5 public int sumBigger(Collection<T> args) {
1.6 for (;;) {
1.7 - ImmutableData<T> previous = this.data;
1.8 + ImmutableData<T> previous;
1.9 + synchronized (this) {
1.10 + previous = this.data;
1.11 + }
1.12 int[] ret = { 0 };
1.13 ImmutableData<T> now = doCriticalSection(args, previous, ret);
1.14