Question

In a JSF app I'm working with, I would like to build a queue to handle the following scenario:

  • Objects (items) of different types are added to this sole queue at specific intervals
  • After the items has been added a method is run that will fetch each item in order from the queue and execute a search based on information found in each item
  • When the search has been executed the item is removed from the queue
  • There can be no more than 10 searches per second

Faced with this scenario, I started looking for information of how to implement it and soon found that I'm lacking the necessary knowledge to know which queue type (of which there seems to be hundreds) to choose and especially how to limit the search calls to 10 per second.

I would be very glad to get any guidelines as to which approach to take in this.

Was it helpful?

Solution

I ended up using a java.util.Queue and handled the call rate through adding a Thread.sleep(100) for each item handled in the queue. Seems to work fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top