Object ret = new Locked() {
protected Object run(Node n) throws RepositoryException {
Property seqProp = n.getProperty("value");
long value = seqProp.getLong();
seqProp.setValue(++value);
seqProp.save();
return new Long(value);
}
}.with(n, false, 10 * 1000); // expect a value after ten seconds
if (ret == Locked.TIMED_OUT) {
System.out.println("Thread" + threadNumber + ": could not get a sequence number within 10 seconds");