/// <summary> /// Dispose managed resources. /// </summary> /// <param name="disposing">Is desposing.</param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { CancelPolling(); if (pubSocket != null) { pubSocket.Disconnect(PublisherAddress); pubSocket.Dispose(); pubSocket = null; } if (poller != null) { poller.Dispose(); poller = null; } if (context != null) { context.Terminate(); context.Dispose(); context = null; } if (source != null) { source.Dispose(); source = null; } } // Shared cleanup logic. disposed = true; } }
public void Dispose() { Disconnect(); if (_reqSocket != null) { _reqSocket.Dispose(); _reqSocket = null; } if (_subSocket != null) { _subSocket.Dispose(); _subSocket = null; } if (_dealerSocket != null) { _dealerSocket.Dispose(); _dealerSocket = null; } if (_heartBeatTimer != null) { _heartBeatTimer.Dispose(); _heartBeatTimer = null; } //The context must be disposed of last! It will hang if the sockets have not been disposed. if (_context != null) { _context.Dispose(); _context = null; } }
public void Dispose() { lock (this) { if (!m_isDisposed) { SharpDBConnection connection; while (m_connections.TryTake(out connection)) { connection.Dispose(); } if (m_contextOwned) { m_context.Dispose(); } m_connections = null; m_context = null; m_isDisposed = true; } } }
protected override void Dispose(bool disposing) { if (disposing) { if (_publisherSocket != null) { _publisherSocket.Dispose(); _publisherSocket = null; } foreach (NetMQSocket subscriber in _subscriberSockets.ToArray()) { subscriber.Dispose(); _subscriberSockets.Remove(subscriber); } // Setting running to false will stop the subscriber tasks _running = false; if (_context != null) { _context.Dispose(); _context = null; } } base.Dispose(disposing); }
private void Dispose(bool isDisposing) { if (isDisposing) { socketFactory?.Dispose(); } }
public void Dispose() { _scheduler.Dispose(); _client.Dispose(); _poller.CancelAndJoin(); _poller.Dispose(); _context.Dispose(); }
private void Dispose(bool disposing) { if (disposing) { subSocket?.Dispose(); context?.Dispose(); } }
public void Dispose() { _poller.Stop(false); _poller.RemoveTimer(_timer); _poller.Dispose(); _context.Dispose(); }
public void Dispose() { _ctx.Dispose(); if (_sharedQueue == null) { throw new ApplicationException("Impossible exception: only used to trick compilation optimization with unused variable _sharedQueue."); } }
public void Stop() { isRunning = false; subscribeSocket.Close(); ctx.Dispose(); receiveThread.Join(100); logger.Info("Server message subscriber stopped"); }
protected override void OnStopped() { base.OnStopped(); _pullSocket.Close(); _pullSocket.Dispose(); _pushSocket.Close(); _pushSocket.Dispose(); _netMqContext.Dispose(); }
public void Dispose() { _clientSocket.Dispose(); _context.Dispose(); if (task != null) { task.Dispose(); } }
public void Stop() { _running = false; if (_socket != null && _context != null) { _socket.Close(); _context.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { Socket.Dispose(); m_ctx.Dispose(); } // get rid of unmanaged resources }
public void Stop() { isRunning = false; responseSocket.Close(); ctx.Dispose(); listenThread.Join(100); logger.Info("Message puller has stopped"); }
public void Dispose() { if (disposed) { return; } disposed = true; zeroMQContext.Dispose(); }
public void Dispose() { _isStart = false; _serverSocket.Dispose(); _context.Dispose(); if (task != null) { task.Dispose(); } }
protected void Cleanup() { ClientFiber.Enqueue(() => { Send.Dispose(); Context1.Dispose(); Subscriber.Dispose(); Context2.Dispose(); }); Thread.Sleep(100); ClientFiber.Dispose(); }
protected override void Dispose() { if (!disposed) { poller.Cancel(); clientR.Dispose(); clientS.Dispose(); context.Dispose(); disposed = true; } }
void IDisposable.Dispose() { if (Interlocked.Increment(ref _disposeCount) != 1) { return; } Debug.WriteLine(string.Format("Disposing {0}...", this.GetType().Name)); new Action(() => _socket.Options.Linger = TimeSpan.Zero).CaptureMqExceptions <TerminatingException>(); new Action(() => _socket.Dispose()).CaptureMqExceptions(); new Action(() => _context.Dispose()).CaptureMqExceptions(); Console.WriteLine(string.Format("{0} disposed.", this.GetType().Name)); }
void IDisposable.Dispose() { if (Interlocked.Increment(ref _disposeCount) != 1) { return; } Debug.WriteLine(string.Format("Disposing {0}...", this.GetType().Name)); _backgroundSocketTaskCts.Cancel(); new Action(() => _context.Dispose()).CaptureMqExceptions(); Console.WriteLine(string.Format("{0} disposed.", this.GetType().Name)); }
protected override void Dispose(bool disposing) { if (disposing && socket != null) { socket.Dispose(); socket = null; } if (disposing && context != null) { context.Dispose(); context = null; } }
public void Stop() { m_log.InfoFormat("Stopping SharpDB..."); m_server.Stop(); m_task.Wait(); m_db.Stop(); m_context.Dispose(); m_server = null; m_db = null; m_context = null; }
public void Dispose() { StopServer(); if (_routerSocket != null) { _routerSocket.Dispose(); _routerSocket = null; } if (_context != null) { _context.Dispose(); _context = null; } }
void IDisposable.Dispose() { tokenSource.Cancel(); if (publisher != null) { publisher.Dispose(); } if (receiver != null) { receiver.Dispose(); } if (context != null) { context.Dispose(); } }
protected void Cleanup() { ClientFiber.Enqueue(() => { Client.Dispose(); ClientContext.Dispose(); Thread.Sleep(10); Service.Dispose(); ServerContext.Dispose(); }); Thread.Sleep(100); Console.WriteLine("Dispose client fiber"); ClientFiber.Dispose(); Console.WriteLine("Dispose service"); ServerFiber.Dispose(); }
protected void Cleanup() { ClientFiber.Enqueue(() => { Console.WriteLine("Dispose push"); Push.Dispose(); Context2.Dispose(); Thread.Sleep(10); Console.WriteLine("Dispose pull"); Pull.Dispose(); Context1.Dispose(); Thread.Sleep(10); }); Thread.Sleep(200); ClientFiber.Dispose(); }
protected override void OnStop() { if (_reader != null) { _reader.Dispose(); } if (_eventPublisher != null) { _eventPublisher.Dispose(); } if (_context != null) { _context.Dispose(); } }
public void Dispose() { if (Interlocked.Increment(ref _disposeCount) != 1) { return; } try { _context.Dispose(); _traces.Debug("IpcEventProxy disposed."); } catch (NetMQException ex) { _traces.Error(ex); } }
void IDisposable.Dispose() { tokenSource.Cancel(); if (subscriber != null) { subscriber.Unsubscribe(String.Empty); subscriber.Dispose(); } if (sender != null) { sender.Dispose(); } if (context != null) { context.Dispose(); } }