Package io.github.pellse.concurrent
Record Class CoreLock.WriteLock
java.lang.Object
java.lang.Record
io.github.pellse.concurrent.CoreLock.WriteLock
- All Implemented Interfaces:
CoreLock<CoreLock.WriteLock>
,Lock<CoreLock.WriteLock>
,DelegateAware<CoreLock.WriteLock>
public static record CoreLock.WriteLock(long token, CoreLock<?> outerLock, Consumer<CoreLock.WriteLock> lockReleaser, Thread acquiredOnThread)
extends Record
implements CoreLock<CoreLock.WriteLock>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.pellse.concurrent.CoreLock
CoreLock.NoopLock, CoreLock.ReadLock, CoreLock.WriteLock
-
Constructor Summary
ConstructorsConstructorDescriptionWriteLock
(long token, CoreLock<?> outerLock, Consumer<CoreLock.WriteLock> lockReleaser, Thread acquiredOnThread) Creates an instance of aWriteLock
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theacquiredOnThread
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of thelockReleaser
record component.CoreLock
<?> Returns the value of theouterLock
record component.long
token()
Returns the value of thetoken
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
WriteLock
public WriteLock(long token, CoreLock<?> outerLock, Consumer<CoreLock.WriteLock> lockReleaser, Thread acquiredOnThread) Creates an instance of aWriteLock
record class.- Parameters:
token
- the value for thetoken
record componentouterLock
- the value for theouterLock
record componentlockReleaser
- the value for thelockReleaser
record componentacquiredOnThread
- the value for theacquiredOnThread
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
token
public long token()Returns the value of thetoken
record component.- Specified by:
token
in interfaceLock<CoreLock.WriteLock>
- Returns:
- the value of the
token
record component
-
outerLock
Returns the value of theouterLock
record component.- Specified by:
outerLock
in interfaceLock<CoreLock.WriteLock>
- Returns:
- the value of the
outerLock
record component
-
lockReleaser
Returns the value of thelockReleaser
record component.- Specified by:
lockReleaser
in interfaceLock<CoreLock.WriteLock>
- Returns:
- the value of the
lockReleaser
record component
-
acquiredOnThread
Returns the value of theacquiredOnThread
record component.- Specified by:
acquiredOnThread
in interfaceLock<CoreLock.WriteLock>
- Returns:
- the value of the
acquiredOnThread
record component
-