Source:
<code>public boolean tryInstallNewTransactionsSchemaVersion(int newVersion) { CheckAndSetResult<ValueAndBound<InternalSchemaMetadata>> transformResult = tryInstallNewVersion(newVersion); Map.Entry<Range<Long>, Integer> finalVersion = getRangeAtBoundThreshold( <START> Iterables.getOnlyElement(transformResult.existingValues())); <END> long newVersionTimestampThreshold = finalVersion.getKey().lowerEndpoint(); if (transformResult.successful() && finalVersion.getValue() == newVersion) { log.info("We attempted to install the transactions schema version {}, and this was successful." + " This version will take effect no later than timestamp {}.", SafeArg.of("newVersion", newVersion), SafeArg.of("timestamp", newVersionTimestampThreshold)); return true; } if (finalVersion.getValue() == newVersion) { log.info("We attempted to install the the transactions schema version {}. We failed, but this version" + " will eventually be utilised anyway, taking effect no later than timestamp {}.", SafeArg.of("newVersion", newVersion), SafeArg.of("timestamp", newVersionTimestampThreshold)); return true; } if (transformResult.successful()) { log.info("We attempted to install the transactions schema version {}, but ended up installing {}" + " because no version existed.", SafeArg.of("versionWeTriedToInstall", newVersion), SafeArg.of("versionWeActuallyInstalled", finalVersion.getValue())); } log.info("We attempted to install the transactions schema version {}, but failed." + " Currently, version will eventually be used from timestamp {}.", SafeArg.of("versionWeTriedToInstall", newVersion), SafeArg.of("versionThatWillBeUsed", finalVersion.getValue()), SafeArg.of("timestamp", newVersionTimestampThreshold)); return false; }</code><technical_language>observation strange return a CAS result a list of existing values, is a single value. OK, worth a special superclass of CheckAndSetResult<ValueAndBound<T>> (or generic) a method returns single existing value</technical_language>

Target:
public boolean tryInstallNewTransactionsSchemaVersion(int newVersion) { CheckAndSetResult<ValueAndBound<InternalSchemaMetadata>> transformResult = tryInstallNewVersion(newVersion); Map.Entry<Range<Long>, Integer> finalVersion = getRangeAtBoundThreshold( Iterables.getOnlyElement(transformResult.existingValues())); long finalVersionTimestampThreshold = finalVersion.getKey().lowerEndpoint(); if (transformResult.successful() && finalVersion.getValue() == newVersion) { log.info("We attempted to install the transactions schema version {}, and this was successful." + " This version will take effect no later than timestamp {}.", SafeArg.of("newVersion", newVersion), SafeArg.of("timestamp", finalVersionTimestampThreshold)); return true; } if (finalVersion.getValue() == newVersion) { log.info("We attempted to install the the transactions schema version {}. We failed, but this version" + " will eventually be utilised anyway, taking effect no later than timestamp {}.", SafeArg.of("newVersion", newVersion), SafeArg.of("timestamp", finalVersionTimestampThreshold)); return true; } if (transformResult.successful()) { log.info("We attempted to install the transactions schema version {}, but ended up installing {}" + " because no version existed.", SafeArg.of("versionWeTriedToInstall", newVersion), SafeArg.of("versionWeActuallyInstalled", finalVersion.getValue())); } log.info("We attempted to install the transactions schema version {}, but failed." + " Currently, version will eventually be used from timestamp {}.", SafeArg.of("versionWeTriedToInstall", newVersion), SafeArg.of("versionThatWillBeUsed", finalVersion.getValue()), SafeArg.of("timestamp", finalVersionTimestampThreshold)); return false; }