コード例 #1
0
        /// <summary>
        ///@see com.espertech.esper.adapter.AdapterCoordinator#add(com.espertech.esper.adapter.Adapter)
        /// </summary>
        public virtual void Coordinate(InputAdapter inputAdapter)
        {
            if (inputAdapter == null)
            {
                throw new ArgumentException("AdapterSpec cannot be null");
            }

            if (!(inputAdapter is CoordinatedAdapter coordinatedAdapter))
            {
                throw new ArgumentException("Cannot coordinate a Adapter of type " + inputAdapter.GetType());
            }

            var adapter = coordinatedAdapter;

            if (_eventsFromAdapters.Values.Contains(adapter) || _emptyAdapters.Contains(adapter))
            {
                return;
            }
            adapter.DisallowStateTransitions();
            adapter.Runtime            = _runtime;
            adapter.UsingEngineThread  = _usingEngineThread;
            adapter.UsingExternalTimer = _usingExternalTimer;
            adapter.ScheduleSlot       = _scheduleBucket.AllocateSlot();
            AddNewEvent(adapter);
        }
コード例 #2
0
        /// <summary>Creates a cache implementation for the strategy as defined by the cache descriptor. </summary>
        /// <param name="cacheDesc">cache descriptor</param>
        /// <param name="epStatementAgentInstanceHandle">statement handle for timer invocations</param>
        /// <param name="schedulingService">scheduling service for time-based caches</param>
        /// <param name="scheduleBucket">for ordered timer invokation</param>
        /// <returns>data cache implementation</returns>
        public static DataCache GetDataCache(ConfigurationDataCache cacheDesc,
                                             EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
                                             SchedulingService schedulingService,
                                             ScheduleBucket scheduleBucket)
        {
            if (cacheDesc == null)
            {
                return(new DataCacheNullImpl());
            }

            if (cacheDesc is ConfigurationLRUCache)
            {
                ConfigurationLRUCache lruCache = (ConfigurationLRUCache)cacheDesc;
                return(new DataCacheLRUImpl(lruCache.Size));
            }

            if (cacheDesc is ConfigurationExpiryTimeCache)
            {
                ConfigurationExpiryTimeCache expCache = (ConfigurationExpiryTimeCache)cacheDesc;
                return(new DataCacheExpiringImpl(expCache.MaxAgeSeconds, expCache.PurgeIntervalSeconds, expCache.CacheReferenceType,
                                                 schedulingService, scheduleBucket.AllocateSlot(), epStatementAgentInstanceHandle));
            }

            throw new IllegalStateException("Cache implementation class not configured");
        }
コード例 #3
0
ファイル: DataCacheFactory.cs プロジェクト: ikvm/nesper
 protected internal DataCache MakeTimeCache(
     ConfigurationExpiryTimeCache expCache,
     StatementContext statementContext,
     EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
     SchedulingService schedulingService,
     ScheduleBucket scheduleBucket,
     int streamNum)
 {
     return(new DataCacheExpiringImpl(
                expCache.MaxAgeSeconds, expCache.PurgeIntervalSeconds, expCache.CacheReferenceType,
                schedulingService, scheduleBucket.AllocateSlot(), epStatementAgentInstanceHandle));
 }