=str #16331 Use ReactiveStreamsCompliance utility everywhere
* if onSubscribe, onError, onComplete throws exception we must not call onError, see 2:13 https://github.com/reactive-streams/reactive-streams
This commit is contained in:
parent
b442c4d9e6
commit
3876793988
15 changed files with 113 additions and 73 deletions
|
|
@ -23,11 +23,13 @@ private[akka] object SubscriberManagement {
|
|||
}
|
||||
|
||||
object Completed extends EndOfStream {
|
||||
def apply[T](subscriber: Subscriber[T]): Unit = subscriber.onComplete()
|
||||
import ReactiveStreamsCompliance._
|
||||
def apply[T](subscriber: Subscriber[T]): Unit = tryOnComplete(subscriber)
|
||||
}
|
||||
|
||||
final case class ErrorCompleted(cause: Throwable) extends EndOfStream {
|
||||
def apply[T](subscriber: Subscriber[T]): Unit = subscriber.onError(cause)
|
||||
import ReactiveStreamsCompliance._
|
||||
def apply[T](subscriber: Subscriber[T]): Unit = tryOnError(subscriber, cause)
|
||||
}
|
||||
|
||||
val ShutDown = new ErrorCompleted(new IllegalStateException("Cannot subscribe to shut-down Publisher"))
|
||||
|
|
@ -37,9 +39,11 @@ private[akka] object SubscriberManagement {
|
|||
* INTERNAL API
|
||||
*/
|
||||
private[akka] trait SubscriptionWithCursor[T] extends Subscription with ResizableMultiReaderRingBuffer.Cursor {
|
||||
import ReactiveStreamsCompliance._
|
||||
|
||||
def subscriber: Subscriber[_ >: T]
|
||||
|
||||
def dispatch(element: T): Unit = subscriber.onNext(element)
|
||||
def dispatch(element: T): Unit = tryOnNext(subscriber, element)
|
||||
|
||||
var active = true
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue