poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brant Schlatzer" <bschlat...@yahoo.com>
Subject file locking?
Date Sun, 02 Feb 2003 06:12:46 GMT

I'm fairly new to POI, and in order to learn about it (in particular HSSF), I've
been hacking on a simple web app to collect fields from a registration form and
append them to a "registrations.xls" file. I've had no problem getting the basic
functionality together, but it occurred to me that since in order to add new
"registrations" I'm reading the file into memory and using:

	HSSFRow row = sheet.createRow((short)(sheet.getLastRowNum() + 1));

...to append a row, it's possible that another instance of my class might well
add a row before I call wb.write(), resulting in one instance stomping on the
row created by the other. Could anyone suggest an appropriate means of locking
the file to be written, or perhaps an alternative approach? Is there a simpler
means to just "append" any new rows at wb.write() time as opposed to assigning
them explicit numbers?

Thanks in advance for your help!


View raw message