Faster disk I/O. BLD200409051800
authorpkuzel@netbeans.org
Sat, 04 Sep 2004 22:02:59 +0000
changeset 51504c6ef1be72a9
parent 5149 a158da739f60
child 5151 6b476ca30432
Faster disk I/O.
vcscore/src/org/netbeans/modules/vcscore/turbo/FileProperties.java
vcscore/src/org/netbeans/modules/vcscore/turbo/Profiles.java
vcscore/src/org/netbeans/modules/vcscore/turbo/TurboUtil.java
     1.1 --- a/vcscore/src/org/netbeans/modules/vcscore/turbo/FileProperties.java	Sat Sep 04 18:37:04 2004 +0000
     1.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/turbo/FileProperties.java	Sat Sep 04 22:02:59 2004 +0000
     1.3 @@ -243,5 +243,9 @@
     1.4          return elements;
     1.5      }
     1.6  
     1.7 +    public String toString() {
     1.8 +        return "[" + name + "=>"  + status + "]";
     1.9 +    }
    1.10 +
    1.11  }
    1.12  
     2.1 --- a/vcscore/src/org/netbeans/modules/vcscore/turbo/Profiles.java	Sat Sep 04 18:37:04 2004 +0000
     2.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/turbo/Profiles.java	Sat Sep 04 22:02:59 2004 +0000
     2.3 @@ -43,9 +43,9 @@
     2.4              String root = FileUtil.toFile(fs.getRoot()).getAbsolutePath();
     2.5              String path = file.getAbsolutePath().substring(root.length());
     2.6              File ret = fs.getCacheFileName(file, path);
     2.7 -            // TODO check that it does not return null for FS root subdirs
     2.8 -            // it caused a lot of  problems in original implementation (such entries must be held locked in-memory)
     2.9 -            assert path.length() > 0 || ret != null;
    2.10 +            // assert that it does not return null for FS root subdirs
    2.11 +            // it's allowed to return null for files like "path/CVS/Root"
    2.12 +            assert path.length() == 0 || path.indexOf(File.separatorChar) != 0 || ret != null : "Root " + root + " path " + path;
    2.13              return ret;
    2.14          }
    2.15          return null;
     3.1 --- a/vcscore/src/org/netbeans/modules/vcscore/turbo/TurboUtil.java	Sat Sep 04 18:37:04 2004 +0000
     3.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/turbo/TurboUtil.java	Sat Sep 04 22:02:59 2004 +0000
     3.3 @@ -50,12 +50,13 @@
     3.4       */
     3.5      public static void refreshFolder(FileObject folder) {
     3.6          if (folder.isFolder() == false) return;
     3.7 -        FileObject[] files = folder.getChildren();
     3.8 -        // XXX it would be faster to issue batch command instead of set of commands
     3.9 -        for (int i = 0; i < files.length; i++) {
    3.10 -            FileObject fileObject = files[i];
    3.11 -            Turbo.getRepositoryMeta(fileObject);
    3.12 -        }
    3.13 +        Turbo.getRepositoryMeta(folder); // it refreshes whole folder
    3.14 +//        FileObject[] files = folder.getChildren();
    3.15 +//        // XXX it would be faster to issue batch command instead of set of commands
    3.16 +//        for (int i = 0; i < files.length; i++) {
    3.17 +//            FileObject fileObject = files[i];
    3.18 +//            Turbo.getRepositoryMeta(fileObject);
    3.19 +//        }
    3.20      }
    3.21  
    3.22      /**
    3.23 @@ -69,7 +70,9 @@
    3.24          // XXX it would be faster to issue batch command instead of set of commands
    3.25          for (int i = 0; i < files.length; i++) {
    3.26              FileObject fileObject = files[i];
    3.27 -            refreshRecursively(fileObject); // recursion
    3.28 +            if (fileObject.isFolder()) {
    3.29 +                refreshRecursively(fileObject); // recursion
    3.30 +            }
    3.31          }
    3.32      }
    3.33  
    3.34 @@ -148,6 +151,8 @@
    3.35      /**
    3.36       * Returns FileReaderListener implementation that populates
    3.37       * the cache from the command data execuded over given FS.
    3.38 +     * <p>
    3.39 +     * It's used by e.g. LIST command.
    3.40       *
    3.41       * @param fs filesystem that allows to properly match command
    3.42       *   output to fileobjects