Shimi/cascal — pull request #1 by edwardw (2012-01-05 18:55:53+00:00)
Title: Made CharsetEncoder/Decoder thread-safe

I saw transient errors such as:

failed: Current state = RESET, new state = FLUSHED

or

failed: Current state = CODING_END, new state = FLUSHED

when running `sbt test`.

Turns out it caused by `CharsetEncoder/Decoder`, called in `Serializer.scala`. They are not thread-safe. The patch wraps them in a Scala `DynamicVariable` so they are thread-local variables and can be safely called from multiple threads.

After applied the patch, `sbt test` consistently succeeds now.