mirror of
https://github.com/corda/corda.git
synced 2025-06-23 01:19:00 +00:00
CORDA-3381 Make internalUtilsKt Observer tee not wrap with SafeSubscriber (#5913)
* Make tee not wrap PublishSubjects in SafeSubscribers, otherwise a non Rx exception from an unsafe observer shuts down all other observers under the same PublishSubject
* Throw SQLException or PersistenceException plain, that may come out of an unsafe subscriber
* Revert "Throw SQLException or PersistenceException plain, that may come out of an unsafe subscriber"
This reverts commit c7b8af3fa6
.
* Update Detekt baseline
This commit is contained in:
committed by
GitHub
parent
cb6ed6042c
commit
9ca1dd59da
@ -15,6 +15,7 @@ import net.corda.core.utilities.seconds
|
||||
import org.slf4j.Logger
|
||||
import rx.Observable
|
||||
import rx.Observer
|
||||
import rx.observers.Subscribers
|
||||
import rx.subjects.PublishSubject
|
||||
import rx.subjects.UnicastSubject
|
||||
import java.io.ByteArrayOutputStream
|
||||
@ -172,8 +173,8 @@ fun <T> Observable<T>.bufferUntilSubscribed(): Observable<T> {
|
||||
@DeleteForDJVM
|
||||
fun <T> Observer<T>.tee(vararg teeTo: Observer<T>): Observer<T> {
|
||||
val subject = PublishSubject.create<T>()
|
||||
subject.subscribe(this)
|
||||
teeTo.forEach { subject.subscribe(it) }
|
||||
subject.unsafeSubscribe(Subscribers.from(this))
|
||||
teeTo.forEach { subject.unsafeSubscribe(Subscribers.from(it)) }
|
||||
return subject
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user