Browse files

removing the synchronization logic for the initialized flag can curre…

…ntly not work with a mere volatile. While an EMC is doing the initialization procedure it needs a method call, done by a different thread, to wait for the init to finnish. This is not possible with a volatile and needs synchronized blocks for now. Thanks to Alex Tkachman for spotting that regression.

git-svn-id: a5544e8c-8a19-0410-ba12-f9af4593a198
  • Loading branch information...
1 parent 74d3bdc commit 2707cf76fc1716d4239888da00f4c4a987e4da94 @blackdrag blackdrag committed Mar 17, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/main/groovy/lang/
6 src/main/groovy/lang/
@@ -269,7 +269,7 @@
// These two properties are used when no ExpandoMetaClassCreationHandle is present
private MetaClass myMetaClass;
- private volatile boolean initialized;
+ private boolean initialized;
private volatile boolean modified;
private boolean initCalled;
@@ -475,11 +475,11 @@ public synchronized void initialize() {
* Checks if the meta class is initialized.
* @see groovy.lang.MetaClassImpl#isInitialized()
- protected boolean isInitialized() {
+ protected synchronized boolean isInitialized() {
return this.initialized;
- protected void setInitialized(boolean b) {
+ protected synchronized void setInitialized(boolean b) {
this.initialized = b;

0 comments on commit 2707cf7

Please sign in to comment.