From 007955b2ba8933acdf9bb768707c52f2e50991e3 Mon Sep 17 00:00:00 2001 From: Konloch Date: Thu, 1 Jul 2021 02:48:10 -0700 Subject: [PATCH] Added Thread Titles --- .../club/bytecodeviewer/BytecodeViewer.java | 33 ++++++++++--------- .../bytecodeviewer/SettingsSerializer.java | 2 +- .../compilers/JavaCompiler.java | 2 +- .../bytecodeviewer/gui/MainViewerGUI.java | 2 +- .../gui/components/ExportJar.java | 2 +- .../resourceviewer/WorkPaneMainComponent.java | 2 +- .../resourceviewer/viewer/ClassViewer.java | 2 +- .../gui/util/PaneUpdaterThread.java | 2 +- .../resources/ResourceDecompiling.java | 4 +-- .../resources/exporting/impl/APKExport.java | 6 ++-- .../resources/exporting/impl/DexExport.java | 6 ++-- .../exporting/impl/RunnableJarExporter.java | 2 +- .../resources/exporting/impl/ZipExport.java | 4 +-- .../bytecodeviewer/util/VersionChecker.java | 2 +- 14 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index b965760e..c13c3c71 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -121,7 +121,7 @@ public class BytecodeViewer /** * The version checker thread */ - private static final Thread versionChecker = new Thread(new VersionChecker()); + private static final Thread versionChecker = new Thread(new VersionChecker(), "Version Checker"); /** * Pings back to bytecodeviewer.com to be added into the total running statistics @@ -132,7 +132,7 @@ public class BytecodeViewer } catch (Exception e) { Configuration.pingback = false; } - }); + }, "Pingback"); /** * Downloads & installs the krakatau & enjarify zips @@ -152,12 +152,12 @@ public class BytecodeViewer } catch (Exception e) { e.printStackTrace(); } - }); + }, "Install Fat-Jar"); /** * Used to check incase booting failed for some reason, this kicks in as a fail safe */ - private static final Thread bootCheck = new Thread(new BootCheck()); + private static final Thread bootCheck = new Thread(new BootCheck(), "Boot Check"); /** * Main startup @@ -221,7 +221,7 @@ public class BytecodeViewer proc.destroy(); SettingsSerializer.saveSettings(); cleanup(); - })); + }, "Shutdown Hook")); viewer.calledAfterLoad(); Settings.resetRecentFilesMenu(); @@ -533,7 +533,7 @@ public class BytecodeViewer BytecodeViewer.viewer.updateBusyStatus(true); Configuration.needsReDump = true; - Thread t = new Thread(new ImportResource(files)); + Thread t = new Thread(new ImportResource(files), "Import Resource"); t.start(); } @@ -594,7 +594,7 @@ public class BytecodeViewer */ public static void cleanupAsync() { - Thread cleanupThread = new Thread(BytecodeViewer::cleanup); + Thread cleanupThread = new Thread(BytecodeViewer::cleanup, "Cleanup"); cleanupThread.start(); } @@ -656,7 +656,7 @@ public class BytecodeViewer BytecodeViewer.resetWorkSpace(true); } else if ((e.getKeyCode() == KeyEvent.VK_T) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { Configuration.lastHotKeyExecuted = System.currentTimeMillis(); - Thread t = new Thread(() -> BytecodeViewer.compile(true)); + Thread t = new Thread(() -> BytecodeViewer.compile(true), "Compile"); t.start(); } else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { Configuration.lastHotKeyExecuted = System.currentTimeMillis(); @@ -673,7 +673,8 @@ public class BytecodeViewer return; } - Thread t = new Thread(() -> { + Thread resourceExport = new Thread(() -> + { if (viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false)) return; @@ -705,16 +706,18 @@ public class BytecodeViewer final File file2 = file; BytecodeViewer.viewer.updateBusyStatus(true); - Thread t1 = new Thread(() -> { + Thread jarExport = new Thread(() -> { JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), file2.getAbsolutePath()); BytecodeViewer.viewer.updateBusyStatus(false); - }); - t1.start(); + }, "Jar Export"); + jarExport.start(); } - }); - t.start(); - } else if ((e.getKeyCode() == KeyEvent.VK_W) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + }, "Resource Export"); + resourceExport.start(); + } + else if ((e.getKeyCode() == KeyEvent.VK_W) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) + { Configuration.lastHotKeyExecuted = System.currentTimeMillis(); if (viewer.workPane.getCurrentViewer() != null) viewer.workPane.tabs.remove(viewer.workPane.getCurrentViewer()); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/SettingsSerializer.java b/src/main/java/the/bytecode/club/bytecodeviewer/SettingsSerializer.java index a618a9b9..7ac9557e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/SettingsSerializer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/SettingsSerializer.java @@ -42,7 +42,7 @@ public class SettingsSerializer public static void saveSettingsAsync() { - Thread saveThread = new Thread(()-> saveSettings()); + Thread saveThread = new Thread(SettingsSerializer::saveSettings, "Save Settings"); saveThread.start(); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java index fed9cd80..4d124ad1 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java @@ -106,7 +106,7 @@ public class JavaCompiler extends InternalCompiler System.out.println("Force killing javac process, assuming it's gotten stuck"); process.destroyForcibly().destroy(); } - }); + }, "Javac Fail-Safe"); failSafe.start(); int exitValue = process.waitFor(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 64a5be15..ca711c8c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -791,7 +791,7 @@ public class MainViewerGUI extends JFrame public void compileOnNewThread() { - Thread t = new Thread(() -> BytecodeViewer.compile(true)); + Thread t = new Thread(() -> BytecodeViewer.compile(true), "Compile"); t.start(); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java index fd715118..f1c93255 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java @@ -65,7 +65,7 @@ public class ExportJar extends JFrame { JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), jarPath, manifest.getText()); BytecodeViewer.viewer.updateBusyStatus(false); - }); + }, "Jar Export"); t.start(); dispose(); }); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java index 04ec9e05..6fa80569 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java @@ -140,7 +140,7 @@ public class WorkPaneMainComponent extends VisibleComponent refreshClass = new JButton("Refresh"); refreshClass.addActionListener((event)->{ - Thread t = new Thread(() -> new WorkPaneRefresh(event).run()); + Thread t = new Thread(() -> new WorkPaneRefresh(event).run(), "Refresh"); t.start(); }); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java index fdc2a010..f41d6a93 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java @@ -181,7 +181,7 @@ public class ClassViewer extends ResourceViewer resourceViewPanel2.updateThread.startNewThread(); if (resourceViewPanel3.decompilerViewIndex > 0) resourceViewPanel3.updateThread.startNewThread(); - }); + }, "ClassViewer Temp Dump"); t.start(); if (isPanel1Editable() || isPanel2Editable() || isPanel3Editable()) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java index bbdc9d2f..b55a7d9a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java @@ -64,7 +64,7 @@ public abstract class PaneUpdaterThread implements Runnable public void startNewThread() { - thread = new Thread(this); + thread = new Thread(this, "Pane Update"); thread.start(); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceDecompiling.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceDecompiling.java index 371a9039..b04f46f4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceDecompiling.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceDecompiling.java @@ -186,7 +186,7 @@ public class ResourceDecompiling BytecodeViewer.viewer.updateBusyStatus(false); } } - }); + }, "Decompile Thread"); decompileThread.start(); } @@ -412,7 +412,7 @@ public class ResourceDecompiling BytecodeViewer.viewer.updateBusyStatus(false); } } - }); + }, "Decompile Thread"); decompileThread.start(); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/APKExport.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/APKExport.java index 245cee31..07db947a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/APKExport.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/APKExport.java @@ -113,12 +113,12 @@ public class APKExport implements Exporter { APKTool.buildAPK(new File(input), file2, finalContainer); BytecodeViewer.viewer.updateBusyStatus(false); - }); + }, "Process APK"); buildAPKThread.start(); - }); + }, "Jar Export"); saveThread.start(); } - }); + }, "Resource Export"); exportThread.start(); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/DexExport.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/DexExport.java index 9cc6fb66..042c2799 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/DexExport.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/DexExport.java @@ -77,12 +77,12 @@ public class DexExport implements Exporter Dex2Jar.saveAsDex(new File(input), outputPath); BytecodeViewer.viewer.updateBusyStatus(false); - }); + }, "Process DEX"); saveAsDex.start(); - }); + }, "Jar Export"); saveAsJar.start(); } - }); + }, "Resource Export"); exportThread.start(); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/RunnableJarExporter.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/RunnableJarExporter.java index 2adeabef..4afcc6b5 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/RunnableJarExporter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/RunnableJarExporter.java @@ -61,7 +61,7 @@ public class RunnableJarExporter implements Exporter new ExportJar(path).setVisible(true); } - }); + }, "Runnable Jar Export"); exportThread.start(); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/ZipExport.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/ZipExport.java index 21e7f486..fac3184e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/ZipExport.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/impl/ZipExport.java @@ -65,10 +65,10 @@ public class ZipExport implements Exporter { JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), file2.getAbsolutePath()); BytecodeViewer.viewer.updateBusyStatus(false); - }); + }, "Jar Export"); saveThread.start(); } - }); + }, "Resource Export"); exportThread.start(); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java index 620cee88..4cef8d40 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java @@ -197,7 +197,7 @@ public class VersionChecker implements Runnable new ExceptionUI(e); } - }); + }, "Downloader"); downloadThread.start(); } }