mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-19 14:15:50 +02:00
[180711] Replaced synchronized with Mutex
This commit is contained in:
parent
910cb15848
commit
65c5084c90
1 changed files with 9 additions and 2 deletions
|
@ -63,6 +63,7 @@ import org.apache.commons.net.ftp.FTPReply;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.rse.core.model.IPropertySet;
|
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.FileTypeMatcher;
|
||||||
import org.eclipse.rse.services.clientserver.IMatcher;
|
import org.eclipse.rse.services.clientserver.IMatcher;
|
||||||
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
||||||
|
@ -79,6 +80,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
private FTPClient _ftpClient;
|
private FTPClient _ftpClient;
|
||||||
private FTPFile[] _ftpFiles;
|
private FTPFile[] _ftpFiles;
|
||||||
|
|
||||||
|
private Mutex _downloadMutex = new Mutex();
|
||||||
|
|
||||||
private String _systemName;
|
private String _systemName;
|
||||||
private String _userHome;
|
private String _userHome;
|
||||||
private transient String _hostName;
|
private transient String _hostName;
|
||||||
|
@ -655,7 +658,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
* (non-Javadoc)
|
* (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)
|
* @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){
|
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);
|
MyProgressMonitor progressMonitor = new MyProgressMonitor(monitor);
|
||||||
|
|
||||||
IHostFile remoteHostFile = getFile(null,remoteParent,remoteFile);
|
IHostFile remoteHostFile = getFile(null,remoteParent,remoteFile);
|
||||||
|
@ -724,6 +729,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new RemoteFileIOException(e);
|
throw new RemoteFileIOException(e);
|
||||||
|
} finally {
|
||||||
|
_downloadMutex.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue