Since I'm using rather large files to transfer (about 20 MB), I've increased the value 10000 to 300000 for the ftp buffer size and the progress monitor. In order to flush out the problem, the only change I needed to do to your sample code was to have the second thread start slightly delayed. After all, with a connection pool, it becomes highly unlikely for all threads to start at the same time. So, I've inserted the following code between the two calls to "new Thread() {..."
try {
Thread.sleep(200);
}
catch (Exception e) {}
There seems to be some type of race condition going on, since I can find delays at which the problem disappears (e.g. for delay = 0). In my example, both files have about the same size of 22 MB and take about 45 seconds each to transfer to the server. However, with just the "right" delay between the 2 concurrent threads, they take a total of 83 seconds to upload instead of the expected 45 seconds.
run:
INFO [TestConcurrent] 9 May 2012 16:06:40.966 : Starting upload: /public_html/Curious/ftp/IMGP2704.DNG
DEBUG [FTPClient] 9 May 2012 16:06:40.983 : Class: com.enterprisedt.net.ftp.FTPClient
Location: file:/C:/Users/Curious/Documents/NetBeansProjects/DebugFTP/src/edtftpj.jar
Version: 2.3.0
Build timestamp: 26-Aug-2011 13:52:07 EST
Java version: 1.6.0_26
CLASSPATH:
C:\Users\Curious\Documents\NetBeansProjects\DebugFTP\src\edtftpj.jar;C:\Users\Curious\Documents\NetBeansProjects\Debu
gFTP\build\classes;C:\Users\Curious\Documents\NetBeansProjects\DebugFTP\src
OS name: Windows Vista
OS arch: x86
OS version: 6.0
DEBUG [FTPClient] 9 May 2012 16:06:41.089 : Connecting to ftp.somename.com/67.20.76.108:21
INFO [TestConcurrent] 9 May 2012 16:06:41.167 : Starting upload: /public_html/Curious/ftp/IMGP2705.DNG
DEBUG [FTPClient] 9 May 2012 16:06:41.167 : Class: com.enterprisedt.net.ftp.FTPClient
Location: file:/C:/Users/Curious/Documents/NetBeansProjects/DebugFTP/src/edtftpj.jar
Version: 2.3.0
Build timestamp: 26-Aug-2011 13:52:07 EST
Java version: 1.6.0_26
CLASSPATH:
C:\Users\Curious\Documents\NetBeansProjects\DebugFTP\src\edtftpj.jar;C:\Users\Curious\Documents\NetBeansProjects\Debu
gFTP\build\classes;C:\Users\Curious\Documents\NetBeansProjects\DebugFTP\src
OS name: Windows Vista
OS arch: x86
OS version: 6.0
DEBUG [FTPClient] 9 May 2012 16:06:41.167 : Connecting to ftp.somename.com/67.20.76.108:21
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.340 : 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.341 : 220-You are user number 1 of 1000 allowed.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.341 : 220-Local time is now 14:07. Server port: 21.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.341 : 220-This is a private system - No anonymous login
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.341 : 220-IPv6 connections are also welcome on this server.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.341 : 220 You will be disconnected after 15 minutes of inactivity.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.342 : ---> USER somename
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.391 : 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.391 : 220-You are user number 2 of 1000 allowed.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.391 : 220-Local time is now 14:07. Server port: 21.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.392 : 220-This is a private system - No anonymous login
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.392 : 220-IPv6 connections are also welcome on this server.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.392 : 220 You will be disconnected after 15 minutes of inactivity.
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.392 : ---> USER somename
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.452 : 331 User somename OK. Password required
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.452 : ---> PASS ********
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.502 : 331 User somename OK. Password required
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.502 : ---> PASS ********
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.653 : 230 OK. Current restricted directory is /
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.653 : ---> PWD
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.723 : 230 OK. Current restricted directory is /
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.723 : ---> PWD
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.764 : 257 "/" is your current location
DEBUG [FTPClient] 9 May 2012 16:06:41.764 : Attempt #1
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.764 : ---> PASV
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.833 : 257 "/" is your current location
DEBUG [FTPClient] 9 May 2012 16:06:41.834 : Attempt #1
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.834 : ---> PASV
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.874 : 227 Entering Passive Mode (67,20,76,108,199,1)
INFO [FTPControlSocket] 9 May 2012 16:06:41.874 : Substituting server supplied IP (67.20.76.108) with remote host IP
(67.20.76.108)
DEBUG [FTPControlSocket] 9 May 2012 16:06:41.948 : 227 Entering Passive Mode (67,20,76,108,148,97)
INFO [FTPControlSocket] 9 May 2012 16:06:41.948 : Substituting server supplied IP (67.20.76.108) with remote host IP
(67.20.76.108)
DEBUG [FTPControlSocket] 9 May 2012 16:06:42.053 : ---> STOR /public_html/Curious/ftp/IMGP2704.DNG
DEBUG [FTPControlSocket] 9 May 2012 16:06:42.130 : ---> STOR /public_html/Curious/ftp/IMGP2705.DNG
DEBUG [FTPControlSocket] 9 May 2012 16:06:42.171 : 150 Accepted data connection
DEBUG [FTPControlSocket] 9 May 2012 16:06:42.249 : 150 Accepted data connection
INFO [ProgressMonitor] 9 May 2012 16:06:48.281 : /public_html/Curious/ftp/IMGP2705.DNG 3009643 bytes
INFO [ProgressMonitor] 9 May 2012 16:06:53.650 : /public_html/Curious/ftp/IMGP2704.DNG 3008390 bytes
INFO [ProgressMonitor] 9 May 2012 16:06:53.959 : /public_html/Curious/ftp/IMGP2705.DNG 6019788 bytes
INFO [ProgressMonitor] 9 May 2012 16:06:59.662 : /public_html/Curious/ftp/IMGP2705.DNG 9029854 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:04.019 : /public_html/Curious/ftp/IMGP2704.DNG 6017329 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:05.349 : /public_html/Curious/ftp/IMGP2705.DNG 12040227 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:11.042 : /public_html/Curious/ftp/IMGP2705.DNG 15050171 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:14.727 : /public_html/Curious/ftp/IMGP2704.DNG 9027052 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:16.730 : /public_html/Curious/ftp/IMGP2705.DNG 18059689 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:22.413 : /public_html/Curious/ftp/IMGP2705.DNG 21067692 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:25.785 : /public_html/Curious/ftp/IMGP2704.DNG 12036521 bytes
INFO [ProgressMonitor] 9 May 2012 16:07:26.161 : /public_html/Curious/ftp/IMGP2705.DNG 22935622 bytes
DEBUG [FTPClient] 9 May 2012 16:07:26.161 : Transferred 22935622 bytes to remote host
DEBUG [FTPControlSocket] 9 May 2012 16:07:26.279 : 226-File successfully transferred
DEBUG [FTPControlSocket] 9 May 2012 16:07:26.279 : 226 44.034 seconds (measured here), 506.89 Kbytes per second
DEBUG [FTPControlSocket] 9 May 2012 16:07:26.279 : ---> QUIT
DEBUG [FTPControlSocket] 9 May 2012 16:07:26.389 : 221-Goodbye. You uploaded 22321 and downloaded 0 kbytes.
DEBUG [FTPControlSocket] 9 May 2012 16:07:26.389 : 221 Logout.
INFO [T