diff --git a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/MessageBroker.kt b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/MessageBroker.kt index 1816ffcd6..56f9626f3 100644 --- a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/MessageBroker.kt +++ b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/MessageBroker.kt @@ -102,8 +102,8 @@ class MessageBroker(queueMessages: Boolean = false) : IPrintable { private val messageContext: ProtocolContexts.MessageContext ) : IRdWireableDispatchHelper { - override fun dispatch(lifetime: Lifetime, scheduler: IScheduler?, action: () -> Unit) { - doDispatch(lifetime.intersect(this.lifetime), scheduler ?: protocol.scheduler, action) + override fun dispatch(scheduler: IScheduler?, action: () -> Unit) { + doDispatch(lifetime, scheduler ?: protocol.scheduler, action) } private fun doDispatch(lifetime: Lifetime, scheduler: IScheduler, action: () -> Unit) { diff --git a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/base/IRdReactive.kt b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/base/IRdReactive.kt index 6715d3215..07a0bda47 100644 --- a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/base/IRdReactive.kt +++ b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/base/IRdReactive.kt @@ -35,8 +35,7 @@ interface IRdWireableDispatchHelper { val rdId: RdId val lifetime: Lifetime - fun dispatch(lifetime: Lifetime = this.lifetime, scheduler: IScheduler? = null, action: () -> Unit) - fun dispatch(scheduler: IScheduler? = null, action: () -> Unit) = dispatch(lifetime, scheduler, action) + fun dispatch(scheduler: IScheduler? = null, action: () -> Unit) } diff --git a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdMap.kt b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdMap.kt index aea3adf52..ccc6ed4ac 100644 --- a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdMap.kt +++ b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdMap.kt @@ -221,8 +221,8 @@ class AsyncRdMap private constructor( override val lifetime: Lifetime get() = dispatchHelper.lifetime - override fun dispatch(lifetime: Lifetime, scheduler: IScheduler?, action: () -> Unit) { - dispatchHelper.dispatch(lifetime, SynchronousScheduler, action) + override fun dispatch(scheduler: IScheduler?, action: () -> Unit) { + dispatchHelper.dispatch(SynchronousScheduler, action) } }) } diff --git a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdSet.kt b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdSet.kt index 8a37966b5..61825d86a 100644 --- a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdSet.kt +++ b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/AsyncRdSet.kt @@ -190,8 +190,8 @@ class AsyncRdSet private constructor( override val lifetime: Lifetime get() = dispatchHelper.lifetime - override fun dispatch(lifetime: Lifetime, scheduler: IScheduler?, action: () -> Unit) { - dispatchHelper.dispatch(lifetime, SynchronousScheduler, action) + override fun dispatch(scheduler: IScheduler?, action: () -> Unit) { + dispatchHelper.dispatch(SynchronousScheduler, action) } }) } diff --git a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt index 30ece6630..12f834d88 100644 --- a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt +++ b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt @@ -130,7 +130,7 @@ class CallSiteWiredRdTask( } else if (resultFromWire is RdTaskResult.Cancelled) sendCancellation() - dispatchHelper.dispatch(outerLifetime, wireScheduler) { + dispatchHelper.dispatch(wireScheduler) { if (!result.setIfEmpty(resultFromWire)) RdReactiveBase.logReceived.trace { "call `${call.location}` (${call.rdid}) response was dropped, task result is: ${result.valueOrNull}" } } @@ -192,7 +192,7 @@ class EndpointWiredRdTask( RdReactiveBase.logReceived.trace { "received cancellation" } buffer.readVoid() //nothing just a void value - dispatchHelper.dispatch(lifetime, wireScheduler) { + dispatchHelper.dispatch(wireScheduler) { val success = result.setIfEmpty(RdTaskResult.Cancelled()) val wireScheduler = call.protocol?.scheduler if (success || wireScheduler == null) diff --git a/rd-net/RdFramework/Base/IRdBindable.cs b/rd-net/RdFramework/Base/IRdBindable.cs index 110e5ddbe..f39f7f3ea 100644 --- a/rd-net/RdFramework/Base/IRdBindable.cs +++ b/rd-net/RdFramework/Base/IRdBindable.cs @@ -46,24 +46,19 @@ public interface IRdWireableDispatchHelper RdId RdId { get; } Lifetime Lifetime { get; } - public void Dispatch(Lifetime lifetime, IScheduler? scheduler, Action action); + public void Dispatch(IScheduler? scheduler, Action action); } public static class RdWireableDispatchHelperEx { - public static void Dispatch(this IRdWireableDispatchHelper helper, Lifetime lifetime, Action action) - { - helper.Dispatch(lifetime, null, action); - } - public static void Dispatch(this IRdWireableDispatchHelper helper, IScheduler? scheduler, Action action) { - helper.Dispatch(helper.Lifetime, scheduler, action); + helper.Dispatch(scheduler, action); } public static void Dispatch(this IRdWireableDispatchHelper helper, Action action) { - helper.Dispatch(helper.Lifetime, null, action); + helper.Dispatch(null, action); } } diff --git a/rd-net/RdFramework/Impl/AsyncRdMap.cs b/rd-net/RdFramework/Impl/AsyncRdMap.cs index aeded2755..f52143345 100644 --- a/rd-net/RdFramework/Impl/AsyncRdMap.cs +++ b/rd-net/RdFramework/Impl/AsyncRdMap.cs @@ -224,7 +224,7 @@ public DelegatingDispatchHelper(IRdWireableDispatchHelper dispatchHelper) myDispatchHelper = dispatchHelper; } - public void Dispatch(Lifetime lifetime, IScheduler? scheduler, Action action) + public void Dispatch(IScheduler? scheduler, Action action) { myDispatchHelper.Dispatch(SynchronousScheduler.Instance, action); } diff --git a/rd-net/RdFramework/Impl/AsyncRdSet.cs b/rd-net/RdFramework/Impl/AsyncRdSet.cs index 072ac2804..3b6970db5 100644 --- a/rd-net/RdFramework/Impl/AsyncRdSet.cs +++ b/rd-net/RdFramework/Impl/AsyncRdSet.cs @@ -252,7 +252,7 @@ public DelegatingDispatchHelper(IRdWireableDispatchHelper dispatchHelper) myDispatchHelper = dispatchHelper; } - public void Dispatch(Lifetime lifetime, IScheduler? scheduler, Action action) + public void Dispatch(IScheduler? scheduler, Action action) { myDispatchHelper.Dispatch(SynchronousScheduler.Instance, action); } diff --git a/rd-net/RdFramework/Impl/MessageBroker.cs b/rd-net/RdFramework/Impl/MessageBroker.cs index cae0f76ba..0b9ba365f 100644 --- a/rd-net/RdFramework/Impl/MessageBroker.cs +++ b/rd-net/RdFramework/Impl/MessageBroker.cs @@ -121,9 +121,9 @@ internal RdWireableDispatchHelper(Lifetime lifetime, ILog log, IRdWireable wirea myMessageContext = messageContext; } - public void Dispatch(Lifetime lifetime, IScheduler? scheduler, Action action) + public void Dispatch(IScheduler? scheduler, Action action) { - DoDispatch(lifetime.Intersect(Lifetime), scheduler ?? myProtocol.Scheduler, action); + DoDispatch(Lifetime, scheduler ?? myProtocol.Scheduler, action); } private void DoDispatch(Lifetime lifetime, IScheduler scheduler, Action action) diff --git a/rd-net/RdFramework/Tasks/WiredRdTask.cs b/rd-net/RdFramework/Tasks/WiredRdTask.cs index acd9ab51b..6f215bbb3 100644 --- a/rd-net/RdFramework/Tasks/WiredRdTask.cs +++ b/rd-net/RdFramework/Tasks/WiredRdTask.cs @@ -124,7 +124,7 @@ public override void OnWireReceived(IProtocol proto, SerializationCtx ctx, Unsaf SendCancellation(); - dispatchHelper.Dispatch(myOuterLifetime, WireScheduler, () => + dispatchHelper.Dispatch(WireScheduler, () => { if (!ResultInternal.SetIfEmpty(taskResult)) Trace(RdReactiveBase.ourLogReceived, "response from wire was rejected because task already has result"); @@ -203,7 +203,7 @@ public override void OnWireReceived(IProtocol proto, SerializationCtx ctx, Unsaf Trace(RdReactiveBase.ourLogReceived, "received cancellation"); reader.ReadVoid(); //nothing just a void value - dispatchHelper.Dispatch(Lifetime, WireScheduler, () => + dispatchHelper.Dispatch(WireScheduler, () => { var success = ResultInternal.SetIfEmpty(RdTaskResult.Cancelled()); var protocolScheduler = myCall.TryGetProto()?.Scheduler;