hat 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.
Comment #1
Posted on Apr 27, 2015 by Helpful Camel
Same behaviour when using beanIO in a camel route.
Strange exceptions that trace back to SimpleDateFormat not being thread safe.
hat 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.
Comment #1
Posted on Apr 27, 2015 by Helpful Camel
Same behaviour when using beanIO in a camel route.
Strange exceptions that trace back to SimpleDateFormat not being thread safe.