Groovy-如何延迟Groovlet修改重新编译检查 [英] Groovy - how to delay Groovlet modification recompile check

查看:280
本文介绍了Groovy-如何延迟Groovlet修改重新编译检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Groovy的新手,我正在考虑使用Groovlets(而不是GRAILS)来替换某些Servlet.如果更改了Groovlet的脚本文件,则Groovlet会重新编译并自动获取更改,包括从Groovlet引用的脚本.

I am new to Groovy, and I am thinking about using Groovlets (not GRAILS) to replace some Servlets. If I change a Groovlet's script file, the Groovlet re-compiles and automatically picks up the changes, including scripts referenced from the Groovlet.

这对开发非常有用,但是我认为groovy必须执行大量文件检查,以查看是否已修改了所有脚本,不仅是在主Groovlet上,而且还在所有引用的子脚本上.在生产环境中,我想每个请求可能会有很多IO.

This is great for development, but I imagine that groovy must perform lots of file checks to see if any of the scripts have been modified, not just on the main Groovlet, but on all referenced sub-scripts. In a production environment, I imagine this could be lots of IO on every request.

我想有一种方法可以禁用Groovlet检查以查看脚本是否已被修改,或者有一种像FreeMarker的setTemplateUpdateDelay()这样的更新延迟",它仅在经过N秒后检查修改/自上次检查以来的毫秒数.

I suppose there is a way to either disable having a Groovlet check to see if scripts have been modified, or perhaps there is a type of "update delay" like FreeMarker's setTemplateUpdateDelay() which only checks for modifications after N elapsed seconds/milliseconds since the last check.

推荐答案

这是在

This is done in GroovyScriptEngine. It checkes for the last modification date of the source file, and if it's newer than the compiled version, it will recompile.

您可以在minimumRecompilationInterval rel ="nofollow">编译器配置.如果将其设置为很高的值,则

You can set the minimumRecompilationInterval in CompilerConfiguration. If you set that to a very high value, the checking of the source file won't be done that often.

这篇关于Groovy-如何延迟Groovlet修改重新编译检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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