private Revision incrementRevision(String clientId) { final Revision current = getLastModification().getRevision(); final long incrementedVersion; if (current.getVersion() == null) { incrementedVersion = 0; } else { incrementedVersion = current.getVersion() + 1; } return new Revision(incrementedVersion, clientId); }
@Override public <T> ConfigurationSnapshot<T> configureFlow( Revision revision, ConfigurationRequest<T> configurationRequest) { lock(); try { // check the revision checkRevision(revision); // execute the configuration request final ConfigurationResult<T> result = configurationRequest.execute(); // update the revision final Revision newRevision = updateRevision(incrementRevision(revision.getClientId())); // build the result return new ConfigurationSnapshot( newRevision.getVersion(), result.getConfiguration(), result.isNew()); } finally { unlock(); } }