NIFI-1996: Fixed bug in the generation of UUID's for components when dealing with Snippets

This closes #519
This commit is contained in:
Mark Payne 2016-06-10 14:35:47 -04:00 committed by Oleg Zhurakousky
parent a8b42c26b6
commit 992b5552bb
2 changed files with 9 additions and 1 deletions

View File

@ -596,7 +596,7 @@ public final class SnippetUtils {
if (seed == null) { if (seed == null) {
return UUID.randomUUID().toString(); return UUID.randomUUID().toString();
} else { } else {
return UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).toString(); return UUID.nameUUIDFromBytes((currentId + seed).getBytes(StandardCharsets.UTF_8)).toString();
} }
} }

View File

@ -383,6 +383,10 @@ public class NaiveRevisionManager implements RevisionManager {
public <T> T get(final String componentId, final ReadOnlyRevisionCallback<T> callback) { public <T> T get(final String componentId, final ReadOnlyRevisionCallback<T> callback) {
final RevisionLock revisionLock = getRevisionLock(new Revision(0L, null, componentId)); final RevisionLock revisionLock = getRevisionLock(new Revision(0L, null, componentId));
logger.debug("Attempting to obtain read lock for {}", revisionLock.getRevision()); logger.debug("Attempting to obtain read lock for {}", revisionLock.getRevision());
if (logger.isTraceEnabled()) {
logger.trace("Attempting to obtain read lock due to following stack trace", new RuntimeException("Exception for generating stack trace for debugging purposes"));
}
revisionLock.acquireReadLock(null, revisionLock.getRevision().getClientId()); revisionLock.acquireReadLock(null, revisionLock.getRevision().getClientId());
logger.debug("Obtained read lock for {}", revisionLock.getRevision()); logger.debug("Obtained read lock for {}", revisionLock.getRevision());
@ -402,6 +406,10 @@ public class NaiveRevisionManager implements RevisionManager {
final Stack<RevisionLock> revisionLocks = new Stack<>(); final Stack<RevisionLock> revisionLocks = new Stack<>();
logger.debug("Will attempt to obtain read locks for components {}", componentIds); logger.debug("Will attempt to obtain read locks for components {}", componentIds);
if (logger.isTraceEnabled()) {
logger.trace("Attempting to obtain read lock due to following stack trace", new RuntimeException("Exception for generating stack trace for debugging purposes"));
}
for (final String componentId : sortedIds) { for (final String componentId : sortedIds) {
final RevisionLock revisionLock = getRevisionLock(new Revision(0L, null, componentId)); final RevisionLock revisionLock = getRevisionLock(new Revision(0L, null, componentId));