Skip to content

Commit

Permalink
Fixes a introduced Bug of btraceio#93, make sure to flush the PrintWr…
Browse files Browse the repository at this point in the history
…iter if the jvm ends
  • Loading branch information
mfilser committed Jul 16, 2015
1 parent 681572f commit 937a51e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/share/classes/com/sun/btrace/agent/FileClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ public void run() {
out.flush();
}
}, flushSec, flushSec);

Runtime.getRuntime().addShutdownHook(new Thread(
new Runnable() {
@Override
public void run() {
out.flush();
}
}));

}

FileClient(Instrumentation inst, File scriptFile, PrintWriter traceWriter) throws IOException {
Expand Down

0 comments on commit 937a51e

Please sign in to comment.