com.tw.go.plugin.cmd.InMemoryConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of git-cmd Show documentation
Show all versions of git-cmd Show documentation
Common module that all Go CD plugins can use to poll Git repository.
package com.tw.go.plugin.cmd;
import com.tw.go.plugin.util.ListUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class InMemoryConsumer implements StreamConsumer {
private Queue lines = new ConcurrentLinkedQueue();
public void consumeLine(String line) {
try {
lines.add(line);
} catch (RuntimeException e) {
// LOG.error("Problem consuming line [" + line + "]", e);
}
}
public List asList() {
return new ArrayList(lines);
}
public String toString() {
return ListUtil.join(asList(), "\n");
}
}