mirror of
https://github.com/corda/corda.git
synced 2025-06-22 17:09:00 +00:00
Upgrade Quasar to 0.7.6 and fix an exception handling bug in SMM that it revealed (if an exception was thrown immediately on protocol startup we let it leak instead of capturing it in the future.
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.0.3'
|
ext.kotlin_version = '1.0.3'
|
||||||
ext.quasar_version = '0.7.5'
|
ext.quasar_version = '0.7.6'
|
||||||
ext.asm_version = '0.5.3'
|
ext.asm_version = '0.5.3'
|
||||||
ext.artemis_version = '1.3.0'
|
ext.artemis_version = '1.3.0'
|
||||||
ext.jackson_version = '2.8.0.rc2'
|
ext.jackson_version = '2.8.0.rc2'
|
||||||
|
BIN
lib/quasar.jar
BIN
lib/quasar.jar
Binary file not shown.
@ -215,8 +215,8 @@ class StateMachineManager(val serviceHub: ServiceHubInternal, tokenizableService
|
|||||||
* restarted with checkpointed state machines in the storage service.
|
* restarted with checkpointed state machines in the storage service.
|
||||||
*/
|
*/
|
||||||
fun <T> add(loggerName: String, logic: ProtocolLogic<T>): ListenableFuture<T> {
|
fun <T> add(loggerName: String, logic: ProtocolLogic<T>): ListenableFuture<T> {
|
||||||
|
val fiber = ProtocolStateMachineImpl(logic, scheduler, loggerName)
|
||||||
try {
|
try {
|
||||||
val fiber = ProtocolStateMachineImpl(logic, scheduler, loggerName)
|
|
||||||
// Need to add before iterating in case of immediate completion
|
// Need to add before iterating in case of immediate completion
|
||||||
initFiber(fiber) {
|
initFiber(fiber) {
|
||||||
val checkpoint = Checkpoint(serializeFiber(fiber), null)
|
val checkpoint = Checkpoint(serializeFiber(fiber), null)
|
||||||
@ -229,11 +229,12 @@ class StateMachineManager(val serviceHub: ServiceHubInternal, tokenizableService
|
|||||||
}
|
}
|
||||||
totalStartedProtocols.inc()
|
totalStartedProtocols.inc()
|
||||||
}
|
}
|
||||||
return fiber.resultFuture
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
|
// TODO: We should be able to remove this as we get more confident that we never fail to log exceptions.
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
throw e
|
check(fiber.resultFuture.isDone)
|
||||||
}
|
}
|
||||||
|
return fiber.resultFuture
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateCheckpoint(psm: ProtocolStateMachineImpl<*>,
|
private fun updateCheckpoint(psm: ProtocolStateMachineImpl<*>,
|
||||||
|
@ -7,13 +7,13 @@ import com.r3corda.core.contracts.TransactionType
|
|||||||
import com.r3corda.core.contracts.USD
|
import com.r3corda.core.contracts.USD
|
||||||
import com.r3corda.core.testing.DUMMY_NOTARY
|
import com.r3corda.core.testing.DUMMY_NOTARY
|
||||||
import com.r3corda.core.testing.MEGA_CORP
|
import com.r3corda.core.testing.MEGA_CORP
|
||||||
|
import com.r3corda.core.testing.rootCauseExceptions
|
||||||
import com.r3corda.node.internal.testing.MockNetwork
|
import com.r3corda.node.internal.testing.MockNetwork
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
import kotlin.test.assertTrue
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the data vending service.
|
* Tests for the data vending service.
|
||||||
@ -76,10 +76,11 @@ class DataVendingServiceTests {
|
|||||||
val notifyPsm = DataVending.Service.notify(registerNode.net, registerNode.services.storageService.myLegalIdentity,
|
val notifyPsm = DataVending.Service.notify(registerNode.net, registerNode.services.storageService.myLegalIdentity,
|
||||||
walletServiceNode.info, tx)
|
walletServiceNode.info, tx)
|
||||||
|
|
||||||
// Check it was accepted
|
// Check it was not accepted
|
||||||
network.runNetwork()
|
network.runNetwork()
|
||||||
val ex = assertFailsWith<java.util.concurrent.ExecutionException> { notifyPsm.get(1, TimeUnit.SECONDS) }
|
assertFailsWith<DataVending.Service.TransactionRejectedError> {
|
||||||
assertTrue(ex.cause is DataVending.Service.TransactionRejectedError)
|
rootCauseExceptions { notifyPsm.get() }
|
||||||
|
}
|
||||||
|
|
||||||
// Check the transaction is not in the receiving node
|
// Check the transaction is not in the receiving node
|
||||||
assertEquals(0, walletServiceNode.services.walletService.currentWallet.states.toList().size)
|
assertEquals(0, walletServiceNode.services.walletService.currentWallet.states.toList().size)
|
||||||
|
Reference in New Issue
Block a user