Is Joda-Time DateTimeFormatter class thread safe?

Steve Kuo picture Steve Kuo · Sep 22, 2012 · Viewed 22.6k times · Source

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.

Answer

Erre Efe picture Erre Efe · Sep 22, 2012

Yes, it is:

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.