Forums Register Login

Need a design idea.

+Pie Number of slices to send: Send
Hi.,
I Have a store and there exists many objects. Periodically i need to clean the store by dispatching the objects in it to another store.
When Iam cleaning the store, some of its object might be already in use (Other threads might be using the object to update its values).
I Can't wait until the other thread release the reference since, its a continuous process. So, some other object might now get Already in Use stage.
I cant't make the Store synchronized since threads creating new objects should not made to wait.

I need some design ideas to achieve proper cleaning of store.
1
+Pie Number of slices to send: Send
One pretty straightforward solution is to create a blocking queue.
When any thread need to work with an object, it takes object from the queue and when work is finished it puts object back to the queue.
And your dispathcer thread will do the following: fetch object from the queue, then move it to another store, but not return it back to the queue.
+Pie Number of slices to send: Send
Looks like a threads question to me, moving to its forum
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 788 times.
Similar Threads
Using Threads
Using Soft references for cache
EJB3 -> Best optimizzed way for bulk insert ?
how to find the variable get updated by simultaneous threads
NX: Grow File Size Puzzle
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:48:00.