示例#1
0
        public NamedWindowProcessor AddProcessor(string name, string contextName, EventType eventType, StatementResultService statementResultService, ValueAddEventProcessor revisionProcessor, string eplExpression, string statementName, bool isPrioritized, bool isEnableSubqueryIndexShare, bool isBatchingDataWindow, bool isVirtualDataWindow, ICollection <string> optionalUniqueKeyProps, string eventTypeAsName, StatementContext statementContextCreateWindow, NamedWindowDispatchService namedWindowDispatchService)
        {
            if (_processors.ContainsKey(name))
            {
                throw new ViewProcessingException("A named window by name '" + name + "' has already been created");
            }

            var processor = namedWindowDispatchService.CreateProcessor(
                name, this, namedWindowDispatchService, contextName, eventType, statementResultService, revisionProcessor,
                eplExpression, statementName, isPrioritized, isEnableSubqueryIndexShare, _enableQueryPlanLog,
                _metricReportingService, isBatchingDataWindow, isVirtualDataWindow, optionalUniqueKeyProps, eventTypeAsName,
                statementContextCreateWindow);

            _processors.Put(name, processor);

            if (!_observers.IsEmpty())
            {
                var theEvent = new NamedWindowLifecycleEvent(name, processor, NamedWindowLifecycleEvent.LifecycleEventType.CREATE);
                foreach (var observer in _observers)
                {
                    observer.Observe(theEvent);
                }
            }

            return(processor);
        }
示例#2
0
        public void RemoveProcessor(string name)
        {
            var processor = _processors.Get(name);

            if (processor != null)
            {
                processor.Dispose();
                _processors.Remove(name);

                if (!_observers.IsEmpty())
                {
                    var theEvent = new NamedWindowLifecycleEvent(name, processor, NamedWindowLifecycleEvent.LifecycleEventType.DESTROY);
                    foreach (var observer in _observers)
                    {
                        observer.Observe(theEvent);
                    }
                }
            }
        }