org.springframework.block.KillBlock Maven / Gradle / Ivy
package org.springframework.block;
public class KillBlock extends AbstractBlock {
enum ExitCode {
NORMAL_SHUTDOWN(0), EMERGENCY_SHUTDOWN(10), OUT_OF_MEMORY(20), WHATEVER(30);
private int value;
ExitCode(int value) {
this.value = value;
}
public void exit() {
System.exit(value);
}
}
public KillBlock() {
this(0);
}
public KillBlock(long timeout) {
super(timeout);
}
@Override
public void eval() {
logger.info("TroubleMaker client: Kill requested.");
System.exit(-1);
}
}