try {
out = new FileOutputStream(fileName);
synchPointOut = new FileOutputStream(synchPointFileName);
s = new ObjectOutputStream(out);
SynchPoint synchPoint = cpm.getSynchPoint();
ProcessTrace pTrace = cpm.getPerformanceReport();
CheckpointData targetToSave = null;
if (pTrace != null) {
if (synchPoint != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checkpoint_with_synchpoint__FINEST",
new Object[] { Thread.currentThread().getName() });
}
targetToSave = new CheckpointData(pTrace, synchPoint);
} else {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checkpoint_with_pt__FINEST",
new Object[] { Thread.currentThread().getName() });
}
targetToSave = new CheckpointData(pTrace);
}
synchronized (targetToSave) {
s.writeObject(targetToSave);
s.flush();
if (synchPoint != null) {
String xmlSynchPoint = synchPoint.serializeToXML();
synchPointOut.write(xmlSynchPoint.getBytes());
synchPointOut.flush();
}
}
}