I'd like to create a shared resource pool which could be accessed by multiple thread concurrently.
Each thread will do something like:
fetch a resource from the pool (if no resource available, do something else)
do something with the fetched resource
return the resource back to the pool.
In java, probably I will go with ConcurrentLinkedQueue.
Is there any better option in scala?
Scala runs on Java so you could just continue using a ConcurrentLinkedQueue. If it works for you, why mess with it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With