We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multiple instances at once?

Hi,

Is it possible to open multiple presentations at once (in separate threads)?

When I run this code:

new Thread(new Runnable() { @Override public void run() { System.out.println("opening 1..."); final Presentation p = new Presentation("/Users/marc/aspose_test/doc1.ppt"); System.out.println("opened 1, has slides: " + p.getSlides().size()); } }).start();
	new Thread(new Runnable()
	{
		@Override
		public void run()
		{
			System.out.println("opening 2...");
			final Presentation p = new Presentation("/Users/marc/aspose_test/doc2.ppt");
			System.out.println("opened 2, has slides: " + p.getSlides().size());
		}
	}).start();

I only get this:

opening 1…
opening 2…

Thanks,
Marc

Hi Marc,


I have observed the requirement shared and like to share that Aspose.Slides is capable of working in multi-threaded environment. You can call different presentations in separate threads.

Many Thanks,

Hi,



Thanks for the quick reply. That’s good news.



However, how can it be that my simple test code is not executing well? This is what happens:



When I open only one file at once (single thread), the presentation is loading within 6-7 seconds.



But when I attempt to open 2 files at once (in separate threads), both presentations are not loaded at all. The app does not exit, it seems like there is a deadlock. As if both threads waiting for each other. Maybe they are accessing the same internal class/routine at the same time (like for Font loading)?



What are you recommendations when running Slides in multithreaded environment?



Marc

Hi Marc,

I have worked over the scenario shared by you and have generated a sample application that can be used to load the separate presentations in separate threads using Aspose.Slides for Java 14.9.0 and have generated the PDF files. It worked without any issue on my end. For your kind reference, I have also attached the sample java file used in my testing as well. I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,

Hi,



Thanks for the reply and the example code. I ran a few test with it. Here are my findings:



When I try to open several .ppt (PowerPoint 97-2004) files simultaneously, I still get the dead lock.



When I try to open several .pptx files, I sometimes get ConcurrentModificationExceptions (see below).



I am really interesting in purchasing a license. However, I need to be sure exceptions like this do not occur in production use.



By the way: you’re referring to Aspose.Slides for Java 14.9.0. I can only find version 14.8.0 on your website.



Thanks,

Marc







java.util.ConcurrentModificationException

at java.util.Vector$Itr.checkForComodification(Vector.java:1156)

at java.util.Vector$Itr.next(Vector.java:1133)

at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)

at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:775)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.setImageData(JPEGImageReader.java:652)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:604)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:342)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:476)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:597)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1054)

at com.sun.imageio.plugins.jpeg.JPEGImageReader.readRaster(JPEGImageReader.java:1453)

at com.aspose.ms.pbdb106a0.pa5e0ff62.c.do(Unknown Source)

at com.aspose.ms.pbdb106a0.pa5e0ff62.c.do(Unknown Source)

at com.aspose.ms.pbdb106a0.pa5e0ff62.c.do(Unknown Source)

at com.aspose.ms.pbdb106a0.pa5e0ff62.c.read(Unknown Source)

at javax.imageio.ImageReader.read(ImageReader.java:940)

at com.aspose.slides.pa5e0ff62.pf4dd765c.pbdb106a0.pbdb106a0.pf4dd765c.a.do(Unknown Source)

at com.aspose.slides.pa5e0ff62.pf4dd765c.pbdb106a0.pbdb106a0.pf4dd765c.a.try(Unknown Source)

at com.aspose.slides.pa5e0ff62.pbdb106a0.p6a2feef8.b.do(Unknown Source)

at com.aspose.slides.pa5e0ff62.pbdb106a0.p6a2feef8.b.(Unknown Source)

at com.aspose.slides.pa5e0ff62.pbdb106a0.p6a2feef8.b.(Unknown Source)

at com.aspose.slides.p390e9825.ar.do(Unknown Source)

at com.aspose.slides.ImageCollection.do(Unknown Source)

at com.aspose.slides.asn.do(Unknown Source)

at com.aspose.slides.aso.if(Unknown Source)

at com.aspose.slides.aso.do(Unknown Source)

at com.aspose.slides.Presentation.for(Unknown Source)

at com.aspose.slides.Presentation.if(Unknown Source)

at com.aspose.slides.Presentation.(Unknown Source)

at com.aspose.slides.Presentation.(Unknown Source)

at com.aspose.slides.Presentation.(Unknown Source)

at com.coursepath.convert.a.Main$1.run(Main.java:28)

at java.lang.Thread.run(Thread.java:744)

Hi Marc,

I have observed your feedback and request you to please share the sample presentations that reproducing issue on your end by even using my Java file. I will be able to investigate the issue further on my end on provision of requested information. Please also share operating system and Java details with us as well.

Many Thanks,

Hi,
I have done some more tests. It seems like one particular ppt file causes problems. Unfortunately I cannot forward this file, it is confidential.
When I save it in pptx, it works. What is your overall experience with ppt vs pptx files? Do pptx files cause less problems in general?
Marc

Hi Marc,


I have observed your comments and like to share that PPTX format generally cause less issues as compared to PPT. Please share, if I may help you further in this regard.

Many Thanks,