public final class LifecycleOnDestroyHelper
extends java.lang.Object
Lifecycle.addObserver(androidx.lifecycle.LifecycleObserver) and Lifecycle.State.DESTROYED.
In particular, calls to Lifecycle.addObserver(LifecycleObserver) are silently ignored
if the owner is already destroyed.
| Modifier and Type | Method and Description |
|---|---|
static void |
shutdownUponDestruction(androidx.lifecycle.Lifecycle lifecycle,
io.grpc.ManagedChannel channel)
Arranges for
ManagedChannel.shutdownNow() to be called on channel just before
lifecycle is destroyed, or immediately if lifecycle is already destroyed. |
static void |
shutdownUponDestruction(androidx.lifecycle.Lifecycle lifecycle,
io.grpc.Server server)
Arranges for
Server.shutdownNow() to be called on server just before lifecycle is destroyed, or immediately if lifecycle is already destroyed. |
@MainThread
public static void shutdownUponDestruction(androidx.lifecycle.Lifecycle lifecycle,
io.grpc.ManagedChannel channel)
ManagedChannel.shutdownNow() to be called on channel just before
lifecycle is destroyed, or immediately if lifecycle is already destroyed.
Must only be called on the application's main thread.
@MainThread
public static void shutdownUponDestruction(androidx.lifecycle.Lifecycle lifecycle,
io.grpc.Server server)
Server.shutdownNow() to be called on server just before lifecycle is destroyed, or immediately if lifecycle is already destroyed.
Must only be called on the application's main thread.