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 <[email protected]>
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 <[email protected]>
Tested-by: Ali Alsuliman <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>
Reviewed-by: Murtadha Hubail <[email protected]>
---
.../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;