Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1198 Refactorings and Cleanups
  3. ZOOKEEPER-1226

extract version check in separate method in PrepRequestProcessor

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      The following code is repeated 4 times and should be put in a method that either throws the Exception or returns the incremented version (see below).

      version = setDataRequest.getVersion();
      int currentVersion = nodeRecord.stat.getVersion();
      if (version != -1 && version != currentVersion) {
          throw new KeeperException.BadVersionException(path);
      }
      version = currentVersion + 1;
      
      private static int checkAndIncVersion(int currentVersion, int versionToCompare, String path )
      

      Attachments

        1. ZOOKEEPER-1226.patch
          14 kB
          Thomas Koch

        Activity

          People

            thkoch Thomas Koch
            thkoch Thomas Koch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: