Package org.jruby.runtime.load
Class LoadService.RequireLocks
java.lang.Object
org.jruby.runtime.load.LoadService.RequireLocks
- Enclosing class:
- LoadService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ConcurrentHashMap<String,LoadService.RequireLocks.RequireLock> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate LoadService.RequireStateexecuteAndClearLock(String path, Function<String, LoadService.RequireState> ifLocked, RubyThread thread, LoadService.RequireLocks.RequireLock lock) private LoadService.RequireStatelock(String path, boolean circularRequireWarning, LoadService.RequireState defaultResult, Function<String, LoadService.RequireState> ifLocked) Get exclusive lock for the specified requireName.
-
Field Details
-
pool
-
-
Constructor Details
-
RequireLocks
private RequireLocks()
-
-
Method Details
-
lock
private LoadService.RequireState lock(String path, boolean circularRequireWarning, LoadService.RequireState defaultResult, Function<String, LoadService.RequireState> ifLocked) Get exclusive lock for the specified requireName. Acquire sync object for the requireName from the pool, then try to lock it. NOTE: This lock is not fair for now.- Parameters:
path- just a name for the lock.- Returns:
- If the sync object already locked by current thread, it just returns false without getting a lock. Otherwise true.
-
executeAndClearLock
private LoadService.RequireState executeAndClearLock(String path, Function<String, LoadService.RequireState> ifLocked, RubyThread thread, LoadService.RequireLocks.RequireLock lock)
-