public EventBean[] Lookup(
            EventBean[] newData,
            ExprEvaluatorContext exprEvaluatorContext)
        {
            ISet<EventBean> removeEvents = null;

            // For every new event (usually 1)
            foreach (var newEvent in newData) {
                eventsPerStream[1] = newEvent;

                // use index to find match
                var matches = tableLookupStrategy.Lookup(eventsPerStream, exprEvaluatorContext);
                if (matches == null || matches.IsEmpty()) {
                    continue;
                }

                if (removeEvents == null) {
                    removeEvents = new LinkedHashSet<EventBean>();
                }

                removeEvents.AddAll(matches);
            }

            EventBean[] result = removeEvents?.ToArray();

            return result;
        }
Пример #2
0
        public ICollection <EventBean> Lookup(EventBean[] events, ExprEvaluatorContext context)
        {
            ExprTableEvalLockUtil.ObtainLockUnless(_lock, context);

            var result = _inner.Lookup(events, context);

            if (result == null)
            {
                return(Collections.GetEmptyList <EventBean>());
            }
            return(result);
        }
Пример #3
0
        private ICollection<EventBean> LookupInternal(
            EventBean[] events,
            ExprEvaluatorContext context)
        {
            TableEvalLockUtil.ObtainLockUnless(_lock, context);

            var result = _inner.Lookup(events, context);
            if (result == null) {
                return Collections.GetEmptyList<EventBean>();
            }

            return result;
        }
 public ICollection <EventBean> Lookup(EventBean[] events, ExprEvaluatorContext context)
 {
     using (_statementLock.AcquireReadLock())
     {
         ICollection <EventBean> result = _inner.Lookup(events, context);
         if (result != null)
         {
             return(new ArrayDeque <EventBean>(result));
         }
         else
         {
             return(Collections.GetEmptySet <EventBean>());
         }
     }
 }
Пример #5
0
 private ICollection<EventBean> LookupInternal(
     EventBean[] events,
     ExprEvaluatorContext context)
 {
     using (_statementLock.AcquireReadLock())
     {
         var result = _inner.Lookup(events, context);
         if (result != null)
         {
             return new ArrayDeque<EventBean>(result);
         }
         else
         {
             return EmptyList<EventBean>.Instance;
         }
     }
 }
Пример #6
0
        public EventBean[] Lookup(EventBean[] newData, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QInfraTriggeredLookup(SubordWMatchExprLookupStrategyType.INDEXED_UNFILTERED);
            }

            ISet <EventBean> removeEvents = null;

            // For every new event (usually 1)
            foreach (EventBean newEvent in newData)
            {
                _eventsPerStream[1] = newEvent;

                // use index to find match
                ICollection <EventBean> matches = _tableLookupStrategy.Lookup(_eventsPerStream, exprEvaluatorContext);
                if ((matches == null) || (matches.IsEmpty()))
                {
                    continue;
                }

                if (removeEvents == null)
                {
                    removeEvents = new LinkedHashSet <EventBean>();
                }
                removeEvents.AddAll(matches);
            }

            if (removeEvents == null)
            {
                return(null);
            }

            EventBean[] result = removeEvents.ToArray();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AInfraTriggeredLookup(result);
            }

            return(result);
        }
Пример #7
0
 public ICollection<EventBean> Lookup(
     EventBean[] events,
     ExprEvaluatorContext context)
 {
     return service.Lookup(events, context);
 }
Пример #8
0
        public EventBean[] Lookup(EventBean[] newData, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QInfraTriggeredLookup(SubordWMatchExprLookupStrategyType.INDEXED_FILTERED);
            }
            ISet <EventBean> foundEvents = null;

            var evaluateParams = new EvaluateParams(_eventsPerStream, true, exprEvaluatorContext);

            // For every new event (usually 1)
            foreach (EventBean newEvent in newData)
            {
                _eventsPerStream[1] = newEvent;

                // use index to find match
                var matches = _tableLookupStrategy.Lookup(_eventsPerStream, exprEvaluatorContext);
                if ((matches == null) || (matches.IsEmpty()))
                {
                    continue;
                }

                // evaluate expression
                var eventsIt = matches.GetEnumerator();
                while (eventsIt.MoveNext())
                {
                    _eventsPerStream[0] = eventsIt.Current;

                    foreach (EventBean aNewData in newData)
                    {
                        _eventsPerStream[1] = aNewData;    // Stream 1 events are the originating events (on-delete events)

                        var result = (bool?)_joinExpr.Evaluate(evaluateParams);
                        if (result != null)
                        {
                            if (result.Value)
                            {
                                if (foundEvents == null)
                                {
                                    foundEvents = new LinkedHashSet <EventBean>();
                                }
                                foundEvents.Add(_eventsPerStream[0]);
                            }
                        }
                    }
                }
            }

            if (foundEvents == null)
            {
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AInfraTriggeredLookup(null);
                }
                return(null);
            }

            EventBean[] events = foundEvents.ToArray();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AInfraTriggeredLookup(events);
            }

            return(events);
        }