Java - LinkedBlockingQueue problem
-
07-11-2019 - |
Question
1 LinkedBlockingQueue queJobs = new LinkedBlockingQueue(150); 2 .......... 3 .. Some other code.... 4 .......... 5 Job curJob = queJobs.take(); 6 .................... 7 .. Again some other code... 8 .................... 9 if(condition1){ 10 queJobs.put(curJob); 11 }
my problem is when condition1 is true, I am putting back the object into queue. but initially it was on top of the queue, but after putting, it will go at the end of queue.
My requirement is :
1. I can put back the element on top of the queue
or
2. Somehow I can wait at line 5, without removing element from the queue.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow