try {
if(concurrencyChecking.isChecking()) {
// check for exception, but don't throw if suppressed through thread-local
final Version otherVersion = originalOid.getVersion();
final Version thisVersion = recreatedOid.getVersion();
if(thisVersion != null &&
otherVersion != null &&
thisVersion.different(otherVersion)) {
if(isConcurrencyCheckingGloballyEnabled() && ConcurrencyChecking.isCurrentlyEnabled()) {
LOG.info("concurrency conflict detected on " + recreatedOid + " (" + otherVersion + ")");
final String currentUser = getAuthenticationSession().getUserName();
throw new ConcurrencyException(currentUser, recreatedOid, thisVersion, otherVersion);
} else {
LOG.warn("concurrency conflict detected but suppressed, on " + recreatedOid + " (" + otherVersion + ")");
}
}
}
} finally {
final Version originalVersion = originalOid.getVersion();
final Version recreatedVersion = recreatedOid.getVersion();
if(recreatedVersion != null && (
originalVersion == null ||
recreatedVersion.different(originalVersion))
) {
if(LOG.isDebugEnabled()) {
LOG.debug("updating version in oid, on " + originalOid + " (" + originalVersion + ") to (" + recreatedVersion +")");
}
originalOid.setVersion(recreatedVersion);