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> {
9 public void assignPilot(T pilot) {
13 // BEGIN: reentrant.merge.int
14 private AtomicInteger cnt = new AtomicInteger();
15 public int sumBigger(Collection<T> args) {
16 T pilotCopy = this.pilot;
17 int own = doCriticalSection(args, pilotCopy);
18 // now merge with global state
22 // END: reentrant.merge.int
24 private int doCriticalSection(Collection<T> args, T pilotCopy) {
27 if (pilotCopy.compareTo(cmp) < 0) {
34 public int getCount() {