コード例 #1
0
        internal ClientConductor(Aeron.Context ctx)
        {
            _ctx = ctx;

            _clientLock = ctx.ClientLock();
            _epochClock = ctx.EpochClock();
            _nanoClock  = ctx.NanoClock();

            _driverProxy       = ctx.DriverProxy();
            _logBuffersFactory = ctx.LogBuffersFactory();

            _keepAliveIntervalNs            = ctx.KeepAliveInterval();
            _driverTimeoutMs                = ctx.DriverTimeoutMs();
            _driverTimeoutNs                = _driverTimeoutMs * 1000000;
            _interServiceTimeoutNs          = ctx.InterServiceTimeout();
            _defaultAvailableImageHandler   = ctx.AvailableImageHandler();
            _defaultUnavailableImageHandler = ctx.UnavailableImageHandler();
            _availableCounterHandler        = ctx.AvailableCounterHandler();
            _unavailableCounterHandler      = ctx.UnavailableCounterHandler();
            _driverEventsAdapter            = new DriverEventsAdapter(ctx.ToClientBuffer(), this);
            _counterValuesBuffer            = ctx.CountersValuesBuffer();
            _countersReader =
                new CountersReader(ctx.CountersMetaDataBuffer(), ctx.CountersValuesBuffer(), Encoding.ASCII);

            long nowNs = _nanoClock.NanoTime();

            _timeOfLastKeepAliveNs      = nowNs;
            _timeOfLastResourcesCheckNs = nowNs;
            _timeOfLastServiceNs        = nowNs;
        }
コード例 #2
0
 internal void AddUnavailableCounterHandler(UnavailableCounterHandler handler)
 {
     _clientLock.Lock();
     try
     {
         EnsureActive();
         EnsureNotReentrant();
         _unavailableCounterHandlers.Add(handler);
     }
     finally
     {
         _clientLock.Unlock();
     }
 }
コード例 #3
0
ファイル: ClientConductor.cs プロジェクト: yazici/Aeron.NET
 internal bool RemoveUnavailableCounterHandler(UnavailableCounterHandler handler)
 {
     _clientLock.Lock();
     try
     {
         EnsureActive();
         EnsureNotReentrant();
         return(_unavailableCounterHandlers.Remove(handler));
     }
     finally
     {
         _clientLock.Unlock();
     }
 }
コード例 #4
0
        internal bool RemoveUnavailableCounterHandler(UnavailableCounterHandler handler)
        {
            _clientLock.Lock();
            try
            {
                if (_isTerminating || _isClosed)
                {
                    return(false);
                }

                EnsureNotReentrant();

                return(_unavailableCounterHandlers.Remove(handler));
            }
            finally
            {
                _clientLock.Unlock();
            }
        }
コード例 #5
0
 private void NotifyUnavailableCounterHandlers(long registrationId, int counterId)
 {
     for (int i = 0, size = _unavailableCounterHandlers.Count; i < size; i++)
     {
         UnavailableCounterHandler handler = _unavailableCounterHandlers[i];
         _isInCallback = true;
         try
         {
             handler(_countersReader, registrationId, counterId);
         }
         catch (Exception ex)
         {
             HandleError(ex);
         }
         finally
         {
             _isInCallback = false;
         }
     }
 }