Java: Thread producer consumer what is the most efficient way to wait for data to be produced
When using BlockingQueue to consume data that is produced what is the most efficient method for waiting for the data to appear? Scenario: Step 1) The data list will be a data store where timestamps are added to. These timestamps are required to be ordered by closest to current time priority. This list may be empty. A thread will be inserting the timestamps into it. Produce Step 2) I want to consume the data in here in another thread that will take the timestamps from data and check if they are after the current time. Consumer then Produce Step 3) If they are after the current time then send