@@ -120,8 +120,8 @@ static FirebaseFirestore newInstance(
120
120
FirebaseFirestore firestore =
121
121
new FirebaseFirestore (context , databaseId , persistenceKey , provider , queue , app );
122
122
app .addLifecycleEventListener (
123
- /* onDeleted */ (firebaseAppName , options ) -> {
124
- firestore .shutdown (/* fromAppDeletion */ true );
123
+ (firebaseAppName , options ) -> {
124
+ firestore .shutdown (/* fromAppDeletion= */ true );
125
125
});
126
126
return firestore ;
127
127
}
@@ -346,30 +346,29 @@ Task<Void> shutdown(boolean fromAppDeletion) {
346
346
}
347
347
348
348
/**
349
- * Shuts down this Firestore SDK instance.
349
+ * Shuts down this FirebaseFirestore instance.
350
350
*
351
- * <p>IMPORTANT: If your application is designed to run with Firestore the entire life cycle, it
352
- * is not recommended to call `shutdown` explicitly, the shutting down happens naturally when the
353
- * application itself is shut down.
351
+ * <p>After shutdown only the {@link #clearPersistence()} method may be used. Any other method
352
+ * will throw an {@link IllegalStateException}.
354
353
*
355
- * <p>For applications designed to run without Firestore from some point on (typically to save
356
- * resources as much as possible), you may call this method .
354
+ * <p>To restart after shutdown, simply create a new instance of FirebaseFirestore with {@link
355
+ * #getInstance()} or {@link #getInstance(FirebaseApp)} .
357
356
*
358
- * <p>Once `shutdown` is called, trying to issue new reads/writes through this instance will
359
- * result in {@link IllegalStateException}. Already requested reads/writes might stop resolving.
360
- * Be sure to handle this well in your application if proceeding with Firestore shutting down is
361
- * desired in your case.
357
+ * <p>Shutdown does not cancel any pending writes and any tasks that are awaiting a response from
358
+ * the server will not be resolved. The next time you start this instance, it will resume
359
+ * attempting to send these writes to the server.
362
360
*
363
- * <p>Note that {@link #clearPersistence()} is an exception, it is designed to run when the
364
- * Firestore SDK instance is shutdown.
361
+ * <p>Note: Under normal circumstances, calling <code>shutdown()</code> is not required. This
362
+ * method is useful only when you want to force this instance to release all of its resources or
363
+ * in combination with {@link #clearPersistence} to ensure that all local state is destroyed
364
+ * between test runs.
365
365
*
366
- * <p>To re-start a Firestore SDK instance, simply create a new instance via {@link
367
- * #getInstance()} or {@link #getInstance(FirebaseApp)}.
366
+ * @return A <code>Task</code> that is resolved when the instance has been successfully shut down.
368
367
*/
369
368
@ VisibleForTesting
370
- // TODO: Make this public and remove @VisibleForTesting
369
+ // TODO(b/135755126) : Make this public and remove @VisibleForTesting
371
370
Task <Void > shutdown () {
372
- return shutdown (/* fromAppDeletion */ false );
371
+ return shutdown (/* fromAppDeletion= */ false );
373
372
}
374
373
375
374
@ VisibleForTesting
0 commit comments