加载资源一次Java [英] Loading Resources Once in Java

查看:180
本文介绍了加载资源一次Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java项目,需要为每个执行加载大文件(语料库为NLP)。让我们称之为方法load(),并且这只被调用一次,方法进程(String text)可以被多次调用,这些属于类Tagger。

I have a project in Java requiring to load large files (corpus for NLP) for every execution. Let's call it method load(), and this is only called once, and the method process(String text) can be called multiple times where these belong to the class Tagger.

我的问题是,每当我需要调整一些代码,除了类Tagger和重新编译/运行项目,项目调用方法process()等待大约10秒或更长时间才能加载这些资源。我可以维护这些资源或Tagger类本身,以便我可以编辑任何代码并重新编译它们,而不卸载Tagger类或卸载资源?

My problem is that whenever I need to tweak some code except for class Tagger and recompile/run the project, where the project calls the method process(), I have to wait for some 10 or more seconds just to have these resources loaded. Can I maintain these resources or the Tagger class itself, such that I can edit any code and recompile them, without unloading the Tagger class or unloading the resources?

我的选项是使用Web服务或一些servlet,但是有更多的替代解决方案吗?还是图书馆更容易创建这些服务?由于解决方案仅在开发阶段需要,但在部署后不需要,当用户在程序执行期间真正加载资源一次,并在关闭时终止。

My option is to use web services or some servlets, but are there more alternative solutions? Or libraries to create these services easier? Since the solution is only required during development stage, but not required after deployed, when users really load the resources once during the program execution and terminates when closed.

谢谢, / p>

Thanks,

推荐答案

我认为JRebel可以轻松地为我做这些工作。但是上述方法可以替代这种商业工具。谢谢。

I think JRebel can do the work for me easily. But the approaches above can be a substitute for this commercial tool. Thanks.

这篇关于加载资源一次Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆