Fix concurrency issue in OpenTelemetryDriver
Fixes
@@ -32,10 +32,11 @@ import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Properties;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;
import javax.annotation.Nullable;
@@ -51,7 +52,7 @@ public final class OpenTelemetryDriver implements Driver {
private static final String URL_PREFIX = "jdbc:otel:";
private static final AtomicBoolean REGISTERED = new AtomicBoolean();
- private static final Collection<Driver> DRIVER_CANDIDATES = new ArrayList<>();
+ private static final List<Driver> DRIVER_CANDIDATES = new CopyOnWriteArrayList<>();
static {
try {
