Is the Joda-Time DateTimeFormatter class thread safe? Once I get an instance from DateTimeFormat.forPattern, can its various parse methods be called by multiple threads? DateTimeFormatter's Javadocs makes no mention of thread safety.
62
votes
3 Answers
85
votes
DateTimeFormat is thread-safe and immutable, and the formatters it returns are as well.
and so is the Java 8 version
Implementation Requirements: This class is immutable and thread-safe.
13
votes
A quick look at the code shows there isn't any mutable shared state in DateTimeFormatter, which would make it thread safe.
4
votes
Found this question on top of google's answers when checking for Java's java.time.format.DateTimeFormatter thread safety
Java's own DateTimeFormatter is also thread-safe, as the documentation states:
This class is immutable and thread-safe