mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-12 02:14:07 +00:00
Changed package naming across all examples.
This commit is contained in:
1 parent
703ebd3e20
commit
8524c75ba6
437 files changed
+1095
-1402
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package com.iluwatar.threadpool;
|
||||
|
||||
/**
|
||||
*
|
||||
* Worker implements Runnable and thus can be executed by ExecutorService
|
||||
*
|
||||
*/
|
||||
public class Worker implements Runnable {
|
||||
|
||||
private final Task task;
|
||||
|
||||
public Worker(final 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user