Use a thread-safe map implementation to keep the compiled patterns.
Note that the comment about Pattern itself not being thread-safe was
wrong, only the Matcher instances created from a Pattern are not
thread-safe, but that's in the responsibility of the caller.