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 AddAvailableCounterHandler(AvailableCounterHandler handler) { _clientLock.Lock(); try { EnsureActive(); EnsureNotReentrant(); _availableCounterHandlers.Add(handler); } finally { _clientLock.Unlock(); } }
internal bool RemoveAvailableCounterHandler(AvailableCounterHandler handler) { _clientLock.Lock(); try { EnsureActive(); EnsureNotReentrant(); return(_availableCounterHandlers.Remove(handler)); } finally { _clientLock.Unlock(); } }
private void NotifyCounterAvailable(long registrationId, int counterId, AvailableCounterHandler handler) { _isInCallback = true; try { handler(_countersReader, registrationId, counterId); } catch (Exception ex) { HandleError(ex); } finally { _isInCallback = false; } }
internal bool RemoveAvailableCounterHandler(AvailableCounterHandler handler) { _clientLock.Lock(); try { if (_isTerminating || _isClosed) { return(false); } EnsureNotReentrant(); return(_availableCounterHandlers.Remove(handler)); } finally { _clientLock.Unlock(); } }