a thread safe object pool template