You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pa...@apache.org on 2019/12/20 17:37:21 UTC
[camel] branch master updated: Fix race conditions in
double-checked locking object initializations.
This is an automated email from the ASF dual-hosted git repository.
pascalschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 4c8c071 Fix race conditions in double-checked locking object initializations.
4c8c071 is described below
commit 4c8c071fba493dbf41f09103712036805133a5a8
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Fri Dec 20 14:36:58 2019 +0100
Fix race conditions in double-checked locking object initializations.
---
.../camel/dataformat/univocity/AbstractUniVocityDataFormat.java | 4 ++--
.../src/main/java/org/apache/camel/impl/engine/ServicePool.java | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
index d53f33e..edf11fd4 100644
--- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
+++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
@@ -83,8 +83,8 @@ public abstract class AbstractUniVocityDataFormat<F extends Format, CWS extends
if (writerSettings == null) {
synchronized (writerSettingsToken) {
if (writerSettings == null) {
- writerSettings = createAndConfigureWriterSettings();
marshaller = new Marshaller<>(headers, headers == null);
+ writerSettings = createAndConfigureWriterSettings();
}
}
}
@@ -105,13 +105,13 @@ public abstract class AbstractUniVocityDataFormat<F extends Format, CWS extends
if (parserSettings == null) {
synchronized (parserSettingsToken) {
if (parserSettings == null) {
+ unmarshaller = new Unmarshaller<>(lazyLoad, asMap);
parserSettings = new ThreadLocal<CPS>() {
@Override
protected CPS initialValue() {
return createAndConfigureParserSettings();
}
};
- unmarshaller = new Unmarshaller<>(lazyLoad, asMap);
}
}
}
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/ServicePool.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/ServicePool.java
index a75cdd6..3efe0a7 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/ServicePool.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/ServicePool.java
@@ -230,8 +230,9 @@ public class ServicePool<S extends Service> extends ServiceSupport implements No
if (s == null) {
synchronized (this) {
if (s == null) {
- s = producer.apply(endpoint);
- endpoint.getCamelContext().addService(s, true, true);
+ S tempS = producer.apply(endpoint);
+ endpoint.getCamelContext().addService(tempS, true, true);
+ s = tempS;
}
}
}