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

Class Caller

lowlevel/SynchronizedComparison.java:38–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38class Caller implements Runnable {
39 private Guarded g;
40 Caller(Guarded g) { this.g = g; }
41 private AtomicLong successfulCalls =
42 new AtomicLong();
43 private AtomicBoolean stop =
44 new AtomicBoolean(false);
45 @Override public void run() {
46 new Timer().schedule(new TimerTask() {
47 public void run() { stop.set(true); }
48 }, 2500);
49 while(!stop.get()) {
50 g.method();
51 successfulCalls.getAndIncrement();
52 }
53 System.out.println(
54 "-> " + successfulCalls.get());
55 }
56}
57
58public class SynchronizedComparison {
59 static void test(Guarded g) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected