@@ -71,12 +71,13 @@ public <T> T read(
71
71
}
72
72
73
73
/**
74
- * Acquires read-only access to the database.
74
+ * Acquires read-only access to the database and consumes the result directly .
75
75
*
76
76
* @param action the action that consumes the DSL context, e.g. a query
77
77
* @throws DatabaseException if an error occurs in the given action
78
78
*/
79
- public void read (CheckedConsumer <? super DSLContext , ? extends DataAccessException > action ) {
79
+ public void readAndConsume (
80
+ CheckedConsumer <? super DSLContext , ? extends DataAccessException > action ) {
80
81
read (context -> {
81
82
action .accept (context );
82
83
// noinspection ReturnOfNull
@@ -85,14 +86,14 @@ public void read(CheckedConsumer<? super DSLContext, ? extends DataAccessExcepti
85
86
}
86
87
87
88
/**
88
- * Acquires read and write access to the database.
89
+ * Acquires read and write access to the database and provides the computed result .
89
90
*
90
91
* @param action the action to apply to the DSL context, e.g. a query
91
92
* @param <T> the type returned by the given action
92
93
* @return the result returned by the given action
93
94
* @throws DatabaseException if an error occurs in the given action
94
95
*/
95
- public <T > T write (
96
+ public <T > T writeAndProvide (
96
97
CheckedFunction <? super DSLContext , T , ? extends DataAccessException > action ) {
97
98
writeLock .lock ();
98
99
try {
@@ -111,7 +112,7 @@ public <T> T write(
111
112
* @throws DatabaseException if an error occurs in the given action
112
113
*/
113
114
public void write (CheckedConsumer <? super DSLContext , ? extends DataAccessException > action ) {
114
- write (context -> {
115
+ writeAndProvide (context -> {
115
116
action .accept (context );
116
117
// noinspection ReturnOfNull
117
118
return null ;
@@ -141,13 +142,13 @@ public <T> T readTransaction(
141
142
}
142
143
143
144
/**
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 .
145
146
*
146
147
* @param handler the handler that is executed within the context of the transaction. It has no
147
148
* return value.
148
149
* @throws DatabaseException if an error occurs in the given handler function
149
150
*/
150
- public void readTransaction (
151
+ public void readTransactionAndConsume (
151
152
CheckedConsumer <? super DSLContext , ? extends DataAccessException > handler ) {
152
153
readTransaction (dsl -> {
153
154
handler .accept (dsl );
@@ -157,15 +158,16 @@ public void readTransaction(
157
158
}
158
159
159
160
/**
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.
161
163
*
162
164
* @param handler the handler that is executed within the context of the transaction. The
163
165
* handler will be called once and its return value is returned from the transaction.
164
166
* @param <T> the return type of the handler
165
167
* @return the object that is returned by the given handler
166
168
* @throws DatabaseException if an error occurs in the given handler function
167
169
*/
168
- public <T > T writeTransaction (
170
+ public <T > T writeTransactionAndProvide (
169
171
CheckedFunction <? super DSLContext , T , DataAccessException > handler ) {
170
172
var holder = new ResultHolder <T >();
171
173
@@ -190,7 +192,7 @@ public <T> T writeTransaction(
190
192
*/
191
193
public void writeTransaction (
192
194
CheckedConsumer <? super DSLContext , ? extends DataAccessException > handler ) {
193
- writeTransaction (dsl -> {
195
+ writeTransactionAndProvide (dsl -> {
194
196
handler .accept (dsl );
195
197
// noinspection ReturnOfNull
196
198
return null ;
0 commit comments