Skip to content

Commit 22b55b0

Browse files
authored
feat: delete deprecated transaction functions (#1647)
BREAKING CHANGE: the deprecated `writeTransaction` and `readTransaction` have been deleted, please use `executeWrite` and `executeRead`
1 parent d818ada commit 22b55b0

31 files changed

+385
-656
lines changed

driver/clirr-ignored-differences.xml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,4 +712,62 @@
712712
<method>org.neo4j.driver.Bookmark lastBookmark()</method>
713713
</difference>
714714

715+
<difference>
716+
<className>org/neo4j/driver/Session</className>
717+
<differenceType>7002</differenceType>
718+
<method>java.lang.Object readTransaction(org.neo4j.driver.TransactionWork)</method>
719+
</difference>
720+
721+
<difference>
722+
<className>org/neo4j/driver/Session</className>
723+
<differenceType>7002</differenceType>
724+
<method>java.lang.Object readTransaction(org.neo4j.driver.TransactionWork, org.neo4j.driver.TransactionConfig)</method>
725+
</difference>
726+
727+
<difference>
728+
<className>org/neo4j/driver/Session</className>
729+
<differenceType>7002</differenceType>
730+
<method>java.lang.Object writeTransaction(org.neo4j.driver.TransactionWork)</method>
731+
</difference>
732+
733+
<difference>
734+
<className>org/neo4j/driver/Session</className>
735+
<differenceType>7002</differenceType>
736+
<method>java.lang.Object writeTransaction(org.neo4j.driver.TransactionWork, org.neo4j.driver.TransactionConfig)</method>
737+
</difference>
738+
739+
<difference>
740+
<className>org/neo4j/driver/async/AsyncSession</className>
741+
<differenceType>7002</differenceType>
742+
<method>java.util.concurrent.CompletionStage readTransactionAsync(org.neo4j.driver.async.AsyncTransactionWork)</method>
743+
</difference>
744+
745+
<difference>
746+
<className>org/neo4j/driver/async/AsyncSession</className>
747+
<differenceType>7002</differenceType>
748+
<method>java.util.concurrent.CompletionStage readTransactionAsync(org.neo4j.driver.async.AsyncTransactionWork, org.neo4j.driver.TransactionConfig)</method>
749+
</difference>
750+
751+
<difference>
752+
<className>org/neo4j/driver/async/AsyncSession</className>
753+
<differenceType>7002</differenceType>
754+
<method>java.util.concurrent.CompletionStage writeTransactionAsync(org.neo4j.driver.async.AsyncTransactionWork)</method>
755+
</difference>
756+
757+
<difference>
758+
<className>org/neo4j/driver/async/AsyncSession</className>
759+
<differenceType>7002</differenceType>
760+
<method>java.util.concurrent.CompletionStage writeTransactionAsync(org.neo4j.driver.async.AsyncTransactionWork, org.neo4j.driver.TransactionConfig)</method>
761+
</difference>
762+
763+
<difference>
764+
<className>org/neo4j/driver/TransactionWork</className>
765+
<differenceType>8001</differenceType>
766+
</difference>
767+
768+
<difference>
769+
<className>org/neo4j/driver/async/AsyncTransactionWork</className>
770+
<differenceType>8001</differenceType>
771+
</difference>
772+
715773
</differences>

driver/src/main/java/org/neo4j/driver/Session.java

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,6 @@ public interface Session extends BaseSession, Resource, QueryRunner {
7373
*/
7474
Transaction beginTransaction(TransactionConfig config);
7575

76-
/**
77-
* Execute a unit of work in a managed {@link AccessMode#READ read} transaction.
78-
* <p>
79-
* This transaction will automatically be committed unless an exception is thrown during query execution or by the user code.
80-
* <p>
81-
* Managed transactions should not be explicitly committed (via {@link Transaction#commit()}).
82-
*
83-
* @param work the {@link TransactionWork} to be applied to a new read transaction.
84-
* @param <T> the return type of the given unit of work.
85-
* @return a result as returned by the given unit of work.
86-
* @deprecated superseded by {@link #executeRead(TransactionCallback)}.
87-
*/
88-
@Deprecated
89-
<T> T readTransaction(TransactionWork<T> work);
90-
9176
/**
9277
* Execute a unit of work as a single, managed transaction with {@link AccessMode#READ read} access mode and retry behaviour. The transaction allows for one
9378
* or more statements to be run.
@@ -105,22 +90,6 @@ default <T> T executeRead(TransactionCallback<T> callback) {
10590
return executeRead(callback, TransactionConfig.empty());
10691
}
10792

108-
/**
109-
* Execute a unit of work in a managed {@link AccessMode#READ read} transaction with the specified {@link TransactionConfig configuration}.
110-
* <p>
111-
* This transaction will automatically be committed unless an exception is thrown during query execution or by the user code.
112-
* <p>
113-
* Managed transactions should not be explicitly committed (via {@link Transaction#commit()}).
114-
*
115-
* @param work the {@link TransactionWork} to be applied to a new read transaction.
116-
* @param config configuration for all transactions started to execute the unit of work.
117-
* @param <T> the return type of the given unit of work.
118-
* @return a result as returned by the given unit of work.
119-
* @deprecated superseded by {@link #executeRead(TransactionCallback, TransactionConfig)}.
120-
*/
121-
@Deprecated
122-
<T> T readTransaction(TransactionWork<T> work, TransactionConfig config);
123-
12493
/**
12594
* Execute a unit of work as a single, managed transaction with {@link AccessMode#READ read} access mode and retry behaviour. The transaction allows for one
12695
* or more statements to be run.
@@ -137,21 +106,6 @@ default <T> T executeRead(TransactionCallback<T> callback) {
137106
*/
138107
<T> T executeRead(TransactionCallback<T> callback, TransactionConfig config);
139108

140-
/**
141-
* Execute a unit of work in a managed {@link AccessMode#WRITE write} transaction.
142-
* <p>
143-
* This transaction will automatically be committed unless an exception is thrown during query execution or by the user code.
144-
* <p>
145-
* Managed transactions should not be explicitly committed (via {@link Transaction#commit()}).
146-
*
147-
* @param work the {@link TransactionWork} to be applied to a new write transaction.
148-
* @param <T> the return type of the given unit of work.
149-
* @return a result as returned by the given unit of work.
150-
* @deprecated superseded by {@link #executeWrite(TransactionCallback)}.
151-
*/
152-
@Deprecated
153-
<T> T writeTransaction(TransactionWork<T> work);
154-
155109
/**
156110
* Execute a unit of work as a single, managed transaction with {@link AccessMode#WRITE write} access mode and retry behaviour. The transaction allows for
157111
* one or more statements to be run.
@@ -186,22 +140,6 @@ default void executeWriteWithoutResult(Consumer<TransactionContext> contextConsu
186140
});
187141
}
188142

189-
/**
190-
* Execute a unit of work in a managed {@link AccessMode#WRITE write} transaction with the specified {@link TransactionConfig configuration}.
191-
* <p>
192-
* This transaction will automatically be committed unless an exception is thrown during query execution or by the user code.
193-
* <p>
194-
* Managed transactions should not be explicitly committed (via {@link Transaction#commit()}).
195-
*
196-
* @param work the {@link TransactionWork} to be applied to a new write transaction.
197-
* @param config configuration for all transactions started to execute the unit of work.
198-
* @param <T> the return type of the given unit of work.
199-
* @return a result as returned by the given unit of work.
200-
* @deprecated superseded by {@link #executeWrite(TransactionCallback, TransactionConfig)}.
201-
*/
202-
@Deprecated
203-
<T> T writeTransaction(TransactionWork<T> work, TransactionConfig config);
204-
205143
/**
206144
* Execute a unit of work as a single, managed transaction with {@link AccessMode#WRITE write} access mode and retry behaviour. The transaction allows for one or more statements to be run.
207145
* <p>

driver/src/main/java/org/neo4j/driver/TransactionWork.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

driver/src/main/java/org/neo4j/driver/async/AsyncSession.java

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -112,31 +112,6 @@ public interface AsyncSession extends BaseSession, AsyncQueryRunner {
112112
*/
113113
CompletionStage<AsyncTransaction> beginTransactionAsync(TransactionConfig config);
114114

115-
/**
116-
* Execute given unit of asynchronous work in a {@link AccessMode#READ read} asynchronous transaction.
117-
* <p>
118-
* Transaction will automatically be committed unless given unit of work fails or
119-
* {@link AsyncTransaction#commitAsync() async transaction commit} fails.
120-
* It will also not be committed if explicitly rolled back via {@link AsyncTransaction#rollbackAsync()}.
121-
* <p>
122-
* Returned stage and given {@link AsyncTransactionWork} can be completed/executed by an IO thread which should never block.
123-
* Otherwise IO operations on this and potentially other network connections might deadlock.
124-
* Please do not chain blocking operations like {@link CompletableFuture#get()} on the returned stage and do not use them inside the
125-
* {@link AsyncTransactionWork}.
126-
* Consider using asynchronous calls throughout the chain or offloading blocking operation to a different {@link Executor}.
127-
* This can be done using methods with "Async" suffix like
128-
* {@link CompletionStage#thenApplyAsync(Function)} or {@link CompletionStage#thenApplyAsync(Function, Executor)}.
129-
*
130-
* @param work the {@link AsyncTransactionWork} to be applied to a new read transaction. Operation executed by the
131-
* given work must be asynchronous.
132-
* @param <T> the return type of the given unit of work.
133-
* @return a {@link CompletionStage completion stage} completed with the same result as returned by the given
134-
* unit of work. Stage can be completed exceptionally if given work or commit fails.
135-
* @deprecated superseded by {@link #executeReadAsync(AsyncTransactionCallback)}.
136-
*/
137-
@Deprecated
138-
<T> CompletionStage<T> readTransactionAsync(AsyncTransactionWork<CompletionStage<T>> work);
139-
140115
/**
141116
* Execute a unit of work as a single, managed transaction with {@link AccessMode#READ read} access mode and retry behaviour. The transaction allows for one
142117
* or more statements to be run.
@@ -157,34 +132,6 @@ default <T> CompletionStage<T> executeReadAsync(AsyncTransactionCallback<Complet
157132
return executeReadAsync(callback, TransactionConfig.empty());
158133
}
159134

160-
/**
161-
* Execute given unit of asynchronous work in a {@link AccessMode#READ read} asynchronous transaction with
162-
* the specified {@link TransactionConfig configuration}.
163-
* <p>
164-
* Transaction will automatically be committed unless given unit of work fails or
165-
* {@link AsyncTransaction#commitAsync() async transaction commit} fails.
166-
* It will also not be committed if explicitly rolled back via {@link AsyncTransaction#rollbackAsync()}.
167-
* <p>
168-
* Returned stage and given {@link AsyncTransactionWork} can be completed/executed by an IO thread which should never block.
169-
* Otherwise IO operations on this and potentially other network connections might deadlock.
170-
* Please do not chain blocking operations like {@link CompletableFuture#get()} on the returned stage and do not use them inside the
171-
* {@link AsyncTransactionWork}.
172-
* Consider using asynchronous calls throughout the chain or offloading blocking operation to a different {@link Executor}.
173-
* This can be done using methods with "Async" suffix like
174-
* {@link CompletionStage#thenApplyAsync(Function)} or {@link CompletionStage#thenApplyAsync(Function, Executor)}.
175-
*
176-
* @param work the {@link AsyncTransactionWork} to be applied to a new read transaction. Operation executed by the
177-
* given work must be asynchronous.
178-
* @param config configuration for all transactions started to execute the unit of work.
179-
* @param <T> the return type of the given unit of work.
180-
* @return a {@link CompletionStage completion stage} completed with the same result as returned by the given
181-
* unit of work. Stage can be completed exceptionally if given work or commit fails.
182-
* @deprecated superseded by {@link #executeReadAsync(AsyncTransactionCallback, TransactionConfig)}.
183-
*/
184-
@Deprecated
185-
<T> CompletionStage<T> readTransactionAsync(
186-
AsyncTransactionWork<CompletionStage<T>> work, TransactionConfig config);
187-
188135
/**
189136
* Execute a unit of work as a single, managed transaction with {@link AccessMode#READ read} access mode and retry behaviour. The transaction allows for one or more statements to be run.
190137
* <p>
@@ -204,31 +151,6 @@ <T> CompletionStage<T> readTransactionAsync(
204151
<T> CompletionStage<T> executeReadAsync(
205152
AsyncTransactionCallback<CompletionStage<T>> callback, TransactionConfig config);
206153

207-
/**
208-
* Execute given unit of asynchronous work in a {@link AccessMode#WRITE write} asynchronous transaction.
209-
* <p>
210-
* Transaction will automatically be committed unless given unit of work fails or
211-
* {@link AsyncTransaction#commitAsync() async transaction commit} fails. It will also not be committed if explicitly
212-
* rolled back via {@link AsyncTransaction#rollbackAsync()}.
213-
* <p>
214-
* Returned stage and given {@link AsyncTransactionWork} can be completed/executed by an IO thread which should never block.
215-
* Otherwise IO operations on this and potentially other network connections might deadlock.
216-
* Please do not chain blocking operations like {@link CompletableFuture#get()} on the returned stage and do not use them inside the
217-
* {@link AsyncTransactionWork}.
218-
* Consider using asynchronous calls throughout the chain or offloading blocking operation to a different {@link Executor}.
219-
* This can be done using methods with "Async" suffix like
220-
* {@link CompletionStage#thenApplyAsync(Function)} or {@link CompletionStage#thenApplyAsync(Function, Executor)}.
221-
*
222-
* @param work the {@link AsyncTransactionWork} to be applied to a new write transaction. Operation executed by the
223-
* given work must be asynchronous.
224-
* @param <T> the return type of the given unit of work.
225-
* @return a {@link CompletionStage completion stage} completed with the same result as returned by the given
226-
* unit of work. Stage can be completed exceptionally if given work or commit fails.
227-
* @deprecated superseded by {@link #executeWriteAsync(AsyncTransactionCallback)}.
228-
*/
229-
@Deprecated
230-
<T> CompletionStage<T> writeTransactionAsync(AsyncTransactionWork<CompletionStage<T>> work);
231-
232154
/**
233155
* Execute a unit of work as a single, managed transaction with {@link AccessMode#WRITE write} access mode and retry behaviour. The transaction allows for
234156
* one or more statements to be run.
@@ -249,34 +171,6 @@ default <T> CompletionStage<T> executeWriteAsync(AsyncTransactionCallback<Comple
249171
return executeWriteAsync(callback, TransactionConfig.empty());
250172
}
251173

252-
/**
253-
* Execute given unit of asynchronous work in a {@link AccessMode#WRITE write} asynchronous transaction with
254-
* the specified {@link TransactionConfig configuration}.
255-
* <p>
256-
* Transaction will automatically be committed unless given unit of work fails or
257-
* {@link AsyncTransaction#commitAsync() async transaction commit} fails. It will also not be committed if explicitly
258-
* rolled back via {@link AsyncTransaction#rollbackAsync()}.
259-
* <p>
260-
* Returned stage and given {@link AsyncTransactionWork} can be completed/executed by an IO thread which should never block.
261-
* Otherwise IO operations on this and potentially other network connections might deadlock.
262-
* Please do not chain blocking operations like {@link CompletableFuture#get()} on the returned stage and do not use them inside the
263-
* {@link AsyncTransactionWork}.
264-
* Consider using asynchronous calls throughout the chain or offloading blocking operation to a different {@link Executor}.
265-
* This can be done using methods with "Async" suffix like
266-
* {@link CompletionStage#thenApplyAsync(Function)} or {@link CompletionStage#thenApplyAsync(Function, Executor)}.
267-
*
268-
* @param work the {@link AsyncTransactionWork} to be applied to a new write transaction. Operation executed by the
269-
* given work must be asynchronous.
270-
* @param config configuration for all transactions started to execute the unit of work.
271-
* @param <T> the return type of the given unit of work.
272-
* @return a {@link CompletionStage completion stage} completed with the same result as returned by the given
273-
* unit of work. Stage can be completed exceptionally if given work or commit fails.
274-
* @deprecated superseded by {@link #executeWriteAsync(AsyncTransactionCallback, TransactionConfig)}.
275-
*/
276-
@Deprecated
277-
<T> CompletionStage<T> writeTransactionAsync(
278-
AsyncTransactionWork<CompletionStage<T>> work, TransactionConfig config);
279-
280174
/**
281175
* Execute a unit of work as a single, managed transaction with {@link AccessMode#WRITE write} access mode and retry behaviour. The transaction allows for one or more statements to be run.
282176
* <p>

driver/src/main/java/org/neo4j/driver/async/AsyncTransactionWork.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)