MCPcopy Index your code
hub / github.com/clojure/clojure / doEnsure

Method doEnsure

src/jvm/clojure/lang/LockingTransaction.java:438–465  ·  view source on GitHub ↗
(Ref ref)

Source from the content-addressed store, hash-verified

436}
437
438void doEnsure(Ref ref){
439 if(!info.running())
440 throw retryex;
441 if(ensures.contains(ref))
442 return;
443 ref.lock.readLock().lock();
444
445 //someone completed a write after our snapshot
446 if(ref.tvals != null && ref.tvals.point > readPoint) {
447 ref.lock.readLock().unlock();
448 throw retryex;
449 }
450
451 Info refinfo = ref.tinfo;
452
453 //writer exists
454 if(refinfo != null && refinfo.running())
455 {
456 ref.lock.readLock().unlock();
457
458 if(refinfo != info) //not us, ensure is doomed
459 {
460 blockAndBail(refinfo);
461 }
462 }
463 else
464 ensures.add(ref);
465}
466
467Object doCommute(Ref ref, IFn fn, ISeq args) {
468 if(!info.running())

Callers 1

touchMethod · 0.80

Calls 5

runningMethod · 0.95
blockAndBailMethod · 0.95
lockMethod · 0.80
containsMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected