private void OnDeserializedCallback(StreamingContext context) { // Constructors and field initializers are not called by DCS, so initialize things here progressUpdateLock = new ReaderWriterLockSlim(); continuationTokenLock = new object(); this.azureFileDirectorySDDLCache = new AzureFileDirectorySDDLCache(); if (!IsStreamJournal) { this.subTransfers = this.serializedSubTransfers; this.ongoingSubDirTransfers = new ConcurrentDictionary <SubDirectoryTransfer, object>(); foreach (var ongoingSubDirTransfer in this.serializedOngoingDirTransfers) { this.ongoingSubDirTransfers.TryAdd(ongoingSubDirTransfer, new object()); } this.subDirectories = new ConcurrentQueue <string>(); foreach (var subdirectory in this.serializedSubDirectories) { this.subDirectories.Enqueue(subdirectory); } } else { this.subTransfers = new TransferCollection <SingleObjectTransfer>(); this.ongoingSubDirTransfers = new ConcurrentDictionary <SubDirectoryTransfer, object>(); this.subDirectories = new ConcurrentQueue <string>(); } this.subTransfers.OverallProgressTracker.Parent = this.ProgressTracker; this.outstandingTasks = 1; }
protected override void Dispose(bool disposing) { if (disposing) { if (null != this.subDirTransfersCompleteSource) { this.subDirTransfersCompleteSource.Task.Wait(); } if (null != this.transfersCompleteSource) { this.transfersCompleteSource.Task.Wait(); } if (null != this.cancellationTokenSource) { this.cancellationTokenSource.Dispose(); this.cancellationTokenSource = null; } if (null != this.progressUpdateLock) { this.progressUpdateLock.Dispose(); this.progressUpdateLock = null; } if (null != this.maxConcurrencyControl) { this.maxConcurrencyControl.Dispose(); this.maxConcurrencyControl = null; } if (null != this.newAddSubDirResetEventSlim) { this.newAddSubDirResetEventSlim.Dispose(); this.newAddSubDirResetEventSlim = null; } if (null != this.directoryListingScheduler) { this.directoryListingScheduler.Dispose(); this.directoryListingScheduler = null; } if (null != this.azureFileDirectorySDDLCache) { this.azureFileDirectorySDDLCache.Dispose(); this.azureFileDirectorySDDLCache = null; } } base.Dispose(disposing); }