On Wed, 19 Nov 2025 15:48:19 GMT, Andy Goryachev <[email protected]> wrote:

>> Some do, but that state is immutable. Converters build a formatter/parser on 
>> construction (if at all needed) and use it for the duration of their 
>> existence. There are some deprecations that we need to do regarding 
>> inspecting the internal state.
>
> This is what `DateFormat` javadoc says:
> 
> 
> Synchronization
> Date formats are not synchronized. It is recommended to create separate 
> format instances for each thread. If multiple threads access a format 
> concurrently, it must be synchronized externally.
> 
> 
> As long as the `DateTimeStringConverter` is used only in the context of the 
> FX application thread, we should be fine.  But can we guarantee that the 
> application code does not try to call it from other threads?

Huh, looks like even non-modifying methods like `DateFormat#parse` are not 
thread safe. The wording is still correct in that the classes are immutable, 
but in the specific case of the Java 8 Date/Time ones, they indeed need to 
reused on the same thread. I'll add a caveat.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1880#discussion_r2543556512

Reply via email to