Hi all,

finally I managed to have timed interrupted execution of scripts in GroovyLab, by adapting code from a Google search.


The following piece of code seems to make good work:


 if (GlobalValues.timedInterruptScriptingOn==true) {
final Map<String, Object> timedInterruptAnnotationParams = new HashMap<>(); timedInterruptAnnotationParams.put("value", GlobalValues.timedInterruptValue); timedInterruptAnnotationParams.put("unit", GeneralUtils.propX(GeneralUtils.classX(TimeUnit.class), TimeUnit.MILLISECONDS.toString()));


ASTTransformationCustomizer timedInterruptCustomizer = new ASTTransformationCustomizer(timedInterruptAnnotationParams, TimedInterrupt.class);

             cf.addCompilationCustomizers(timedInterruptCustomizer);
                 }




Thanks!


Best Regards

Stergios

Reply via email to