2010-06-07 2 views
0

отредактированный вариант кода Java:Почему DefaultFileMonitor продолжает перечислять файлы в моем FTP-местоположении в цикле?

FileSystemOptions opts = new FileSystemOptions(); 
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); 

// fileToMonitor is the FTP folder.     
LOG.debug("Trying to resolve file " + fileToMonitor + "..."); 
FileObject fo = fileSystemManager.resolveFile(fileToMonitor, opts); 

LOG.debug("File resolved, attempting to add to DefaultFileMonitor..."); 
DefaultFileMonitor monitor = createFileMonitor(processor); 

// This line causes PORT and LIST commnads to be sent to the FTP server 
monitor.addFile(fo); 
LOG.debug("File successfully, added to DefaultFileMonitor"); 

Я мониторинг сетевого трафика и, кажется, что, когда местоположение FTP добавляется к монитору, он посылает PORT и LIST команд двух папок на сервере. Проблема заключается в том, что она продолжает делать это (по-видимому, пока она не исчерпывает портов клиента звонить из ?.

Вот выдержка из сети FTP трафика:

50   0.312500   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'PORT xxx,xxx,xxx,xxx,49,114' 
51   0.312500   {TCP:2, IPv4:0} FTP  FTP:Response to Port 12620, '200 PORT command successful.' 
52   0.312500   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'LIST tmp/dump' 
<snipped> 
270  1.750000   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'PORT xxx,xxx,xxx,xxx,49,115' 
271  1.750000   {TCP:2, IPv4:0} FTP  FTP:Response to Port 12620, '200 PORT command successful.' 
272  1.750000   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'LIST tmp' 
<snipped> 
343  2.296875   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'PORT xxx,xxx,xxx,xxx,49,116' 
344  2.312500   {TCP:2, IPv4:0} FTP  FTP:Response to Port 12620, '200 PORT command successful.' 
345  2.312500   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'LIST tmp/dump' 
<snipped> 
560  3.687500   {TCP:2, IPv4:0} FTP  FTP:Response to Port 12620, '226 Transfer complete.' 
566  4.031250   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'PORT xxx,xxx,xxx,xxx,49,118' 
567  4.031250   {TCP:2, IPv4:0} FTP  FTP:Response to Port 12620, '200 PORT command successful.' 
568  4.031250   {TCP:2, IPv4:0} FTP  FTP:Request from Port 12620,'LIST tmp' 
<repeat> 

часть ответа от СПИСКА Обратите внимание, что команды повторяются для одних и тех же папок, но порт меняется каждый раз. Это не происходит, если в этих местах нет файлов.

Что вызывает это поведение и как его изменить, получает листинг один раз?

Редактировать: Я сузил проблему до метода getChildren() в FileObject.

Это единственный интернет-ссылка, которую я смог найти: http://mail-archives.apache.org/mod_mbox/commons-user/201005.mbox/%[email protected]%3E

ответ

 Смежные вопросы

  • Нет связанных вопросов^_^