Class DateFormatSupplier

  • All Implemented Interfaces:
    Supplier<DateFormat>

    public abstract class DateFormatSupplier
    extends ThreadLocal<DateFormat>
    implements Supplier<DateFormat>
    DateFormatSupplier is a ThreadLocal<DateFormat> that will set the correct TimeZone when the object is retrieved by get(). This exists as a way to get around thread safety issues in DateFormat. This class also contains helper methods that create some useful DateFormatSuppliers. Instances of DateFormatSuppliers can be shared, but note that a DateFormat generated from it will be shared by all classes within a Thread. In general, the state of a retrieved DateFormat should not be changed, unless it makes sense to only perform a state change within that Thread.