1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

[431060][local] RSE performance over local network drives are suboptimal

This commit is contained in:
Dave McKnight 2014-03-25 11:12:23 -04:00
parent a2215eb3b8
commit 411e15f6dc
3 changed files with 28 additions and 5 deletions

View file

@ -55,7 +55,7 @@
* Samuel Wu (IBM) - [395981] Local file encoding is not handled properly * Samuel Wu (IBM) - [395981] Local file encoding is not handled properly
* David McKnight (IBM) - [422508] Unable to map A:\ and B:\ as selectable drives in RSE View * David McKnight (IBM) - [422508] Unable to map A:\ and B:\ as selectable drives in RSE View
* David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver. * David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver.
* David McKnight (IBM) - [427306] A couple cases where RSE doesn't indicate lack of space for upload * David McKnight (IBM) - [431060][local] RSE performance over local network drives are suboptimal
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.local.files; package org.eclipse.rse.internal.services.local.files;

View file

@ -47,6 +47,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
private boolean _isArchive = false; private boolean _isArchive = false;
private IHostFilePermissions _permissions = null; private IHostFilePermissions _permissions = null;
private FileInfo _info = null; private FileInfo _info = null;
private boolean _needsQuery = false;
public LocalHostFile(File file) public LocalHostFile(File file)
{ {
@ -75,6 +76,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
_info.setName(new String(name.toCharArray())); _info.setName(new String(name.toCharArray()));
} }
} }
_needsQuery = false;
} }
@ -162,8 +164,10 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean exists() public boolean exists()
{ {
if (_exists == null || needsQuery()){ boolean needsQuery = needsQuery();
if (_exists == null || needsQuery){
if (_info != null){ if (_info != null){
if (needsQuery) fetchInfo();
_exists = new Boolean(_info.exists()); _exists = new Boolean(_info.exists());
} }
else { else {
@ -181,6 +185,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public long getSize() public long getSize()
{ {
if (_info != null){ if (_info != null){
if (needsQuery()) fetchInfo();
return _info.getLength(); return _info.getLength();
} }
return _file.length(); return _file.length();
@ -189,6 +194,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public long getModifiedDate() public long getModifiedDate()
{ {
if (_info != null){ if (_info != null){
if (needsQuery()) fetchInfo();
return _info.getLastModified(); return _info.getLastModified();
} }
return _file.lastModified(); return _file.lastModified();
@ -198,6 +204,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
{ {
_file = new File(newAbsolutePath); _file = new File(newAbsolutePath);
_isArchive = ArchiveHandlerManager.getInstance().isArchive(_file); _isArchive = ArchiveHandlerManager.getInstance().isArchive(_file);
fetchInfo();
} }
public boolean isArchive() public boolean isArchive()
@ -207,6 +214,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean canRead() { public boolean canRead() {
if (_info != null){ if (_info != null){
if (needsQuery()) fetchInfo();
return _info.getAttribute(EFS.ATTRIBUTE_OWNER_READ); return _info.getAttribute(EFS.ATTRIBUTE_OWNER_READ);
} }
return _file.canRead(); return _file.canRead();
@ -214,6 +222,11 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean canWrite() { public boolean canWrite() {
if (_info != null){ if (_info != null){
if (needsQuery()) fetchInfo();
boolean readOnly = _info.getAttribute(EFS.ATTRIBUTE_READ_ONLY);
if (readOnly){
return false;
}
return _info.getAttribute(EFS.ATTRIBUTE_OWNER_WRITE); return _info.getAttribute(EFS.ATTRIBUTE_OWNER_WRITE);
} }
return _file.canWrite(); return _file.canWrite();
@ -228,6 +241,9 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
} }
private boolean needsQuery(){ private boolean needsQuery(){
if (LocalFileNativesManager.isUsingNatives() && _needsQuery){
return true;
}
long t = System.currentTimeMillis(); long t = System.currentTimeMillis();
if (_lastQueryTime == 0 || (t - _lastQueryTime) > 5000){ if (_lastQueryTime == 0 || (t - _lastQueryTime) > 5000){
_lastQueryTime = t; _lastQueryTime = t;
@ -235,4 +251,8 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
} }
return false; return false;
} }
public void setNeedsQuery(boolean flag){
_needsQuery = true;
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,6 +14,7 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [187571] Classification is empty for local directories * Martin Oberhuber (Wind River) - [187571] Classification is empty for local directories
* Martin Oberhuber (Wind River) - [234726] Update IRemoteFile Javadocs * Martin Oberhuber (Wind River) - [234726] Update IRemoteFile Javadocs
* David McKnight (IBM) - [431060][local] RSE performance over local network drives are suboptimal
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.local.model; package org.eclipse.rse.internal.subsystems.files.local.model;
@ -74,7 +75,9 @@ public class LocalFile extends AbstractRemoteFile
return _classification; return _classification;
} }
public void markStale(boolean isStale) {
super.markStale(isStale);
_localHostFile.setNeedsQuery(isStale);
}
} }