Biblioteca Java - Rev 28

Subversion Repositories:
Rev:
/*
 * Worker.java
 */

package exemple.fire.tpool;

/**
 * Class created by @author Mihai HULEA at Feb 22, 2005.
 *
 * This class is part of the labs project.
 *
 */

public class Worker implements Runnable {
    private int workerNumber;

    Worker(int number) {
        workerNumber = number;
    }

    public void run() {
        for (int i=0;i<=100;i+=20) {
        // Perform some work ...
            System.out.println("Worker number: " + workerNumber
                + ", percent complete: " + i );
            try {
                Thread.sleep((int)(Math.random() * 1000));
            } catch (InterruptedException e) {
            }
        }
    }
}