Class LatestValueSubscriber<T>
- java.lang.Object
-
- io.servicetalk.concurrent.internal.LatestValueSubscriber<T>
-
- Type Parameters:
T
- The type of data.
- All Implemented Interfaces:
PublisherSource.Subscriber<T>
public final class LatestValueSubscriber<T> extends java.lang.Object implements PublisherSource.Subscriber<T>
APublisherSource.Subscriber
which makes the latest value fromonNext(Object)
available outside the context of thePublisherSource.Subscriber
.
-
-
Constructor Summary
Constructors Constructor Description LatestValueSubscriber()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
lastSeenValue(T defaultValue)
Get the last seen value.void
onComplete()
Callback to signal completion of thePublisherSource
for thisSubscriber
.void
onError(java.lang.Throwable t)
Callback to receive anerror
for thisSubscriber
.void
onNext(T newValue)
Callback to receive adata
element for thisSubscriber
.void
onSubscribe(PublisherSource.Subscription s)
Callback to receive aPublisherSource.Subscription
for thisSubscriber
.
-
-
-
Method Detail
-
onSubscribe
public void onSubscribe(PublisherSource.Subscription s)
Description copied from interface:PublisherSource.Subscriber
Callback to receive aPublisherSource.Subscription
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onSubscribe
in interfacePublisherSource.Subscriber<T>
- Parameters:
s
-PublisherSource.Subscription
for thisSubscriber
.
-
onNext
public void onNext(T newValue)
Description copied from interface:PublisherSource.Subscriber
Callback to receive adata
element for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onNext
in interfacePublisherSource.Subscriber<T>
- Parameters:
newValue
- Adata
element.
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:PublisherSource.Subscriber
Callback to receive anerror
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onError
in interfacePublisherSource.Subscriber<T>
- Parameters:
t
-error
for thisSubscriber
.
-
onComplete
public void onComplete()
Description copied from interface:PublisherSource.Subscriber
Callback to signal completion of thePublisherSource
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onComplete
in interfacePublisherSource.Subscriber<T>
-
-