public void RecordRunning(Message message, bool isInterleavable) { // Note: This method is always called while holding lock on this activation, so no need for additional locks here numRunning++; if (message.Direction != Message.Directions.OneWay && !(message.SendingActivation is null) && !message.SendingGrain.IsClient()) { RunningRequestsSenders.Add(message.SendingActivation); } if (this.Blocking != null || isInterleavable) { return; } // This logic only works for non-reentrant activations // Consider: Handle long request detection for reentrant activations. this.Blocking = message; currentRequestStartTime = DateTime.UtcNow; }
public void ResetRunning(Message message) { // Note: This method is always called while holding lock on this activation, so no need for additional locks here numRunning--; RunningRequestsSenders.Remove(message.SendingActivation); if (numRunning == 0) { becameIdle = DateTime.UtcNow; if (!IsExemptFromCollection) { collector.TryRescheduleCollection(this); } } // The below logic only works for non-reentrant activations. if (this.Blocking != null && !message.Equals(this.Blocking)) { return; } this.Blocking = null; currentRequestStartTime = DateTime.MinValue; }