Skip to content

Instantly share code, notes, and snippets.

@redvasily
Created March 13, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redvasily/d97f1b42153af22fe8cb07467feb8a03 to your computer and use it in GitHub Desktop.
Save redvasily/d97f1b42153af22fe8cb07467feb8a03 to your computer and use it in GitHub Desktop.
val value = replica.getLong("long-value").join()
while (true) {
val random = ThreadLocalRandom.current()
try {
log.info("Incrementing")
val f = value.incrementAndGet().join()
log.info("New value: {}", f)
Thread.sleep(random.nextLong(1000, 3000))
} catch (e: Exception) {
log.error("Some error", e)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment