Java - 我如何重新启动 ServiceLoader
Java - How i can restart ServiceLoader
如何停止 ServiceLoader 以便重新加载 jar?
我试图再次调用 load 方法。不幸的是,这没有帮助。
关于 javadoc 文档,您可以使用 reload
方法:
Clear this loader's provider cache so that all providers will be reloaded.
After invoking this method, subsequent invocations of the iterator method will lazily look up and instantiate providers from scratch, just as is done by a newly-created loader.
This method is intended for use in situations in which new providers can be installed into a running Java virtual machine.
如何停止 ServiceLoader 以便重新加载 jar? 我试图再次调用 load 方法。不幸的是,这没有帮助。
关于 javadoc 文档,您可以使用 reload
方法:
Clear this loader's provider cache so that all providers will be reloaded.
After invoking this method, subsequent invocations of the iterator method will lazily look up and instantiate providers from scratch, just as is done by a newly-created loader.
This method is intended for use in situations in which new providers can be installed into a running Java virtual machine.