Change from a ThreadLocal to a shared selector cache

The thread local version does not scale well to a large number of worker threads.