From 041be2b78172aad66b400e394adc8133763e98e7 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sun, 11 Apr 2010 17:51:03 +0300 Subject: [PATCH] Support unregistering plugins This will be needed to shut down dumping without shutting down the whole emulator. --- org/jpc/pluginsbase/Plugins.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/org/jpc/pluginsbase/Plugins.java b/org/jpc/pluginsbase/Plugins.java index d30cf95..6bede8e 100644 --- a/org/jpc/pluginsbase/Plugins.java +++ b/org/jpc/pluginsbase/Plugins.java @@ -375,6 +375,27 @@ public class Plugins } } + public synchronized boolean unregisterPlugin(Plugin plugin) + { + if(nonRegisteredPlugins.contains(plugin)) { + nonRegisteredPlugins.remove(plugin); + System.err.println("Informational: Shutting down " + plugin.getClass().getName() + "..."); + plugin.systemShutdown(); + System.err.println("Informational: Shut down " + plugin.getClass().getName() + "."); + return true; + } else { + System.err.println("Informational: Shutting down " + plugin.getClass().getName() + "..."); + if(plugin.systemShutdown()) { + System.err.println("Informational: Shut down " + plugin.getClass().getName() + "."); + plugins.remove(plugin); + return true; + } else { + System.err.println("Error: " + plugin.getClass().getName() + " does not want to shut down."); + return false; + } + } + } + private class ShutdownHook extends Thread { public void run() -- 2.11.4.GIT