Apache Commons JCI 重新加载类加载器
有人有使用 Apache Commons JCI API 的 ReloadingClassLoader 的经验吗?
唯一的用法示例可以在以下页面中找到: http://commons.apache.org/jci /usage.html
我假设每当目录或 jar 更改时,它都会自动重新加载类加载器中的类?
如果是这样,您是否必须再次加载/实例化先前加载/实例化的类(通过调用 loadClass())才能使用新修改的类?这是正确的吗?
希望这一点是清楚的。
Does anyone have any experience in using the ReloadingClassLoader of the Apache Commons JCI API?
The only usage example can found in the following page: http://commons.apache.org/jci/usage.html
I am assuming that whenever the directory or jar changes, it will automatically reload the classes within the classloader?
If so, you would have to load/instantiate a previously loaded/instantiated class (by calling loadClass()) again to use the newly modified class? Is that correct?
Hope this is clear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://commons.apache.org/jci/apidocs /org/apache/commons/jci/ReloadingClassLoader.html - 根据此处的最小文档,您需要显式调用 loadClass,如果底层资源已更改,那么它将为您提供类的新图像旧的。
检查代码会很有用,因为文档对此的介绍不是很广泛。
http://commons.apache.org/jci/apidocs/org/apache/commons/jci/ReloadingClassLoader.html - According to the minimal documentation here, you need to call loadClass explicitly and if the underlying Resource has changed, then it will give you the new image of the Class instead of the old one.
It will be useful to checkout the code since the documentation is not very extensive on this.