if (Files.exists(file)) {
/* Attempt to read the existing file */
try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) {
- @SuppressWarnings("unchecked")
- ISegmentStore<ISegment> syscalls = (ISegmentStore<ISegment>) ois.readObject();
- fSystemCalls = syscalls;
+ Object[] syscallsArray = (Object[]) ois.readObject();
+ final ISegmentStore<ISegment> systemCalls = new TreeMapStore<>();
+ for (Object element : syscallsArray) {
+ if (element instanceof ISegment) {
+ ISegment segment = (ISegment) element;
+ systemCalls.add(segment);
+ }
+ }
+ fSystemCalls = systemCalls;
+ for (LatencyAnalysisListener listener : fListeners) {
+ listener.onComplete(this, systemCalls);
+ }
return true;
} catch (IOException | ClassNotFoundException | ClassCastException e) {
/*
/* Serialize the collections to disk for future usage */
try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) {
- oos.writeObject(syscalls);
+ oos.writeObject(syscalls.toArray());
} catch (IOException e) {
/* Didn't work, oh well. We will just re-read the trace next time */
}
private final InitialInfo fInfo;
private final long fEndTime;
private final int fRet;
- private final transient long fDuration;
/**
* @param info
fInfo = info;
fEndTime = endTime;
fRet = ret;
- fDuration = fEndTime - fInfo.fStartTime;
}
@Override
@Override
public long getLength() {
- return fDuration;
+ return fEndTime - fInfo.fStartTime;
}
/**
return fRet;
}
-
@Override
public int compareTo(@Nullable ISegment o) {
if (o == null) {