Package com.sap.cds.services.runtime
Interface ChangeSetContextRunner
public interface ChangeSetContextRunner
-
Method Summary
Modifier and TypeMethodDescriptionEagerly marks theChangeSetContext
as transactional (seeChangeSetContext.markTransactional()
).void
run
(Consumer<ChangeSetContext> changeSetHandler) Opens aChangeSetContext
and runs the given handler within its scope.<T> T
run
(Function<ChangeSetContext, T> changeSetHandler) Opens aChangeSetContext
and runs the given handler within its scope.
-
Method Details
-
markTransactional
ChangeSetContextRunner markTransactional()Eagerly marks theChangeSetContext
as transactional (seeChangeSetContext.markTransactional()
). TransactionalChangeSetContext
s ensure to allocate transactions and corresponding resources (e.g. SQL connections), upon first interaction with a transactional data sources. Those resources are released only after closing theChangeSetContext
. A transactional data source might mark theChangeSetContext
as transactional, if it requires a transaction (e.g. when executing aCqnInsert
,CqnUpdate
,CqnDelete
orCqnSelect
with locks).ChangeSetContext
that are not marked transactional allow transactional data sources to free resources earlier, e.g. after each interaction. For example in case of JDBC data sources, SQL connections can be returned to the connection pool after executing aCqnSelect
without locks. In that case they are not required to be kept for the entireChangeSetContext
scope. Once aChangeSetContext
is marked as transactional it can't be unmarked again.- Returns:
- the
ChangeSetContextRunner
-
run
Opens aChangeSetContext
and runs the given handler within its scope. TheChangeSetContext
marks a scope in which all opened transactions etc. are committed cancelled together. Note that single transactions may fail during commit but others might be successful.The
ChangeSetContext
will be propagated to allEventContext
instances in the service call hierarchy.- Type Parameters:
T
- The type of the response- Parameters:
changeSetHandler
- The handler for processing the request within the context- Returns:
- A generic response object of the handler
-
run
Opens aChangeSetContext
and runs the given handler within its scope. TheChangeSetContext
marks a scope in which all opened transactions etc. are committed cancelled together. Note that single transactions may fail during commit but others might be successful.The
ChangeSetContext
will be propagated to allEventContext
instances in the service call hierarchy.- Parameters:
changeSetHandler
- The handler for processing the request within the context
-