@@ -143,35 +143,36 @@ RemoteDocumentCache getRemoteDocumentCache() {
143
143
144
144
@ Override
145
145
void runTransaction (String action , Runnable operation ) {
146
+ Logger .debug (TAG , "Starting transaction: %s" , action );
147
+ referenceDelegate .onTransactionStarted ();
148
+ db .beginTransaction ();
146
149
try {
147
- Logger .debug (TAG , "Starting transaction: %s" , action );
148
- referenceDelegate .onTransactionStarted ();
149
- db .beginTransaction ();
150
150
operation .run ();
151
151
152
152
// Note that an exception in operation.run() will prevent this code from running.
153
153
db .setTransactionSuccessful ();
154
154
} finally {
155
155
db .endTransaction ();
156
- referenceDelegate .onTransactionCommitted ();
157
156
}
157
+ referenceDelegate .onTransactionCommitted ();
158
158
}
159
159
160
160
@ Override
161
161
<T > T runTransaction (String action , Supplier <T > operation ) {
162
+ Logger .debug (TAG , "Starting transaction: %s" , action );
163
+ T value = null ;
164
+ referenceDelegate .onTransactionStarted ();
165
+ db .beginTransaction ();
162
166
try {
163
- Logger .debug (TAG , "Starting transaction: %s" , action );
164
- referenceDelegate .onTransactionStarted ();
165
- db .beginTransaction ();
166
- T value = operation .get ();
167
+ value = operation .get ();
167
168
168
169
// Note that an exception in operation.run() will prevent this code from running.
169
170
db .setTransactionSuccessful ();
170
- return value ;
171
171
} finally {
172
172
db .endTransaction ();
173
- referenceDelegate .onTransactionCommitted ();
174
173
}
174
+ referenceDelegate .onTransactionCommitted ();
175
+ return value ;
175
176
}
176
177
177
178
/**
0 commit comments