/// <summary> /// Dispose resources /// </summary> public void Dispose() { _actor?.Dispose(); _connectionDisposable?.Dispose(); _reqSocket?.Dispose(); _disposables?.Dispose(); }
public void Dispose() { lock (m_actor) { m_actor.Dispose(); } }
public void Dispose() { m_actor.Dispose(); m_messagesPipe.Options.Linger = TimeSpan.Zero; m_messagesPipe.Dispose(); }
private bool _disposedValue; // To detect redundant calls /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _stopRequested = true; try { lock (_lockSocket) { _actor?.Dispose(); } } catch (SocketException error) { if (error.ErrorCode == 10035 || error.ErrorCode == 10054) //ignore socket close errors when exiting { return; } throw; } while (_running) { Thread.Sleep(100); } } _disposedValue = true; } }
/// <summary> /// /// </summary> private void ServerLoop() { if (Thread.CurrentThread.Name == null) { Thread.CurrentThread.Name = "Nyx Hub Server Loop"; } _disposables.Add(NyxMessageStream.Subscribe(RepSocketOnReceiveReady, x => _logger.Error("Error processing stream.", x))); _hubActor?.Dispose(); _hubActor = NetMQActor.Create(new HubShimHandler(_inMessage, Port)); _logger.Debug("Starting hub server loop..."); _isStarted = true; _plugman.StartAllPlugins(); _nodeStatusSubject.OnNext(NyxNodeStatus.Started); // Endless loop until request to stop, then shutdowns while (!_serverCancelToken.IsCancellationRequested) { _serverEvent.WaitOne(TimeSpan.FromSeconds(60)); } _plugman.StopAllPlugins(); Status = NyxNodeStatus.Stopped; _nodeStatusSubject.OnNext(Status); try { _hubActor?.SendFrame(NetMQActor.EndShimMessage); _hubActor?.Dispose(); } catch (TerminatingException) { // Ignore and go } _isStarted = false; }
public void Stop() { if (actor != null) { actor.Dispose(); actor = null; } }
public void Stop() { if (_actor != null) { _actor.Dispose(); _actor = null; } }
public void Dispose() { lock (m_actor) { m_actor.Dispose(); m_outgoingQueue.Dispose(); } }
public void Dispose() { lock (m_actor) { m_actor.Dispose(); disposed = true; } }
public void Dispose() { _actor?.Dispose(); _publisher?.Dispose(); _subscriber?.Dispose(); _beacon?.Dispose(); _poll?.Dispose(); _shim?.Dispose(); }
/// <summary> /// Init or reinit all communications. /// </summary> public void Init() { if (Interlocked.CompareExchange(ref _requiresInitialisation, 0, 1) == 0) { return; } _actor?.SendFrame(NetMQActor.EndShimMessage); _actor?.Dispose(); _actor = NetMQActor.Create(new ShimHandler(this, _connectionSubject, _address, _port)); }
/// <summary> /// 析构 /// </summary> public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; ShimHandler.Close(); Monitor.Enter(ShimHandler); Monitor.Exit(ShimHandler); _actor.Dispose(); _messagesPipe.Options.Linger = TimeSpan.Zero; _messagesPipe.Dispose(); }
/// <summary> /// Release any contained resources. /// </summary> /// <param name="disposing">true if managed resources are to be released</param> protected virtual void Dispose(bool disposing) { if (!disposing) { return; } Stop(); if (_useEvents) { _inboxPoller?.StopAsync(); _inboxPoller?.Dispose(); } _actor?.Dispose(); _inbox?.Dispose(); }
public void Dispose() { _actor.Dispose(); }
public void Dispose() { _poller.Stop(); _actor.Dispose(); }