Hi All,

I need to develop an web based application using java swing, servlets, xml and all this need to be done using a custom framework application that we use in house.

In brief the functionality is just to parse the user uploaded xml file and insert it into database. However I need to take of synchronizing
such activity since same xml file may be uploaded by multiple users in which I need to ask the second user to wait until the first user completes uploading his xml file.

In the client side, the user uploads a large xml file (20MB) using JFileChooser and in the server side, in a servlet I parse the xml file and insert the xml data into oracle database.

Due to large size of xml file uploaded by user, I read 1MB chunks of data as bytes and write it to a file on server side using the servlet and once this is done I'll parse the xml file that is written on the server side using xml DOM parser and insert the xml data into the database.

Now my question how to synchronize the reading and writing of server side xml file since more than one user may write to the same file on the server so that I can maintain integrity amond the users who try upload the same xml file concurrently.

Is this design correct or how can I better handle my design ?

Thanks & Regards,