poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Nesbitt <br...@nesbot.com>
Subject What is the best/safest statet to cache workbook bytes at
Date Wed, 25 Sep 2013 15:39:53 GMT
I want to cache Excel workbook data as close to having a Workbook object as
possible.  I need it just before as there will be multiple threads writing
data to the cells of the workbook so I want to create a new workbook object
on each cache access.

Here are the options I see.

#1) Store the raw byte[] and pass in an inputstream to
the WorkbookFactory.create() method as this will create a new workbook
instance each time

#2) Store an instance of NPOIFSFileSystem or OPCPackage and use that to
call WorkbookFactory.create()... this will create a new Workbook instance
as well

>From my tests #2 is faster as I assume some pre-parsing is done by the
npiofs and opc classes.  Are the NPOIFSFileSystem and OPCPackage
threadsafe?  (Can I have multiple threads using the same instance in a call
to WorkbookFactory.create()).

#3 ?? Is there a way to hold a Workbook instance in the cache and make a
fast copy of it on each get() call?

Thanks,
Brian.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message