mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[291738] [efs] repeated queries to RSEFileStoreImpl.fetchInfo() in short time-span should be reduced
This commit is contained in:
parent
5fb4c2106f
commit
02446923b9
3 changed files with 19 additions and 8 deletions
|
@ -22,6 +22,7 @@
|
||||||
* Kevin Doyle (IBM) - [210673] [efs][nls] Externalize Strings in RSEFileStore and RSEFileStoreImpl
|
* Kevin Doyle (IBM) - [210673] [efs][nls] Externalize Strings in RSEFileStore and RSEFileStoreImpl
|
||||||
* Timur Shipilov (Xored) - [224538] RSEFileStore.getParent() returns null for element which is not root of filesystem
|
* Timur Shipilov (Xored) - [224538] RSEFileStore.getParent() returns null for element which is not root of filesystem
|
||||||
* David McKnight (IBM) - [287185] EFS provider should interpret the URL host component as RSE connection name rather than a hostname
|
* David McKnight (IBM) - [287185] EFS provider should interpret the URL host component as RSE connection name rather than a hostname
|
||||||
|
* David McKnight (IBM) - [291738] [efs] repeated queries to RSEFileStoreImpl.fetchInfo() in short time-span should be reduced
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.efs;
|
package org.eclipse.rse.internal.efs;
|
||||||
|
@ -243,14 +244,13 @@ public class RSEFileStore extends FileStore
|
||||||
Bundle[] bundles = ctx.getBundles();
|
Bundle[] bundles = ctx.getBundles();
|
||||||
for (int i=0; i<bundles.length; i++) {
|
for (int i=0; i<bundles.length; i++) {
|
||||||
if ("org.eclipse.core.resources".equals(bundles[i].getSymbolicName())) { //$NON-NLS-1$
|
if ("org.eclipse.core.resources".equals(bundles[i].getSymbolicName())) { //$NON-NLS-1$
|
||||||
if (resourcesBundle==null || bundles[i].getState()==Bundle.ACTIVE) {
|
if (resourcesBundle==null && bundles[i].getState()==Bundle.ACTIVE) {
|
||||||
resourcesBundle = bundles[i];
|
resourcesBundle = bundles[i];
|
||||||
}
|
}
|
||||||
//System.out.println(resourcesBundle);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resourcesBundle.getState()==Bundle.ACTIVE;
|
return resourcesBundle != null && resourcesBundle.getState()==Bundle.ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [220300] EFS Size Property not properly updated after saving
|
* Martin Oberhuber (Wind River) - [220300] EFS Size Property not properly updated after saving
|
||||||
* Martin Oberhuber (Wind River) - [234026] Clarify IFileService#createFolder() Javadocs
|
* Martin Oberhuber (Wind River) - [234026] Clarify IFileService#createFolder() Javadocs
|
||||||
* David McKnight (IBM) - [287185] EFS provider should interpret the URL host component as RSE connection name rather than a hostname
|
* David McKnight (IBM) - [287185] EFS provider should interpret the URL host component as RSE connection name rather than a hostname
|
||||||
|
* David McKnight (IBM) - [291738] [efs] repeated queries to RSEFileStoreImpl.fetchInfo() in short time-span should be reduced
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.efs;
|
package org.eclipse.rse.internal.efs;
|
||||||
|
@ -79,6 +80,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
public class RSEFileStoreImpl extends FileStore
|
public class RSEFileStoreImpl extends FileStore
|
||||||
{
|
{
|
||||||
private RSEFileStore _store;
|
private RSEFileStore _store;
|
||||||
|
private long _lastFetch = 0;
|
||||||
|
|
||||||
//cached IRemoteFile object: an Object to avoid early class loading
|
//cached IRemoteFile object: an Object to avoid early class loading
|
||||||
private transient volatile IRemoteFile _remoteFile;
|
private transient volatile IRemoteFile _remoteFile;
|
||||||
|
@ -514,8 +516,14 @@ public class RSEFileStoreImpl extends FileStore
|
||||||
* @see org.eclipse.core.filesystem.IFileStore#fetchInfo(int, org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.core.filesystem.IFileStore#fetchInfo(int, org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
|
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) < 1000)){
|
||||||
// clear cache in order to query latest info
|
// clear cache in order to query latest info
|
||||||
cacheRemoteFile(null);
|
cacheRemoteFile(null);
|
||||||
|
_lastFetch = curTime;
|
||||||
|
}
|
||||||
|
|
||||||
// connect if needed. Will throw exception if not successful.
|
// connect if needed. Will throw exception if not successful.
|
||||||
IRemoteFile remoteFile = getRemoteFileObject(monitor, false);
|
IRemoteFile remoteFile = getRemoteFileObject(monitor, false);
|
||||||
String classification = (remoteFile==null) ? null : remoteFile.getClassification();
|
String classification = (remoteFile==null) ? null : remoteFile.getClassification();
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Mike Kucera (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
* Mike Kucera (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
||||||
* David McKnight (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
* David McKnight (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
||||||
|
* David McKnight (IBM) - [291738] [efs] repeated queries to RSEFileStoreImpl.fetchInfo() in short time-span should be reduced
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
package org.eclipse.rse.internal.efs;
|
package org.eclipse.rse.internal.efs;
|
||||||
|
|
||||||
|
@ -204,11 +205,13 @@ public class RemoteEditorManager implements ISaveParticipant, IResourceChangeLis
|
||||||
if (input instanceof FileEditorInput){
|
if (input instanceof FileEditorInput){
|
||||||
IFile file = ((FileEditorInput)input).getFile();
|
IFile file = ((FileEditorInput)input).getFile();
|
||||||
URI uri = file.getLocationURI();
|
URI uri = file.getLocationURI();
|
||||||
|
if (uri != null && uri.getScheme() != null){
|
||||||
if ("rse".equals(uri.getScheme())) { //$NON-NLS-1$
|
if ("rse".equals(uri.getScheme())) { //$NON-NLS-1$
|
||||||
IEditorPart editor = editorReference.getEditor(false);
|
IEditorPart editor = editorReference.getEditor(false);
|
||||||
callback.apply(page, editor, file);
|
callback.apply(page, editor, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (PartInitException e){
|
} catch (PartInitException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue