use of net.openhft.chronicle.bytes.MethodReader in project Chronicle-Queue by OpenHFT.
the class ResultGenerator method main.
public static void main(String[] args) throws IOException {
if (args.length != 1) {
throw new IllegalArgumentException("Usage: <program> [resource-name]");
}
final ConfigParser configParser = new ConfigParser(args[0]);
final List<StageConfig> allStageConfigs = configParser.getAllStageConfigs();
final StageConfig lastStageConfig = allStageConfigs.get(allStageConfigs.size() - 1);
Jvm.setExceptionHandlers((c, m, t) -> {
System.out.println(m);
}, (c, m, t) -> {
System.out.println(m);
if (t != null) {
t.printStackTrace();
}
}, (c, m, t) -> System.out.println(m));
try (final SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(lastStageConfig.getOutputPath()).build();
final Writer resultsWriter = new FileWriter("results.txt", false)) {
final MethodReader methodReader = queue.createTailer().methodReader(new CapturingReceiver(resultsWriter));
while (methodReader.readOne()) {
// report
}
}
}
use of net.openhft.chronicle.bytes.MethodReader in project Chronicle-Queue by OpenHFT.
the class JDBCService method runLoop.
void runLoop() {
try {
JDBCResult result = out.acquireAppender().methodWriterBuilder(JDBCResult.class).recordHistory(true).get();
JDBCComponent js = new JDBCComponent(connectionSupplier, result);
MethodReader reader = in.createTailer().afterLastWritten(out).methodReader(js);
Pauser pauser = Pauser.millis(1, 10);
while (!closed) {
if (reader.readOne())
pauser.reset();
else
pauser.pause();
}
} catch (Throwable t) {
LOGGER.warn("Run loop exited", t);
}
}
Aggregations