18
18
19
19
import com .google .api .core .ApiFuture ;
20
20
import com .google .cloud .Timestamp ;
21
- import com .google .cloud .spanner .AsyncTransactionManager . TransactionContextFuture ;
21
+ import com .google .cloud .spanner .Options . TransactionOption ;
22
22
import com .google .cloud .spanner .TransactionManager .TransactionState ;
23
23
import com .google .common .util .concurrent .ListenableFuture ;
24
24
import com .google .common .util .concurrent .MoreExecutors ;
43
43
* so can cause resources to be leaked and deadlocks. Easiest way to guarantee this is by calling
44
44
* {@link #close()} in a finally block.
45
45
*
46
- * @see DatabaseClient#transactionManagerAsync()
46
+ * @see DatabaseClient#transactionManagerAsync(TransactionOption... )
47
47
*/
48
48
public interface AsyncTransactionManager extends AutoCloseable {
49
49
/**
@@ -91,10 +91,10 @@ Timestamp get(long timeout, TimeUnit unit)
91
91
92
92
/**
93
93
* {@link AsyncTransactionStep} is returned by {@link
94
- * TransactionContextFuture#then(AsyncTransactionFunction)} and {@link
95
- * AsyncTransactionStep#then(AsyncTransactionFunction)} and allows transaction steps that should
96
- * be executed serially to be chained together. Each step can contain one or more statements that
97
- * may execute in parallel.
94
+ * TransactionContextFuture#then(AsyncTransactionFunction, Executor )} and {@link
95
+ * AsyncTransactionStep#then(AsyncTransactionFunction, Executor )} and allows transaction steps
96
+ * that should be executed serially to be chained together. Each step can contain one or more
97
+ * statements that may execute in parallel.
98
98
*
99
99
* <p>Example usage:
100
100
*
@@ -115,6 +115,9 @@ Timestamp get(long timeout, TimeUnit unit)
115
115
* executor)
116
116
* .commitAsync();
117
117
* }</pre>
118
+ *
119
+ * @param <I>
120
+ * @param <O>
118
121
*/
119
122
interface AsyncTransactionStep <I , O > extends ApiFuture <O > {
120
123
/**
@@ -140,6 +143,9 @@ <RES> AsyncTransactionStep<O, RES> then(
140
143
* a {@link TransactionContext} and the output value of the previous transaction step as its input
141
144
* parameters. The method should return an {@link ApiFuture} that will return the result of this
142
145
* step.
146
+ *
147
+ * @param <I>
148
+ * @param <O>
143
149
*/
144
150
interface AsyncTransactionFunction <I , O > {
145
151
/**
@@ -151,16 +157,16 @@ interface AsyncTransactionFunction<I, O> {
151
157
* @param input the result of the previous transaction step.
152
158
* @return an {@link ApiFuture} that will return the result of this step, and that will be the
153
159
* input of the next transaction step. This method should never return <code>null</code>.
154
- * Instead, if the method does not have a return value, the method should return {@link
155
- * ApiFutures#immediateFuture(null)} .
160
+ * Instead, if the method does not have a return value, the method should return
161
+ * ApiFutures#immediateFuture(null).
156
162
*/
157
163
ApiFuture <O > apply (TransactionContext txn , I input ) throws Exception ;
158
164
}
159
165
160
166
/**
161
167
* Creates a new read write transaction. This must be called before doing any other operation and
162
168
* can only be called once. To create a new transaction for subsequent retries, see {@link
163
- * #resetForRetry ()}.
169
+ * #resetForRetryAsync ()}.
164
170
*/
165
171
TransactionContextFuture beginAsync ();
166
172
0 commit comments