Skip to content

DateTypeHandlerSupport not thread-safe #131

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Create multiple Unmarshallers (one per thread) from the same StreamFactory
2. Unmarshall records with a date in each of the threads

What is the expected output? What do you see instead?
All records get unmarshalled correctely. Instead, Exceptions get thrown.

What version of BeanIO are you using? What JDK version?
BeanIO 2.1.0

Please provide any additional information below.
While the documentation claims that "All included BeanIO type handlers are 
thread safe", DateTypeHandlerSupport potentially uses the same SimpleDateFormat 
for multiple Unmarshaller instances. Since SimpleDateFormat is not thread-safe 
this causes the behaviour as shown. Switching to a custom TypeHandler that uses 
a thread-local SimpleDateFormat solves the problem.

Original issue reported on code.google.com by gyr...@gmail.com on 24 Mar 2015 at 12:58

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions