Class LeakPresenceDetector.ResourceScope
java.lang.Object
io.netty.util.LeakPresenceDetector.ResourceScope
- All Implemented Interfaces:
Closeable, AutoCloseable
- Enclosing class:
LeakPresenceDetector<T>
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) final Map<LeakPresenceDetector.PresenceTracker<?>, Throwable> (package private) final String(package private) final LongAdder -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
name
-
openResourceCounter
-
creationStacks
-
closed
int closed
-
-
Constructor Details
-
ResourceScope
Create a new scope.- Parameters:
name- The scope name, used for error reporting
-
-
Method Details
-
checkOpen
void checkOpen() -
check
void check() -
hasOpenResources
public boolean hasOpenResources()Check whether there are any open resources left, andclose()would throw.- Returns:
trueif there are open resources
-
close
public void close()Close this scope. Closing a scope will prevent new resources from being allocated (or released) in this scope. The call also throws an exception if there are any resources left open.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-