Use thread-safe map to track active plans.

Before whenever two or more plans started simultaneously a deadlock would occur, as each plan found the other already running.

This fix uses a thread-safe map to track the plan that currently holds the mutex. When the plan finishes the mutex is cleared. If a plan dies without clearing the mutex a plan awaiting the mutex will perform the cleanup instead.

The implementation does assume that the pre- and post-chain actions run in a single JVM. Hopefully this is actually true...

This fix has been running in our Bamboo installation for a while and works for us without deadlocks. This fixes issue #1.