use of com.google.common.util.concurrent.AbstractExecutionThreadService in project graylog2-server by Graylog2.
the class GeneratorTransport method doLaunch.
@Override
public void doLaunch(final MessageInput input) throws MisfireException {
generatorService = new AbstractExecutionThreadService() {
Thread runThread;
@Override
protected void run() throws Exception {
while (isRunning()) {
if (isThrottled()) {
blockUntilUnthrottled();
}
final RawMessage rawMessage = GeneratorTransport.this.produceRawMessage(input);
if (rawMessage != null) {
input.processRawMessage(rawMessage);
}
}
}
@Override
protected void startUp() throws Exception {
runThread = Thread.currentThread();
}
@Override
protected void triggerShutdown() {
runThread.interrupt();
}
};
generatorService.startAsync();
}
Aggregations