Loading Resources Once Upon a Time in Java

I have a Java project that requires downloading large files (corpus for NLP) for each execution. Let us call it the load () method, and this is called only once, and the method process (line text) can be called several times when they belong to the Tagger class.

My problem is that whenever I need to configure some code other than the Tagger class and recompile / run the project where the project calls the method () method, I need to wait about 10 seconds or more to have these resources loaded . Can I support these resources or the Tagger class itself so that I can edit any code and recompile them without unloading the Tagger class or unloading resources?

My option is to use web services or some servlets, but are there any alternative solutions? Or are libraries for creating these services easier? Since the solution is required only at the development stage, but is not required after deployment, when users actually load resources once during program execution and exit when they close.

Thanks,

+2
source share
5 answers

I think JRebel can easily work for me. But the above approaches can replace this commercial tool. Thanks.

0
source

You can consider the possibility of hot swapping, which allows you to recompile one or more classes and combine them into an already running application.

http://java.sun.com/j2se/1.4.2/docs/guide/jpda/enhancements.html#hotswap

+2
source

Here's a guide to reloading classes using a dynamic classloader, which is probably best: http://www.zeroturnaround.com/blog/reloading-objects-classes-classloaders/

+1
source

If the slowdown is for data processing, try serializing the tagger class and save it to disk. Class loading at program start.

0
source

Well, if you use a dynamic language such as Groovy , you can issue statements that must be compiled at run time, while these resources are already loaded.

Also, if you are editing JSP, I know that the servlet container usually listens for changes in the file and will recompile the page if it finds any file.

0
source

All Articles