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; }
internal void AddUnavailableCounterHandler(UnavailableCounterHandler handler) { _clientLock.Lock(); try { EnsureActive(); EnsureNotReentrant(); _unavailableCounterHandlers.Add(handler); } finally { _clientLock.Unlock(); } }
internal bool RemoveUnavailableCounterHandler(UnavailableCounterHandler handler) { _clientLock.Lock(); try { EnsureActive(); EnsureNotReentrant(); return(_unavailableCounterHandlers.Remove(handler)); } finally { _clientLock.Unlock(); } }
internal bool RemoveUnavailableCounterHandler(UnavailableCounterHandler handler) { _clientLock.Lock(); try { if (_isTerminating || _isClosed) { return(false); } EnsureNotReentrant(); return(_unavailableCounterHandlers.Remove(handler)); } finally { _clientLock.Unlock(); } }
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; } } }