private int CheckLiveness(long nowNs) { if ((_timeOfLastKeepAliveNs + _keepAliveIntervalNs) - nowNs < 0) { long lastKeepAliveMs = _driverProxy.TimeOfLastDriverKeepaliveMs(); if (_epochClock.Time() > (lastKeepAliveMs + _driverTimeoutMs)) { _isTerminating = true; ForceCloseResources(); long keepAliveAgeMs = _epochClock.Time() - lastKeepAliveMs; throw new DriverTimeoutException("MediaDriver keepalive age exceeded (ms): timeout= " + _driverTimeoutMs + ", actual=" + keepAliveAgeMs); } _driverProxy.SendClientKeepalive(); _timeOfLastKeepAliveNs = nowNs; return(1); } return(0); }
private void CheckDriverHeartbeat() { long deadlineMs = _driverProxy.TimeOfLastDriverKeepaliveMs() + _driverTimeoutMs; if (_isDriverActive && (_epochClock.Time() > deadlineMs)) { _isDriverActive = false; _errorHandler(new DriverTimeoutException("MediaDriver has been inactive for over " + _driverTimeoutMs + "ms")); } }
private int CheckLiveness(long nowNs) { if ((_timeOfLastKeepAliveNs + _keepAliveIntervalNs) - nowNs < 0) { long lastKeepAliveMs = _driverProxy.TimeOfLastDriverKeepaliveMs(); var nowMs = _epochClock.Time(); if (nowMs > (lastKeepAliveMs + _driverTimeoutMs)) { _isTerminating = true; ForceCloseResources(); throw new DriverTimeoutException("MediaDriver keepalive age exceeded (ms): timeout= " + _driverTimeoutMs + ", actual=" + (nowMs - lastKeepAliveMs)); } if (null == _heartbeatTimestamp) { int counterId = HeartbeatTimestamp.FindCounterIdByRegistrationId(_countersReader, HeartbeatTimestamp.CLIENT_HEARTBEAT_TYPE_ID, _ctx.ClientId()); if (counterId != Agrona.Concurrent.Status.CountersReader.NULL_COUNTER_ID) { _heartbeatTimestamp = new AtomicCounter(_counterValuesBuffer, counterId); _heartbeatTimestamp.SetOrdered(nowMs); _timeOfLastKeepAliveNs = nowNs; } } else { int counterId = _heartbeatTimestamp.Id; if (!HeartbeatTimestamp.IsActive(_countersReader, counterId, HeartbeatTimestamp.CLIENT_HEARTBEAT_TYPE_ID, _ctx.ClientId())) { _isTerminating = true; ForceCloseResources(); throw new AeronException("unexpected close of heartbeat timestamp counter: " + counterId); } _heartbeatTimestamp.SetOrdered(nowMs); _timeOfLastKeepAliveNs = nowNs; } return(1); } return(0); }
private int checkLiveness(long nowNs) { if (nowNs > (_timeOfLastKeepAliveNs + _keepAliveIntervalNs)) { if (_epochClock.Time() > (_driverProxy.TimeOfLastDriverKeepaliveMs() + _driverTimeoutMs)) { OnClose(); throw new DriverTimeoutException("MediaDriver keepalive older than (ms): " + _driverTimeoutMs); } _driverProxy.SendClientKeepalive(); _timeOfLastKeepAliveNs = nowNs; return(1); } return(0); }
private int CheckLiveness(long nowNs) { if ((_timeOfLastKeepAliveNs + _keepAliveIntervalNs) - nowNs < 0) { if (_epochClock.Time() > (_driverProxy.TimeOfLastDriverKeepaliveMs() + _driverTimeoutMs)) { _isTerminating = true; ForceCloseResources(); Thread.Yield(); throw new DriverTimeoutException("MediaDriver keepalive older than (ms): " + _driverTimeoutMs); } _driverProxy.SendClientKeepalive(); _timeOfLastKeepAliveNs = nowNs; return(1); } return(0); }