/// <summary>This method updates child views and clears the batch of events. </summary> protected void SendBatch() { // If there are child views and the batch was filled, fireStatementStopped Update method if (HasViews) { // Convert to object arrays EventBean[] newData = null; EventBean[] oldData = null; if (CurrentBatch.IsNotEmpty()) { newData = CurrentBatch.ToArray(); } if ((LastBatch != null) && (LastBatch.IsNotEmpty())) { oldData = LastBatch.ToArray(); } // Post new data (current batch) and old data (prior batch) if ((newData != null) || (oldData != null)) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QViewIndicate(this, _lengthBatchViewFactory.ViewName, newData, oldData); } UpdateChildren(newData, oldData); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AViewIndicate(); } } } LastBatch = CurrentBatch; CurrentBatch = new LinkedHashSet <EventBean>(); }
/// <summary> /// This method updates child views and clears the batch of events. We schedule a /// new callback at this time if there were events in the batch. /// </summary> protected void SendBatch() { IsCallbackScheduled = false; // If there are child views and the batch was filled, fireStatementStopped Update method if (HasViews) { // Convert to object arrays EventBean[] newData = null; EventBean[] oldData = null; if (CurrentBatch.IsNotEmpty()) { newData = CurrentBatch.ToArray(); } if ((LastBatch != null) && (LastBatch.IsNotEmpty())) { oldData = LastBatch.ToArray(); } if ((newData != null) || (oldData != null) || (_isForceOutput)) { Instrument.With( i => i.QViewIndicate(this, _timeBatchViewFactory.ViewName, newData, oldData), i => i.AViewIndicate(), () => UpdateChildren(newData, oldData)); } } // Only if forceOutput is enabled or // there have been any events in this or the last interval do we schedule a callback, // such as to not waste resources when no events arrive. if ((CurrentBatch.IsNotEmpty()) || ((LastBatch != null) && (LastBatch.IsNotEmpty())) || (_isForceOutput)) { ScheduleCallback(); IsCallbackScheduled = true; } LastBatch = CurrentBatch; CurrentBatch = new LinkedHashSet <EventBean>(); }
/// <summary>Evaluate an event by asking each index to match the event. Any filter callbacks at this node automatically match the event and do not need to be further evaluated, and are thus added to the "matches" list of callbacks. NOTE: This client should not use the lock before calling this method. </summary> /// <param name="theEvent">is the event wrapper supplying the event property values</param> /// <param name="matches">is the list of callbacks to add to for any matches found</param> /// <param name="ctx">evaluator context</param> public void MatchEvent( EventBean theEvent, ICollection <FilterHandle> matches, ExprEvaluatorContext ctx) { using (_nodeRwLock.AcquireReadLock()) { if (InstrumentationHelper.ENABLED) { if (_indizes.IsNotEmpty()) { InstrumentationHelper.Get().QFilterHandleSetIndexes(_indizes); } } // Ask each of the indizes to match against the attribute values var length = _indizes.Count; for (int ii = 0; ii < length; ii++) { _indizes[ii].MatchEvent(theEvent, matches, ctx); } if (InstrumentationHelper.ENABLED) { if (_indizes.IsNotEmpty()) { InstrumentationHelper.Get().AFilterHandleSetIndexes(); } } if (InstrumentationHelper.ENABLED) { if (_callbackSet.IsNotEmpty()) { InstrumentationHelper.Get().QaFilterHandleSetCallbacks(_callbackSet); } } // Add each filter callback stored in this node to the matching list _callbackSet.AddTo(matches); //foreach (FilterHandle filterCallback in _callbackSet) //{ // matches.Add(filterCallback); //} } }