We're updating the issue view to help you get more done. 

Provide access to database transactions for CorDapp developers

Description

Currently CorDapp developers have access to Corda persistence via the flow framework and Corda services. However, it might be the case that some work needs to be performed on another thread. Trying to access `CordaPersistence` from another thread results in the following exception:

Caused by: java.lang.IllegalStateException: Was expecting to find CordaPersistence set on current thread: Thread[RxIoScheduler-2,5,main]

This is because there's no `ThreadLocal` instance of `CordaPersistence` available. It would be useful if there was an API for CorDapp developers to wrap vault calls etc. in a database transaction block. This would allow developers to perform tasks that require node database access in separate threads.

CVSS Vector

None

Status

Assignee

Michele Sollecito

Reporter

Roger Willis

Labels

CVSS Score

None

Feature Team

Operational Experience

Target Version/s

Corda 3.3

Ported to...

None

Fix versions

Priority

Medium