Package org.ojalgo.type.function
Class QueuedConsumer<T>
- java.lang.Object
-
- org.ojalgo.type.function.QueuedConsumer<T>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.util.function.Consumer<T>
,AutoConsumer<T>
,AutoFunctional
final class QueuedConsumer<T> extends java.lang.Object implements AutoConsumer<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
QueuedConsumer.Worker<T>
-
Field Summary
Fields Modifier and Type Field Description private boolean
myActive
private int
myBatchSize
private java.util.function.Consumer<T>[]
myConsumers
private java.util.concurrent.Future<?>[]
myFutures
private java.util.concurrent.BlockingQueue<T>
myQueue
-
Fields inherited from interface org.ojalgo.type.function.AutoConsumer
NULL
-
-
Constructor Summary
Constructors Constructor Description QueuedConsumer(java.util.concurrent.ExecutorService executor, java.util.concurrent.BlockingQueue<T> queue, java.util.function.Consumer<T>... consumers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
(package private) int
drainTo(java.util.List<T> batchContainer)
(package private) boolean
isMoreToCome()
(package private) java.util.List<T>
newBatchContainer()
void
write(T item)
Write the item to the consumer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ojalgo.type.function.AutoConsumer
accept, writeBatch
-
-
-
-
Field Detail
-
myActive
private volatile boolean myActive
-
myBatchSize
private final int myBatchSize
-
myConsumers
private final java.util.function.Consumer<T>[] myConsumers
-
myFutures
private final java.util.concurrent.Future<?>[] myFutures
-
myQueue
private final java.util.concurrent.BlockingQueue<T> myQueue
-
-
Method Detail
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceAutoConsumer<T>
- Throws:
java.lang.Exception
-
write
public void write(T item)
Description copied from interface:AutoConsumer
Write the item to the consumer.- Specified by:
write
in interfaceAutoConsumer<T>
- Parameters:
item
- The item to be written
-
drainTo
int drainTo(java.util.List<T> batchContainer)
-
isMoreToCome
boolean isMoreToCome()
-
newBatchContainer
java.util.List<T> newBatchContainer()
-
-