aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Parker2012-02-21 01:33:36 (EST)
committerJayaprakash Arthanareeswaran2012-02-21 01:38:09 (EST)
commit7b395b3717036fc2a84c58be444dfad51be38b89 (patch)
tree3333842b7b48aa1dd8b6724ba6a55ae274084606
parente4d4ff5013f9df9fd57cdef7bafc039c1cd3f062 (diff)
downloadeclipse.jdt.core-7b395b3717036fc2a84c58be444dfad51be38b89.zip
eclipse.jdt.core-7b395b3717036fc2a84c58be444dfad51be38b89.tar.gz
eclipse.jdt.core-7b395b3717036fc2a84c58be444dfad51be38b89.tar.bz2
HEAD - Fix for 365499: Add a system property to control for
JavaModelManager's jar type cache size
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelCache.java20
2 files changed, 18 insertions, 6 deletions
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index ab3c1f7..cd91d67 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -52,7 +52,9 @@ Eclipse SDK 3.8.0 - %date% - 3.8.0 M6
<h2>What's new in this drop</h2>
<h3>Problem Reports Fixed</h3>
-<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=368152">368152</a>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365499">365499</a>
+Add a system property to control for JavaModelManager's jar type cache size
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=368152">368152</a>
ConcurrentModificationException on startup in ExternalFoldersManager.createPendingFolders
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=244544">244544</a>
codeSelect fails on constant declaration in anonymous and local classes
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelCache.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelCache.java
index 6a049a9..eb4297c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelCache.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelCache.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Terry Parker <tparker@google.com> (Google Inc.) https://bugs.eclipse.org/365499
*******************************************************************************/
package org.eclipse.jdt.internal.core;
import java.util.HashMap;
@@ -28,6 +29,7 @@ public class JavaModelCache {
public static final int DEFAULT_OPENABLE_SIZE = 250; // average 6629 bytes per openable (includes children) -> maximum size : 662900*BASE_VALUE bytes
public static final int DEFAULT_CHILDREN_SIZE = 250*20; // average 20 children per openable
public static final String RATIO_PROPERTY = "org.eclipse.jdt.core.javamodelcache.ratio"; //$NON-NLS-1$
+ public static final String JAR_TYPE_RATIO_PROPERTY = "org.eclipse.jdt.core.javamodelcache.jartyperatio"; //$NON-NLS-1$
public static final Object NON_EXISTING_JAR_TYPE_INFO = new Object();
@@ -72,9 +74,9 @@ public class JavaModelCache {
protected LRUCache jarTypeCache;
public JavaModelCache() {
- // set the size of the caches in function of the maximum amount of memory available
+ // set the size of the caches as a function of the maximum amount of memory available
double ratio = getMemoryRatio();
- // adjust the size of the openable cache in function of the RATIO_PROPERTY property
+ // adjust the size of the openable cache using the RATIO_PROPERTY property
double openableRatio = getOpenableRatio();
this.projectCache = new HashMap(DEFAULT_PROJECT_SIZE); // NB: Don't use a LRUCache for projects as they are constantly reopened (e.g. during delta processing)
if (VERBOSE) {
@@ -91,13 +93,21 @@ public JavaModelCache() {
}
private double getOpenableRatio() {
- String property = System.getProperty(RATIO_PROPERTY);
+ return getRatioForProperty(RATIO_PROPERTY);
+}
+
+private double getJarTypeRatio() {
+ return getRatioForProperty(JAR_TYPE_RATIO_PROPERTY);
+}
+
+private double getRatioForProperty(String propertyName) {
+ String property = System.getProperty(propertyName);
if (property != null) {
try {
return Double.parseDouble(property);
} catch (NumberFormatException e) {
// ignore
- Util.log(e, "Could not parse value for " + RATIO_PROPERTY + ": " + property); //$NON-NLS-1$ //$NON-NLS-2$
+ Util.log(e, "Could not parse value for " + propertyName + ": " + property); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return 1.0;
@@ -249,7 +259,7 @@ protected void removeInfo(JavaElement element) {
}
}
protected void resetJarTypeCache() {
- this.jarTypeCache = new LRUCache((int) (DEFAULT_OPENABLE_SIZE * getMemoryRatio()));
+ this.jarTypeCache = new LRUCache((int) (DEFAULT_OPENABLE_SIZE * getMemoryRatio() * getJarTypeRatio()));
}
public String toString() {
return toStringFillingRation(""); //$NON-NLS-1$