You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2015/10/31 23:12:21 UTC

incubator-groovy git commit: GROOVY-7535: Groovy category throwing MissingMethodException and MissingPropertyException when using multiple threads (closes #169)

Repository: incubator-groovy
Updated Branches:
  refs/heads/master 89135be7c -> 8a7fadcde


GROOVY-7535: Groovy category throwing MissingMethodException and MissingPropertyException when using multiple threads (closes #169)

Fixed non-atomic use of atomicCategoryUsageCounter.


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/8a7fadcd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/8a7fadcd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/8a7fadcd

Branch: refs/heads/master
Commit: 8a7fadcde85629102d20a1f490e063c682617a83
Parents: 89135be
Author: Keith Suderman <su...@cs.vassar.edu>
Authored: Sat Oct 31 15:11:33 2015 -0400
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sat Oct 31 23:10:34 2015 +0100

----------------------------------------------------------------------
 .../org/codehaus/groovy/runtime/GroovyCategorySupport.java     | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/8a7fadcd/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java b/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java
index cadf07a..1aa9f99 100644
--- a/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java
+++ b/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java
@@ -72,8 +72,7 @@ public class GroovyCategorySupport {
         private Map<String, String> propertySetterMap;
 
         private void newScope () {
-            atomicCategoryUsageCounter.incrementAndGet();
-            categoriesInUse = atomicCategoryUsageCounter.get();
+            categoriesInUse = atomicCategoryUsageCounter.incrementAndGet();
             DefaultMetaClassInfo.setCategoryUsed(true);
             VMPluginFactory.getPlugin().invalidateCallSites();
             level++;
@@ -96,8 +95,7 @@ public class GroovyCategorySupport {
                 }
             }
             level--;
-            atomicCategoryUsageCounter.getAndDecrement();
-            categoriesInUse = atomicCategoryUsageCounter.get();
+            categoriesInUse = atomicCategoryUsageCounter.decrementAndGet();
             VMPluginFactory.getPlugin().invalidateCallSites();
             if (categoriesInUse==0) DefaultMetaClassInfo.setCategoryUsed(false);
             if (level == 0) {