extract version check in separate method in PrepRequestProcessor
----------------------------------------------------------------

                 Key: ZOOKEEPER-1226
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1226
             Project: ZooKeeper
          Issue Type: Improvement
            Reporter: Thomas Koch


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).
{code}
version = setDataRequest.getVersion();
int currentVersion = nodeRecord.stat.getVersion();
if (version != -1 && version != currentVersion) {
    throw new KeeperException.BadVersionException(path);
}
version = currentVersion + 1;
{code}

{code}
private static int checkAndIncVersion(int currentVersion, int versionToCompare, 
String path )
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to