servlet thread safety
843842Mar 10 2009 — edited Mar 11 2009I am new to Java and servlets. I am experimenting with servlets. I have separate process that puts files on my server periodically. I have written a servlet that reads the folder and determines there is a batch of files that need to be uploaded (ftp'd) to another server. I use apache commons ftp to send the files. The batch size varies, sometimes its 1 file, sometimes as many as 5 files. I find that infrequently, the ftp doesn't complete. I have started using log4j and what I find is that my servlet with ftp will send files 1 and 2 correctly, but after the ftp login and starting the ftp on file 3 of 5, my logging suddenly stops and then I start getting logging on file 4. Its as though something has forced it to jump
I am not seeing any exceptions. I log each part of the ftp process, the connection, the login, changing folders, sending the file, etc. I'm not sure yet if it is always in the same spot in the list of files.
I'm concerned there may be some concurancy problem. Its almost like I have my web service starts to run and then part way through, another request for the web service interrupts it and takes control. I am using Tomcat.
Any suggestions? How do I track it.