From 409cbb71197092fe69c151437b38bc4ec7f84e4d Mon Sep 17 00:00:00 2001 From: David McKnight Date: Fri, 5 Oct 2012 19:47:43 +0000 Subject: [PATCH] [391164] [dstore] don't clear cached elements when they're not spirited or deleted --- .../dstore/files/DStoreFileService.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java index e5565fa2c61..f2dd56eb98a 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java @@ -1211,7 +1211,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer DataElement de = null; if (name.equals(".") && name.equals(remoteParent)) //$NON-NLS-1$ { - de = getElementFor(name); + de = getElementFor(name, true); } else { @@ -1221,7 +1221,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer buf.append(sep); } buf.append(name); - de = getElementFor(buf.toString()); + de = getElementFor(buf.toString(), true); } return de; } @@ -2095,8 +2095,12 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer } return results; } + + protected DataElement getElementFor(String path){ + return getElementFor(path, false); + } - protected DataElement getElementFor(String path) + protected DataElement getElementFor(String path, boolean forceReuse) { if (!isInitialized()) { @@ -2113,8 +2117,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer String normalizedPath = PathUtility.normalizeUnknown(path); DataElement element = (DataElement)_fileElementMap.get(normalizedPath); if (element != null) - { - if (element.isDeleted() + { + if (forceReuse || element.isDeleted() || element.isSpirit()){ // when using spirit, don't use element cache _fileElementMap.remove(normalizedPath); element = null; @@ -2408,6 +2412,9 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer */ DataElement remoteFile = file.getDataElement(); + if (remoteFile.isSpirit()){ + remoteFile = getElementFor(rfile.getAbsolutePath()); + } DataElement status = dsStatusCommand(remoteFile, IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS, monitor); if (status != null) {