1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

[291738] [efs] repeated queries to RSEFileStoreImpl.fetchInfo() in short time-span should be reduced

This commit is contained in:
David McKnight 2009-11-06 14:46:12 +00:00
parent 505d25d53f
commit a8dd20590e

View file

@ -80,8 +80,11 @@ import org.eclipse.rse.ui.RSEUIPlugin;
public class RSEFileStoreImpl extends FileStore
{
private RSEFileStore _store;
private long _lastFetch = 0;
// to help with with performance issues when eclipse makes excessing fetchInfo calls
private long _lastFetch = 0;
private int _fetchWaitThreshold = 5000;
//cached IRemoteFile object: an Object to avoid early class loading
private transient volatile IRemoteFile _remoteFile;
@ -94,6 +97,16 @@ public class RSEFileStoreImpl extends FileStore
*/
public RSEFileStoreImpl(RSEFileStore store) {
_store = store;
String waitStr = System.getProperty("rse_efs_fetch_wait_threshold"); //$NON-NLS-1$
if (waitStr != null && waitStr.length() > 0){
try {
_fetchWaitThreshold = Integer.parseInt(waitStr);
}
catch (Exception e){
_fetchWaitThreshold = 5000;
}
}
}
/*
@ -517,8 +530,10 @@ public class RSEFileStoreImpl extends FileStore
*/
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
long curTime = System.currentTimeMillis();
// don't clear cache when there are several successive queries in a short time-span
if (_lastFetch == 0 || ((curTime - _lastFetch) > 5000)){
if (_lastFetch == 0 || ((curTime - _lastFetch) > _fetchWaitThreshold)){
// clear cache in order to query latest info
cacheRemoteFile(null);
_lastFetch = curTime;