1 package org.apidesign.reentrant;
3 import java.util.Collection;
4 import java.util.concurrent.atomic.AtomicInteger;
6 public class CriticalSectionReentrant<T extends Comparable<T>> implements CriticalSection<T> {
8 private AtomicInteger cnt = new AtomicInteger();
10 public void assignPilot(T pilot) {
14 public int sumBigger(Collection<T> args) {
15 T pilotCopy = this.pilot;
16 int own = doCriticalSection(args, pilotCopy);
17 // now merge with global state
22 private int doCriticalSection(Collection<T> args, T pilotCopy) {
25 if (pilotCopy.compareTo(cmp) < 0) {
32 public int getCount() {