Hey!

This doesn't surprise me.  I recommend that you use a database.
They are designed to handle collisions like this.

Using file i/o is risky, i.e., you get data errors like yours.  Worse
than that, depending on what operating system you are using, your
app. could get a very rude file locked error.  I've seen these
file locked errors pile up until the whole system shuts down.
NT likes to put up error messages.  What if 3000 more hits
come in while NT is doing this.  Opps, Houston we have a
problem.

Use files for read only.  Remember in servlets, everyone gets their
own thread of execution.  Think about what that means as it applies
to your design and you will quickly realize that you can not use files
for persistent data.

Sans adieu,
Danny Rubis

Marcos wrote:

> hi,
>
>     i have running a sevlets that reads from a file a number and it adds
>
> one more. after changes it saves.
>     i want to use the same file from another servlet. any problem?? if
> both servlets try to open and save at the same time.
>
> file =  4455
>
> servlet 1                                              servlet2
> {                                                          {
>    read from file   4455                            read from file 4455
>    ++                                                        ++
>   4456                                                      4456
>   save                                                      save
> }                                                            }
>
> it is wrong. in file should be  4457.
>
> thanks in advance,
>
> marcos
> [EMAIL PROTECTED]
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to