Re: Thread Safety of sheet operations

Nick Burch <[email protected]> Thu, 19 May 2022 18:09:55 +0100 (BST)
Newsgroups gmane.comp.jakarta.poi.user
Message-ID <[email protected]>
On Mon, 16 May 2022, Andreas Reichel wrote:
> Of course I am fully aware that POI is not thread safety on workbook
> level and threads can only be used as long as every sheet is processed
> within its own thread (without altering styles).

We only ensure that you are safe if each workbook is created in its own 
thread, we generally advise against having multiple threads working on the 
same workbook as it often goes wrong. It sounds like you've pushed things 
well beyond our normally recommended limits already...

> So far so good.
>
> I only wonder, if POI should have blocked Sheet sheet =
> workbook.createSheet(p[4]); by itself, e. g. using a semaphore and
> print a warning.

Won't that slow down the 99.9% case, where people are just using a single 
thread for the whole workbook? And doesn't it risk people trying to do 
things that aren't generally thread-safe because "that bit seemed fine" 
and getting stuck later?

Nick


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]