Пример #1
0
 public EventBusSource(
     ILockManager lockManager,
     IThreadLocalManager threadLocalManager)
 {
     _iLock           = lockManager.CreateLock(GetType());
     _collectorDataTL = threadLocalManager.Create <EPDataFlowEventBeanCollectorContext>(() => null);
 }
Пример #2
0
 public EmitterCollectorUpdateListener(EPDataFlowIRStreamCollector collector, LocalEmitter emitterForCollector, IThreadLocal <EPDataFlowIRStreamCollectorContext> collectorDataTL, bool submitEventBean)
 {
     _collector           = collector;
     _emitterForCollector = emitterForCollector;
     _collectorDataTL     = collectorDataTL;
     _submitEventBean     = submitEventBean;
 }
Пример #3
0
 public EPStatementSource(
     ILockManager lockManager,
     IThreadLocalManager threadLocalManager)
 {
     _iLock                 = lockManager.CreateLock(MethodBase.GetCurrentMethod().DeclaringType);
     _collectorDataTL       = threadLocalManager.Create <EPDataFlowIRStreamCollectorContext>(() => null);
     _lifeCycleEventHandler = Observe;
 }
 public ExpressionResultCacheService(
     int declareExprCacheSize,
     IThreadLocalManager threadLocalManager)
 {
     _declareExprCacheSize = declareExprCacheSize;
     _threadCache          = threadLocalManager.Create(
         () => new ExpressionResultCacheServiceHolder(declareExprCacheSize));
 }
 public ExprConcatNodeEvalThreadLocal(
     ExprConcatNode parent,
     ExprEvaluator[] evaluators,
     IThreadLocalManager threadLocalManager)
 {
     _parent      = parent;
     _evaluators  = evaluators;
     _localBuffer = threadLocalManager.Create <StringBuilder>(() => new StringBuilder());
 }
Пример #6
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="statementResultService">handles result delivery</param>
 /// <param name="dispatchService">for performing the dispatch</param>
 /// <param name="threadLocalManager">The thread local manager.</param>
 protected UpdateDispatchViewBase(
     StatementResultService statementResultService,
     DispatchService dispatchService,
     IThreadLocalManager threadLocalManager)
 {
     _isDispatchWaiting     = threadLocalManager.Create(() => new Mutable <bool>());
     DispatchService        = dispatchService;
     StatementResultService = statementResultService;
 }
Пример #7
0
        public ThreadLocal(Func <T> valueFactory, bool trackAllValues)
        {
            if (valueFactory == null)
            {
                throw new ArgumentNullException(nameof(valueFactory));
            }

            _wrapped = trackAllValues ? (IThreadLocal <T>) new TrackingThreadLocal <T>(valueFactory) : new NoTrackingThreadLocal <T>(valueFactory);
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VariableVersionThreadLocal"/> class.
 /// </summary>
 /// <param name="threadLocalManager">The thread local manager.</param>
 public VariableVersionThreadLocal(IThreadLocalManager threadLocalManager)
 {
     if (threadLocalManager != null) {
         _vThreadLocal = threadLocalManager.Create(CreateEntry);
     }
     else {
         _vThreadLocal = null;
     }
 }
Пример #9
0
 public StatementResultServiceImpl(
     StatementInformationalsRuntime statementInformationals,
     EPServicesContext epServicesContext)
 {
     StatementDispatchTl = new SlimThreadLocal<StatementDispatchTLEntry>(() => new StatementDispatchTLEntry());
     _statementInformationals = statementInformationals;
     _epServicesContext = epServicesContext;
     _outboundThreading = epServicesContext.ThreadingService.IsOutboundThreading;
     IsMakeSynthetic = statementInformationals.IsAlwaysSynthesizeOutputEvents;
 }
Пример #10
0
 public ExprConcatNodeEvalThreadLocal(
     ExprConcatNode parent,
     ExprEvaluator[] evaluators)
 {
     localBuffer = new SystemThreadLocal<StringBuilder>(() => new StringBuilder());
     buffer = localBuffer.GetOrCreate();
     this.parent = parent;
     this.evaluators = evaluators;
     buffer = localBuffer.GetOrCreate();
 }
Пример #11
0
 private void Dispose(bool disposeManagedResources)
 {
     if (disposeManagedResources)
     {
         if (Interlocked.CompareExchange(ref _disposing, 1, 0) == 0)
         {
             _wrapped.Dispose();
             _wrapped = null;
         }
     }
 }
Пример #12
0
 public ExprNodeAdapterMultiStream(int filterSpecId, int filterSpecParamPathNum, ExprNode exprNode, ExprEvaluatorContext evaluatorContext, VariableService variableService, EventBean[] prototype)
     : base(filterSpecId, filterSpecParamPathNum, exprNode, evaluatorContext, variableService)
 {
     _prototypeArray = prototype;
     _arrayPerThread = ThreadLocalManager.Create(
         () =>
     {
         var eventsPerStream = new EventBean[_prototypeArray.Length];
         Array.Copy(_prototypeArray, 0, eventsPerStream, 0, _prototypeArray.Length);
         return(eventsPerStream);
     });
 }
Пример #13
0
        /// <summary>Ctor. </summary>
        /// <param name="svc">isolated services</param>
        /// <param name="unisolatedSvc">engine services</param>
        public EPRuntimeIsolatedImpl(EPIsolationUnitServices svc, EPServicesContext unisolatedSvc)
        {
            _services           = svc;
            _unisolatedServices = unisolatedSvc;
            _threadWorkQueue    = new ThreadWorkQueue();

            _isSubselectPreeval           = unisolatedSvc.EngineSettingsService.EngineSettings.Expression.IsSelfSubselectPreeval;
            _isPrioritized                = unisolatedSvc.EngineSettingsService.EngineSettings.Execution.IsPrioritized;
            _isLatchStatementInsertStream = unisolatedSvc.EngineSettingsService.EngineSettings.Threading.IsInsertIntoDispatchPreserveOrder;

            _threadLocalData = ThreadLocalManager.Create(CreateLocalData);
        }
Пример #14
0
        /// <summary>
        /// Dispatches when the statement is stopped any remaining results.
        /// </summary>
        public void DispatchOnStop()
        {
            var dispatches = _lastResults.GetOrCreate();

            if (dispatches.IsEmpty())
            {
                return;
            }

            Execute();

            _lastResults = ThreadLocalManager.Create(
                () => new LinkedList <UniformPair <EventBean[]> >());
        }
Пример #15
0
 public MethodPollingViewable(
     MethodStreamSpec methodStreamSpec,
     DataCache dataCache,
     EventType eventType,
     ExprEvaluatorContext exprEvaluatorContext,
     MethodPollingViewableMeta metadata,
     IThreadLocalManager threadLocalManager)
 {
     _methodStreamSpec     = methodStreamSpec;
     _dataCacheThreadLocal = threadLocalManager.Create <DataCache>(() => null);
     _dataCache            = dataCache;
     _eventType            = eventType;
     _exprEvaluatorContext = exprEvaluatorContext;
     _metadata             = metadata;
 }
Пример #16
0
        private void Dispose(bool disposeManagedResources)
        {
            if (!disposeManagedResources)
            {
                return;
            }

            if (Interlocked.CompareExchange(ref _disposing, 1, 0) != 0)
            {
                return;
            }

            _wrapped?.Dispose();
            _wrapped = null;
        }
Пример #17
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="myStreamNumber">is the stream number of the view</param>
        /// <param name="inputParameters">are the event property names providing input parameter keys</param>
        /// <param name="pollExecStrategy">is the strategy to use for retrieving results</param>
        /// <param name="dataCache">is looked up before using the strategy</param>
        /// <param name="eventType">is the type of events generated by the view</param>
        /// <param name="threadLocalManager">The thread local manager.</param>

        public DatabasePollingViewable(
            int myStreamNumber,
            IList <String> inputParameters,
            PollExecStrategy pollExecStrategy,
            DataCache dataCache,
            EventType eventType,
            IThreadLocalManager threadLocalManager)
        {
            _dataCacheThreadLocal = threadLocalManager.Create <DataCache>(() => null);
            _myStreamNumber       = myStreamNumber;
            _inputParameters      = inputParameters;
            _pollExecStrategy     = pollExecStrategy;
            _dataCache            = dataCache;
            _eventType            = eventType;
        }
Пример #18
0
 public ThreadLocal(Func <T> valueFactory, bool trackAllValues)
 {
     if (valueFactory == null)
     {
         throw new ArgumentNullException("valueFactory");
     }
     if (trackAllValues)
     {
         _wrapped = new TrackingThreadLocal <T>(valueFactory);
     }
     else
     {
         _wrapped = new NoTrackingThreadLocal <T>(valueFactory);
     }
 }
Пример #19
0
        public ExprNodeAdapterMSPlain(
            FilterSpecParamExprNode factory,
            ExprEvaluatorContext evaluatorContext,
            EventBean[] prototype,
            VariableManagementService variableService)
            : base(factory, evaluatorContext, prototype)
        {
            _variableService = variableService;

            _arrayPerThread = new SlimThreadLocal<EventBean[]>(
                () => {
                    var eventsPerStream = new EventBean[prototypeArray.Length];
                    Array.Copy(prototypeArray, 0, eventsPerStream, 0, prototypeArray.Length);
                    return eventsPerStream;
                });
        }
Пример #20
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="exprNode">is the bool expression</param>
        /// <param name="prototype">is the row of events the we are matching on</param>
        /// <param name="variableService">for setting variable version for evaluating variables, if required</param>
        public ExprNodeAdapter(ExprNode exprNode, EventBean[] prototype,
                               VariableService variableService)
        {
            _exprNode        = exprNode;
            _exprNodeEval    = exprNode.ExprEvaluator;
            _variableService = variableService;
            _arrayPerThread  = ThreadLocalManager.Create <EventBean[]>(CreateLocalData);

            if (prototype == null)
            {
                _prototype = new EventBean[1];
            }
            else
            {
                _prototype = prototype;
            }
        }
Пример #21
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="statementLifecycleSvc">handles persistence for statements</param>
        /// <param name="metricReportingService">for metrics reporting</param>
        /// <param name="threadingService">for outbound threading</param>
        /// <param name="threadLocalManager">The thread local manager.</param>
        public StatementResultServiceImpl(
            String statementName,
            StatementLifecycleSvc statementLifecycleSvc,
            MetricReportingServiceSPI metricReportingService,
            ThreadingService threadingService,
            IThreadLocalManager threadLocalManager)
        {
            Log.Debug(".ctor");

            _threadLocalManager     = threadLocalManager;
            _lastResults            = threadLocalManager.Create(() => new LinkedList <UniformPair <EventBean[]> >());
            _isDebugEnabled         = ExecutionPathDebugLog.IsEnabled && Log.IsDebugEnabled;
            _statementName          = statementName;
            _statementLifecycleSvc  = statementLifecycleSvc;
            _metricReportingService = metricReportingService;
            _statementOutputHooks   = metricReportingService != null ? metricReportingService.StatementOutputHooks : new List <StatementResultListener>();
            _threadingService       = threadingService;
        }
Пример #22
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="schedulingService">The scheduling service.</param>
 /// <param name="variableService">is for variable access</param>
 /// <param name="tableService">The table service.</param>
 /// <param name="isPrioritized">if the engine is running with prioritized execution</param>
 /// <param name="eventProcessingRWLock">The event processing rw lock.</param>
 /// <param name="exceptionHandlingService">The exception handling service.</param>
 /// <param name="metricReportingService">The metric reporting service.</param>
 /// <param name="threadLocalManager">The thread local manager.</param>
 public NamedWindowDispatchServiceImpl(
     SchedulingService schedulingService,
     VariableService variableService,
     TableService tableService,
     bool isPrioritized,
     IReaderWriterLock eventProcessingRWLock,
     ExceptionHandlingService exceptionHandlingService,
     MetricReportingService metricReportingService,
     IThreadLocalManager threadLocalManager)
 {
     _threadLocal              = threadLocalManager.Create <DispatchesTL>(() => new DispatchesTL());
     _schedulingService        = schedulingService;
     _variableService          = variableService;
     _tableService             = tableService;
     _isPrioritized            = isPrioritized;
     _eventProcessingRwLock    = eventProcessingRWLock;
     _exceptionHandlingService = exceptionHandlingService;
     _metricReportingService   = metricReportingService;
 }
Пример #23
0
 public TableExprEvaluatorContext(IThreadLocalManager threadLocalManager)
 {
     _threadLocal = threadLocalManager.Create <IDictionary <ILockable, IDisposable> >(
         () => new Dictionary <ILockable, IDisposable>());
 }
Пример #24
0
 /// <summary>
 /// Dispose for destroying an engine instance: sets references to null and clears thread-locals
 /// </summary>
 public void Dispose()
 {
     _services        = null;
     _threadLocalData = null;
 }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ThreadWorkQueue"/> class.
 /// </summary>
 public ThreadWorkQueue(IThreadLocalManager threadLocalManager)
 {
     _threadQueue = threadLocalManager.Create(
         () => new DualWorkQueue <object>());
 }
Пример #26
0
 public EventBusSink(IThreadLocalManager threadLocalManager)
 {
     _collectorDataTL = threadLocalManager.Create <EPDataFlowEventCollectorContext>(() => null);
 }
Пример #27
0
 /// <summary>
 /// Ctor.
 /// </summary>
 public VariableVersionThreadLocal()
 {
     _vThreadLocal = ThreadLocalManager.Create <VariableVersionThreadEntry>(CreateEntry);
 }
 static MultiMatchHandlerNoSubqueryWDedup()
 {
     Dedups = (new FastThreadLocalFactory())
              .CreateThreadLocal(() => new LinkedHashSet <FilterHandleCallback>());
 }
 public void Init()
 {
     _threadCache = ThreadLocalManager.Create(
         () => new ExpressionResultCacheServiceAgentInstance());
 }
Пример #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DispatchServiceImpl"/> class.
 /// </summary>
 public DispatchServiceImpl()
 {
     _threadDispatchQueue = ThreadLocalManager.Create(
         () => new Queue <Dispatchable>());
 }