Top Description Inners Fields Constructors Methods
reactor.core.publisher

pack-priv final Class BlockingIterable<T>

extends Object
implements Iterable<T>, Scannable
Class Inheritance
All Implemented Interfaces
reactor.core.Scannable, java.lang.Iterable
Type Parameters
<T>
the value type
Imports
java.util.Iterator, .NoSuchElementException, .Objects, .Queue, .Spliterator, .Spliterators, java.util.concurrent.atomic.AtomicReferenceFieldUpdater, java.util.concurrent.locks.Condition, .Lock, .ReentrantLock, java.util.function.Supplier, java.util.stream.Stream, .StreamSupport, org.reactivestreams.Subscription, reactor.core.CorePublisher, .Exceptions, .Scannable, reactor.core.scheduler.Schedulers, reactor.util.annotation.Nullable, reactor.util.context.Context

An iterable that consumes a Publisher in a blocking fashion.

It also implements methods to stream the contents via Stream that also supports cancellation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final Supplier<Context>
pack-priv final Supplier<Queue<T>>
pack-priv final CorePublisher<? extends T>

Constructor Summary

AccessConstructor and Description
pack-priv
BlockingIterable(CorePublisher<? extends T> source, int batchSize, Supplier<Queue<T>> queueSupplier, Supplier<Context> contextSupplier)

Method Summary

Modifier and TypeMethod and Description
pack-priv BlockingIterable.SubscriberIterator<T>
public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
public Spliterator<T>
spliterator()

Overrides default java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.
public Stream<T>

Returns:

a Stream of unknown size with onClose attached to Subscription#cancel()
stream
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

batchSizeback to summary
pack-priv final int batchSize
contextSupplierback to summary
pack-priv final Supplier<Context> contextSupplier
queueSupplierback to summary
pack-priv final Supplier<Queue<T>> queueSupplier
sourceback to summary
pack-priv final CorePublisher<? extends T> source

Constructor Detail

BlockingIterableback to summary
pack-priv BlockingIterable(CorePublisher<? extends T> source, int batchSize, Supplier<Queue<T>> queueSupplier, Supplier<Context> contextSupplier)

Method Detail

createIteratorback to summary
pack-priv BlockingIterable.SubscriberIterator<T> createIterator()
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<T>

an Iterator.

Annotations
@Override
scanUnsafeback to summary
public Object scanUnsafe(Scannable.Attr<T> key)

Implements reactor.core.Scannable.scanUnsafe.

Doc from reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of the Attr key, implementors should take care to return values of the correct type, and return null if no specific value is available.

For public consumption of attributes, prefer using scan(Attr), which will return a typed value and fall back to the key's default if the component didn't define any mapping.

Parameters
key:Scannable.Attr<T>

a Attr to resolve for the component.

Returns:Object

the value associated to the key for that specific component, or null if none.

Annotations
@Override
@Nullable
spliteratorback to summary
public Spliterator<T> spliterator()

Overrides default java.lang.Iterable.spliterator.

Doc from java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

Returns:Spliterator<T>

a Spliterator over the elements described by this Iterable.

Annotations
@Override
streamback to summary
public Stream<T> stream()
Returns:Stream<T>

a Stream of unknown size with onClose attached to Subscription#cancel()

reactor.core.publisher back to summary

pack-priv final Class BlockingIterable.SubscriberIterator<T>

extends Object
implements InnerConsumer<T>, Iterator<T>, Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable, java.util.Iterator, reactor.core.publisher.InnerConsumer, reactor.core.Scannable, reactor.core.CoreSubscriber, org.reactivestreams.Subscriber

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final Condition
pack-priv final Context
pack-priv volatile boolean
pack-priv Throwable
pack-priv final int
pack-priv final Lock
pack-priv long
pack-priv final Queue<T>
pack-priv volatile Subscription
s

pack-priv static final AtomicReferenceFieldUpdater<BlockingIterable.SubscriberIterator<T>, Subscription>
S

Constructor Summary

AccessConstructor and Description
pack-priv
SubscriberIterator(Queue<T> queue, Context context, int batchSize)

Method Summary

Modifier and TypeMethod and Description
public Context
currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Successful terminal state.
public void
onError(Throwable
the throwable signaled
t
)

Implements org.reactivestreams.Subscriber.onError.

Failed terminal state.
public void
onNext(T
the element signaled
t
)

Implements org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).
public void
onSubscribe(Subscription
the Subscription that allows requesting data via Subscription#request(long)
s
)

Implements reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long).
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

batchSizeback to summary
pack-priv final int batchSize
conditionback to summary
pack-priv final Condition condition
contextback to summary
pack-priv final Context context
doneback to summary
pack-priv volatile boolean done
errorback to summary
pack-priv Throwable error
limitback to summary
pack-priv final int limit
lockback to summary
pack-priv final Lock lock
producedback to summary
pack-priv long produced
queueback to summary
pack-priv final Queue<T> queue
sback to summary
pack-priv volatile Subscription s
Sback to summary
pack-priv static final AtomicReferenceFieldUpdater<BlockingIterable.SubscriberIterator<T>, Subscription> S
Annotations
@SuppressWarnings:rawtypes

Constructor Detail

SubscriberIteratorback to summary
pack-priv SubscriberIterator(Queue<T> queue, Context context, int batchSize)

Method Detail

currentContextback to summary
public Context currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Doc from reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.

Returns:Context

a resolved context or Context#empty()

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:T

the next element in the iteration

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Doc from org.reactivestreams.Subscriber.onComplete.

Successful terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Annotations
@Override
onErrorback to summary
public void onError(Throwable t)

Implements org.reactivestreams.Subscriber.onError.

Doc from org.reactivestreams.Subscriber.onError.

Failed terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Parameters
t:Throwable

the throwable signaled

Annotations
@Override
onNextback to summary
public void onNext(T t)

Implements org.reactivestreams.Subscriber.onNext.

Doc from org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).

Parameters
t:T

the element signaled

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Subscription s)

Implements reactor.core.CoreSubscriber.onSubscribe.

Doc from reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long). Should further onNext related state modification occur, thread-safety will be required.

Note that an invalid request <= 0 will not produce an onError and will simply be ignored or reported through a debug-enabled reactor.util.Logger. Invoked after calling Publisher#subscribe(Subscriber).

No data will start flowing until Subscription#request(long) is invoked.

It is the responsibility of this Subscriber instance to call Subscription#request(long) whenever more data is wanted.

The Publisher will send notifications only in response to Subscription#request(long).

Parameters
s:Subscription

Doc from org.reactivestreams.Subscriber.onSubscribe.

the Subscription that allows requesting data via Subscription#request(long)

Annotations
@Override
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
scanUnsafeback to summary
public Object scanUnsafe(Scannable.Attr<T> key)

Implements reactor.core.Scannable.scanUnsafe.

Doc from reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of the Attr key, implementors should take care to return values of the correct type, and return null if no specific value is available.

For public consumption of attributes, prefer using scan(Attr), which will return a typed value and fall back to the key's default if the component didn't define any mapping.

Parameters
key:Scannable.Attr<T>

a Attr to resolve for the component.

Returns:Object

the value associated to the key for that specific component, or null if none.

Annotations
@Override
@Nullable
signalConsumerback to summary
pack-priv void signalConsumer()