/// <summary>
 /// Ctor - use for the first and unused latch to indicate completion.
 /// </summary>
 public NamedWindowConsumerLatchSpin(NamedWindowConsumerLatchFactory factory)
     : base(null, null)
 {
     _factory     = factory;
     _isCompleted = true;
     _earlier     = null;
 }
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="deltaData">The delta data.</param>
        /// <param name="dispatchTo">The dispatch to.</param>
        /// <param name="factory">The factory.</param>
        /// <param name="earlier">the latch before this latch that this latch should be waiting for</param>
        public NamedWindowConsumerLatchSpin(NamedWindowDeltaData deltaData, IDictionary <EPStatementAgentInstanceHandle, IList <NamedWindowConsumerView> > dispatchTo, NamedWindowConsumerLatchFactory factory, NamedWindowConsumerLatchSpin earlier)
            : base(deltaData, dispatchTo)
        {
            _factory = factory;
            _earlier = earlier;
#if DEBUG && DEVELOPMENT
            _allocTime = _factory.TimeSourceService.GetTimeMillis();
#endif
        }
Beispiel #3
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="name">the factory name</param>
        /// <param name="enabled"></param>
        /// <param name="msecWait">the number of milliseconds latches will await maximually</param>
        /// <param name="locking">the blocking strategy to employ</param>
        /// <param name="timeSourceService">time source provider</param>
        /// <param name="initializenow"></param>
        public NamedWindowConsumerLatchFactory(string name, bool enabled, long msecWait, ConfigurationEngineDefaults.Threading.Locking locking, TimeSourceService timeSourceService, bool initializenow)
        {
            Name              = name;
            Enabled           = enabled;
            MsecWait          = msecWait;
            TimeSourceService = timeSourceService;

            UseSpin = enabled && (locking == ConfigurationEngineDefaults.Threading.Locking.SPIN);

            // construct a completed latch as an initial root latch
            if (initializenow && UseSpin)
            {
                _currentLatchSpin = new NamedWindowConsumerLatchSpin(this);
            }
            else if (initializenow && enabled)
            {
                _currentLatchWait = new NamedWindowConsumerLatchWait(this);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Returns a new latch.
 /// <para />Need not be synchronized as there is one per statement and execution is during statement lock.
 /// </summary>
 /// <returns>latch</returns>
 public NamedWindowConsumerLatch NewLatch(NamedWindowDeltaData delta, IDictionary <EPStatementAgentInstanceHandle, IList <NamedWindowConsumerView> > consumers)
 {
     if (_useSpin)
     {
         var nextLatch = new NamedWindowConsumerLatchSpin(delta, consumers, this, _currentLatchSpin);
         _currentLatchSpin = nextLatch;
         return(nextLatch);
     }
     else
     {
         if (_enabled)
         {
             var nextLatch = new NamedWindowConsumerLatchWait(delta, consumers, this, _currentLatchWait);
             _currentLatchWait.Later = nextLatch;
             _currentLatchWait       = nextLatch;
             return(nextLatch);
         }
         return(new NamedWindowConsumerLatchNone(delta, consumers));
     }
 }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="earlier">the latch before this latch that this latch should be waiting for</param>
 public NamedWindowConsumerLatchSpin(NamedWindowDeltaData deltaData, IDictionary <EPStatementAgentInstanceHandle, IList <NamedWindowConsumerView> > dispatchTo, NamedWindowConsumerLatchFactory factory, NamedWindowConsumerLatchSpin earlier)
     : base(deltaData, dispatchTo)
 {
     _factory = factory;
     _earlier = earlier;
 }
 /// <summary>
 /// Called to indicate that the latch completed and a later latch can start.
 /// </summary>
 public override void Done()
 {
     _isCompleted = true;
     _earlier     = null;
 }