Package rx.internal.operators
Class OperatorGroupBy.GroupBySubscriber<T,K,V>
- java.lang.Object
-
- rx.Subscriber<T>
-
- rx.internal.operators.OperatorGroupBy.GroupBySubscriber<T,K,V>
-
- All Implemented Interfaces:
Observer<T>
,Subscription
- Enclosing class:
- OperatorGroupBy<T,K,V>
public static final class OperatorGroupBy.GroupBySubscriber<T,K,V> extends Subscriber<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
OperatorGroupBy.GroupBySubscriber.EvictionAction<K>
-
Field Summary
Fields Modifier and Type Field Description (package private) Subscriber<? super GroupedObservable<K,V>>
actual
(package private) int
bufferSize
(package private) java.util.concurrent.atomic.AtomicBoolean
cancelled
(package private) boolean
delayError
(package private) boolean
done
(package private) java.lang.Throwable
error
(package private) java.util.Queue<K>
evictedKeys
(package private) java.util.concurrent.atomic.AtomicInteger
groupCount
(package private) java.util.Map<java.lang.Object,OperatorGroupBy.GroupedUnicast<K,V>>
groups
(package private) Func1<? super T,? extends K>
keySelector
(package private) static java.lang.Object
NULL_KEY
(package private) OperatorGroupBy.GroupByProducer
producer
(package private) java.util.Queue<GroupedObservable<K,V>>
queue
(package private) java.util.concurrent.atomic.AtomicLong
requested
(package private) ProducerArbiter
s
(package private) Func1<? super T,? extends V>
valueSelector
(package private) java.util.concurrent.atomic.AtomicInteger
wip
-
Constructor Summary
Constructors Constructor Description GroupBySubscriber(Subscriber<? super GroupedObservable<K,V>> actual, Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, int bufferSize, boolean delayError, Func1<Action1<K>,java.util.Map<K,java.lang.Object>> mapFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
void
cancel(K key)
(package private) boolean
checkTerminated(boolean d, boolean empty, Subscriber<? super GroupedObservable<K,V>> a, java.util.Queue<?> q)
private java.util.Map<java.lang.Object,OperatorGroupBy.GroupedUnicast<K,V>>
createMap(Func1<Action1<K>,java.util.Map<K,java.lang.Object>> mapFactory, Action1<K> evictionAction)
(package private) void
drain()
(package private) void
errorAll(Subscriber<? super GroupedObservable<K,V>> a, java.util.Queue<?> q, java.lang.Throwable ex)
void
onCompleted()
Notifies the Observer that theObservable
has finished sending push-based notifications.void
onError(java.lang.Throwable t)
Notifies the Observer that theObservable
has experienced an error condition.void
onNext(T t)
Provides the Observer with a new item to observe.void
requestMore(long n)
void
setProducer(Producer s)
If other subscriber is set (by calling constructorSubscriber(Subscriber)
orSubscriber(Subscriber, boolean)
) then this method callssetProducer
on the other subscriber.-
Methods inherited from class rx.Subscriber
add, isUnsubscribed, onStart, request, unsubscribe
-
-
-
-
Field Detail
-
actual
final Subscriber<? super GroupedObservable<K,V>> actual
-
bufferSize
final int bufferSize
-
delayError
final boolean delayError
-
groups
final java.util.Map<java.lang.Object,OperatorGroupBy.GroupedUnicast<K,V>> groups
-
queue
final java.util.Queue<GroupedObservable<K,V>> queue
-
producer
final OperatorGroupBy.GroupByProducer producer
-
evictedKeys
final java.util.Queue<K> evictedKeys
-
NULL_KEY
static final java.lang.Object NULL_KEY
-
s
final ProducerArbiter s
-
cancelled
final java.util.concurrent.atomic.AtomicBoolean cancelled
-
requested
final java.util.concurrent.atomic.AtomicLong requested
-
groupCount
final java.util.concurrent.atomic.AtomicInteger groupCount
-
error
java.lang.Throwable error
-
done
volatile boolean done
-
wip
final java.util.concurrent.atomic.AtomicInteger wip
-
-
Method Detail
-
createMap
private java.util.Map<java.lang.Object,OperatorGroupBy.GroupedUnicast<K,V>> createMap(Func1<Action1<K>,java.util.Map<K,java.lang.Object>> mapFactory, Action1<K> evictionAction)
-
setProducer
public void setProducer(Producer s)
Description copied from class:Subscriber
If other subscriber is set (by calling constructorSubscriber(Subscriber)
orSubscriber(Subscriber, boolean)
) then this method callssetProducer
on the other subscriber. If the other subscriber is not set and no requests have been made to this subscriber thenp.request(Long.MAX_VALUE)
is called. If the other subscriber is not set and some requests have been made to this subscriber thenp.request(n)
is called where n is the accumulated requests to this subscriber.- Overrides:
setProducer
in classSubscriber<T>
- Parameters:
s
- producer to be used by this subscriber or the other subscriber (or recursively its other subscriber) to make requests from
-
onNext
public void onNext(T t)
Description copied from interface:Observer
Provides the Observer with a new item to observe.The
Observable
may call this method 0 or more times.The
Observable
will not call this method again after it calls eitherObserver.onCompleted()
orObserver.onError(java.lang.Throwable)
.- Parameters:
t
- the item emitted by the Observable
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:Observer
Notifies the Observer that theObservable
has experienced an error condition.If the
Observable
calls this method, it will not thereafter callObserver.onNext(T)
orObserver.onCompleted()
.- Parameters:
t
- the exception encountered by the Observable
-
onCompleted
public void onCompleted()
Description copied from interface:Observer
Notifies the Observer that theObservable
has finished sending push-based notifications.The
Observable
will not call this method if it callsObserver.onError(java.lang.Throwable)
.
-
requestMore
public void requestMore(long n)
-
cancel
public void cancel()
-
cancel
public void cancel(K key)
-
drain
void drain()
-
errorAll
void errorAll(Subscriber<? super GroupedObservable<K,V>> a, java.util.Queue<?> q, java.lang.Throwable ex)
-
checkTerminated
boolean checkTerminated(boolean d, boolean empty, Subscriber<? super GroupedObservable<K,V>> a, java.util.Queue<?> q)
-
-