Class ReentryGuard.NOPRentryGuard
java.lang.Object
ch.qos.logback.core.util.ReentryGuard.NOPRentryGuard
- All Implemented Interfaces:
ReentryGuard
- Enclosing interface:
ReentryGuard
No-op implementation that never locks. Useful in contexts where re-entrancy
protection is not required.
isLocked() always returns false. lock() and
unlock() are no-ops.
Use this implementation when the caller explicitly wants to disable reentrancy protection (for example in tests or in environments where the cost of thread-local checks is undesirable and re-entrancy cannot occur).
- Since:
- 1.5.21
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.qos.logback.core.util.ReentryGuard
ReentryGuard.NOPRentryGuard, ReentryGuard.ReentryGuardImpl -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
NOPRentryGuard
public NOPRentryGuard()
-
-
Method Details
-
isLocked
Description copied from interface:ReentryGuardReturn true if the current thread holds the guard (i.e. is inside a guarded region).Implementations typically return
falseif the current thread has not previously calledReentryGuard.lock()or if the stored value isnull.- Specified by:
isLockedin interfaceReentryGuard- Returns:
trueif the guard is locked for the current thread,falseotherwise
-
lock
Description copied from interface:ReentryGuardMark the guard as locked for the current thread.Callers must ensure
ReentryGuard.unlock()is invoked in a finally block to avoid leaving the guard permanently locked for the thread.- Specified by:
lockin interfaceReentryGuard
-
unlock
Description copied from interface:ReentryGuardRelease the guard for the current thread.After calling
unlock()theReentryGuard.isLocked()should returnfalsefor the current thread (unlesslock()is called again).- Specified by:
unlockin interfaceReentryGuard
-