groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject groovy git commit: Remove duplicate ReferenceBundle definitions (closes #249)
Date Thu, 28 Jan 2016 04:00:05 GMT
Repository: groovy
Updated Branches:
  refs/heads/master d26bdd416 -> b5f039685


Remove duplicate ReferenceBundle definitions (closes #249)

Removed static initialization of default Soft/Weak bundles in ReferenceManager class.  The
methods in that class were not used in the codebase.  Looking at the history of those static
bundle references it appeared that 500 was the original threshold setting.  Typical startup
creates roughly 1000 managed references, so 500 seems like a more appropriate value than 5000.


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

Branch: refs/heads/master
Commit: b5f0396855d79a772add2702d17a6dca31b46355
Parents: d26bdd4
Author: John Wagenleitner <jwagenleitner@apache.org>
Authored: Tue Jan 26 20:38:35 2016 -0800
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Wed Jan 27 19:59:02 2016 -0800

----------------------------------------------------------------------
 .../codehaus/groovy/util/ReferenceBundle.java   |  2 +-
 .../codehaus/groovy/util/ReferenceManager.java  | 25 ++++++++++----------
 2 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b5f03968/src/main/org/codehaus/groovy/util/ReferenceBundle.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/util/ReferenceBundle.java b/src/main/org/codehaus/groovy/util/ReferenceBundle.java
index cab1479..6ba9085 100644
--- a/src/main/org/codehaus/groovy/util/ReferenceBundle.java
+++ b/src/main/org/codehaus/groovy/util/ReferenceBundle.java
@@ -38,7 +38,7 @@ public class ReferenceBundle{
     static {
         ReferenceQueue queue = new ReferenceQueue();
         ReferenceManager callBack = ReferenceManager.createCallBackedManager(queue);
-        ReferenceManager manager  = ReferenceManager.createThresholdedIdlingManager(queue,
callBack, 5000);
+        ReferenceManager manager  = ReferenceManager.createThresholdedIdlingManager(queue,
callBack, 500);
         softReferences = new ReferenceBundle(manager, ReferenceType.SOFT);
         weakReferences = new ReferenceBundle(manager, ReferenceType.WEAK);
         phantomReferences = new ReferenceBundle(manager, ReferenceType.PHANTOM);

http://git-wip-us.apache.org/repos/asf/groovy/blob/b5f03968/src/main/org/codehaus/groovy/util/ReferenceManager.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/util/ReferenceManager.java b/src/main/org/codehaus/groovy/util/ReferenceManager.java
index 2e40f09..1059214 100644
--- a/src/main/org/codehaus/groovy/util/ReferenceManager.java
+++ b/src/main/org/codehaus/groovy/util/ReferenceManager.java
@@ -156,21 +156,20 @@ public class ReferenceManager {
     public String toString() {
         return "ReferenceManager(idling)";
     }
-    
-    private static final ReferenceBundle SOFT_BUNDLE, WEAK_BUNDLE;
-    static {
-        ReferenceQueue queue = new ReferenceQueue();
-        ReferenceManager callBack = ReferenceManager.createCallBackedManager(queue);
-        ReferenceManager manager  = ReferenceManager.createThresholdedIdlingManager(queue,
callBack, 500);
-        SOFT_BUNDLE = new ReferenceBundle(manager, ReferenceType.SOFT);
-        WEAK_BUNDLE = new ReferenceBundle(manager, ReferenceType.WEAK);
-    }
-    
+
+    /**
+     * @deprecated use {@link ReferenceBundle#getSoftBundle()}
+     */
+    @Deprecated
     public static ReferenceBundle getDefaultSoftBundle() {
-        return SOFT_BUNDLE;
+        return ReferenceBundle.getSoftBundle();
     }
-    
+
+    /**
+     * @deprecated use {@link ReferenceBundle#getWeakBundle()}
+     */
+    @Deprecated
     public static ReferenceBundle getDefaultWeakBundle() {
-        return WEAK_BUNDLE;
+        return ReferenceBundle.getWeakBundle();
     }
 }


Mime
View raw message