Hi
I have swing application that uploads very big number of files to ftp server. from 10k to 100k
I had a problem that sometimes files were not uploaded. I found that the ftp api that i use does not reuse the socket connections, so i tune the server to maxUserPort to 60k default wait time 3 minutes.
But if one client uploads 100k files this means that the client will run out of socket connections too? I suppose this!
I have the follwoing 2 exceptions in the log file of the swing application.
java.net.SocketOutputStream.socketWrite0(Native Method)
java.net.SocketOutputStream.socketWrite(Unknown Source)
java.net.SocketOutputStream.write(Unknown Source)
sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
sun.nio.cs.StreamEncoder.flush(Unknown Source)
java.io.OutputStreamWriter.flush(Unknown Source)
com.enterprisedt.net.ftp.FTPControlSocket.writeCommand(FTPControlSocket.java:784)
com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:765)
com.enterprisedt.net.ftp.FTPClient.chdir(FTPClient.java:2747)
admin.ProcessThread.uploadImagesToFTP(Unknown Source)
admin.ProcessThread.doInBackground(Unknown Source)
admin.ProcessThread.doInBackground(Unknown Source)
javax.swing.SwingWorker$1.call(Unknown Source)
java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
java.util.concurrent.FutureTask.run(Unknown Source)
javax.swing.SwingWorker.run(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
//Method definition
private native void socketWrite0(FileDescriptor fd, byte[] b, int off,
int len) throws IOException;
Obviously the exception is IO
com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:927)
com.enterprisedt.net.ftp.FTPClient.initPut(FTPClient.java:1779)
com.enterprisedt.net.ftp.FTPClient.putData(FTPClient.java:1838)
com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1595)
com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1580)
com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1558)
admin.ProcessThread.uploadImagesToFTP(Unknown Source)
admin.ProcessThread.doInBackground(Unknown Source)
admin.ProcessThread.doInBackground(Unknown Source)
javax.swing.SwingWorker$1.call(Unknown Source)
java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
java.util.concurrent.FutureTask.run(Unknown Source)
javax.swing.SwingWorker.run(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
//Method definition
com.enterprisedt.net.ftp.FTPReply validateReply(java.lang.String string, java.lang.String string1) throws com.enterprisedt.net.ftp.FTPException { /* compiled code */ }
Obviously the exception is FTP
The program logic do not allow to upload batch of files or folders. It checks file by file if is uploaded and makes bulk inserts into database on some time.