void OnServiceFolderRemoved(ServiceFolderRemoved message) { _log.InfoFormat("[Topshelf] Folder Removed: {0}", message.ServiceName); if (_actorCache.Has(message.ServiceName)) { var actor = _actorCache[message.ServiceName]; _actorCache.Remove(message.ServiceName); _serviceCache.Remove(message.ServiceName); ChannelConnection connection = null; connection = _channel.Connect(x => { x.AddConsumerOf <ServiceStopped>() .Where(m => m.ServiceName == message.ServiceName) .UsingConsumer(_ => { actor.Send(new UnloadService(message.ServiceName)); }); x.AddConsumerOf <ServiceUnloaded>() .Where(m => m.ServiceName == message.ServiceName) .UsingConsumer(_ => { // actor.Exit(); why timeout? connection.Dispose(); }); }); actor.Send(new StopService(message.ServiceName)); } }
void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_channelConnection != null) { _log.DebugFormat("[Topshelf] Closing coordinator channel"); _channelConnection.Dispose(); _channelConnection = null; } if (_updated != null && _updated.Implements <IDisposable>()) { var disp = (IDisposable)_updated; disp.Dispose(); } _channel = null; } _disposed = true; }
public void Close_connection() { if (_connection != null) { _connection.Dispose(); _connection = null; } }
protected override void ShutdownListener() { try { _httpListener.Close(); _connectionChannelConnection.Dispose(); base.ShutdownListener(); } catch (HttpListenerException ex) { throw new HttpServerException("An error occurred while shutting down the server", ex); } }
void HandleExit(Exit message) { if (_actorConnection != null) { _actorConnection.Dispose(); _actorConnection = null; } _inboxCache.GetAll().Cast <IDisposable>().Each(x => x.Dispose()); _inboxCache.ClearAll(); _internalConnection.Dispose(); _internalConnection = null; }
void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _scheduledAction.Cancel(); _connection.Dispose(); _fileSystemEventProducer.Dispose(); } _disposed = true; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_consumerPool != null) { _consumerPool.Stop(); _consumerPool.Dispose(); _consumerPool = null; } if (_serviceContainer != null) { _serviceContainer.Stop(); _serviceContainer.Dispose(); _serviceContainer = null; } if (ControlBus != this) { ControlBus.Dispose(); } if (_performanceCounterConnection != null) { _performanceCounterConnection.Dispose(); _performanceCounterConnection = null; } _eventChannel = null; Endpoint = null; if (_counters != null) { _counters.Dispose(); _counters = null; } EndpointCache.Dispose(); } _disposed = true; }
void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_eventConnection != null) { _eventConnection.Dispose(); _eventConnection = null; } } _disposed = true; }
void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_channelConnection != null) { _log.DebugFormat("[Topshelf] Closing coordinator channel"); _channelConnection.Dispose(); _channelConnection = null; } _channel = null; } _disposed = true; }
public void Should_manage_interleaved_changes_the_the_chain() { var firstFuture = new Future <TestMessage>(); var secondFuture = new Future <TestMessage>(); var adapter = new ChannelAdapter <TestMessage>(new ShuntChannel <TestMessage>()); var first = new ConsumerChannel <TestMessage>(_fiber, firstFuture.Complete); ChannelConnection firstScope = adapter.Connect(x => x.AddChannel(first)); var second = new ConsumerChannel <TestMessage>(_fiber, secondFuture.Complete); ChannelConnection secondScope = adapter.Connect(x => x.AddChannel(second)); firstScope.Dispose(); new TraceChannelVisitor().Visit(adapter); adapter.Send(new TestMessage()); firstFuture.IsCompleted.ShouldBeFalse(); secondFuture.IsCompleted.ShouldBeTrue(); }
public void Stop() { if (_producer != null) { _producer.Dispose(); _producer = null; } if (_scheduler != null) { _scheduler.Stop(30.Seconds()); _scheduler = null; } if (_connection != null) { _connection.Dispose(); _connection = null; } _channel = null; }
public void Stop() { if (_producer != null) { _producer.Dispose(); _producer = null; } _pendingNotifications.Each(x => x.Value.Cancel()); if (_scheduler != null) { _scheduler.Stop(30.Seconds()); _scheduler = null; } if (_connection != null) { _connection.Dispose(); _connection = null; } _channel = null; }
public void Finally() { _server.Stop(); _connection.Dispose(); }
public void After() { _connection.Dispose(); _connection = null; _input = null; }
public void Dispose() { _cts.Cancel(); _transport.Dispose(); }
public void Dispose() { _connection.Dispose(); }