MCPcopy Create free account
hub / github.com/BruceEckel/OnJava8-Examples / CountingTask

Class CountingTask

concurrent/CountingTask.java:7–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import java.util.concurrent.*;
6
7public class CountingTask implements Callable<Integer> {
8 final int id;
9 public CountingTask(int id) { this.id = id; }
10 @Override public Integer call() {
11 Integer val = 0;
12 for(int i = 0; i < 100; i++)
13 val++;
14 System.out.println(id + " " +
15 Thread.currentThread().getName() + " " + val);
16 return val;
17 }
18}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected