Package io.netty.util
Class ResourceLeakDetectorFactory
- java.lang.Object
-
- io.netty.util.ResourceLeakDetectorFactory
-
- Direct Known Subclasses:
ResourceLeakDetectorFactory.DefaultResourceLeakDetectorFactory
public abstract class ResourceLeakDetectorFactory extends java.lang.Object
This static factory should be used to loadResourceLeakDetector
s as needed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ResourceLeakDetectorFactory.DefaultResourceLeakDetectorFactory
Default implementation that loads custom leak detector via system property
-
Field Summary
Fields Modifier and Type Field Description private static ResourceLeakDetectorFactory
factoryInstance
private static InternalLogger
logger
-
Constructor Summary
Constructors Constructor Description ResourceLeakDetectorFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ResourceLeakDetectorFactory
instance()
Get the singleton instance of this factory class.<T> ResourceLeakDetector<T>
newResourceLeakDetector(java.lang.Class<T> resource)
Returns a new instance of aResourceLeakDetector
with the given resource class.<T> ResourceLeakDetector<T>
newResourceLeakDetector(java.lang.Class<T> resource, int samplingInterval)
Returns a new instance of aResourceLeakDetector
with the given resource class.abstract <T> ResourceLeakDetector<T>
newResourceLeakDetector(java.lang.Class<T> resource, int samplingInterval, long maxActive)
Deprecated.UsenewResourceLeakDetector(Class, int)
instead.static void
setResourceLeakDetectorFactory(ResourceLeakDetectorFactory factory)
Set the factory's singleton instance.
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
factoryInstance
private static volatile ResourceLeakDetectorFactory factoryInstance
-
-
Method Detail
-
instance
public static ResourceLeakDetectorFactory instance()
Get the singleton instance of this factory class.- Returns:
- the current
ResourceLeakDetectorFactory
-
setResourceLeakDetectorFactory
public static void setResourceLeakDetectorFactory(ResourceLeakDetectorFactory factory)
Set the factory's singleton instance. This has to be called before the static initializer of theResourceLeakDetector
is called by all the callers of this factory. That is, before initializing a Netty Bootstrap.- Parameters:
factory
- the instance that will become the currentResourceLeakDetectorFactory
's singleton
-
newResourceLeakDetector
public final <T> ResourceLeakDetector<T> newResourceLeakDetector(java.lang.Class<T> resource)
Returns a new instance of aResourceLeakDetector
with the given resource class.- Type Parameters:
T
- the type of the resource class- Parameters:
resource
- the resource class used to initialize theResourceLeakDetector
- Returns:
- a new instance of
ResourceLeakDetector
-
newResourceLeakDetector
@Deprecated public abstract <T> ResourceLeakDetector<T> newResourceLeakDetector(java.lang.Class<T> resource, int samplingInterval, long maxActive)
Deprecated.UsenewResourceLeakDetector(Class, int)
instead.Returns a new instance of a
ResourceLeakDetector
with the given resource class.- Type Parameters:
T
- the type of the resource class- Parameters:
resource
- the resource class used to initialize theResourceLeakDetector
samplingInterval
- the interval on which sampling takes placemaxActive
- This is deprecated and will be ignored.- Returns:
- a new instance of
ResourceLeakDetector
-
newResourceLeakDetector
public <T> ResourceLeakDetector<T> newResourceLeakDetector(java.lang.Class<T> resource, int samplingInterval)
Returns a new instance of aResourceLeakDetector
with the given resource class.- Type Parameters:
T
- the type of the resource class- Parameters:
resource
- the resource class used to initialize theResourceLeakDetector
samplingInterval
- the interval on which sampling takes place- Returns:
- a new instance of
ResourceLeakDetector
-
-