private void AwaitResponse(long correlationId, string expectedChannel, bool isSlowOperation) { _driverException = null; var timeout = _nanoClock.NanoTime() + _driverTimeoutNs; do { if (isSlowOperation) { Thread.Sleep(1); } else { Thread.Yield(); } DoWork(correlationId, expectedChannel); if (_driverListener.LastReceivedCorrelationId() == correlationId) { if (null != _driverException) { throw _driverException; } return; } } while (_nanoClock.NanoTime() < timeout); throw new DriverTimeoutException("No response from driver within timeout"); }
private void AwaitResponse(long correlationId, string expectedChannel) { _driverException = null; var deadlineNs = _nanoClock.NanoTime() + _driverTimeoutNs; do { if (null == _driverAgentInvoker) { Aeron.Sleep(1); } else { _driverAgentInvoker.Invoke(); } DoWork(correlationId, expectedChannel); if (_driverListener.LastReceivedCorrelationId() == correlationId) { if (null != _driverException) { throw _driverException; } return; } } while (_nanoClock.NanoTime() < deadlineNs); throw new DriverTimeoutException("No response from driver wihtout timeout"); }
private void AwaitResponse(long correlationId) { _driverException = null; var deadlineNs = _nanoClock.NanoTime() + _driverTimeoutNs; do { try { Thread.Sleep(1); } catch (ThreadInterruptedException) { Thread.CurrentThread.Interrupt(); throw; } Service(correlationId); if (_driverEventsAdapter.ReceivedCorrelationId() == correlationId) { if (null != _driverException) { throw _driverException; } return; } Thread.Sleep(0); // check interrupt } while (deadlineNs - _nanoClock.NanoTime() > 0); throw new DriverTimeoutException("no response from MediaDriver within (ms):" + _driverTimeoutMs); }
public void OnError(long correlationId, int codeValue, ErrorCode errorCode, string message) { _driverException = new RegistrationException(correlationId, codeValue, errorCode, message); var resource = _resourceByRegIdMap[correlationId]; if (resource is Subscription subscription) { subscription.InternalClose(); _resourceByRegIdMap.Remove(correlationId); } }
private void AwaitResponse(long correlationId) { _driverException = null; var nowNs = _nanoClock.NanoTime(); var deadlineNs = nowNs + _driverTimeoutNs; CheckTimeouts(nowNs); _awaitingIdleStrategy.Reset(); do { if (null == _driverAgentInvoker) { _awaitingIdleStrategy.Idle(); } else { _driverAgentInvoker.Invoke(); } Service(correlationId); if (_driverEventsAdapter.ReceivedCorrelationId == correlationId) { _stashedChannel = null; RegistrationException ex = _driverException; if (null != _driverException) { _driverException = null; throw ex; } return; } try { Thread.Sleep(1); } catch (ThreadInterruptedException) { _isTerminating = true; throw new AgentTerminationException("thread interrupted"); } } while (deadlineNs - _nanoClock.NanoTime() > 0); throw new DriverTimeoutException("no response from MediaDriver within (ms):" + _driverTimeoutMs); }
private void DoWorkUntil(long correlationId, long timeout, string expectedChannel) { _driverException = null; do { DoWork(correlationId, expectedChannel); if (_driverListener.LastReceivedCorrelationId() == correlationId) { if (null != _driverException) { throw _driverException; } return; } } while (_nanoClock.NanoTime() < timeout); throw new DriverTimeoutException("No response from driver within timeout"); }
private void RegisterHotkey() { try { Hook.UnregisterHotkeys(); // unregister any hotkeys that might already have been registered // Make sure "UsesHotKey" is true and we have, at minimum, a SelectedKey defined if (Settings.UsesHotkey && !String.IsNullOrWhiteSpace(Settings.SelectedKey)) { Func <string, ModifierKeys> getModifierKey = (keyString) => String.IsNullOrWhiteSpace(keyString) ? ModifierKeys.None : (ModifierKeys)Enum.Parse(typeof(ModifierKeys), keyString); ModifierKeys modifierKeys = ModifierKeys.None | getModifierKey(Settings.FirstModifier) | getModifierKey(Settings.SecondModifier); //Keys selectedKey = (Keys)Enum.Parse(typeof(Keys), Settings.SelectedKey); Keys selectedKey = Keys.None; if (KeyMapper.AvailableKeys.TryGetValue(Settings.SelectedKey, out selectedKey)) { Hook.RegisterHotKey(modifierKeys, selectedKey); } else { throw new ArgumentException("Unknown key name '" + Settings.SelectedKey + "'"); } } } catch (Exception ex) { if (RegistrationException != null) { RegistrationException.Invoke(this, new UnhandledExceptionEventArgs(ex, false)); } else { throw; } } }
private void AwaitResponse(long correlationId) { _driverException = null; var deadlineNs = _nanoClock.NanoTime() + _driverTimeoutNs; do { Aeron.Sleep(1); Service(correlationId); if (_driverEventsAdapter.LastReceivedCorrelationId() == correlationId) { if (null != _driverException) { throw _driverException; } return; } } while (_nanoClock.NanoTime() < deadlineNs); throw new DriverTimeoutException("No response from MediaDriver within (ms):" + _driverTimeoutMs); }
public void OnError(ErrorCode errorCode, string message, long correlationId) { _driverException = new RegistrationException(errorCode, message); }
public override void onError(RegistrationException error, string accessToken, string gcmToken) { Log.e(TAG, string.Format("Error: {0:D}, {1}", error.ErrorCode, error.Message)); }
public void OnError(long correlationId, int codeValue, ErrorCode errorCode, string message) { _driverException = new RegistrationException(codeValue, errorCode, message); }