internal Receiver(object owner, Action <Message <T> > onReceived, SynchronizationLock context, Pipeline pipeline, bool enforceIsolation = false) { this.scheduler = pipeline.Scheduler; this.onReceived = PipelineElement.TrackStateObjectOnContext <Message <T> >(onReceived, owner, pipeline); this.owner = owner; this.syncContext = context; this.enforceIsolation = enforceIsolation; this.cloner = RecyclingPool.Create <T>(); this.pipeline = pipeline; }
internal Receiver(object owner, Action <Message <T> > onReceived, SynchronizationLock context, Pipeline pipeline, bool enforceIsolation = false) { this.scheduler = pipeline.Scheduler; this.onReceived = onReceived; this.owner = owner; this.syncContext = context; this.enforceIsolation = enforceIsolation; this.cloner = RecyclingPool.Create <T>(); #if DEBUG this.debugTrace = new StackTrace(true); #endif }
internal Receiver(int id, string name, PipelineElement element, object owner, Action <Message <T> > onReceived, SynchronizationLock context, Pipeline pipeline, bool enforceIsolation = false) { this.scheduler = pipeline.Scheduler; this.schedulerContext = pipeline.SchedulerContext; this.lastEnvelope = default; this.onReceived = m => { this.lastEnvelope = m.Envelope; PipelineElement.TrackStateObjectOnContext(onReceived, owner, pipeline)(m); }; this.Id = id; this.Name = name; this.element = element; this.Owner = owner; this.syncContext = context; this.enforceIsolation = enforceIsolation; this.Recycler = RecyclingPool.Create <T>(); this.pipeline = pipeline; this.receiverDiagnosticsCollector = new Lazy <DiagnosticsCollector.ReceiverCollector>(() => this.pipeline.DiagnosticsCollector?.GetReceiverDiagnosticsCollector(pipeline, element, this), true); }