alias melix
@CedricChampeau
cedric.champeau@gmail.com
https://github.com/melix
http://www.gopivotal.com
alias Porthos
@fabricematrat
fabricematrat@gmail.com
https://github.com/fabricematrat
@ThreadInterrupt
import groovy.transform.ThreadInterrupt
while (true) {
// eat cpu
}
@TimedInterrupt(10)
import groovy.transform.TimedInterrupt
while (true) {
// eat cpu
}
@ConditionalInterrupt({counter++>1})
import groovy.transform.ConditionalInterrupt
counter=0
def scriptMethod() {
4.times {
println 'executing script method...'
}
}
scriptMethod()
System.exit(-1)
def configuration = new CompilerConfiguration()
def customizer = new SecureASTCustomizer()
customizer.with {
receiversBlackList = ["java.lang.System"]
}
configuration.addCompilationCustomizers(customizer)
new GroovyShell(configuration).evaluate("System.exit(-1)")
def configuration = new CompilerConfiguration()
def customizer = new SecureRuntimeASTCustomizer()
customizer.with {
receiversBlackList = ["java.lang.System"]
}
configuration.addCompilationCustomizers(customizer)
new GroovyShell(configuration).evaluate("((Object)System).exit(-1)")
((Object)System).exit(-1)
groovyAccessControl.checkCall(((Object)System),
"exit",
[-1],
{ receiver, methodName, args -> ... something doing the call... })
public Object checkCall(Object receiver,
String methodName,
Object[] args,
Closure closure) {
checkCallOnReceiver(receiver, methodName, args,
methodsOnReceiverBlacklist,
methodsOnReceiverWhitelist);
return closure.call(receiver, methodName, args);
}