mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 02:55:04 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
f1dea5460a
commit
f106b5e766
172 files changed
+2552
-2088
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei;
|
||||
|
||||
public abstract class RestartableTask {
|
||||
|
||||
public final String name;
|
||||
private Thread thread;
|
||||
private volatile boolean restart;
|
||||
@@ -14,14 +15,13 @@ public abstract class RestartableTask {
|
||||
|
||||
private void start() {
|
||||
thread = new Thread(name) {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
do {
|
||||
while (stopped)
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
while (stopped) try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException ignored) {}
|
||||
if (!restart) execute();
|
||||
} while (!finish());
|
||||
}
|
||||
@@ -52,7 +52,8 @@ public abstract class RestartableTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops execution until restart is called. If a thread is running, the restart flag will be set, and the thread will be paused once the execute method exits.
|
||||
* Stops execution until restart is called. If a thread is running, the restart flag will be set, and the thread
|
||||
* will be paused once the execute method exits.
|
||||
*/
|
||||
public synchronized void stop() {
|
||||
if (thread != null) {
|
||||
|
||||
Reference in new issue
Block a user