@@ -71,12 +71,13 @@ public <T> T read(
7171 }
7272
7373 /**
74- * Acquires read-only access to the database.
74+ * Acquires read-only access to the database and consumes the result directly .
7575 *
7676 * @param action the action that consumes the DSL context, e.g. a query
7777 * @throws DatabaseException if an error occurs in the given action
7878 */
79- public void read (CheckedConsumer <? super DSLContext , ? extends DataAccessException > action ) {
79+ public void readAndConsume (
80+ CheckedConsumer <? super DSLContext , ? extends DataAccessException > action ) {
8081 read (context -> {
8182 action .accept (context );
8283 // noinspection ReturnOfNull
@@ -85,14 +86,14 @@ public void read(CheckedConsumer<? super DSLContext, ? extends DataAccessExcepti
8586 }
8687
8788 /**
88- * Acquires read and write access to the database.
89+ * Acquires read and write access to the database and provides the computed result .
8990 *
9091 * @param action the action to apply to the DSL context, e.g. a query
9192 * @param <T> the type returned by the given action
9293 * @return the result returned by the given action
9394 * @throws DatabaseException if an error occurs in the given action
9495 */
95- public <T > T write (
96+ public <T > T writeAndProvide (
9697 CheckedFunction <? super DSLContext , T , ? extends DataAccessException > action ) {
9798 writeLock .lock ();
9899 try {
@@ -111,7 +112,7 @@ public <T> T write(
111112 * @throws DatabaseException if an error occurs in the given action
112113 */
113114 public void write (CheckedConsumer <? super DSLContext , ? extends DataAccessException > action ) {
114- write (context -> {
115+ writeAndProvide (context -> {
115116 action .accept (context );
116117 // noinspection ReturnOfNull
117118 return null ;
@@ -141,13 +142,13 @@ public <T> T readTransaction(
141142 }
142143
143144 /**
144- * Acquires a transaction that can only read from the database.
145+ * Acquires a transaction that can only read from the database and consumes the result directly .
145146 *
146147 * @param handler the handler that is executed within the context of the transaction. It has no
147148 * return value.
148149 * @throws DatabaseException if an error occurs in the given handler function
149150 */
150- public void readTransaction (
151+ public void readTransactionAndConsume (
151152 CheckedConsumer <? super DSLContext , ? extends DataAccessException > handler ) {
152153 readTransaction (dsl -> {
153154 handler .accept (dsl );
@@ -157,15 +158,16 @@ public void readTransaction(
157158 }
158159
159160 /**
160- * Acquires a transaction that can read and write to the database.
161+ * Acquires a transaction that can read and write to the database and provides the computed
162+ * result.
161163 *
162164 * @param handler the handler that is executed within the context of the transaction. The
163165 * handler will be called once and its return value is returned from the transaction.
164166 * @param <T> the return type of the handler
165167 * @return the object that is returned by the given handler
166168 * @throws DatabaseException if an error occurs in the given handler function
167169 */
168- public <T > T writeTransaction (
170+ public <T > T writeTransactionAndProvide (
169171 CheckedFunction <? super DSLContext , T , DataAccessException > handler ) {
170172 var holder = new ResultHolder <T >();
171173
@@ -190,7 +192,7 @@ public <T> T writeTransaction(
190192 */
191193 public void writeTransaction (
192194 CheckedConsumer <? super DSLContext , ? extends DataAccessException > handler ) {
193- writeTransaction (dsl -> {
195+ writeTransactionAndProvide (dsl -> {
194196 handler .accept (dsl );
195197 // noinspection ReturnOfNull
196198 return null ;
0 commit comments