Github user grkvlt commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/203#discussion_r68139884
--- Diff:
core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedObjectStore.java
---
@@ -94,25 +94,19 @@ public File getBaseDir() {
}
public void prepareForMasterUse() {
- if (doneFirstContentiousWrite.get())
- return;
- synchronized (this) {
- if (doneFirstContentiousWrite.get())
- return;
- try {
- if (deferredBackupNeeded) {
- // defer backup and path creation until first write
- // this way if node is standby or auto, the backup is
not created superfluously
+ if (doneFirstContentiousWrite.getAndSet(true)) return;
--- End diff --
@aledsage you're right that the semantics changed here. in fact, I think
all we need is a normal boolean and a `synchronized` critical section, the
atomic CAS aspect of the `AtomicBoolean` aren't being used here, since we can
be sure only one thread at a time is checking the value inside the critical
section. I've refactored to reflect that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---