From 858495afde7f042774cbab98f7dd3128a03a0920 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 2 Mar 2020 16:14:39 +0300 Subject: [PATCH] Make CameraLogger ThreadSafe (#779) Co-authored-by: Mattia Iavarone --- .../com/otaliastudios/cameraview/CameraLogger.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraLogger.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraLogger.java index 2219455c..e2aa80af 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraLogger.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraLogger.java @@ -1,16 +1,16 @@ package com.otaliastudios.cameraview; +import android.util.Log; + import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import android.util.Log; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; /** * Utility class that can log traces and info. @@ -59,7 +59,7 @@ public final class CameraLogger { @VisibleForTesting static String lastTag; private static int sLevel; - private static List sLoggers = new ArrayList<>(); + private static Set sLoggers = new CopyOnWriteArraySet<>(); @VisibleForTesting static Logger sAndroidLogger = new Logger() { @Override