public void Close() { Enumerable .Range(0, PartitionCount) .SelectMany(PartitionTable) .OfType <DynamicRemoteStorage>() .ForEach(s => { try { int id = GetInstanceId(s.ReplicaInformation.Id); using (var request = new StorageInformationWriter(MyPartitionId, m_nameservice.InstanceId)) { m_module.NotifyRemoteStorageOnLeaving(id, request); } } catch { } }); m_cancelSrc.Cancel(); m_backupctl.Dispose(); m_taskexec.Dispose(); m_partitioner.Dispose(); m_healthmon.Dispose(); m_cloudidx.Dispose(); m_persistent_storage.Dispose(); m_nameservice.Dispose(); m_chunktable.Dispose(); m_taskqueue.Dispose(); m_healthmanager.Dispose(); m_backupmgr.Dispose(); }