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

"Chen, Yi" <[email protected]> Fri, 13 Jun 2003 13:59:32 -0500
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <BA5552BC92B87843A43C4D3E0F6BF7943E1479@eg-msgmbx-a11.int.westgroup.com>
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