Package io.grpc.internal
Class ManagedChannelOrphanWrapper
java.lang.Object
io.grpc.Channel
io.grpc.ManagedChannel
io.grpc.internal.ForwardingManagedChannel
io.grpc.internal.ManagedChannelOrphanWrapper
Best effort detecting channels that has not been properly cleaned up.
Use
WeakReference to avoid keeping the channel alive and retaining too much memory.
Check lost references only on new channel creation and log message to indicate
the previous channel (id and target) that has not been shutdown. This is done to avoid Object
finalizers.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Loggerprivate final ManagedChannelOrphanWrapper.ManagedChannelReferenceprivate static final ReferenceQueue<ManagedChannelOrphanWrapper> private static final ConcurrentMap<ManagedChannelOrphanWrapper.ManagedChannelReference, ManagedChannelOrphanWrapper.ManagedChannelReference> -
Constructor Summary
ConstructorsConstructorDescriptionManagedChannelOrphanWrapper(ManagedChannel delegate) ManagedChannelOrphanWrapper(ManagedChannel delegate, ReferenceQueue<ManagedChannelOrphanWrapper> refqueue, ConcurrentMap<ManagedChannelOrphanWrapper.ManagedChannelReference, ManagedChannelOrphanWrapper.ManagedChannelReference> refs) -
Method Summary
Modifier and TypeMethodDescriptionshutdown()Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.Initiates a forceful shutdown in which preexisting and new calls are cancelled.Methods inherited from class io.grpc.internal.ForwardingManagedChannel
authority, awaitTermination, enterIdle, getState, isShutdown, isTerminated, newCall, notifyWhenStateChanged, resetConnectBackoff, toString
-
Field Details
-
refqueue
-
refs
private static final ConcurrentMap<ManagedChannelOrphanWrapper.ManagedChannelReference,ManagedChannelOrphanWrapper.ManagedChannelReference> refs -
logger
-
phantom
-
-
Constructor Details
-
ManagedChannelOrphanWrapper
ManagedChannelOrphanWrapper(ManagedChannel delegate) -
ManagedChannelOrphanWrapper
ManagedChannelOrphanWrapper(ManagedChannel delegate, ReferenceQueue<ManagedChannelOrphanWrapper> refqueue, ConcurrentMap<ManagedChannelOrphanWrapper.ManagedChannelReference, ManagedChannelOrphanWrapper.ManagedChannelReference> refs)
-
-
Method Details
-
shutdown
Description copied from class:ManagedChannelInitiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.- Overrides:
shutdownin classForwardingManagedChannel- Returns:
- this
-
shutdownNow
Description copied from class:ManagedChannelInitiates a forceful shutdown in which preexisting and new calls are cancelled. Although forceful, the shutdown process is still not instantaneous;ManagedChannel.isTerminated()will likely returnfalseimmediately after this method returns.- Overrides:
shutdownNowin classForwardingManagedChannel- Returns:
- this
-