You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by al...@apache.org on 2024/05/23 14:29:12 UTC
(asterixdb) branch master updated: [ASTERIXDB-3405][EXT] Avoid ConcurrentModificationException in DatasourceFactoryProvider
This is an automated email from the ASF dual-hosted git repository.
alsuliman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 7d25bd875a [ASTERIXDB-3405][EXT] Avoid ConcurrentModificationException in DatasourceFactoryProvider
7d25bd875a is described below
commit 7d25bd875a7ac349d476e4545d7c9e1e82b2700a
Author: Ali Alsuliman <al...@gmail.com>
AuthorDate: Thu May 23 05:45:03 2024 +0300
[ASTERIXDB-3405][EXT] Avoid ConcurrentModificationException in DatasourceFactoryProvider
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Change-Id: Ic9dd2358ad093d3d59f838e85bc746d795638bb0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18310
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Ali Alsuliman <al...@gmail.com>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
Reviewed-by: Murtadha Hubail <mh...@apache.org>
---
.../asterix/external/provider/DatasourceFactoryProvider.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java
index b0aded657a..f35dce4aa5 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java
@@ -116,9 +116,7 @@ public class DatasourceFactoryProvider {
throw new NotImplementedException();
}
- if (factories == null) {
- initFactories();
- }
+ initFactories();
if (factories.containsKey(adaptorName)) {
Map<String, Class<?>> formatClassMap = factories.get(adaptorName);
@@ -134,7 +132,10 @@ public class DatasourceFactoryProvider {
}
}
- protected static void initFactories() throws AsterixException {
+ protected static synchronized void initFactories() throws AsterixException {
+ if (factories != null) {
+ return;
+ }
factories = new HashMap<>();
ClassLoader cl = ParserFactoryProvider.class.getClassLoader();
final Charset encoding = StandardCharsets.UTF_8;