try
{
if (cdata != null)
{
// use method-scoped loggers everywhere in RT:
final Logger log = Logger.getLogger ();
final boolean info = log.atINFO ();
final long start = info ? System.currentTimeMillis () : 0;
{
final ICoverageData cdataView = useSnapshot ? cdata.shallowCopy () : cdata;
synchronized (Object.class) // fake a JVM-global critical section when multilply loaded RT's write to the same file
{
DataFactory.persist (cdataView, outFile, merge);
}
}
if (info)
{
final long end = System.currentTimeMillis ();
log.info ("runtime coverage data " + (merge ? "merged into" : "written to") + " [" + outFile.getAbsolutePath () + "] {in " + (end - start) + " ms}");
}
}
}
catch (Throwable t)
{
// log
t.printStackTrace ();
// TODO: do better chaining in JRE 1.4+
throw new RuntimeException (IAppConstants.APP_NAME + " failed to dump coverage data: " + t.toString ());
}