Skip to content

Commit d343bce

Browse files
committed
Implemented Task Manager API
1 parent a0adb9b commit d343bce

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.google.gson.Gson;
2222
import com.google.gson.GsonBuilder;
23+
import com.konloch.taskmanager.TaskManager;
2324
import me.konloch.kontainer.io.DiskReader;
2425
import org.apache.commons.io.FileUtils;
2526
import org.objectweb.asm.tree.ClassNode;
@@ -150,6 +151,7 @@ public class BytecodeViewer
150151
private static final Thread PING_BACK = new Thread(new PingBack(), "Pingback");
151152
private static final Thread INSTALL_FAT_JAR = new Thread(new InstallFatJar(), "Install Fat-Jar");
152153
private static final Thread BOOT_CHECK = new Thread(new BootCheck(), "Boot Check");
154+
private static final TaskManager TASK_MANAGER = new TaskManager();
153155

154156
/**
155157
* Main startup
@@ -257,6 +259,9 @@ public static void boot(boolean cli)
257259
cleanup();
258260
}, "Shutdown Hook"));
259261

262+
//start the background task manager
263+
TASK_MANAGER.start();
264+
260265
//setup the viewer
261266
viewer.calledAfterLoad();
262267

@@ -580,6 +585,16 @@ public static void startPlugin(File file)
580585
Settings.addRecentPlugin(file);
581586
}
582587

588+
/**
589+
* Returns the Task Manager
590+
*
591+
* @return the global task manager object
592+
*/
593+
public static TaskManager getTaskManager()
594+
{
595+
return TASK_MANAGER;
596+
}
597+
583598
/**
584599
* Send a message to alert the user
585600
*

src/main/java/the/bytecode/club/bytecodeviewer/api/BCV.java

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
package the.bytecode.club.bytecodeviewer.api;
2020

21+
import com.konloch.taskmanager.TaskManager;
2122
import org.objectweb.asm.ClassWriter;
2223
import org.objectweb.asm.tree.ClassNode;
2324
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
@@ -164,6 +165,16 @@ public static void createNewClassNodeLoaderInstance()
164165
loader = new ClassNodeLoader();
165166
}
166167

168+
/**
169+
* Returns the background Task Manager
170+
*
171+
* @return the global BCV background task manager
172+
*/
173+
public static TaskManager getTaskManager()
174+
{
175+
return BytecodeViewer.getTaskManager();
176+
}
177+
167178
/**
168179
* Used to start a plugin from file.
169180
*

0 commit comments

Comments
 (0)