poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avik Sengupta <a...@apache.org>
Subject Re: file locking?
Date Mon, 03 Feb 2003 08:57:10 GMT
You'll have to synchronize on the workbook instance in you code. There
is no magic solution here i suppose. 

On Sun, 2003-02-02 at 11:42, Brant Schlatzer wrote:
> Hi-
> 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!
> -Brant
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org

View raw message