Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,25 @@ public Long call() throws RepositoryException, InterruptedException {
}
Node n = s.getNode(counterPath);

long value = new LockedWrapper<Long>() {
long value = 0;
synchronized (counter) {
value = new LockedWrapper<Long>() {

@Override
protected Long run(Node node)
throws RepositoryException {
@Override
protected Long run(Node node)
throws RepositoryException {

Property seqProp = node.getProperty("value");
long value = seqProp.getLong();
seqProp.setValue(++value);
s.save();
return value;
}
}.with(n, false);
Property seqProp = node.getProperty("value");
long value = seqProp.getLong();
seqProp.setValue(++value);
s.save();
return value;
}
}.with(n, false);

// check that the sequence is ok
assertEquals(counter.getAndIncrement(), value);
// check that the sequence is ok
assertEquals(counter.getAndIncrement(), value);
}

// do a random wait
Thread.sleep(random.nextInt(100));
Expand Down