Dalinar
12/26/2018, 9:54 AMCompletableFuture
correctly
if I hammer (just from a single thread) asyncDumpReport()
then am I correct to assume that there is no chance of dumpReport()
firing until the previous call to dumpReport()
has completed?
`
/**
* calls [dumpReport] asynchronously, _if there is not currently such a call in progress_
*/
private fun asyncDumpReport() {
val p = promise
if (p == null || p.getNow(false))
promise = CompletableFuture.supplyAsync {
try {
dumpReport()
} finally {}
true
}
}
private var promise: CompletableFuture<Boolean>? = null
`
Andreas Sinz
12/26/2018, 10:24 AMasyncDumpReport
while another dump is still running, it will just skip the dumping-partDalinar
12/26/2018, 10:25 AMTimmy
12/27/2018, 11:19 AMval p =...
and the if?
Since you not using the result of CompletableFuture you're could instead of use the thread safe functions from AtomicBoolean for the example