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>
Enclosing interface:
CoreLock<L extends CoreLock<L>>

public static record CoreLock.WriteLock(long token, CoreLock<?> outerLock, Consumer<CoreLock.WriteLock> lockReleaser, Thread acquiredOnThread) extends Record implements CoreLock<CoreLock.WriteLock>
  • Constructor Details

    • WriteLock

      public WriteLock(long token, CoreLock<?> outerLock, Consumer<CoreLock.WriteLock> lockReleaser, Thread acquiredOnThread)
      Creates an instance of a WriteLock record class.
      Parameters:
      token - the value for the token record component
      outerLock - the value for the outerLock record component
      lockReleaser - the value for the lockReleaser record component
      acquiredOnThread - the value for the acquiredOnThread record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • token

      public long token()
      Returns the value of the token record component.
      Specified by:
      token in interface Lock<CoreLock.WriteLock>
      Returns:
      the value of the token record component
    • outerLock

      public CoreLock<?> outerLock()
      Returns the value of the outerLock record component.
      Specified by:
      outerLock in interface Lock<CoreLock.WriteLock>
      Returns:
      the value of the outerLock record component
    • lockReleaser

      public Consumer<CoreLock.WriteLock> lockReleaser()
      Returns the value of the lockReleaser record component.
      Specified by:
      lockReleaser in interface Lock<CoreLock.WriteLock>
      Returns:
      the value of the lockReleaser record component
    • acquiredOnThread

      public Thread acquiredOnThread()
      Returns the value of the acquiredOnThread record component.
      Specified by:
      acquiredOnThread in interface Lock<CoreLock.WriteLock>
      Returns:
      the value of the acquiredOnThread record component