Пример #1
0
  public boolean open() throws IOException {
    boolean softClosed = file.open();
    if (!softClosed) {
      // LAST TIME THE FILE WAS NOT CLOSED IN SOFT WAY
      OLogManager.instance()
          .warn(
              this,
              "segment file '%s' was not closed correctly last time",
              OFileUtils.getPath(file.getName()));
      wasSoftlyClosedAtPreviousTime = false;
    }

    return softClosed;
  }
Пример #2
0
 public void open() throws IOException {
   // @TODO: LAZY OPEN FILES
   for (OFile file : files)
     if (!file.open()) {
       // LAST TIME THE FILE WAS NOT CLOSED IN SOFT WAY
       OLogManager.instance()
           .warn(
               this,
               "segment file '%s' was not closed correctly last time",
               OFileUtils.getPath(file.getName()));
       // TODO VERIFY DATA?
       wasSoftlyClosedAtPreviousTime = false;
     }
 }
Пример #3
0
 public void rename(String iOldName, String iNewName) {
   for (OFile file : files) {
     final String osFileName = file.getName();
     if (osFileName.startsWith(name)) {
       final File newFile =
           new File(
               storage.getStoragePath()
                   + "/"
                   + iNewName
                   + osFileName.substring(osFileName.lastIndexOf(name) + name.length()));
       for (OStorageFileConfiguration conf : config.infoFiles) {
         if (conf.parent.name.equals(name)) conf.parent.name = iNewName;
         if (conf.path.endsWith(osFileName))
           conf.path = new String(conf.path.replace(osFileName, newFile.getName()));
       }
       boolean renamed = file.renameTo(newFile);
       while (!renamed) {
         OMemoryWatchDog.freeMemoryForResourceCleanup(100);
         renamed = file.renameTo(newFile);
       }
     }
   }
 }