I have an instance of an org.joda.time.DateTimeFormat in an object :
object TimeRange {
lazy val dateFormat = DateTimeFormat.forPattern("YYYY-MM-dd")
}
My API is asynchronous (using Finagle Future) and different threads may want to access my dateFormat to format date using function dateFormat.parseDateTime("2013-07-01"). My question is: how can I be sure that this method invocation will be thread safe ? Can we assume that all method invocations without side effects are thread safe ? Does it depend on the specific implementation of DateTimeFormat ?
Thanks,
From the doc:
DateTimeFormat is thread-safe and immutable, and the formatters it returns are as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With