diff options
author | Andrew Johnson | 2010-01-14 10:11:31 +0000 |
---|---|---|
committer | Andrew Johnson | 2010-01-14 10:11:31 +0000 |
commit | 92fdbf0b5d7777fba29093c2fb4bc954b3084f0a (patch) | |
tree | 781b32b18fc92da458fc9eecd000e90a55a1cee2 | |
parent | b95056478d769a80449e44b69303f87f468326a0 (diff) | |
download | org.eclipse.mat-92fdbf0b5d7777fba29093c2fb4bc954b3084f0a.tar.gz org.eclipse.mat-92fdbf0b5d7777fba29093c2fb4bc954b3084f0a.tar.xz org.eclipse.mat-92fdbf0b5d7777fba29093c2fb4bc954b3084f0a.zip |
295603 Progress bars and messages for reopening dumps
4 files changed, 26 insertions, 1 deletions
diff --git a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/Messages.java b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/Messages.java index d5e0489a..613ff0fd 100644 --- a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/Messages.java +++ b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/Messages.java @@ -42,6 +42,8 @@ public class Messages extends NLS public static String SnapshotFactoryImpl_Error_OpeningHeapDump;
public static String SnapshotFactoryImpl_Error_ReparsingHeapDump;
public static String SnapshotFactoryImpl_ErrorOpeningHeapDump;
+ public static String SnapshotFactoryImpl_ReparsingHeapDumpAsIndexOutOfDate;
+ public static String SnapshotFactoryImpl_ReparsingHeapDumpWithOutOfDateIndex;
public static String SnapshotImpl_BuildingHistogram;
public static String SnapshotImpl_Error_DomTreeNotAvailable;
public static String SnapshotImpl_Error_ObjectNotFound;
@@ -53,6 +55,7 @@ public class Messages extends NLS public static String SnapshotImpl_Label;
public static String SnapshotImpl_ReadingInboundReferrers;
public static String SnapshotImpl_ReadingOutboundReferrers;
+ public static String SnapshotImpl_ReopeningParsedHeapDumpFile;
public static String SnapshotImpl_RetrievingDominators;
public static String ObjectArrayImpl_forArray;
public static String ObjectMarker_CalculateRetainedSize;
diff --git a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotFactoryImpl.java b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotFactoryImpl.java index f2f0592f..e362eeb5 100644 --- a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotFactoryImpl.java +++ b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotFactoryImpl.java @@ -15,6 +15,7 @@ import java.io.FileFilter; import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -87,6 +88,14 @@ public class SnapshotFactoryImpl implements SnapshotFactory.Implementation {
answer = SnapshotImpl.readFromFile(file, prefix, listener);
}
+ else
+ {
+ String message = MessageUtil.format(Messages.SnapshotFactoryImpl_ReparsingHeapDumpAsIndexOutOfDate,
+ file.getPath(), new Date(file.lastModified()),
+ indexFile.getPath(), new Date(indexFile.lastModified()));
+ listener.sendUserMessage(Severity.INFO, message, null);
+ listener.subTask(Messages.SnapshotFactoryImpl_ReparsingHeapDumpWithOutOfDateIndex);
+ }
}
}
catch (IOException ignore_and_reparse)
@@ -95,6 +104,7 @@ public class SnapshotFactoryImpl implements SnapshotFactory.Implementation : ignore_and_reparse.getClass().getName();
String message = MessageUtil.format(Messages.SnapshotFactoryImpl_Error_ReparsingHeapDump, text);
listener.sendUserMessage(Severity.WARNING, message, ignore_and_reparse);
+ listener.subTask(message);
}
if (answer == null)
diff --git a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotImpl.java b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotImpl.java index b3e1b2e1..c0b38c61 100644 --- a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotImpl.java +++ b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotImpl.java @@ -92,9 +92,12 @@ public final class SnapshotImpl implements ISnapshot {
FileInputStream fis = null;
+ listener.beginTask(Messages.SnapshotImpl_ReopeningParsedHeapDumpFile, 9);
+
try
{
fis = new FileInputStream(prefix + "index");//$NON-NLS-1$
+ listener.worked(1);
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(fis));
String version = in.readUTF();
@@ -105,6 +108,7 @@ public final class SnapshotImpl implements ISnapshot Parser parser = ParserPlugin.getDefault().getParserRegistry().lookupParser(objectReaderUniqueIdentifier);
if (parser == null)
throw new IOException(Messages.SnapshotImpl_Error_ParserNotFound + objectReaderUniqueIdentifier);
+ listener.worked(1);
IObjectReader heapObjectReader = parser.create(IObjectReader.class, ParserRegistry.OBJECT_READER);
XSnapshotInfo snapshotInfo = (XSnapshotInfo) in.readObject();
@@ -118,19 +122,23 @@ public final class SnapshotImpl implements ISnapshot HashMapIntObject<HashMapIntObject<XGCRootInfo[]>> rootsPerThread = (HashMapIntObject<HashMapIntObject<XGCRootInfo[]>>) in
.readObject();
+ listener.worked(1);
if (listener.isCanceled())
throw new IProgressListener.OperationCanceledException();
HashMapIntObject<String> loaderLabels = (HashMapIntObject<String>) in.readObject();
BitField arrayObjects = (BitField) in.readObject();
+ listener.worked(3);
snapshotInfo.setPrefix(prefix);
snapshotInfo.setPath(file.getAbsolutePath());
IndexManager indexManager = new IndexManager();
indexManager.init(prefix);
- return new SnapshotImpl(snapshotInfo, heapObjectReader, classCache, roots, rootsPerThread, loaderLabels,
+ SnapshotImpl ret = new SnapshotImpl(snapshotInfo, heapObjectReader, classCache, roots, rootsPerThread, loaderLabels,
arrayObjects, indexManager);
+ listener.worked(3);
+ return ret;
}
catch (ClassNotFoundException e)
{
@@ -148,6 +156,7 @@ public final class SnapshotImpl implements ISnapshot {
if (fis != null)
fis.close();
+ listener.done();
}
}
diff --git a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/messages.properties b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/messages.properties index 870ee621..43a6d98b 100644 --- a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/messages.properties +++ b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/messages.properties @@ -25,6 +25,8 @@ SnapshotFactoryImpl_Error_NoParserRegistered=No parser registered for file ''{0} SnapshotFactoryImpl_Error_OpeningHeapDump=Error opening heap dump ''{0}''. Check the error log for further details.
SnapshotFactoryImpl_Error_ReparsingHeapDump=Reparsing heap dump file due to {0}
SnapshotFactoryImpl_ErrorOpeningHeapDump=Error opening heap dump
+SnapshotFactoryImpl_ReparsingHeapDumpAsIndexOutOfDate=Reparsing heap dump file ''{0}'' modified at {1} as it is newer than index file ''{2}'' modified at {3}
+SnapshotFactoryImpl_ReparsingHeapDumpWithOutOfDateIndex=Reparsing heap dump file due to out of date index file
SnapshotImpl_BuildingHistogram=building histogram
SnapshotImpl_Error_DomTreeNotAvailable=Dominator tree not available. Delete indices and parse again.
SnapshotImpl_Error_ObjectNotFound=Object {0} not found.
@@ -36,6 +38,7 @@ SnapshotImpl_Histogram=Histogram SnapshotImpl_Label=label
SnapshotImpl_ReadingInboundReferrers=reading inbound referrers
SnapshotImpl_ReadingOutboundReferrers=reading outbound referrers
+SnapshotImpl_ReopeningParsedHeapDumpFile=Reopening parsed heap dump file
SnapshotImpl_RetrievingDominators=Retrieving dominators...
ObjectArrayImpl_forArray={0} for array {1}
ObjectMarker_CalculateRetainedSize=Calculate Retained Size
|