jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torgeir Veimo <torgeir.ve...@gmail.com>
Subject new atomicCounter support (OAK-2220)
Date Fri, 13 Nov 2015 04:40:27 GMT
Am trying to use the new atomicSupport feature, and am wondering if I'm
using it the correct way;

My counter is initialised with

Node counter = JcrUtils.getOrCreateByPath("/testCounter",
"oak:Unstructured", session);
if (counter.isNew()) {
  counter.addMixin("mix:atomicCounter");
  session.save();
}

then when fetching a new value

counter.setProperty("oak:increment", 1);
session.save();
long value = counter.getProperty("oak:counter").getLong();

What happens if the same code is called from a different thread / session
after the session.save() but before the getProperty() call? Will the value
remain unchanged in this thread / session?

-- 
-Tor

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message