I need to maintain a list of userids (proxy accounts) which will be dished out to multithreaded clients. Basically the clients will use the userids to perform actions; but for this question, it is not important what these actions are. When a client gets hold of a userid, it is not available to other clients until the action is completed.
I’m trying to think of a concurrent data structure to maintain this pool of userids.
Any ideas ? Would a ConcurrentQueue do the job ? Clients will dequeue a userid, and add back the userid when they are finished with it.
For a similar situation I implemented my own BlockingQueue. As long as you keep track of the pool of ids you can shutdown the queue at an appropriate time.