Example #1
0
 internal void ReleaseLogBuffers(LogBuffers logBuffers, long registrationId)
 {
     if (logBuffers.DecRef() == 0)
     {
         logBuffers.LingerDeadlineNs(_nanoClock.NanoTime() + _ctx.ResourceLingerDurationNs());
         _logBuffersByIdMap.Remove(registrationId);
         _lingeringLogBuffers.Add(logBuffers);
     }
 }
        private void CheckServiceInterval(long nowNs)
        {
            if ((_timeOfLastServiceNs + _interServiceTimeoutNs) - nowNs < 0)
            {
                int lingeringResourcesSize = _lingeringResources.Count;

                ForceCloseResources();

                if (_lingeringResources.Count > lingeringResourcesSize)
                {
                    Aeron.Sleep(NanoUtil.ToMillis(_ctx.ResourceLingerDurationNs()));
                }

                OnClose();

                throw new ConductorServiceTimeoutException("service interval exceeded (ns): " + _interServiceTimeoutNs);
            }
        }
Example #3
0
        private int CheckLingeringResources(long nowNs)
        {
            int workCount = 0;

            var lingeringResources = _lingeringResources;

            for (int lastIndex = lingeringResources.Count - 1, i = lastIndex; i >= 0; i--)
            {
                IManagedResource resource = lingeringResources[i];

                if ((resource.TimeOfLastStateChange() + _ctx.ResourceLingerDurationNs()) - nowNs < 0)
                {
                    ListUtil.FastUnorderedRemove(lingeringResources, i, lastIndex--);
                    resource.Delete();
                    workCount++;
                }
            }

            return(workCount);
        }