Change how jvm works

This commit is contained in:
Bjorn Beishline 2026-01-28 01:53:29 -07:00
parent 67b9f06381
commit dbe8321db8

View File

@ -90,35 +90,28 @@ impl JvmWorker {
}; };
} }
JvmCommand::InstantiateAllPlugins { respond_to } => { JvmCommand::InstantiateAllPlugins { respond_to } => {
match self.jvm { let jvm = match self.jvm {
Some(ref jvm) => { Some(ref jvm) => jvm,
let _ = None => &Jvm::attach_thread().unwrap(),
respond_to.send(self.plugin_manager.instantiate_all_plugins(jvm));
}
None => {
unreachable!("Shouldn't be able to instantiate plugins without a JVM")
}
}; };
let _ = respond_to.send(self.plugin_manager.instantiate_all_plugins(jvm));
} }
JvmCommand::EnableAllPlugins { respond_to } => { JvmCommand::EnableAllPlugins { respond_to } => {
match self.jvm { let jvm = match self.jvm {
Some(ref jvm) => { Some(ref jvm) => jvm,
None => &Jvm::attach_thread().unwrap(),
};
let _ = respond_to.send(self.plugin_manager.enable_all_plugins(jvm)); let _ = respond_to.send(self.plugin_manager.enable_all_plugins(jvm));
} }
None => {
unreachable!("Shouldn't be able to enable plugins without a JVM")
}
};
}
JvmCommand::DisableAllPlugins { respond_to } => { JvmCommand::DisableAllPlugins { respond_to } => {
match self.jvm { let jvm = match self.jvm {
Some(ref jvm) => { Some(ref jvm) => jvm,
let _ = respond_to.send(self.plugin_manager.disable_all_plugins(jvm)); None => &Jvm::attach_thread().unwrap(),
}
None => {
unreachable!("Shouldn't be able to disable plugins without a JVM")
}
}; };
let _ = respond_to.send(self.plugin_manager.disable_all_plugins(jvm));
} }
JvmCommand::Shutdown { respond_to } => { JvmCommand::Shutdown { respond_to } => {
let _ = respond_to.send(self.plugin_manager.unload_all_plugins()); let _ = respond_to.send(self.plugin_manager.unload_all_plugins());