From 65c5084c902c1a9aaf8b3ffd8ae3f1c4e9ba7783 Mon Sep 17 00:00:00 2001 From: Javier Montalvo Orus Date: Wed, 4 Apr 2007 13:19:19 +0000 Subject: [PATCH] [180711] Replaced synchronized with Mutex --- .../rse/internal/services/files/ftp/FTPService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java index 13b09948e62..794e79ef4b8 100644 --- a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java +++ b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java @@ -63,6 +63,7 @@ import org.apache.commons.net.ftp.FTPReply; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.rse.core.model.IPropertySet; +import org.eclipse.rse.services.Mutex; import org.eclipse.rse.services.clientserver.FileTypeMatcher; import org.eclipse.rse.services.clientserver.IMatcher; import org.eclipse.rse.services.clientserver.NamePatternMatcher; @@ -79,6 +80,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT private FTPClient _ftpClient; private FTPFile[] _ftpFiles; + private Mutex _downloadMutex = new Mutex(); + private String _systemName; private String _userHome; private transient String _hostName; @@ -655,7 +658,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT * (non-Javadoc) * @see org.eclipse.rse.services.files.IFileService#download(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.io.File, boolean, java.lang.String) */ - public synchronized boolean download(IProgressMonitor monitor, String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding) throws SystemMessageException + public boolean download(IProgressMonitor monitor, String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding) throws SystemMessageException { if (monitor!=null){ @@ -664,6 +667,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT } } + _downloadMutex.waitForLock(monitor, Long.MAX_VALUE); + MyProgressMonitor progressMonitor = new MyProgressMonitor(monitor); IHostFile remoteHostFile = getFile(null,remoteParent,remoteFile); @@ -724,7 +729,9 @@ public class FTPService extends AbstractFileService implements IFileService, IFT catch (Exception e) { throw new RemoteFileIOException(e); - } + } finally { + _downloadMutex.release(); + } return retValue; }