aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Bruch2012-05-21 12:51:48 (EDT)
committerMarcel Bruch2012-05-21 12:51:48 (EDT)
commit01643195856375e47ad1d2cd5dd002d42c56b742 (patch)
treecb8bd125d0039fc3649d4bde5d2529fdfab57299
parente684cb843b3c56d7f190e272c6d6a6f2b37ca926 (diff)
downloadorg.eclipse.recommenders-01643195856375e47ad1d2cd5dd002d42c56b742.zip
org.eclipse.recommenders-01643195856375e47ad1d2cd5dd002d42c56b742.tar.gz
org.eclipse.recommenders-01643195856375e47ad1d2cd5dd002d42c56b742.tar.bz2
[calls] added simple model size filter to prevent long loading times and
huge memory consumption. We've need a smarter way to store recommendation models in a more condensed way... Change-Id: I849e690ca6c64ce1e9c2bc86718df14012163dfc
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallNetZipModelFactory.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallNetZipModelFactory.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallNetZipModelFactory.java
index 6824337..c117991 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallNetZipModelFactory.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallNetZipModelFactory.java
@@ -28,6 +28,9 @@ import com.google.common.io.Closeables;
public class CallNetZipModelFactory extends ZipPoolableModelFactory<IType, IObjectMethodCallsNet> {
+ // 64mb object output stream
+ private static final long MAX_MODEL_SIZE = 64 * 1024 * 1024;
+
private final JavaElementResolver jdtResolver;
public CallNetZipModelFactory(File zip, JavaElementResolver jdtResolver) throws IOException {
@@ -43,7 +46,11 @@ public class CallNetZipModelFactory extends ZipPoolableModelFactory<IType, IObje
private ZipEntry getEntry(IType jType) {
ITypeName rType = toRecName(jType);
String name = rType.getIdentifier().substring(1) + ".data";
- return zip.getEntry(name);
+ ZipEntry entry = zip.getEntry(name);
+ if (entry.getSize() > MAX_MODEL_SIZE) {
+ return null;
+ }
+ return entry;
}
private ITypeName toRecName(IType jType) {