Cancelling of Saving Document process (Java)

Hello!

I need information on what has been done about the feature that is logged in your tracking system under the name WORDSNET-11575 (option to cancel the document saving process)?

I saw that there are two threads on that topic, from March 2018 and April 2019, and it says there that you didn’t have support for it at the time, but it doesn’t say anything further.

Just for better understanding, what I need is the ability to safely and easily cancel the document saving process using the Aspose Words for Java API.

Links to the following threads:

Best regards!

@zpredojevic

Unfortunately, there is no news available on this feature at the moment. We will inform you via this forum thread once it is available. We apologize for your inconvenience.

You may be able to manually interrupt Aspose.Words during long running tasks. You can use following code example to achieve your requirement. Hope this helps you.

public void testThreadInterruption() throws InterruptedException
{
    // run Aspose.Words long operation in a separate thread
    Thread infiniteThread = new Thread(infiniteProcessingLoop());
    infiniteThread.start();

    // interrupt it in a while
    Thread.sleep(2000);
    infiniteThread.interrupt();

    // wait till it dies
    infiniteThread.join(5000);

    // check if it is dead
    if (infiniteThread.getState() == Thread.State.RUNNABLE)
        Assert.fail("Thread didn't stop properly");
}

private static Runnable infiniteProcessingLoop()
{
    return new Runnable()
    {
        @Override
        public void run()
        {
            try
            {
                while (true)
                {
                    new Document("pathToTestDoc").save("output.docx");
                }
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }

        }
    };
}

The issues you have found earlier (filed as WORDSNET-11575) have been fixed in this Aspose.Words for .NET 22.1 update also available on NuGet.