Quantcast

timed interrupts for scripts in GroovyLab

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

timed interrupts for scripts in GroovyLab

sterg
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

Loading...