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-24 16:51:10 -04:00
parent a537c62d41
commit 6bd0182261
5 changed files with 124 additions and 41 deletions

View file

@ -2,12 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.rse.services.local;singleton:=true Bundle-SymbolicName: org.eclipse.rse.services.local;singleton:=true
Bundle-Version: 2.1.500.qualifier Bundle-Version: 3.0.0.qualifier
Bundle-Activator: org.eclipse.rse.internal.services.local.Activator Bundle-Activator: org.eclipse.rse.internal.services.local.Activator
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)" org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
org.eclipse.core.filesystem
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.internal.services.local;x-friends:="org.eclipse.rse.subsystems.files.local,org.eclipse.rse.subsystems.processes.local,org.eclipse.rse.subsystems.shells.local", Export-Package: org.eclipse.rse.internal.services.local;x-friends:="org.eclipse.rse.subsystems.files.local,org.eclipse.rse.subsystems.processes.local,org.eclipse.rse.subsystems.shells.local",

View file

@ -10,6 +10,6 @@
</parent> </parent>
<groupId>org.eclipse.tm</groupId> <groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.rse.services.local</artifactId> <artifactId>org.eclipse.rse.services.local</artifactId>
<version>2.1.500-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -82,6 +82,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.eclipse.core.filesystem.provider.FileInfo;
import org.eclipse.core.internal.filesystem.local.LocalFileNativesManager;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -161,12 +163,22 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
private boolean _isWin95 = false; private boolean _isWin95 = false;
private boolean _isWinNT = false; private boolean _isWinNT = false;
private String _osCmdShell = null; private String _osCmdShell = null;
private boolean _getParentCanonicalPath = false;
protected ISystemFileTypes _fileTypeRegistry; protected ISystemFileTypes _fileTypeRegistry;
public LocalFileService(ISystemFileTypes fileTypeRegistry) public LocalFileService(ISystemFileTypes fileTypeRegistry)
{ {
_fileTypeRegistry = fileTypeRegistry; _fileTypeRegistry = fileTypeRegistry;
String getParentCanonicalPathStr = System.getProperty("local.get.parent.canonical.path"); //$NON-NLS-1$
if (getParentCanonicalPathStr != null){
try {
_getParentCanonicalPath = Boolean.parseBoolean(getParentCanonicalPathStr);
}
catch (Exception e){
}
}
} }
@ -226,13 +238,11 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
boolean result = false; boolean result = false;
File entry = new File(dir, name); File entry = new File(dir, name);
if (entry.exists()) { FileInfo info = fetchInfo(entry);
boolean isDirectory = entry.isDirectory();
if (info.exists()) {
boolean isDirectory = info.isDirectory();
boolean isFile = !isDirectory; boolean isFile = !isDirectory;
if (isFile){
isFile = entry.isFile();
}
if (isFile) { if (isFile) {
result = _matcher.matches(name); result = _matcher.matches(name);
} else if (isDirectory) { } else if (isDirectory) {
@ -731,15 +741,18 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
protected IHostFile[] internalFetch(String remoteParent, String fileFilter, int type, IProgressMonitor monitor) throws SystemMessageException { protected IHostFile[] internalFetch(String remoteParent, String fileFilter, int type, IProgressMonitor monitor) throws SystemMessageException {
LocalFileNameFilter fFilter = new LocalFileNameFilter(fileFilter, type); LocalFileNameFilter fFilter = new LocalFileNameFilter(fileFilter, type);
File localParent = new File(remoteParent); File localParent = new File(remoteParent);
FileInfo parentInfo = fetchInfo(localParent);
boolean isArchive = false; boolean isArchive = false;
boolean isVirtual = false; boolean isVirtual = false;
if (localParent.exists()) { boolean parentExists = parentInfo.exists();
if (localParent.isFile()) { if (parentExists) {
if (!parentInfo.isDirectory()) {
isArchive = ArchiveHandlerManager.getInstance().isArchive(localParent); isArchive = ArchiveHandlerManager.getInstance().isArchive(localParent);
} }
// if the system type is Windows, we get the canonical path so that we have the correct case in the path // if the system type is Windows, we get the canonical path so that we have the correct case in the path
// this is needed because Windows paths are case insensitive // this is needed because Windows paths are case insensitive
if (isWindows()) { if (isWindows() && _getParentCanonicalPath) { // slows things down significantly so only do if property is on
try { try {
localParent = localParent.getCanonicalFile(); // can this be avoided for network drives? localParent = localParent.getCanonicalFile(); // can this be avoided for network drives?
} catch (IOException e) { } catch (IOException e) {
@ -783,7 +796,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
return convertToHostFiles(new File[] { file }, type); return convertToHostFiles(new File[] { file }, type);
} }
*/ */
if (localParent.exists()) { if (parentExists) {
File[] files = localParent.listFiles(fFilter); File[] files = localParent.listFiles(fFilter);
if (files == null) { if (files == null) {
//throw new RemoteFileException("Error listing: " + localParent.getAbsolutePath()); //throw new RemoteFileException("Error listing: " + localParent.getAbsolutePath());
@ -804,18 +817,16 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
for (int i = 0; i < files.length; i++) for (int i = 0; i < files.length; i++)
{ {
File file = files[i]; File file = files[i];
boolean isDirectory = file.isDirectory(); FileInfo info = fetchInfo(file);
boolean isFile = !isDirectory;
if (isFile){
isFile = file.isFile();
}
boolean isDirectory = info.isDirectory();
boolean isFile = !isDirectory;
if (isDirectory) if (isDirectory)
{ {
if (type == IFileService.FILE_TYPE_FILES_AND_FOLDERS || if (type == IFileService.FILE_TYPE_FILES_AND_FOLDERS ||
type == IFileService.FILE_TYPE_FOLDERS) type == IFileService.FILE_TYPE_FOLDERS)
{ {
results.add(new LocalHostFile(file, false, isFile)); results.add(new LocalHostFile(file, false, info));
} }
} }
else if (isFile) else if (isFile)
@ -823,28 +834,43 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
if (type == IFileService.FILE_TYPE_FILES_AND_FOLDERS || if (type == IFileService.FILE_TYPE_FILES_AND_FOLDERS ||
type == IFileService.FILE_TYPE_FILES) type == IFileService.FILE_TYPE_FILES)
{ {
results.add(new LocalHostFile(file, false, isFile)); results.add(new LocalHostFile(file, false, info));
} else if (type == IFileService.FILE_TYPE_FOLDERS && } else if (type == IFileService.FILE_TYPE_FOLDERS &&
ArchiveHandlerManager.getInstance().isArchive(file)) { ArchiveHandlerManager.getInstance().isArchive(file)) {
// On Local Archive's should be considered Folders // On Local Archive's should be considered Folders
// as they are containers that can be opened. // as they are containers that can be opened.
results.add(new LocalHostFile(file, false, isFile)); results.add(new LocalHostFile(file, false, info));
} }
} }
else if (file.exists()) else if (info.exists())
{ {
results.add(new LocalHostFile(file, false, isFile)); results.add(new LocalHostFile(file, false, info));
} }
} }
} }
return (IHostFile[])results.toArray(new IHostFile[results.size()]); return (IHostFile[])results.toArray(new IHostFile[results.size()]);
} }
private FileInfo fetchInfo(File file) {
if (LocalFileNativesManager.isUsingNatives()) {
FileInfo info = LocalFileNativesManager.fetchFileInfo(file.getAbsolutePath());
//natives don't set the file name on all platforms
if (info.getName().length() == 0) {
String name = file.getName();
//Bug 294429: make sure that substring baggage is removed
info.setName(new String(name.toCharArray()));
}
return info;
}
return null;
}
public IHostFile getUserHome() public IHostFile getUserHome()
{ {
String userHome =System.getProperty("user.home"); //$NON-NLS-1$ String userHome =System.getProperty("user.home"); //$NON-NLS-1$
File userHomeFile = new File(userHome); File userHomeFile = new File(userHome);
return new LocalHostFile(userHomeFile, (userHomeFile.getParent() == null), userHomeFile.isFile()); FileInfo info = fetchInfo(userHomeFile);
return new LocalHostFile(userHomeFile, (userHomeFile.getParent() == null), info);
} }
@ -876,7 +902,9 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
IHostFile[] fileObjs = new LocalHostFile[v.size()]; IHostFile[] fileObjs = new LocalHostFile[v.size()];
for (int idx = 0; idx < v.size(); idx++) for (int idx = 0; idx < v.size(); idx++)
{ {
fileObjs[idx] = new LocalHostFile((File) v.get(idx), true, false); File file = (File)v.get(idx);
FileInfo info = fetchInfo(file);
fileObjs[idx] = new LocalHostFile((File) v.get(idx), true, info);
} }
return fileObjs; return fileObjs;
@ -895,17 +923,17 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
boolean isArchiveParent = false; boolean isArchiveParent = false;
boolean isRoot = (remoteParent == null || remoteParent.length() == 0); boolean isRoot = (remoteParent == null || remoteParent.length() == 0);
if (!isRoot) { if (!isRoot) {
File remoteParentFile = new File(remoteParent); isVirtualParent = ArchiveHandlerManager.isVirtual(remoteParent);
if (!remoteParentFile.exists()) { if (!isVirtualParent){
isVirtualParent = ArchiveHandlerManager.isVirtual(remoteParent); File remoteParentFile = new File(remoteParent);
} else if (remoteParentFile.isFile()) {
isArchiveParent = ArchiveHandlerManager.getInstance().isArchive(remoteParentFile); isArchiveParent = ArchiveHandlerManager.getInstance().isArchive(remoteParentFile);
} }
} }
if (!isVirtualParent && !isArchiveParent) if (!isVirtualParent && !isArchiveParent)
{ {
File file = isRoot ? new File(name) : new File(remoteParent, name); File file = isRoot ? new File(name) : new File(remoteParent, name);
return new LocalHostFile(file, isRoot, file.isFile()); FileInfo info = fetchInfo(file);
return new LocalHostFile(file, isRoot, info);
} }
else else
{ {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2010 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
@ -16,12 +16,16 @@
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
* David McKnight (IBM) - [294521] Local "hidden" files and folders are always shown * David McKnight (IBM) - [294521] Local "hidden" files and folders are always shown
* 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) - [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;
import java.io.File; import java.io.File;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.provider.FileInfo;
import org.eclipse.core.internal.filesystem.local.LocalFileNativesManager;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.files.IHostFile; import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.services.files.IHostFilePermissions; import org.eclipse.rse.services.files.IHostFilePermissions;
@ -42,24 +46,38 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
private boolean _isRoot = false; private boolean _isRoot = false;
private boolean _isArchive = false; private boolean _isArchive = false;
private IHostFilePermissions _permissions = null; private IHostFilePermissions _permissions = null;
private FileInfo _info = null;
public LocalHostFile(File file) public LocalHostFile(File file)
{ {
_file = file; _file = file;
_isArchive = ArchiveHandlerManager.getInstance().isArchive(_file); _isArchive = ArchiveHandlerManager.getInstance().isArchive(_file);
fetchInfo();
} }
public LocalHostFile(File file, boolean isRoot, boolean isFile) public LocalHostFile(File file, boolean isRoot, FileInfo info)
{ {
_file = file; _file = file;
_info = info;
_isRoot = isRoot; _isRoot = isRoot;
if (!isRoot){ if (!isRoot){
_isArchive = ArchiveHandlerManager.getInstance().isArchive(_file); _isArchive = ArchiveHandlerManager.getInstance().isArchive(_file);
_isFile = new Boolean(isFile);
_isDirectory = new Boolean(!isFile);
} }
} }
private void fetchInfo() {
if (LocalFileNativesManager.isUsingNatives()) {
_info = LocalFileNativesManager.fetchFileInfo(_file.getAbsolutePath());
//natives don't set the file name on all platforms
if (_info.getName().length() == 0) {
String name = _file.getName();
//Bug 294429: make sure that substring baggage is removed
_info.setName(new String(name.toCharArray()));
}
}
}
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@ -88,8 +106,13 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean isHidden() public boolean isHidden()
{ {
if (_isHidden == null || needsQuery()){ if (_isHidden == null || needsQuery()){
String name = getName(); if (_info != null){
_isHidden = new Boolean(name.charAt(0) == '.' || (!_isRoot && _file.isHidden())); _isHidden = new Boolean(_info.getAttribute(EFS.ATTRIBUTE_HIDDEN));
}
else {
String name = getName();
_isHidden = new Boolean(name.charAt(0) == '.' || (!_isRoot && _file.isHidden()));
}
} }
return _isHidden.booleanValue(); return _isHidden.booleanValue();
} }
@ -102,7 +125,13 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean isDirectory() public boolean isDirectory()
{ {
if (_isDirectory == null){ if (_isDirectory == null){
_isDirectory = new Boolean(_file.isDirectory()); if (_info != null){
// use cached info
_isDirectory = new Boolean(_info.isDirectory());
}
else {
_isDirectory = new Boolean(_file.isDirectory());
}
} }
return _isDirectory.booleanValue(); return _isDirectory.booleanValue();
} }
@ -115,7 +144,13 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean isFile() public boolean isFile()
{ {
if (_isFile == null){ if (_isFile == null){
_isFile = new Boolean(_file.isFile()); if (_info != null){
// use cached info
_isFile = new Boolean(!_info.isDirectory());
}
else {
_isFile = new Boolean(_file.isFile());
}
} }
return _isFile.booleanValue(); return _isFile.booleanValue();
} }
@ -128,7 +163,12 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public boolean exists() public boolean exists()
{ {
if (_exists == null || needsQuery()){ if (_exists == null || needsQuery()){
_exists = new Boolean(_file.exists()); if (_info != null){
_exists = new Boolean(_info.exists());
}
else {
_exists = new Boolean(_file.exists());
}
} }
return _exists.booleanValue(); return _exists.booleanValue();
} }
@ -140,11 +180,17 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
public long getSize() public long getSize()
{ {
if (_info != null){
return _info.getLength();
}
return _file.length(); return _file.length();
} }
public long getModifiedDate() public long getModifiedDate()
{ {
if (_info != null){
return _info.getLastModified();
}
return _file.lastModified(); return _file.lastModified();
} }
@ -160,10 +206,16 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
} }
public boolean canRead() { public boolean canRead() {
if (_info != null){
return _info.getAttribute(EFS.ATTRIBUTE_OWNER_READ);
}
return _file.canRead(); return _file.canRead();
} }
public boolean canWrite() { public boolean canWrite() {
if (_info != null){
return _info.getAttribute(EFS.ATTRIBUTE_OWNER_WRITE);
}
return _file.canWrite(); return _file.canWrite();
} }

View file

@ -17,6 +17,7 @@
* Xuan Chen (IBM) - [194865] [local][Archives] Searching contents of a file in an Archive doesn't work * Xuan Chen (IBM) - [194865] [local][Archives] Searching contents of a file in an Archive doesn't work
* Xuan Chen (IBM) - [205448] [search]All the files are listed as in the Remote Search view even only found one match in a file * Xuan Chen (IBM) - [205448] [search]All the files are listed as in the Remote Search view even only found one match in a file
* 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) - [431060][local] RSE performance over local network drives are suboptimal
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.local.search; package org.eclipse.rse.internal.services.local.search;
@ -271,7 +272,8 @@ public class LocalSearchHandler implements ISearchHandler
{ {
// note that the file can not be root // note that the file can not be root
file = new LocalHostFile(theFile, false, true);
file = new LocalHostFile(theFile);
/* TODO /* TODO
if (!isArchive) if (!isArchive)
@ -379,7 +381,7 @@ public class LocalSearchHandler implements ISearchHandler
// file is root // file is root
boolean isRoot = false; //TODO boolean isRoot = false; //TODO
fileImpl = new LocalHostFile(theFile, isRoot, true); fileImpl = new LocalHostFile(theFile);
} }
// create local file differently for virtual directory // create local file differently for virtual directory
else else