T
- Type of data stored in Queuepublic class Queue<T> extends java.lang.Object implements Adapter<T>
)
Modifier and Type | Class and Description |
---|---|
static class |
Queue.ClosedQueueException
Exception thrown if Queue closed
|
static class |
Queue.NIL |
static class |
Queue.QueueReader<T> |
static class |
Queue.QueueTimeoutException
Exception thrown if Queue polling timesout
|
Constructor and Description |
---|
Queue()
Construct a Queue backed by a LinkedBlockingQueue
|
Queue(java.util.concurrent.BlockingQueue<T> queue)
Queue accepts a BlockingQueue to make use of Blocking semantics
|
Queue(java.util.Queue<T> q,
WaitStrategy<T> consumer,
WaitStrategy<T> producer) |
Queue(QueueFactory<T> factory) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T data)
Add a single data point to the queue
If the queue is a bounded queue and is full, will return false
|
void |
addContinuation(Continuation c) |
boolean |
close()
Close this Queue
|
void |
closeAndClear() |
static <T> Queue<T> |
createMergeQueue() |
boolean |
fromStream(java.util.stream.Stream<T> stream) |
T |
get() |
boolean |
isOpen() |
boolean |
offer(T data)
Offer a single datapoint to this Queue
If the queue is a bounded queue and is full it will block until space comes available or until
offer time out is reached (default is Integer.MAX_VALUE DAYS).
|
T |
poll(long time,
java.util.concurrent.TimeUnit unit) |
int |
size() |
ReactiveSeq<T> |
stream() |
ReactiveSeq<T> |
stream(Continueable s) |
ReactiveSeq<java.util.Collection<T>> |
streamBatch(Continueable s,
java.util.function.Function<java.util.function.BiFunction<java.lang.Long,java.util.concurrent.TimeUnit,T>,java.util.function.Supplier<java.util.Collection<T>>> batcher) |
ReactiveSeq<java.util.Collection<T>> |
streamBatchNoTimeout(Continueable s,
java.util.function.Function<java.util.function.Supplier<T>,java.util.function.Supplier<java.util.Collection<T>>> batcher) |
ReactiveSeq<java.util.concurrent.CompletableFuture<T>> |
streamCompletableFutures() |
ReactiveSeq<T> |
streamControl(Continueable s,
java.util.function.Function<java.util.function.Supplier<T>,java.util.function.Supplier<T>> batcher) |
ReactiveSeq<java.util.concurrent.CompletableFuture<T>> |
streamControlFutures(Continueable s,
java.util.function.Function<java.util.function.Supplier<T>,java.util.concurrent.CompletableFuture<T>> batcher) |
<R> R |
visit(java.util.function.Function<? super Queue<T>,? extends R> caseQueue,
java.util.function.Function<? super Topic<T>,? extends R> caseTopic) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
futureStream, futureStream, matches
public static final Queue.NIL NILL
public Queue()
public Queue(QueueFactory<T> factory)
public Queue(java.util.concurrent.BlockingQueue<T> queue)
queue
- BlockingQueue to back this Queuepublic Queue(java.util.Queue<T> q, WaitStrategy<T> consumer, WaitStrategy<T> producer)
public static <T> Queue<T> createMergeQueue()
public ReactiveSeq<T> stream()
public ReactiveSeq<T> stream(Continueable s)
public ReactiveSeq<java.util.Collection<T>> streamBatchNoTimeout(Continueable s, java.util.function.Function<java.util.function.Supplier<T>,java.util.function.Supplier<java.util.Collection<T>>> batcher)
public ReactiveSeq<java.util.Collection<T>> streamBatch(Continueable s, java.util.function.Function<java.util.function.BiFunction<java.lang.Long,java.util.concurrent.TimeUnit,T>,java.util.function.Supplier<java.util.Collection<T>>> batcher)
public ReactiveSeq<T> streamControl(Continueable s, java.util.function.Function<java.util.function.Supplier<T>,java.util.function.Supplier<T>> batcher)
public ReactiveSeq<java.util.concurrent.CompletableFuture<T>> streamControlFutures(Continueable s, java.util.function.Function<java.util.function.Supplier<T>,java.util.concurrent.CompletableFuture<T>> batcher)
public ReactiveSeq<java.util.concurrent.CompletableFuture<T>> streamCompletableFutures()
streamCompletableFutures
in interface Adapter<T>
public boolean fromStream(java.util.stream.Stream<T> stream)
fromStream
in interface Adapter<T>
stream
- Input data from provided Streampublic T poll(long time, java.util.concurrent.TimeUnit unit) throws Queue.QueueTimeoutException
Queue.QueueTimeoutException
public T get()
public boolean add(T data)
data
- Data to addpublic boolean offer(T data)
public boolean close()
public void closeAndClear()
public int size()
public boolean isOpen()
public void addContinuation(Continuation c)