arjun4084346 commented on code in PR #3857:
URL: https://github.com/apache/gobblin/pull/3857#discussion_r1450982068
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/FlowSpec.java:
##########
@@ -75,13 +78,22 @@ public class FlowSpec implements Configurable, Spec {
/** Human-readable description of the flow spec */
final String description;
- /** Flow config as a typesafe config object */
- final Config config;
+ /* Note that since getConfig() and getConfigAsProperties() are independent
accessors, `volatile` doesn't ensure a
+ * consistent view between them. In a multi-threaded scenario one should use
the following access mechanism:
+ * FlowSpec fs = ...
+ * synchronized (fs) {
Review Comment:
suggesting users to syncronized over the entire `FlowSpec` does not look
good.
Also, it looks a unnecessary usage of calling `getConfig` and
`getConfigAsProperties` and compare both.
Both the fields can *momentarily* have different value, but that's not a
problem as long as only `syncronized addProperty` method has write access to
them.
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/FlowSpec.java:
##########
@@ -75,13 +78,22 @@ public class FlowSpec implements Configurable, Spec {
/** Human-readable description of the flow spec */
final String description;
- /** Flow config as a typesafe config object */
- final Config config;
+ /* Note that since getConfig() and getConfigAsProperties() are independent
accessors, `volatile` doesn't ensure a
+ * consistent view between them. In a multi-threaded scenario one should use
the following access mechanism:
+ * FlowSpec fs = ...
+ * synchronized (fs) {
Review Comment:
suggesting users to syncronized over the entire `FlowSpec` does not look
good.
Also, it looks a unnecessary usage of calling `getConfig` and
`getConfigAsProperties` and compare both.
Both the fields can ***momentarily*** have different value, but that's not a
problem as long as only `syncronized addProperty` method has write access to
them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]