Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

eclipse - PropertyManager2 iterates the tree for infinite depth for deleting/moving an IFile

I have a scenario, where I have around 10K files inside a folder named '_out'. and '_out' in-turn contains other folders and inner files and sub folders. I'm deleting around 6000 files , which are directly present under the _out folder.

I delete the files by using the following code snippets:

for(IFile iFile:files){
iFile.delete(true, new NullProgressMonitor());
}

During the delete of each file, Property of each resource is being deleted, internally in the API Resource.deleteResource(boolean, MultiStatus), using method call to IPropertyManager.deleteResource(IResource). This API in-turn calls PropertyManager2.deleteProperties(IResource, int depth) with INFINITE depth and hence, all the folder and sub-folders inside the location "workspace.metadata.pluginsorg.eclipse.core.resources.projectsprojectName.indexes8f" are visited and 'Properties.index' files are loaded in each folder and then, checked whether the given IFile has a property in them. Where '8f' folder represents the Bucket for the '_out' folder.

for all the 6000 files, this operation is being repeated and hence, it takes around 15 minutes to delete all the 6000 files.

Ideally, should we just visit the properties.index file under the '8f' and delete the property for the given file and return?

My assumption is that the Properties for any files present directly under the '_out' folder will be saved under the 'properties.index' file in the Bucket corresponding to '_out' folder. (in my scenario 8f folder).

Apologies, if I have misunderstood it. Kindly, clarify.

I have raised a bug for the same at link.

Thanks, Palraj

question from:https://stackoverflow.com/questions/65713537/propertymanager2-iterates-the-tree-for-infinite-depth-for-deleting-moving-an-ifi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...