- java.lang.Object
-
- ch.qos.logback.core.util.ReentryGuard.NOPRentryGuard
-
- All Implemented Interfaces:
ReentryGuard
- Enclosing interface:
- ReentryGuard
public static class ReentryGuard.NOPRentryGuard extends Object implements ReentryGuard
No-op implementation that never locks. Useful in contexts where re-entrancy protection is not required.isLocked()always returnsfalse.lock()andunlock()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).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ch.qos.logback.core.util.ReentryGuard
ReentryGuard.NOPRentryGuard, ReentryGuard.ReentryGuardImpl
-
-
Constructor Summary
Constructors Constructor Description NOPRentryGuard()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisLocked()Return true if the current thread holds the guard (i.e. is inside a guarded region).voidlock()Mark the guard as locked for the current thread.voidunlock()Release the guard for the current thread.
-
-
-
Constructor Detail
-
NOPRentryGuard
public NOPRentryGuard()
-
-
Method Detail
-
isLocked
public boolean 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
public void 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
public void 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
-
-