cell1 = pool.createCell(new DefaultKey[Int], () => {
// depend on a already completed cell, callback is triggered immediately
cell1.whenComplete(completed, _ => FinalOutcome(10))
cell1.onComplete(_ => latch.countDown())
latch.await() // meanwhile, cell1 gets final value 10 via whenComplete
NextOutcome(-1) // the intended initial value of cell1.
})
If the PR on lazy evaluation gets accepted, simply catch the exception that is thrown when init() is called and the returned value is put.
cell1 = pool.createCell(new DefaultKey[Int], () => {
// depend on a already completed cell, callback is triggered immediately
cell1.whenComplete(completed, _ => FinalOutcome(10))
cell1.onComplete(_ => latch.countDown())
latch.await() // meanwhile, cell1 gets final value
10viawhenCompleteNextOutcome(-1) // the intended initial value of cell1.
})
If the PR on lazy evaluation gets accepted, simply catch the exception that is thrown when init() is called and the returned value is put.