Multiple threads

Hello

The method "deepClone" on the Document class, it threadsafe?

In the example you give at the bottom of this thread:

https://forum.aspose.com/t/82120

you but the call for deepClone inside the synchronized "block", but is it necessary?

Regards,
Morten

Hi Morten,

Thanks for your inquiry. Aspose.Words is multithread safe as long as only one thread works on a document at a time. It is a typical scenario to have one thread working on one document. Different threads can safely work on different documents at the same time. Document.deepClone method performs a deep copy of the Document.

Moreover, the Document objects are independent of each other and as long as only one thread at a time is allowed to modify a document (a typical requirement for any collection class).
wotnot:
you but the call for deepClone inside the synchronized "block", but is it necessary?
No, it is not necessary. Please reads Konstantin comments:

BTW, I believe that loading the template file from a disk for every thread is not very efficient operation. As an alternative you can load the template only once and then deep clone it for every thread:

The following thread is very old and user reported an exception issue while using multiple thread.

I suggest you please use the latest version of Aspose.Words for Java.