Class LeakPresenceExtension.WithTransferableScope<T>
java.lang.Object
io.netty.util.ResourceLeakDetector<T>
io.netty.util.LeakPresenceDetector<T>
io.netty.util.test.LeakPresenceExtension.WithTransferableScope<T>
- Enclosing class:
LeakPresenceExtension
public static final class LeakPresenceExtension.WithTransferableScope<T>
extends LeakPresenceDetector<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class LeakPresenceDetector
LeakPresenceDetector.AllocationProhibitedException, LeakPresenceDetector.ResourceScopeModifier and TypeClassDescriptionstatic final classSpecial exception type to show that an allocation is prohibited at the moment, for example because theLeakPresenceDetector.ResourceScopeis closed, or because the current thread cannot be associated with a particular scope.static final classA resource scope keeps track of the resources for a particular set of threads.Nested classes/interfaces inherited from class ResourceLeakDetector
ResourceLeakDetector.LeakListener, ResourceLeakDetector.LevelModifier and TypeClassDescriptionstatic interfacestatic enumRepresents the level of resource leak detection. -
Constructor Summary
ConstructorsConstructorDescriptionWithTransferableScope(Class<?> resourceType, int samplingInterval) WithTransferableScope(Class<?> resourceType, int samplingInterval, long maxActive) -
Method Summary
Modifier and TypeMethodDescriptionprotected LeakPresenceDetector.ResourceScopeGet the resource scope for the current thread.Methods inherited from class LeakPresenceDetector
check, isRecordEnabled, staticInitializer, track, trackForciblyModifier and TypeMethodDescriptionstatic voidcheck()Check the current leak presence detector scope for open resources.final booleanCheck whetherResourceLeakTracker.record()does anything for this detector.static <R> RstaticInitializer(Supplier<R> supplier) Wrap a static initializer so that any resources created inside the block will not be tracked.final ResourceLeakTracker<T> Creates a newResourceLeakTrackerwhich is expected to be closed viaResourceLeakTracker.close(Object)when the related resource is deallocated.final ResourceLeakTracker<T> trackForcibly(T obj) Creates a newResourceLeakTrackerwhich is expected to be closed viaResourceLeakTracker.close(Object)when the related resource is deallocated.Methods inherited from class ResourceLeakDetector
addExclusions, getInitialHint, getLevel, isEnabled, needReport, open, reportInstancesLeak, reportTracedLeak, reportUntracedLeak, setEnabled, setLeakListener, setLevelModifier and TypeMethodDescriptionstatic voidaddExclusions(Class clz, String... methodNames) protected ObjectgetInitialHint(String resourceType) Create a hint object to be attached to an object tracked by this record.static ResourceLeakDetector.LevelgetLevel()Returns the current resource leak detection level.static booleanReturnstrueif resource leak detection is enabled.protected booleanWhen the return value istrue,ResourceLeakDetector.reportTracedLeak(String, String)andResourceLeakDetector.reportUntracedLeak(String)will be called once a leak is detected, otherwise not.final ResourceLeakDeprecated.protected voidreportInstancesLeak(String resourceType) Deprecated.This method will no longer be invoked byResourceLeakDetector.protected voidreportTracedLeak(String resourceType, String records) This method is called when a traced leak is detected.protected voidreportUntracedLeak(String resourceType) This method is called when an untraced leak is detected.static voidsetEnabled(boolean enabled) Deprecated.UseResourceLeakDetector.setLevel(Level)instead.voidsetLeakListener(ResourceLeakDetector.LeakListener leakListener) Set leak listener.static voidSets the resource leak detection level.
-
Constructor Details
-
WithTransferableScope
-
WithTransferableScope
-
-
Method Details
-
currentScope
Description copied from class:LeakPresenceDetectorGet the resource scope for the current thread. This is used to assign resources to scopes, and it is used byLeakPresenceDetector.check()to tell which scope to check for open resources. By default, the global scope is returned.- Overrides:
currentScopein classLeakPresenceDetector<T>- Returns:
- The resource scope to use
-
ResourceLeakDetector.track(Object)