You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by "Chen, Yi" <Yi...@thomson.com> on 2003/06/13 20:59:32 UTC

ORO FTP MultiThread Problem -- null returned when listFiles() cal led by serveral threads

Hi, 
  I am not sure whether this is the right place to ask this question. Please
direct me to the corrent email address if this is not the place. Thanks.
   I  am using the ORO FTP package (Jakarta Commons/Net
http://jakarta.apache.org/commons/net/changes-report.html )  and when I used
a couple of threads, and each of them performed directory listing on a
directory for 500 times  ( ftpClient.listFiles() ). Almost always some of
the threads would fail to get the correct file size in that directory, they
returned a null. This never happens when only 1 thread is used.  
  To be more exact, this happens when I use at least 3 threads, no matter
whether the threads were accessing the same directory or different
directories. Two threads don't seem to have this problem though, I had 2
threads do listFiles() on two different directories, each of them looped for
6000 times, no null returned.
It seems that the problem arised from this part of code:
if (!FTPReply.isPositivePreliminary(sendCommand(command, arg)))
            {           	
                server.close();
                return null;
            }

   Do anyone have any suggestions on how to fix this problem?       

     Thanks a lot!

Sincerely,
Yi Chen


---------------------------------------------------------------------
To unsubscribe, e-mail: oro-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: oro-user-help@jakarta.apache.org