MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / f

Method f

lowlevel/SyncOnObject.java:14–19  ·  view source on GitHub ↗
(boolean nap)

Source from the content-addressed store, hash-verified

12 ConcurrentLinkedQueue<String> trace =
13 new ConcurrentLinkedQueue<>();
14 public synchronized void f(boolean nap) {
15 for(int i = 0; i < 5; i++) {
16 trace.add(String.format("f() " + i));
17 if(nap) new Nap(0.01);
18 }
19 }
20 private Object syncObject = new Object();
21 public void g(boolean nap) {
22 synchronized(syncObject) {

Callers 1

testMethod · 0.95

Calls 2

addMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected