@Deprecated public interface ThreadLock
Modifier and Type | Method and Description |
---|---|
default int |
gettid()
Deprecated.
|
default void |
lock()
Deprecated.
Lock the resource using the current OS thread id.
|
void |
lock(int osThreadId)
Deprecated.
Lock the resource using a threadId
|
default boolean |
tryLock()
Deprecated.
Try to lock once or fail using the current OS thread id.
|
boolean |
tryLock(int osThreadId)
Deprecated.
Try to lock once or fail
|
default void |
unlock()
Deprecated.
Unlock for a threadId
|
void |
unlock(int osThreadId)
Deprecated.
Unlock for a threadId
|
default boolean tryLock() throws IllegalStateException
IllegalStateException
- if the same threadId already holds the lockdefault int gettid()
boolean tryLock(int osThreadId) throws IllegalStateException
osThreadId
- to attempt to lock forIllegalStateException
- if the same threadId already holds the lockdefault void lock() throws InterruptedRuntimeException, IllegalStateException
InterruptedRuntimeException
- if an interrupt occurred before or during a busy loop retry. It won't throw this if the lock can be obtained immediately.IllegalStateException
- if the same threadId already holds the lockvoid lock(int osThreadId) throws InterruptedRuntimeException, IllegalStateException
osThreadId
- to lockInterruptedRuntimeException
- if an interrupt occurred before or during a busy loop retry. It won't throw this if the lock can be obtained immediately.IllegalStateException
- if the same threadId already holds the lockdefault void unlock() throws IllegalStateException
IllegalStateException
- if the thread previously held the lock but doesn't hold it now.void unlock(int osThreadId) throws IllegalStateException
osThreadId
- to unlockIllegalStateException
- if the thread previously held the lock but doesn't hold it now.Copyright © 2023. All rights reserved.