Skip to content

Commit

Permalink
Remove duplicate ReferenceBundle definitions (closes #249)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jwagenleitner committed Jan 28, 2016
1 parent d26bdd4 commit b5f0396
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/org/codehaus/groovy/util/ReferenceBundle.java
Expand Up @@ -38,7 +38,7 @@ public ReferenceManager getManager() {
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);
Expand Down
25 changes: 12 additions & 13 deletions src/main/org/codehaus/groovy/util/ReferenceManager.java
Expand Up @@ -156,21 +156,20 @@ public void stopThread() {}
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();
}
}

0 comments on commit b5f0396

Please sign in to comment.