Top Inners Fields Constructors Methods
io.reactivex.internal.operators.observable

public final Class ObservableCreate<T>

extends Observable<T>
Class Inheritance
Imports
java.util.concurrent.atomic.*, io.reactivex.*, io.reactivex.disposables.Disposable, io.reactivex.exceptions.Exceptions, io.reactivex.functions.Cancellable, io.reactivex.internal.disposables.*, io.reactivex.internal.fuseable.SimpleQueue, io.reactivex.internal.queue.SpscLinkedArrayQueue, io.reactivex.internal.util.AtomicThrowable, io.reactivex.plugins.RxJavaPlugins

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
ObservableCreate.SerializedEmitter<
the value type
T
>

Serializes calls to onNext, onError and onComplete.

Field Summary

Modifier and TypeField and Description
pack-priv final ObservableOnSubscribe<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
subscribeActual(Observer<? super T>
the incoming Observer, never null
observer
)

Implements abstract io.reactivex.Observable.subscribeActual.

Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Observers.
Inherited from io.reactivex.Observable:
allambambArrayambWithanyasblockingFirstblockingFirstblockingForEachblockingIterableblockingIterableblockingLastblockingLastblockingLatestblockingMostRecentblockingNextblockingSingleblockingSingleblockingSubscribeblockingSubscribeblockingSubscribeblockingSubscribeblockingSubscribebufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferSizecachecacheWithInitialCapacitycastcollectcollectIntocombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestDelayErrorcombineLatestDelayErrorcombineLatestDelayErrorcombineLatestDelayErrorcombineLatestDelayErrorcomposeconcatconcatconcatconcatconcatconcatconcatArrayconcatArrayDelayErrorconcatArrayEagerconcatArrayEagerconcatArrayEagerDelayErrorconcatArrayEagerDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatEagerconcatEagerconcatEagerconcatEagerconcatMapconcatMapconcatMapCompletableconcatMapCompletableconcatMapCompletableDelayErrorconcatMapCompletableDelayErrorconcatMapCompletableDelayErrorconcatMapDelayErrorconcatMapDelayErrorconcatMapEagerconcatMapEagerconcatMapEagerDelayErrorconcatMapEagerDelayErrorconcatMapIterableconcatMapIterableconcatMapMaybeconcatMapMaybeconcatMapMaybeDelayErrorconcatMapMaybeDelayErrorconcatMapMaybeDelayErrorconcatMapSingleconcatMapSingleconcatMapSingleDelayErrorconcatMapSingleDelayErrorconcatMapSingleDelayErrorconcatWithconcatWithconcatWithconcatWithcontainscountcreatedebouncedebouncedebouncedefaultIfEmptydeferdelaydelaydelaydelaydelaydelaydelaySubscriptiondelaySubscriptiondelaySubscriptiondematerializedematerializedistinctdistinctdistinctdistinctUntilChangeddistinctUntilChangeddistinctUntilChangeddoAfterNextdoAfterTerminatedoFinallydoOnCompletedoOnDisposedoOnEachdoOnEachdoOnErrordoOnLifecycledoOnNextdoOnSubscribedoOnTerminateelementAtelementAtelementAtOrErroremptyerrorerrorfilterfirstfirstElementfirstOrErrorflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapflatMapCompletableflatMapCompletableflatMapIterableflatMapIterableflatMapMaybeflatMapMaybeflatMapSingleflatMapSingleforEachforEachWhileforEachWhileforEachWhilefromArrayfromCallablefromFuturefromFuturefromFuturefromFuturefromIterablefromPublishergenerategenerategenerategenerategenerategroupBygroupBygroupBygroupBygroupBygroupJoinhideignoreElementsintervalintervalintervalintervalintervalRangeintervalRangeisEmptyjoinjustjustjustjustjustjustjustjustjustjustlastlastElementlastOrErrorliftmapmaterializemergemergemergemergemergemergemergemergemergeArraymergeArraymergeArrayDelayErrormergeArrayDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeWithmergeWithmergeWithmergeWithneverobserveOnobserveOnobserveOnofTypeonErrorResumeNextonErrorResumeNextonErrorReturnonErrorReturnItemonExceptionResumeNextonTerminateDetachpublishpublishrangerangeLongreducereducereduceWithrepeatrepeatrepeatUntilrepeatWhenreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayretryretryretryretryretryretryUntilretryWhensafeSubscribesamplesamplesamplesamplesamplesamplescanscanscanWithsequenceEqualsequenceEqualsequenceEqualsequenceEqualserializesharesinglesingleElementsingleOrErrorskipskipskipskipLastskipLastskipLastskipLastskipLastskipLastskipUntilskipWhilesortedsortedstartWithstartWithstartWithstartWithArraysubscribesubscribesubscribesubscribesubscribesubscribesubscribeOnsubscribeWithswitchIfEmptyswitchMapswitchMapswitchMapCompletableswitchMapCompletableDelayErrorswitchMapDelayErrorswitchMapDelayErrorswitchMapMaybeswitchMapMaybeDelayErrorswitchMapSingleswitchMapSingleDelayErrorswitchOnNextswitchOnNextswitchOnNextDelayErrorswitchOnNextDelayErrortaketaketaketakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeLasttakeUntiltakeUntiltakeWhiletesttestthrottleFirstthrottleFirstthrottleLastthrottleLastthrottleLatestthrottleLatestthrottleLatestthrottleLatestthrottleWithTimeoutthrottleWithTimeouttimeIntervaltimeIntervaltimeIntervaltimeIntervaltimeouttimeouttimeouttimeouttimeouttimeouttimeouttimeouttimertimertimestamptimestamptimestamptimestamptotoFlowabletoFuturetoListtoListtoListtoMaptoMaptoMaptoMultimaptoMultimaptoMultimaptoMultimaptoSortedListtoSortedListtoSortedListtoSortedListunsafeCreateunsubscribeOnusingusingwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwrapzipzipzipzipzipzipzipzipzipzipzipzipzipArrayzipIterablezipWithzipWithzipWithzipWith

Field Detail

sourceback to summary
pack-priv final ObservableOnSubscribe<T> source

Constructor Detail

ObservableCreateback to summary
public ObservableCreate(ObservableOnSubscribe<T> source)

Method Detail

subscribeActualback to summary
protected void subscribeActual(Observer<? super T> observer)

Implements abstract io.reactivex.Observable.subscribeActual.

Doc from io.reactivex.Observable.subscribeActual.

Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Observers.

There is no need to call any of the plugin hooks on the current Observable instance or the Observer; all hooks and basic safeguards have been applied by subscribe(Observer) before this method gets called.

Parameters
observer:Observer<? super T>

the incoming Observer, never null

Annotations
@Override
io.reactivex.internal.operators.observable back to summary

pack-priv final Class ObservableCreate.CreateEmitter<T>

extends AtomicReference<Disposable>
implements ObservableEmitter<T>, Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.disposables.Disposable, io.reactivex.ObservableEmitter, io.reactivex.Emitter

Field Summary

Modifier and TypeField and Description
pack-priv final Observer<? super T>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
CreateEmitter(Observer<? super T> observer)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements io.reactivex.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public boolean
isDisposed()

Implements io.reactivex.ObservableEmitter.isDisposed, io.reactivex.disposables.Disposable.isDisposed.

Returns true if the downstream disposed the sequence or the emitter was terminated via onError(Throwable), onComplete or a successful tryOnError(Throwable).
public void
onComplete()

Implements io.reactivex.Emitter.onComplete.

Signal a completion.
public void
onError(Throwable
the Throwable to signal, not null
t
)

Implements io.reactivex.Emitter.onError.

Signal a Throwable exception.
public void
onNext(T
the value to signal, not null
t
)

Implements io.reactivex.Emitter.onNext.

Signal a normal value.
public ObservableEmitter<T>
serialize()

Implements io.reactivex.ObservableEmitter.serialize.

Ensures that calls to onNext, onError and onComplete are properly serialized.
public void
setCancellable(Cancellable
the cancellable resource, null is allowed
c
)

Implements io.reactivex.ObservableEmitter.setCancellable.

Sets a Cancellable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.
public void
setDisposable(Disposable
the disposable, null is allowed
d
)

Implements io.reactivex.ObservableEmitter.setDisposable.

Sets a Disposable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.
public String
toString()

Overrides java.util.concurrent.atomic.AtomicReference.toString.

Returns the String representation of the current value.
public boolean
tryOnError(Throwable
the throwable error to signal if possible
t
)

Implements io.reactivex.ObservableEmitter.tryOnError.

Attempts to emit the specified Throwable error if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.
Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleaseupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

observerback to summary
pack-priv final Observer<? super T> observer
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

Constructor Detail

CreateEmitterback to summary
pack-priv CreateEmitter(Observer<? super T> observer)

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.disposables.Disposable.dispose.

Doc from io.reactivex.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.ObservableEmitter.isDisposed, io.reactivex.disposables.Disposable.isDisposed.

Doc from io.reactivex.ObservableEmitter.isDisposed.

Returns true if the downstream disposed the sequence or the emitter was terminated via onError(Throwable), onComplete or a successful tryOnError(Throwable).

This method is thread-safe.

Returns:boolean

true if the downstream disposed the sequence or the emitter was terminated

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements io.reactivex.Emitter.onComplete.

Doc from io.reactivex.Emitter.onComplete.

Signal a completion.

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

Implements io.reactivex.Emitter.onError.

Doc from io.reactivex.Emitter.onError.

Signal a Throwable exception.

Parameters
t:Throwable

the Throwable to signal, not null

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

Implements io.reactivex.Emitter.onNext.

Doc from io.reactivex.Emitter.onNext.

Signal a normal value.

Parameters
t:T

the value to signal, not null

Annotations
@Override
serializeback to summary
public ObservableEmitter<T> serialize()

Implements io.reactivex.ObservableEmitter.serialize.

Doc from io.reactivex.ObservableEmitter.serialize.

Ensures that calls to onNext, onError and onComplete are properly serialized.

Returns:ObservableEmitter<T>

the serialized ObservableEmitter

Annotations
@Override
setCancellableback to summary
public void setCancellable(Cancellable c)

Implements io.reactivex.ObservableEmitter.setCancellable.

Doc from io.reactivex.ObservableEmitter.setCancellable.

Sets a Cancellable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.

Parameters
c:Cancellable

the cancellable resource, null is allowed

Annotations
@Override
setDisposableback to summary
public void setDisposable(Disposable d)

Implements io.reactivex.ObservableEmitter.setDisposable.

Doc from io.reactivex.ObservableEmitter.setDisposable.

Sets a Disposable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.

Parameters
d:Disposable

the disposable, null is allowed

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.concurrent.atomic.AtomicReference.toString.

Doc from java.util.concurrent.atomic.AtomicReference.toString.

Returns the String representation of the current value.

Returns:String

the String representation of the current value

Annotations
@Override
tryOnErrorback to summary
public boolean tryOnError(Throwable t)

Implements io.reactivex.ObservableEmitter.tryOnError.

Doc from io.reactivex.ObservableEmitter.tryOnError.

Attempts to emit the specified Throwable error if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.

Unlike onError(Throwable), the RxJavaPlugins.onError is not called if the error could not be delivered.

History: 2.1.1 - experimental

Parameters
t:Throwable

the throwable error to signal if possible

Returns:boolean

true if successful, false if the downstream is not able to accept further events

Annotations
@Override
io.reactivex.internal.operators.observable back to summary

pack-priv final Class ObservableCreate.SerializedEmitter<T>

extends AtomicInteger
implements ObservableEmitter<T>
Class Inheritance
All Implemented Interfaces
io.reactivex.ObservableEmitter, io.reactivex.Emitter
Type Parameters
<T>
the value type

Serializes calls to onNext, onError and onComplete.

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean
pack-priv final ObservableEmitter<T>
pack-priv final AtomicThrowable
pack-priv final SpscLinkedArrayQueue<T>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
public boolean
isDisposed()

Implements io.reactivex.ObservableEmitter.isDisposed.

Returns true if the downstream disposed the sequence or the emitter was terminated via onError(Throwable), onComplete or a successful tryOnError(Throwable).
public void
onComplete()

Implements io.reactivex.Emitter.onComplete.

Signal a completion.
public void
onError(Throwable
the Throwable to signal, not null
t
)

Implements io.reactivex.Emitter.onError.

Signal a Throwable exception.
public void
onNext(T
the value to signal, not null
t
)

Implements io.reactivex.Emitter.onNext.

Signal a normal value.
public ObservableEmitter<T>
serialize()

Implements io.reactivex.ObservableEmitter.serialize.

Ensures that calls to onNext, onError and onComplete are properly serialized.
public void
setCancellable(Cancellable
the cancellable resource, null is allowed
c
)

Implements io.reactivex.ObservableEmitter.setCancellable.

Sets a Cancellable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.
public void
setDisposable(Disposable
the disposable, null is allowed
d
)

Implements io.reactivex.ObservableEmitter.setDisposable.

Sets a Disposable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.
public String
toString()

Overrides java.util.concurrent.atomic.AtomicInteger.toString.

Returns the String representation of the current value.
public boolean
tryOnError(Throwable
the throwable error to signal if possible
t
)

Implements io.reactivex.ObservableEmitter.tryOnError.

Attempts to emit the specified Throwable error if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.
Inherited from java.util.concurrent.atomic.AtomicInteger:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleaseupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

doneback to summary
pack-priv volatile boolean done
emitterback to summary
pack-priv final ObservableEmitter<T> emitter
errorback to summary
pack-priv final AtomicThrowable error
queueback to summary
pack-priv final SpscLinkedArrayQueue<T> queue
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicInteger.serialVersionUID.

Constructor Detail

SerializedEmitterback to summary
pack-priv SerializedEmitter(ObservableEmitter<T> emitter)

Method Detail

drainback to summary
pack-priv void drain()
drainLoopback to summary
pack-priv void drainLoop()
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.ObservableEmitter.isDisposed.

Doc from io.reactivex.ObservableEmitter.isDisposed.

Returns true if the downstream disposed the sequence or the emitter was terminated via onError(Throwable), onComplete or a successful tryOnError(Throwable).

This method is thread-safe.

Returns:boolean

true if the downstream disposed the sequence or the emitter was terminated

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements io.reactivex.Emitter.onComplete.

Doc from io.reactivex.Emitter.onComplete.

Signal a completion.

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

Implements io.reactivex.Emitter.onError.

Doc from io.reactivex.Emitter.onError.

Signal a Throwable exception.

Parameters
t:Throwable

the Throwable to signal, not null

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

Implements io.reactivex.Emitter.onNext.

Doc from io.reactivex.Emitter.onNext.

Signal a normal value.

Parameters
t:T

the value to signal, not null

Annotations
@Override
serializeback to summary
public ObservableEmitter<T> serialize()

Implements io.reactivex.ObservableEmitter.serialize.

Doc from io.reactivex.ObservableEmitter.serialize.

Ensures that calls to onNext, onError and onComplete are properly serialized.

Returns:ObservableEmitter<T>

the serialized ObservableEmitter

Annotations
@Override
setCancellableback to summary
public void setCancellable(Cancellable c)

Implements io.reactivex.ObservableEmitter.setCancellable.

Doc from io.reactivex.ObservableEmitter.setCancellable.

Sets a Cancellable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.

Parameters
c:Cancellable

the cancellable resource, null is allowed

Annotations
@Override
setDisposableback to summary
public void setDisposable(Disposable d)

Implements io.reactivex.ObservableEmitter.setDisposable.

Doc from io.reactivex.ObservableEmitter.setDisposable.

Sets a Disposable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.

Parameters
d:Disposable

the disposable, null is allowed

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.concurrent.atomic.AtomicInteger.toString.

Doc from java.util.concurrent.atomic.AtomicInteger.toString.

Returns the String representation of the current value.

Returns:String

the String representation of the current value

Annotations
@Override
tryOnErrorback to summary
public boolean tryOnError(Throwable t)

Implements io.reactivex.ObservableEmitter.tryOnError.

Doc from io.reactivex.ObservableEmitter.tryOnError.

Attempts to emit the specified Throwable error if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.

Unlike onError(Throwable), the RxJavaPlugins.onError is not called if the error could not be delivered.

History: 2.1.1 - experimental

Parameters
t:Throwable

the throwable error to signal if possible

Returns:boolean

true if successful, false if the downstream is not able to accept further events

Annotations
@Override