From b8eb4448c891d768d720b60fb8508a868382128e Mon Sep 17 00:00:00 2001 From: Shams Asari Date: Thu, 18 May 2017 14:15:43 +0100 Subject: [PATCH] Made RetryableExeption a FlowException and reverted UnknownFix to be retryable --- core/src/main/kotlin/net/corda/core/Utils.kt | 9 ++------- .../main/kotlin/net/corda/irs/api/NodeInterestRates.kt | 3 +-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/Utils.kt b/core/src/main/kotlin/net/corda/core/Utils.kt index 95c88285e2..c4218c1784 100644 --- a/core/src/main/kotlin/net/corda/core/Utils.kt +++ b/core/src/main/kotlin/net/corda/core/Utils.kt @@ -9,6 +9,7 @@ import com.google.common.util.concurrent.* import net.corda.core.crypto.SecureHash import net.corda.core.crypto.newSecureRandom import net.corda.core.crypto.sha256 +import net.corda.core.flows.FlowException import net.corda.core.serialization.CordaSerializable import org.slf4j.Logger import rx.Observable @@ -32,13 +33,7 @@ import java.util.zip.Deflater import java.util.zip.ZipEntry import java.util.zip.ZipInputStream import java.util.zip.ZipOutputStream -import kotlin.collections.Iterable import kotlin.collections.LinkedHashMap -import kotlin.collections.List -import kotlin.collections.filter -import kotlin.collections.firstOrNull -import kotlin.collections.fold -import kotlin.collections.forEach import kotlin.concurrent.withLock import kotlin.reflect.KProperty @@ -281,7 +276,7 @@ class ThreadBox(val content: T, val lock: ReentrantLock = ReentrantLock() * We avoid the use of the word transient here to hopefully reduce confusion with the term in relation to (Java) serialization. */ @CordaSerializable -abstract class RetryableException(message: String) : Exception(message) +abstract class RetryableException(message: String) : FlowException(message) /** * A simple wrapper that enables the use of Kotlin's "val x by TransientProperty { ... }" syntax. Such a property diff --git a/samples/irs-demo/src/main/kotlin/net/corda/irs/api/NodeInterestRates.kt b/samples/irs-demo/src/main/kotlin/net/corda/irs/api/NodeInterestRates.kt index 21ef8739ce..b485f406a1 100644 --- a/samples/irs-demo/src/main/kotlin/net/corda/irs/api/NodeInterestRates.kt +++ b/samples/irs-demo/src/main/kotlin/net/corda/irs/api/NodeInterestRates.kt @@ -7,7 +7,6 @@ import net.corda.core.crypto.DigitalSignature import net.corda.core.crypto.MerkleTreeException import net.corda.core.crypto.keys import net.corda.core.crypto.sign -import net.corda.core.flows.FlowException import net.corda.core.flows.FlowLogic import net.corda.core.identity.Party import net.corda.core.math.CubicSplineInterpolator @@ -235,7 +234,7 @@ object NodeInterestRates { } // TODO: can we split into two? Fix not available (retryable/transient) and unknown (permanent) - class UnknownFix(val fix: FixOf) : FlowException("Unknown fix: $fix") + class UnknownFix(val fix: FixOf) : RetryableException("Unknown fix: $fix") /** Fix container, for every fix name & date pair stores a tenor to interest rate map - [InterpolatingRateMap] */ class FixContainer(val fixes: Set, val factory: InterpolatorFactory = CubicSplineInterpolator) {