Refactor SimpleDateFormat to the new DateTimeFormatter of JDK 8 which is thread safe.
This commit is contained in:
parent
a2a6981cdb
commit
64a3a9c028
4 changed files with 27 additions and 25 deletions
|
|
@ -5,8 +5,8 @@ package akka.remote.artery
|
|||
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.time.Instant
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
|
||||
|
|
@ -27,6 +27,8 @@ object BenchmarkFileReporter {
|
|||
target
|
||||
}
|
||||
|
||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm-ss")
|
||||
|
||||
def apply(testName: String, system: ActorSystem): BenchmarkFileReporter =
|
||||
new BenchmarkFileReporter {
|
||||
val gitCommit = {
|
||||
|
|
@ -34,8 +36,7 @@ object BenchmarkFileReporter {
|
|||
Try("git describe".!!.trim).getOrElse("[unknown]")
|
||||
}
|
||||
val testResultFile: File = {
|
||||
val format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")
|
||||
val fileName = s"${format.format(new Date())}-Artery-$testName-$gitCommit-results.txt"
|
||||
val fileName = s"${formatter.format(Instant.now())}-Artery-$testName-$gitCommit-results.txt"
|
||||
new File(targetDirectory, fileName)
|
||||
}
|
||||
val config = system.settings.config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue