Is there a kind of PriorityBlockingQueue
in Java that allows waiting (like the take()
method does) for a certain level of elements instead of one element? I.e. "notify me when the level reaches 500 elements"?
No you don't have maybe you can extend PriorityBlockingQueue
for your need. take()
can return once you have more than 500 elements.
private volatile size;
public synchronized void take(){
while(size<500){
........
.........
}
}
just pseudocode.