21 lines
394 B
Java
Raw Normal View History

2015-05-17 18:08:50 +03:00
package com.iluwatar;
public class Worker implements Runnable {
private Task task;
public Worker(Task task) {
this.task = task;
}
@Override
public void run() {
System.out.println(String.format("%s processing %s", Thread.currentThread().getName(), task.toString()));
try {
Thread.sleep(task.getTimeMs());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}