forked from Viscent/javamtp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...PatternInAction/src/io/github/viscent/mtpattern/ch5/tpt/DelegatingTerminatableThread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.github.viscent.mtpattern.ch5.tpt; | ||
|
||
public class DelegatingTerminatableThread extends AbstractTerminatableThread { | ||
private final Runnable task; | ||
|
||
public DelegatingTerminatableThread(Runnable task) { | ||
this.task = task; | ||
} | ||
|
||
@Override | ||
protected void doRun() throws Exception { | ||
this.task.run(); | ||
} | ||
|
||
public static AbstractTerminatableThread of(Runnable task) { | ||
DelegatingTerminatableThread ret = new DelegatingTerminatableThread( | ||
task); | ||
return ret; | ||
} | ||
} |