mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-11 22:13:34 +00:00
Reformat rest of the design patterns - Issue #224
This commit is contained in:
1 parent
449340bd2b
commit
306b1f3d31
337 files changed
+6740
-6847
No files matched your search
@@ -6,20 +6,21 @@ package com.iluwatar.threadpool;
|
||||
*
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
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