Class CloseableQueue<T>
java.lang.Object
org.apache.sysds.runtime.ooc.cache.io.CloseableQueue<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Close queue for N consumers.booleanenqueueIfOpen(T task) Enqueue if the queue is not closed.booleanPoll with max timeout.take()
-
Constructor Details
-
CloseableQueue
public CloseableQueue()
-
-
Method Details
-
enqueueIfOpen
Enqueue if the queue is not closed.- Returns:
- false if already closed
- Throws:
InterruptedException
-
take
- Throws:
InterruptedException
-
poll
Poll with max timeout.- Returns:
- item, or null if: - timeout, or - queue has been closed and this consumer reached its poison pill
- Throws:
InterruptedException
-
close
Close queue for N consumers. Each consumer will receive exactly one poison pill and then should stop.- Throws:
InterruptedException
-
isFinished
public boolean isFinished()
-