Makes Pig thread safe

* Use `ConcurrentHashMap` instead of `HashMap`
* Add `synchronized` to `addListener` and `removeListener` methods because they use a `HashSet` that is not thread safe.