Free Support Forum - aspose.com

Aspose .Slides Multithreading

I am loading the same .ppt file in two threads simultaneously.

Thread 1 :
Presentation presentation = new Presentation(this.getClass().getClassLoader().getResourceAsStream(“Sample.ppt”));

Thread 2 :
Presentation presentation = new Presentation(this.getClass().getClassLoader().getResourceAsStream(“Sample.ppt”));

Will there be any issue with the above code ? Is it thread safe ?

@agarwalsarthak121

Yes, the API is thread safe and there should be no issue while working in parallel threads. One suggestion that `I like to add here is to try loading the presentation from stream rather directly from file.

But I’m using getResourceAsStream() .
Can you show an example of what you mean by loading from stream ?

@agarwalsarthak121

That is fine if you are loading file as stream. I suggested as a better approach to load file as stream rather then directly as file.