groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterg <st...@teiemt.gr>
Subject timed interrupts for scripts in GroovyLab
Date Tue, 24 Jan 2017 15:22:46 GMT
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


Mime
View raw message