I need a data structure like HashSet<Obj, BlockingQueue<Obj> > ds
which should be thread safe and instance safe. I can use redisTemplate to store this data structure as redis is thread safe but the problem is when i run multiple instances of my application, the BlockingQueue
is not returning different object for concurrent thread in all instances all time. When i call take()
after getting the queue using key from redis, sometimes some instance getting same object. I need different object in all instances. I can use Set
rather then Queue
as Set
will return object randomly. But still there is a chance to get same object in different instance. Any suggestion will be highly appreciable.
↧
Instance safe HashSet of BlockingQueue
↧