We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d97043 commit 7ab799cCopy full SHA for 7ab799c
singleton/src/test/java/com/iluwatar/singleton/LazyLoadedSingletonThreadSafetyTest.java
@@ -3,6 +3,7 @@
3
import org.junit.Test;
4
5
import java.util.ArrayList;
6
+import java.util.Collections;
7
import java.util.List;
8
import java.util.concurrent.*;
9
@@ -18,7 +19,7 @@
18
19
public class LazyLoadedSingletonThreadSafetyTest {
20
21
private static final int NUM_THREADS = 5;
- private List<ThreadSafeLazyLoadedIvoryTower> threadObjects = new ArrayList<>();
22
+ private List<ThreadSafeLazyLoadedIvoryTower> threadObjects = Collections.synchronizedList(new ArrayList<>());
23
24
//NullObject class so Callable has to return something
25
private class NullObject{private NullObject(){}}
0 commit comments