org.springframework.block.LoadBlock Maven / Gradle / Ivy
package org.springframework.block;
public class LoadBlock extends AbstractBlock {
public LoadBlock() {
this(0);
}
public LoadBlock(long timeout) {
super(timeout);
}
@Override
public void eval() {
String msg = timeout == 0 ? "NEVER" : "" + (timeout / 60000) + " minute(s)";
logger.info("TroubleMaker client: Load requested.");
logger.info("STARTING TroubleMaker Load thread, will timeout in " + msg);
long start = System.currentTimeMillis();
// block for specified period of time (milliseconds)
while (true) {
// log.info("Thread "+t+" executing...");
if (System.currentTimeMillis() - start >= timeout && timeout > 0) {
break;
}
}
logger.info("DONE TroubleMaker Load thread");
}
}