Skip to content

Commit

Permalink
Shutdown class loader on plugin unload/server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmq committed Jul 5, 2023
1 parent 447362e commit 1d5cfac
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import me.lucko.jarrelocator.JarRelocator;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
Expand Down Expand Up @@ -56,6 +57,14 @@ private LibraryManager() {
initLibraries();
}

public void shutdown() {
try {
classLoader.close();
} catch (IOException e) {
PySpigot.get().getLogger().log(Level.SEVERE, "Exception when closing JarClassLoader", e);
}
}

/**
* Load a library into the classpath.
* @param fileName The name of the Jar file to load into the classpath
Expand Down

0 comments on commit 1d5cfac

Please sign in to comment.