aboutsummaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
Diffstat (limited to 'third_party')
-rw-r--r--third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventCache.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventCache.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventCache.java
index 3d8775f..d150987 100644
--- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventCache.java
+++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventCache.java
@@ -42,9 +42,13 @@ public class EventCache {
private EventCache() {}
- public static synchronized EventCache getInstance() {
+ public static EventCache getInstance() {
if (mEventCache == null) {
- mEventCache = new EventCache();
+ synchronized (EventCache.class) {
+ if (mEventCache == null) {
+ mEventCache = new EventCache();
+ }
+ }
}
return mEventCache;
}