Skip to content

Commit

Permalink
Adding example to ContextServiceDefinition.unchanged()
Browse files Browse the repository at this point in the history
  • Loading branch information
mswatosh committed Dec 10, 2021
1 parent da7e2e8 commit 85a8d78
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,19 @@

/**
* <p>Types of context that are left alone when a thread
* runs the contextual task or action.</p>
* runs the contextual task or action.
* <p>For example, with <code> unchanged = TRANSACTION</code>
* if a transaction is started after a function is
* contextualized, but before the function is run on the same thread,
* the transaction will be active in the contextual function:</p>
*
* <pre>Consumer<String, Integer> updateDB = contextService.contextualConsumer(fn);
*
*&#47;/ later, on another thread
*tx.begin();
*updateDB.accept("java:comp/env/jdbc/ds1");
*&#47;/...additional transactional work
*tx.commit();</pre>
*
* <p>Constants are provided on this class for the context types
* that are defined by the Jakarta EE Concurrency specification.</p>
Expand Down

0 comments on commit 85a8d78

Please sign in to comment.