withDataSubstitution

abstract fun <T> withDataSubstitution(dataFactory: DataFactory<DataT>, body: () -> T): T

Substitutes the data provided by dataFactory instead of a shared resource (which is done by substitutor), executes body in this context and calls finalizer afterwards. Note that finalizer is called even in the case of exceptional completion of body.