Merge pull request #778 from corda/aslemmer-merge-88c12791a81a49bdaab93e6bda4d070d7bf1ac5c

Aslemmer merge 88c12791a8
This commit is contained in:
Andras Slemmer 2018-04-26 11:41:20 +01:00 committed by GitHub
commit d2b6978d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 KiB

After

Width:  |  Height:  |  Size: 238 KiB

View File

@ -108,7 +108,7 @@ class DBTransactionStorage(cacheSizeBytes: Long) : WritableTransactionStorage, S
override fun track(): DataFeed<List<SignedTransaction>, SignedTransaction> { override fun track(): DataFeed<List<SignedTransaction>, SignedTransaction> {
return txStorage.exclusive { return txStorage.exclusive {
DataFeed(allPersisted().map { it.second.toSignedTx() }.toList(), updates.bufferUntilSubscribed().wrapWithDatabaseTransaction()) DataFeed(allPersisted().map { it.second.toSignedTx() }.toList(), updates.bufferUntilSubscribed())
} }
} }

View File

@ -38,6 +38,7 @@ import net.corda.nodeapi.internal.persistence.contextTransaction
import net.corda.nodeapi.internal.persistence.contextTransactionOrNull import net.corda.nodeapi.internal.persistence.contextTransactionOrNull
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.slf4j.MDC
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import kotlin.reflect.KProperty1 import kotlin.reflect.KProperty1
@ -174,11 +175,16 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
} }
} }
fun setLoggingContext() {
context.pushToLoggingContext()
MDC.put("flow-id", id.uuid.toString())
}
@Suspendable @Suspendable
override fun run() { override fun run() {
logic.stateMachine = this logic.stateMachine = this
context.pushToLoggingContext() setLoggingContext()
initialiseFlow() initialiseFlow()
@ -331,6 +337,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
require(continuation == FlowContinuation.ProcessEvents) require(continuation == FlowContinuation.ProcessEvents)
Fiber.unparkDeserialized(this, scheduler) Fiber.unparkDeserialized(this, scheduler)
} }
setLoggingContext()
return uncheckedCast(processEventsUntilFlowIsResumed( return uncheckedCast(processEventsUntilFlowIsResumed(
isDbTransactionOpenOnEntry = false, isDbTransactionOpenOnEntry = false,
isDbTransactionOpenOnExit = true isDbTransactionOpenOnExit = true