static final int WAIT_TIME = 60000;
- public static final boolean PRINT = false;
+ public static final boolean PRINT = BarrierTracing.BOOKKEEPING && true;
final AsyncBarrierImpl caller;
void inc(Object id, String info) {
if(PRINT) {
- System.err.println("inc barrier[" + get() + "] " + this);
+ LOGGER.warn("inc barrier[" + get() + "] " + this);
StackTraceElement[] elems = new Exception().getStackTrace();
- for(int i=0;i<4;i++) System.err.println(elems[i]);
+ for(int i=0;i<4;i++) LOGGER.warn("{}", elems[i]);
}
if (incrementAndGet() == 1) {
public void dec() {
if(PRINT) {
- System.err.println("dec barrier[" + get() + "] " + this);
+ LOGGER.warn("dec barrier[" + get() + "] " + this);
StackTraceElement[] elems = new Exception().getStackTrace();
- for(int i=0;i<3;i++) System.err.println(elems[i]);
+ for(int i=0;i<3;i++) LOGGER.warn("{}", elems[i]);
}
int count = decrementAndGet();
public static String report(AsyncBarrierImpl barrier) {
CacheEntry<?> e = BarrierTracing.entryMap.get(barrier);
if(e != null) return e.toString();
- else return "Barrier@" + System.identityHashCode(barrier);
+ else return "[" + barrier.get() + " requests]: Barrier@" + System.identityHashCode(barrier);
}
public static void printReverse(AsyncBarrierImpl barrier, int indent) {
return;
for (int i = 0; i < indent; i++)
System.err.print(" ");
- System.err.println("[" + barrier.get() + " requests]: " + report(barrier));
+ System.err.println(report(barrier));
Collection<AsyncBarrierImpl> children = BarrierTracing.reverseLookup.get(barrier);
if (children != null) {
LOGGER.warn("AsyncBarrierImpl.waitBarrier("
+ request
+ ") is taking long to execute, so far "
- + (waitCount / 1000) + " s.");
+ + (waitCount / 1000) + " s. this.get() = " + get());
if (BarrierTracing.BOOKKEEPING) {
synchronized (BarrierTracing.reverseLookup) {