Which scala collection is best for creating a resource pool

I would like to create a shared resource pool that can be accessed by multiple threads at the same time.

Each thread will do something like:

  • select a resource from the pool (if the resource is unavailable, do something else)

  • do something with the selected resource

  • return the resource to the pool.

In java, I will probably go with ConcurrentLinkedQueue.

Is there a better option in scala?

+5
source share
1 answer

Scala runs in Java, so you can just keep using ConcurrentLinkedQueue. If this works for you, why contact him?

0
source

Source: https://habr.com/ru/post/1201490/


All Articles