AFFINITY-6 Factoring out static stuff from AffinityLock into a more reusable form