@@ -142,24 +142,33 @@ RemoteDocumentCache getRemoteDocumentCache() {
142
142
return remoteDocumentCache ;
143
143
}
144
144
145
+ private static class ReferenceDelegateToSQLiteTransactionListenerAdapter
146
+ implements SQLiteTransactionListener {
147
+ private ReferenceDelegate instance ;
148
+
149
+ ReferenceDelegateToSQLiteTransactionListenerAdapter (ReferenceDelegate instance ) {
150
+ this .instance = instance ;
151
+ }
152
+
153
+ @ Override
154
+ public void onBegin () {
155
+ instance .onTransactionStarted ();
156
+ }
157
+
158
+ @ Override
159
+ public void onCommit () {
160
+ instance .onTransactionCommitted ();
161
+ }
162
+
163
+ @ Override
164
+ public void onRollback () {}
165
+ }
166
+
145
167
@ Override
146
168
void runTransaction (String action , Runnable operation ) {
147
169
Logger .debug (TAG , "Starting transaction: %s" , action );
148
170
db .beginTransactionWithListener (
149
- new SQLiteTransactionListener () {
150
- @ Override
151
- public void onBegin () {
152
- referenceDelegate .onTransactionStarted ();
153
- }
154
-
155
- @ Override
156
- public void onCommit () {
157
- referenceDelegate .onTransactionCommitted ();
158
- }
159
-
160
- @ Override
161
- public void onRollback () {}
162
- });
171
+ new ReferenceDelegateToSQLiteTransactionListenerAdapter (referenceDelegate ));
163
172
try {
164
173
operation .run ();
165
174
@@ -175,20 +184,7 @@ <T> T runTransaction(String action, Supplier<T> operation) {
175
184
Logger .debug (TAG , "Starting transaction: %s" , action );
176
185
T value = null ;
177
186
db .beginTransactionWithListener (
178
- new SQLiteTransactionListener () {
179
- @ Override
180
- public void onBegin () {
181
- referenceDelegate .onTransactionStarted ();
182
- }
183
-
184
- @ Override
185
- public void onCommit () {
186
- referenceDelegate .onTransactionCommitted ();
187
- }
188
-
189
- @ Override
190
- public void onRollback () {}
191
- });
187
+ new ReferenceDelegateToSQLiteTransactionListenerAdapter (referenceDelegate ));
192
188
try {
193
189
value = operation .get ();
194
190
0 commit comments