in AdlsDotNetSDK/FileProperties/PropertyManager.cs [141:196]
private PropertyTreeNode RunGetProperty(string path)
{
try
{
if (PropertyLog.IsDebugEnabled)
{
PropertyLog.Debug($"FileProperty, SourcePath: {path}, GetDiskUsage: {GetSizeProperty}, GetAclProperty: {GetAclProperty}{(GetAclProperty ? $", AclConsistency: {HideConsistentAclTree}" : string.Empty)}, SaveToLocal: {SaveToLocal}");
}
var dir = Client.GetDirectoryEntry(path); // If the path does not exist then it will throw an exception
HeadNode = new PropertyTreeNode(dir.FullName, dir.Type, dir.Length, null, DisplayFiles || GetAclProperty);
if (dir.Type == DirectoryEntryType.FILE && !DisplayFiles)
{
throw new ArgumentException("Input path is a file and DisplayFiles is false");
}
if (_cancelToken.IsCancellationRequested)
{
return HeadNode;
}
ConsumerQueue.Add(new EnumerateAndGetPropertyJob(HeadNode, this));
//Threads responsible for enumerating and retrieving properties like size and acl
_threadConsumer = new Thread[_numThreads];
for (int i = 0; i < _numThreads; i++)
{
_threadConsumer[i] = new Thread(ConsumerRun){Name = $"ConsumerThread-{i}"};
_threadConsumer[i].Start();
}
//Thread responsible for writing to the file
_threadWriter = new Thread(WriterThreadRun){Name = "WriterThread"};
_threadWriter.Start();
for (int i = 0; i < _numThreads; i++)
{
_threadConsumer[i].Join();
}
//This will end the writer thread
PropertyWriterQueue.Add(new PoisonJob());
_threadWriter.Join();
if (GetException() != null)
{
throw GetException();
}
WritePropertyTreeNodeToFile(HeadNode);
return HeadNode;
}
finally
{
PropertyDumpWriter.Dispose();
}
}