Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Замыкания #28

Open
aarexer opened this issue Oct 30, 2018 · 0 comments
Open

Замыкания #28

aarexer opened this issue Oct 30, 2018 · 0 comments
Labels
other Other section

Comments

@aarexer
Copy link
Collaborator

aarexer commented Oct 30, 2018

в тредах и лямбдах можно использовать только final, замыкания

final int[] i = {0};
csvParser.iterator().forEachRemaining(record -> {
final int numOfRecord = i[0]++;
Optional<ProducerRecord<K, SpecificRecord>> prec = createProducerRecord(record, numOfRecord);
if (prec.isPresent()) {
logger.trace("Sending record: {}", prec.get());
producer.send(prec.get());
}
if (i[0] % 100000 == 1) {
logger.info("File {} processed {} rows by {} milliseconds.", filename, i[0], System.currentTimeMillis() - start);
}
});

@aarexer aarexer added the other Other section label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other Other section
Projects
None yet
Development

No branches or pull requests

1 participant