public class ResourceLeakDetector<T> extends Object
| 构造器和说明 |
|---|
ResourceLeakDetector(Class<?> resourceType)
已过时。
|
ResourceLeakDetector(Class<?> resourceType,
int samplingInterval)
This should not be used directly by users of
ResourceLeakDetector. |
ResourceLeakDetector(Class<?> resourceType,
int samplingInterval,
long maxActive)
已过时。
|
ResourceLeakDetector(String resourceType)
已过时。
|
ResourceLeakDetector(String resourceType,
int samplingInterval,
long maxActive)
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addExclusions(Class clz,
String... methodNames) |
static Level |
getLevel()
Returns the current resource leak detection level.
|
static boolean |
isEnabled()
Returns
true if resource leak detection is enabled. |
protected void |
reportTracedLeak(String resourceType,
String records)
This method is called when a traced leak is detected.
|
protected void |
reportUntracedLeak(String resourceType)
This method is called when an untraced leak is detected.
|
static void |
setLevel(Level level)
Sets the resource leak detection level.
|
ResourceLeakTracker<T> |
track(T obj)
Creates a new
ResourceLeakTracker which is expected to be closed via
ResourceLeakTracker.close(Object) when the related resource is deallocated. |
@Deprecated public ResourceLeakDetector(Class<?> resourceType)
@Deprecated public ResourceLeakDetector(String resourceType)
@Deprecated public ResourceLeakDetector(Class<?> resourceType, int samplingInterval, long maxActive)
public ResourceLeakDetector(Class<?> resourceType, int samplingInterval)
ResourceLeakDetector.
Please use ResourceLeakDetector(Class)
or ResourceLeakDetector(Class, int, long)@Deprecated public ResourceLeakDetector(String resourceType, int samplingInterval, long maxActive)
ResourceLeakDetector(Class, int, long).
maxActive - This is deprecated and will be ignored.public static boolean isEnabled()
true if resource leak detection is enabled.
如果启用了资源泄漏检测。public static void setLevel(Level level)
public static Level getLevel()
public final ResourceLeakTracker<T> track(T obj)
ResourceLeakTracker which is expected to be closed via
ResourceLeakTracker.close(Object) when the related resource is deallocated.
创建一个新的 ResourceLeakTracker,这个ResourceLeakTracker将被关闭,当相关资源被释放。ResourceLeakTracker or nullprotected void reportTracedLeak(String resourceType, String records)
protected void reportUntracedLeak(String resourceType)
Copyright © 2021. All rights reserved.