Save replays in a new thread.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-03-11 21:00:50 -04:00
parent 712cf30e01
commit c53679fe63

View File

@ -230,8 +230,11 @@ public class Replay {
}
}
// write file
File file = new File(dir, String.format("%s.osr", getReplayFilename()));
// write file in new thread
final File file = new File(dir, String.format("%s.osr", getReplayFilename()));
new Thread() {
@Override
public void run() {
try (FileOutputStream out = new FileOutputStream(file)) {
OsuWriter writer = new OsuWriter(out);
@ -309,6 +312,8 @@ public class Replay {
ErrorHandler.error("Could not save replay data.", e, true);
}
}
}.start();
}
/**
* Returns the file name of where the replay should be saved and loaded,