-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes exhaustion when loading large profiles (#4127)
- Loading branch information
Showing
2 changed files
with
68 additions
and
6 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/main/java/io/github/thebusybiscuit/slimefun4/Threads.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,23 @@ | ||
package io.github.thebusybiscuit.slimefun4; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public class Threads { | ||
|
||
@ParametersAreNonnullByDefault | ||
public static void newThread(JavaPlugin plugin, String name, Runnable runnable) { | ||
// TODO: Change to thread pool | ||
new Thread(runnable, plugin.getName() + " - " + name).start(); | ||
} | ||
|
||
public static String getCaller() { | ||
// First item will be getting the call stack | ||
// Second item will be this call | ||
// Third item will be the func we care about being called | ||
// And finally will be the caller | ||
StackTraceElement element = Thread.currentThread().getStackTrace()[3]; | ||
return element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber(); | ||
} | ||
} |
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