mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
Introducing Observable.toFuture() extension method
This commit is contained in:
@ -144,7 +144,7 @@ class NodeSchedulerService(private val database: Database,
|
||||
Pair(earliestState, rescheduled!!)
|
||||
}
|
||||
if (scheduledState != null) {
|
||||
schedulerTimerExecutor.execute() {
|
||||
schedulerTimerExecutor.execute {
|
||||
log.trace { "Scheduling as next $scheduledState" }
|
||||
// This will block the scheduler single thread until the scheduled time (returns false) OR
|
||||
// the Future is cancelled due to rescheduling (returns true).
|
||||
@ -152,7 +152,7 @@ class NodeSchedulerService(private val database: Database,
|
||||
log.trace { "Invoking as next $scheduledState" }
|
||||
onTimeReached(scheduledState)
|
||||
} else {
|
||||
log.trace { "Recheduled $scheduledState" }
|
||||
log.trace { "Rescheduled $scheduledState" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.corda.node.services.persistence
|
||||
|
||||
import com.google.common.util.concurrent.SettableFuture
|
||||
import net.corda.core.contracts.StateRef
|
||||
import net.corda.core.contracts.TransactionType
|
||||
import net.corda.core.crypto.DigitalSignature
|
||||
import net.corda.core.crypto.NullPublicKey
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.toFuture
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.transactions.WireTransaction
|
||||
import net.corda.core.utilities.DUMMY_NOTARY
|
||||
@ -109,8 +109,7 @@ class DBTransactionStorageTests {
|
||||
|
||||
@Test
|
||||
fun `updates are fired`() {
|
||||
val future = SettableFuture.create<SignedTransaction>()
|
||||
transactionStorage.updates.subscribe { tx -> future.set(tx) }
|
||||
val future = transactionStorage.updates.toFuture()
|
||||
val expected = newTransaction()
|
||||
databaseTransaction(database) {
|
||||
transactionStorage.addTransaction(expected)
|
||||
|
Reference in New Issue
Block a user