Biblioteca Java - Blame information for rev 28
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
28 | mihai | 1 | /* |
2 | * Worker.java | ||
3 | */ | ||
4 | package exemple.fire.tpool; | ||
5 | |||
6 | /** | ||
7 | * Class created by @author Mihai HULEA at Feb 22, 2005. | ||
8 | * | ||
9 | * This class is part of the labs project. | ||
10 | * | ||
11 | */ | ||
12 | public class Worker implements Runnable { | ||
13 | private int workerNumber; | ||
14 | |||
15 | Worker(int number) { | ||
16 | workerNumber = number; | ||
17 | } | ||
18 | |||
19 | public void run() { | ||
20 | for (int i=0;i<=100;i+=20) { | ||
21 | // Perform some work ... | ||
22 | System.out.println("Worker number: " + workerNumber | ||
23 | + ", percent complete: " + i ); | ||
24 | try { | ||
25 | Thread.sleep((int)(Math.random() * 1000)); | ||
26 | } catch (InterruptedException e) { | ||
27 | } | ||
28 | } | ||
29 | } | ||
30 | } |