Some preliminary code to avoid deadlock situations

This is not a complete sollution, but does reduce the chances
of deadlocks in the most common places.

Deadlocks may still occur when removing entitlements that
create subpools while subpools are being bound (with other pools)
As well as updating subpools.

We need to lock the source pool before updating derived pools,
which makes enforcing order much harder.  We might be able to
get around that by leveraging the "created" date (breaking
ties with id)
more general compareTo
Merge pull request #581 from candlepin/ckozak/deadlocks

Some preliminary code to avoid deadlock situations